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
3 // found in the LICENSE file.
5 #include "cc/scrollbar_geometry_stub.h"
10 using WebKit::WebScrollbar
;
11 using WebKit::WebScrollbarThemeGeometry
;
15 ScrollbarGeometryStub::ScrollbarGeometryStub(scoped_ptr
<WebScrollbarThemeGeometry
> geometry
)
16 : m_geometry(geometry
.Pass())
20 ScrollbarGeometryStub::~ScrollbarGeometryStub()
24 WebScrollbarThemeGeometry
* ScrollbarGeometryStub::clone() const
26 return m_geometry
->clone();
29 int ScrollbarGeometryStub::thumbPosition(WebScrollbar
* scrollbar
)
31 return m_geometry
->thumbPosition(scrollbar
);
34 int ScrollbarGeometryStub::thumbLength(WebScrollbar
* scrollbar
)
36 return std::max(0, m_geometry
->thumbLength(scrollbar
));
39 int ScrollbarGeometryStub::trackPosition(WebScrollbar
* scrollbar
)
41 return m_geometry
->trackPosition(scrollbar
);
44 int ScrollbarGeometryStub::trackLength(WebScrollbar
* scrollbar
)
46 return m_geometry
->trackLength(scrollbar
);
49 bool ScrollbarGeometryStub::hasButtons(WebScrollbar
* scrollbar
)
51 return m_geometry
->hasButtons(scrollbar
);
54 bool ScrollbarGeometryStub::hasThumb(WebScrollbar
* scrollbar
)
56 return m_geometry
->hasThumb(scrollbar
);
59 WebRect
ScrollbarGeometryStub::trackRect(WebScrollbar
* scrollbar
)
61 return m_geometry
->trackRect(scrollbar
);
64 WebRect
ScrollbarGeometryStub::thumbRect(WebScrollbar
* scrollbar
)
66 return m_geometry
->thumbRect(scrollbar
);
69 int ScrollbarGeometryStub::minimumThumbLength(WebScrollbar
* scrollbar
)
71 return m_geometry
->minimumThumbLength(scrollbar
);
74 int ScrollbarGeometryStub::scrollbarThickness(WebScrollbar
* scrollbar
)
76 return m_geometry
->scrollbarThickness(scrollbar
);
79 WebRect
ScrollbarGeometryStub::backButtonStartRect(WebScrollbar
* scrollbar
)
81 return m_geometry
->backButtonStartRect(scrollbar
);
84 WebRect
ScrollbarGeometryStub::backButtonEndRect(WebScrollbar
* scrollbar
)
86 return m_geometry
->backButtonEndRect(scrollbar
);
89 WebRect
ScrollbarGeometryStub::forwardButtonStartRect(WebScrollbar
* scrollbar
)
91 return m_geometry
->forwardButtonStartRect(scrollbar
);
94 WebRect
ScrollbarGeometryStub::forwardButtonEndRect(WebScrollbar
* scrollbar
)
96 return m_geometry
->forwardButtonEndRect(scrollbar
);
99 WebRect
ScrollbarGeometryStub::constrainTrackRectToTrackPieces(WebScrollbar
* scrollbar
, const WebRect
& rect
)
101 return m_geometry
->constrainTrackRectToTrackPieces(scrollbar
, rect
);
104 void ScrollbarGeometryStub::splitTrack(WebScrollbar
* scrollbar
, const WebRect
& unconstrainedTrackRect
, WebRect
& beforeThumbRect
, WebRect
& thumbRect
, WebRect
& afterThumbRect
)
106 m_geometry
->splitTrack(scrollbar
, unconstrainedTrackRect
, beforeThumbRect
, thumbRect
, afterThumbRect
);