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
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.
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.
27 #include "platform/exported/WebScrollbarImpl.h"
29 #include "platform/geometry/IntRect.h"
30 #include "platform/scroll/Scrollbar.h"
34 WebScrollbarImpl::WebScrollbarImpl(Scrollbar
* scrollbar
)
35 : m_scrollbar(scrollbar
)
39 bool WebScrollbarImpl::isOverlay() const
41 return m_scrollbar
->isOverlayScrollbar();
44 int WebScrollbarImpl::value() const
46 return m_scrollbar
->value();
49 WebPoint
WebScrollbarImpl::location() const
51 return m_scrollbar
->location();
54 WebSize
WebScrollbarImpl::size() const
56 return m_scrollbar
->size();
59 bool WebScrollbarImpl::enabled() const
61 return m_scrollbar
->enabled();
64 int WebScrollbarImpl::maximum() const
66 return m_scrollbar
->maximum();
69 int WebScrollbarImpl::totalSize() const
71 return m_scrollbar
->totalSize();
74 bool WebScrollbarImpl::isScrollableAreaActive() const
76 return m_scrollbar
->isScrollableAreaActive();
79 void WebScrollbarImpl::getTickmarks(WebVector
<WebRect
>& webTickmarks
) const
81 Vector
<IntRect
> tickmarks
;
82 m_scrollbar
->getTickmarks(tickmarks
);
84 WebVector
<WebRect
> result(tickmarks
.size());
85 for (size_t i
= 0; i
< tickmarks
.size(); ++i
)
86 result
[i
] = tickmarks
[i
];
88 webTickmarks
.swap(result
);
91 WebScrollbar::ScrollbarControlSize
WebScrollbarImpl::controlSize() const
93 return static_cast<WebScrollbar::ScrollbarControlSize
>(m_scrollbar
->controlSize());
96 WebScrollbar::ScrollbarPart
WebScrollbarImpl::pressedPart() const
98 return static_cast<WebScrollbar::ScrollbarPart
>(m_scrollbar
->pressedPart());
101 WebScrollbar::ScrollbarPart
WebScrollbarImpl::hoveredPart() const
103 return static_cast<WebScrollbar::ScrollbarPart
>(m_scrollbar
->hoveredPart());
106 WebScrollbar::ScrollbarOverlayStyle
WebScrollbarImpl::scrollbarOverlayStyle() const
108 return static_cast<WebScrollbar::ScrollbarOverlayStyle
>(m_scrollbar
->scrollbarOverlayStyle());
111 WebScrollbar::Orientation
WebScrollbarImpl::orientation() const
113 return static_cast<WebScrollbar::Orientation
>(m_scrollbar
->orientation());
116 bool WebScrollbarImpl::isLeftSideVerticalScrollbar() const
118 return m_scrollbar
->isLeftSideVerticalScrollbar();
121 bool WebScrollbarImpl::isCustomScrollbar() const
123 return m_scrollbar
->isCustomScrollbar();
126 bool WebScrollbarImpl::isAlphaLocked() const
128 return m_scrollbar
->isAlphaLocked();
131 void WebScrollbarImpl::setIsAlphaLocked(bool flag
)
133 m_scrollbar
->setIsAlphaLocked(flag
);
136 float WebScrollbarImpl::elasticOverscroll() const
138 return m_scrollbar
->elasticOverscroll();
141 void WebScrollbarImpl::setElasticOverscroll(float elasticOverscroll
)
143 m_scrollbar
->setElasticOverscroll(elasticOverscroll
);