Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: cc/input/pinch_zoom_scrollbar_geometry.cc

Issue 12965007: Fix cpplint errors in cc/(animation|input|layers|trees|test)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/input/pinch_zoom_scrollbar_geometry.h ('k') | cc/input/pinch_zoom_scrollbar_painter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/input/pinch_zoom_scrollbar_geometry.h" 5 #include "cc/input/pinch_zoom_scrollbar_geometry.h"
6 6
7 #include <algorithm>
8
7 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
8 10
9 namespace cc { 11 namespace cc {
10 12
11 const int PinchZoomScrollbarGeometry::kTrackWidth = 10; 13 const int PinchZoomScrollbarGeometry::kTrackWidth = 10;
12 14
13 WebScrollbarThemeGeometry* PinchZoomScrollbarGeometry::clone() const { 15 WebScrollbarThemeGeometry* PinchZoomScrollbarGeometry::clone() const {
14 return static_cast<WebScrollbarThemeGeometry*>( 16 return static_cast<WebScrollbarThemeGeometry*>(
15 new PinchZoomScrollbarGeometry()); 17 new PinchZoomScrollbarGeometry());
16 } 18 }
(...skipping 18 matching lines...) Expand all
35 float size = std::max(scrollbar->size().width, scrollbar->size().height); 37 float size = std::max(scrollbar->size().width, scrollbar->size().height);
36 float proportion = size / scrollbar->totalSize(); 38 float proportion = size / scrollbar->totalSize();
37 int track_length = this->trackLength(scrollbar); 39 int track_length = this->trackLength(scrollbar);
38 int length = proportion * track_length + 0.5f; 40 int length = proportion * track_length + 0.5f;
39 length = std::max(length, kTrackWidth); 41 length = std::max(length, kTrackWidth);
40 if (length > track_length) 42 if (length > track_length)
41 length = 0; 43 length = 0;
42 return length; 44 return length;
43 } 45 }
44 46
45 int PinchZoomScrollbarGeometry::trackPosition(WebScrollbar*) { 47 int PinchZoomScrollbarGeometry::trackPosition(WebScrollbar* scrollbar) {
46 return 0; 48 return 0;
47 } 49 }
48 50
49 int PinchZoomScrollbarGeometry::trackLength(WebScrollbar* scrollbar) { 51 int PinchZoomScrollbarGeometry::trackLength(WebScrollbar* scrollbar) {
50 WebRect track = trackRect(scrollbar); 52 WebRect track = trackRect(scrollbar);
51 if (scrollbar->orientation() == WebScrollbar::Horizontal) 53 if (scrollbar->orientation() == WebScrollbar::Horizontal)
52 return track.width; 54 return track.width;
53 else 55 else
54 return track.height; 56 return track.height;
55 } 57 }
56 58
57 bool PinchZoomScrollbarGeometry::hasButtons(WebScrollbar*) { 59 bool PinchZoomScrollbarGeometry::hasButtons(WebScrollbar* scrollbar) {
58 return false; 60 return false;
59 } 61 }
60 62
61 bool PinchZoomScrollbarGeometry::hasThumb(WebScrollbar*) { 63 bool PinchZoomScrollbarGeometry::hasThumb(WebScrollbar* scrollbar) {
62 return true; 64 return true;
63 } 65 }
64 66
65 WebRect PinchZoomScrollbarGeometry::trackRect(WebScrollbar* scrollbar) { 67 WebRect PinchZoomScrollbarGeometry::trackRect(WebScrollbar* scrollbar) {
66 int thickness = scrollbarThickness(scrollbar); 68 int thickness = scrollbarThickness(scrollbar);
67 if (scrollbar->orientation() == WebScrollbar::Horizontal) { 69 if (scrollbar->orientation() == WebScrollbar::Horizontal) {
68 return WebRect(scrollbar->location().x, scrollbar->location().y, 70 return WebRect(scrollbar->location().x, scrollbar->location().y,
69 scrollbar->size().width, thickness); 71 scrollbar->size().width, thickness);
70 } else { 72 } else {
71 return WebRect(scrollbar->location().x, scrollbar->location().y, 73 return WebRect(scrollbar->location().x, scrollbar->location().y,
(...skipping 11 matching lines...) Expand all
83 } else { 85 } else {
84 return WebRect(track.x + (track.width - thickness) / 2, track.y + thumb_pos, 86 return WebRect(track.x + (track.width - thickness) / 2, track.y + thumb_pos,
85 thickness, thumbLength(scrollbar)); 87 thickness, thumbLength(scrollbar));
86 } 88 }
87 } 89 }
88 90
89 int PinchZoomScrollbarGeometry::minimumThumbLength(WebScrollbar* scrollbar) { 91 int PinchZoomScrollbarGeometry::minimumThumbLength(WebScrollbar* scrollbar) {
90 return scrollbarThickness(scrollbar); 92 return scrollbarThickness(scrollbar);
91 } 93 }
92 94
93 int PinchZoomScrollbarGeometry::scrollbarThickness(WebScrollbar*) { 95 int PinchZoomScrollbarGeometry::scrollbarThickness(WebScrollbar* scrollbar) {
94 return kTrackWidth; 96 return kTrackWidth;
95 } 97 }
96 98
97 WebRect PinchZoomScrollbarGeometry::backButtonStartRect(WebScrollbar*) { 99 WebRect PinchZoomScrollbarGeometry::backButtonStartRect(
100 WebScrollbar* scrollbar) {
98 return WebRect(); 101 return WebRect();
99 } 102 }
100 103
101 WebRect PinchZoomScrollbarGeometry::backButtonEndRect(WebScrollbar*) { 104 WebRect PinchZoomScrollbarGeometry::backButtonEndRect(WebScrollbar* scrollbar) {
102 return WebRect(); 105 return WebRect();
103 } 106 }
104 107
105 WebRect PinchZoomScrollbarGeometry::forwardButtonStartRect(WebScrollbar*) { 108 WebRect PinchZoomScrollbarGeometry::forwardButtonStartRect(
109 WebScrollbar* scrollbar) {
106 return WebRect(); 110 return WebRect();
107 } 111 }
108 112
109 WebRect PinchZoomScrollbarGeometry::forwardButtonEndRect(WebScrollbar*) { 113 WebRect PinchZoomScrollbarGeometry::forwardButtonEndRect(
114 WebScrollbar* scrollbar) {
110 return WebRect(); 115 return WebRect();
111 } 116 }
112 117
113 WebRect PinchZoomScrollbarGeometry::constrainTrackRectToTrackPieces( 118 WebRect PinchZoomScrollbarGeometry::constrainTrackRectToTrackPieces(
114 WebScrollbar*, const WebRect& rect) { 119 WebScrollbar* scrollbar, const WebRect& rect) {
115 return rect; 120 return rect;
116 } 121 }
117 122
118 void PinchZoomScrollbarGeometry::splitTrack( 123 void PinchZoomScrollbarGeometry::splitTrack(
119 WebScrollbar* scrollbar, const WebRect& track, WebRect& start_track, 124 WebScrollbar* scrollbar, const WebRect& track, WebRect& start_track,
120 WebRect& thumb, WebRect& end_track) { 125 WebRect& thumb, WebRect& end_track) {
121 thumb = thumbRect(scrollbar); 126 thumb = thumbRect(scrollbar);
122 start_track = WebRect(); 127 start_track = WebRect();
123 end_track = WebRect(); 128 end_track = WebRect();
124 } 129 }
125 130
126 } // namespace cc 131 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/pinch_zoom_scrollbar_geometry.h ('k') | cc/input/pinch_zoom_scrollbar_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698