1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25 #include "config.h"
26
27 #include "platform/exported/WebScrollbarImpl.h"
28
29 #include "platform/geometry/IntRect.h"
30 #include "platform/scroll/Scrollbar.h"
31
32 namespace blink {
33
WebScrollbarImpl(WebCore::Scrollbar * scrollbar)34 WebScrollbarImpl::WebScrollbarImpl(WebCore::Scrollbar* scrollbar)
35 : m_scrollbar(scrollbar)
36 {
37 }
38
isOverlay() const39 bool WebScrollbarImpl::isOverlay() const
40 {
41 return m_scrollbar->isOverlayScrollbar();
42 }
43
value() const44 int WebScrollbarImpl::value() const
45 {
46 return m_scrollbar->value();
47 }
48
location() const49 WebPoint WebScrollbarImpl::location() const
50 {
51 return m_scrollbar->location();
52 }
53
size() const54 WebSize WebScrollbarImpl::size() const
55 {
56 return m_scrollbar->size();
57 }
58
enabled() const59 bool WebScrollbarImpl::enabled() const
60 {
61 return m_scrollbar->enabled();
62 }
63
maximum() const64 int WebScrollbarImpl::maximum() const
65 {
66 return m_scrollbar->maximum();
67 }
68
totalSize() const69 int WebScrollbarImpl::totalSize() const
70 {
71 return m_scrollbar->totalSize();
72 }
73
isScrollViewScrollbar() const74 bool WebScrollbarImpl::isScrollViewScrollbar() const
75 {
76 return m_scrollbar->isScrollViewScrollbar();
77 }
78
isScrollableAreaActive() const79 bool WebScrollbarImpl::isScrollableAreaActive() const
80 {
81 return m_scrollbar->isScrollableAreaActive();
82 }
83
getTickmarks(WebVector<WebRect> & webTickmarks) const84 void WebScrollbarImpl::getTickmarks(WebVector<WebRect>& webTickmarks) const
85 {
86 Vector<WebCore::IntRect> tickmarks;
87 m_scrollbar->getTickmarks(tickmarks);
88
89 WebVector<WebRect> result(tickmarks.size());
90 for (size_t i = 0; i < tickmarks.size(); ++i)
91 result[i] = tickmarks[i];
92
93 webTickmarks.swap(result);
94 }
95
controlSize() const96 WebScrollbar::ScrollbarControlSize WebScrollbarImpl::controlSize() const
97 {
98 return static_cast<WebScrollbar::ScrollbarControlSize>(m_scrollbar->controlSize());
99 }
100
pressedPart() const101 WebScrollbar::ScrollbarPart WebScrollbarImpl::pressedPart() const
102 {
103 return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->pressedPart());
104 }
105
hoveredPart() const106 WebScrollbar::ScrollbarPart WebScrollbarImpl::hoveredPart() const
107 {
108 return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart());
109 }
110
scrollbarOverlayStyle() const111 WebScrollbar::ScrollbarOverlayStyle WebScrollbarImpl::scrollbarOverlayStyle() const
112 {
113 return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle());
114 }
115
orientation() const116 WebScrollbar::Orientation WebScrollbarImpl::orientation() const
117 {
118 return static_cast<WebScrollbar::Orientation>(m_scrollbar->orientation());
119 }
120
isLeftSideVerticalScrollbar() const121 bool WebScrollbarImpl::isLeftSideVerticalScrollbar() const
122 {
123 return m_scrollbar->isLeftSideVerticalScrollbar();
124 }
125
isCustomScrollbar() const126 bool WebScrollbarImpl::isCustomScrollbar() const
127 {
128 return m_scrollbar->isCustomScrollbar();
129 }
130
isAlphaLocked() const131 bool WebScrollbarImpl::isAlphaLocked() const
132 {
133 return m_scrollbar->isAlphaLocked();
134 }
135
setIsAlphaLocked(bool flag)136 void WebScrollbarImpl::setIsAlphaLocked(bool flag)
137 {
138 m_scrollbar->setIsAlphaLocked(flag);
139 }
140
141 } // namespace blink
142