OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/scrollbar_geometry_stub.h" | 5 #include "cc/scrollbar_geometry_stub.h" |
6 | 6 |
| 7 #include <cmath> |
| 8 |
7 using WebKit::WebRect; | 9 using WebKit::WebRect; |
8 using WebKit::WebScrollbar; | 10 using WebKit::WebScrollbar; |
9 using WebKit::WebScrollbarThemeGeometry; | 11 using WebKit::WebScrollbarThemeGeometry; |
10 | 12 |
11 namespace cc { | 13 namespace cc { |
12 | 14 |
13 ScrollbarGeometryStub::ScrollbarGeometryStub(scoped_ptr<WebScrollbarThemeGeometr
y> geometry) | 15 ScrollbarGeometryStub::ScrollbarGeometryStub(scoped_ptr<WebScrollbarThemeGeometr
y> geometry) |
14 : m_geometry(geometry.Pass()) | 16 : m_geometry(geometry.Pass()) |
15 { | 17 { |
16 } | 18 } |
17 | 19 |
18 ScrollbarGeometryStub::~ScrollbarGeometryStub() | 20 ScrollbarGeometryStub::~ScrollbarGeometryStub() |
19 { | 21 { |
20 } | 22 } |
21 | 23 |
22 WebScrollbarThemeGeometry* ScrollbarGeometryStub::clone() const | 24 WebScrollbarThemeGeometry* ScrollbarGeometryStub::clone() const |
23 { | 25 { |
24 return m_geometry->clone(); | 26 return m_geometry->clone(); |
25 } | 27 } |
26 | 28 |
27 int ScrollbarGeometryStub::thumbPosition(WebScrollbar* scrollbar) | 29 int ScrollbarGeometryStub::thumbPosition(WebScrollbar* scrollbar) |
28 { | 30 { |
29 return m_geometry->thumbPosition(scrollbar); | 31 return m_geometry->thumbPosition(scrollbar); |
30 } | 32 } |
31 | 33 |
32 int ScrollbarGeometryStub::thumbLength(WebScrollbar* scrollbar) | 34 int ScrollbarGeometryStub::thumbLength(WebScrollbar* scrollbar) |
33 { | 35 { |
34 return m_geometry->thumbLength(scrollbar); | 36 return std::max(0, m_geometry->thumbLength(scrollbar)); |
35 } | 37 } |
36 | 38 |
37 int ScrollbarGeometryStub::trackPosition(WebScrollbar* scrollbar) | 39 int ScrollbarGeometryStub::trackPosition(WebScrollbar* scrollbar) |
38 { | 40 { |
39 return m_geometry->trackPosition(scrollbar); | 41 return m_geometry->trackPosition(scrollbar); |
40 } | 42 } |
41 | 43 |
42 int ScrollbarGeometryStub::trackLength(WebScrollbar* scrollbar) | 44 int ScrollbarGeometryStub::trackLength(WebScrollbar* scrollbar) |
43 { | 45 { |
44 return m_geometry->trackLength(scrollbar); | 46 return m_geometry->trackLength(scrollbar); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 { | 100 { |
99 return m_geometry->constrainTrackRectToTrackPieces(scrollbar, rect); | 101 return m_geometry->constrainTrackRectToTrackPieces(scrollbar, rect); |
100 } | 102 } |
101 | 103 |
102 void ScrollbarGeometryStub::splitTrack(WebScrollbar* scrollbar, const WebRect& u
nconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& af
terThumbRect) | 104 void ScrollbarGeometryStub::splitTrack(WebScrollbar* scrollbar, const WebRect& u
nconstrainedTrackRect, WebRect& beforeThumbRect, WebRect& thumbRect, WebRect& af
terThumbRect) |
103 { | 105 { |
104 m_geometry->splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, t
humbRect, afterThumbRect); | 106 m_geometry->splitTrack(scrollbar, unconstrainedTrackRect, beforeThumbRect, t
humbRect, afterThumbRect); |
105 } | 107 } |
106 | 108 |
107 } // namespace cc | 109 } // namespace cc |
OLD | NEW |