Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / exported / WebScrollbarThemeGeometryNative.cpp
blobd9df7d27d719181db5abef9a3d521ebcae415b60
1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #include "config.h"
28 #include "platform/exported/WebScrollbarThemeGeometryNative.h"
30 #include "platform/exported/WebScrollbarThemeClientImpl.h"
31 #include "platform/scroll/ScrollbarTheme.h"
32 #include "public/platform/WebScrollbar.h"
34 namespace blink {
36 PassOwnPtr<WebScrollbarThemeGeometryNative> WebScrollbarThemeGeometryNative::create(ScrollbarTheme* theme)
38 return adoptPtr(new WebScrollbarThemeGeometryNative(theme));
41 WebScrollbarThemeGeometryNative::WebScrollbarThemeGeometryNative(ScrollbarTheme* theme)
42 : m_theme(theme)
46 WebScrollbarThemeGeometryNative* WebScrollbarThemeGeometryNative::clone() const
48 return new WebScrollbarThemeGeometryNative(m_theme);
51 int WebScrollbarThemeGeometryNative::thumbPosition(WebScrollbar* scrollbar)
53 WebScrollbarThemeClientImpl client(scrollbar);
54 return m_theme->thumbPosition(&client);
57 int WebScrollbarThemeGeometryNative::thumbLength(WebScrollbar* scrollbar)
59 WebScrollbarThemeClientImpl client(scrollbar);
60 return m_theme->thumbLength(&client);
63 int WebScrollbarThemeGeometryNative::trackPosition(WebScrollbar* scrollbar)
65 WebScrollbarThemeClientImpl client(scrollbar);
66 return m_theme->trackPosition(&client);
69 int WebScrollbarThemeGeometryNative::trackLength(WebScrollbar* scrollbar)
71 WebScrollbarThemeClientImpl client(scrollbar);
72 return m_theme->trackLength(&client);
75 bool WebScrollbarThemeGeometryNative::hasButtons(WebScrollbar* scrollbar)
77 WebScrollbarThemeClientImpl client(scrollbar);
78 return m_theme->hasButtons(&client);
81 bool WebScrollbarThemeGeometryNative::hasThumb(WebScrollbar* scrollbar)
83 WebScrollbarThemeClientImpl client(scrollbar);
84 return m_theme->hasThumb(&client);
87 WebRect WebScrollbarThemeGeometryNative::trackRect(WebScrollbar* scrollbar)
89 WebScrollbarThemeClientImpl client(scrollbar);
90 return m_theme->trackRect(&client);
93 WebRect WebScrollbarThemeGeometryNative::thumbRect(WebScrollbar* scrollbar)
95 WebScrollbarThemeClientImpl client(scrollbar);
96 return m_theme->thumbRect(&client);
99 int WebScrollbarThemeGeometryNative::minimumThumbLength(WebScrollbar* scrollbar)
101 WebScrollbarThemeClientImpl client(scrollbar);
102 return m_theme->minimumThumbLength(&client);
105 int WebScrollbarThemeGeometryNative::scrollbarThickness(WebScrollbar* scrollbar)
107 WebScrollbarThemeClientImpl client(scrollbar);
108 return m_theme->scrollbarThickness(client.controlSize());
111 WebRect WebScrollbarThemeGeometryNative::backButtonStartRect(WebScrollbar* scrollbar)
113 WebScrollbarThemeClientImpl client(scrollbar);
114 return m_theme->backButtonRect(&client, BackButtonStartPart, false);
117 WebRect WebScrollbarThemeGeometryNative::backButtonEndRect(WebScrollbar* scrollbar)
119 WebScrollbarThemeClientImpl client(scrollbar);
120 return m_theme->backButtonRect(&client, BackButtonEndPart, false);
123 WebRect WebScrollbarThemeGeometryNative::forwardButtonStartRect(WebScrollbar* scrollbar)
125 WebScrollbarThemeClientImpl client(scrollbar);
126 return m_theme->forwardButtonRect(&client, ForwardButtonStartPart, false);
129 WebRect WebScrollbarThemeGeometryNative::forwardButtonEndRect(WebScrollbar* scrollbar)
131 WebScrollbarThemeClientImpl client(scrollbar);
132 return m_theme->forwardButtonRect(&client, ForwardButtonEndPart, false);
135 WebRect WebScrollbarThemeGeometryNative::constrainTrackRectToTrackPieces(WebScrollbar* scrollbar, const WebRect& rect)
137 WebScrollbarThemeClientImpl client(scrollbar);
138 return m_theme->constrainTrackRectToTrackPieces(&client, IntRect(rect));
141 void WebScrollbarThemeGeometryNative::splitTrack(WebScrollbar* scrollbar, const WebRect& webTrack, WebRect& webStartTrack, WebRect& webThumb, WebRect& webEndTrack)
143 WebScrollbarThemeClientImpl client(scrollbar);
144 IntRect track(webTrack);
145 IntRect startTrack;
146 IntRect thumb;
147 IntRect endTrack;
148 m_theme->splitTrack(&client, track, startTrack, thumb, endTrack);
150 webStartTrack = startTrack;
151 webThumb = thumb;
152 webEndTrack = endTrack;
155 } // namespace blink