OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 int ScrollbarGroup::scrollSize(WebCore::ScrollbarOrientation orientation) const | 94 int ScrollbarGroup::scrollSize(WebCore::ScrollbarOrientation orientation) const |
95 { | 95 { |
96 WebPluginScrollbarImpl* webScrollbar = orientation == HorizontalScrollbar ?
m_horizontalScrollbar : m_verticalScrollbar; | 96 WebPluginScrollbarImpl* webScrollbar = orientation == HorizontalScrollbar ?
m_horizontalScrollbar : m_verticalScrollbar; |
97 if (!webScrollbar) | 97 if (!webScrollbar) |
98 return 0; | 98 return 0; |
99 Scrollbar* scrollbar = webScrollbar->scrollbar(); | 99 Scrollbar* scrollbar = webScrollbar->scrollbar(); |
100 return scrollbar->totalSize() - scrollbar->visibleSize(); | 100 return scrollbar->totalSize() - scrollbar->visibleSize(); |
101 } | 101 } |
102 | 102 |
103 int ScrollbarGroup::scrollPosition(Scrollbar* scrollbar) const | |
104 { | |
105 WebPluginScrollbarImpl* webScrollbar = scrollbar->orientation() == Horizonta
lScrollbar ? m_horizontalScrollbar : m_verticalScrollbar; | |
106 if (!webScrollbar) | |
107 return 0; | |
108 return webScrollbar->scrollOffset(); | |
109 } | |
110 | |
111 void ScrollbarGroup::setScrollOffset(const IntPoint& offset) | 103 void ScrollbarGroup::setScrollOffset(const IntPoint& offset) |
112 { | 104 { |
113 if (m_horizontalScrollbar && m_horizontalScrollbar->scrollOffset() != offset
.x()) | 105 if (m_horizontalScrollbar && m_horizontalScrollbar->scrollOffset() != offset
.x()) |
114 m_horizontalScrollbar->setScrollOffset(offset.x()); | 106 m_horizontalScrollbar->setScrollOffset(offset.x()); |
115 else if (m_verticalScrollbar && m_verticalScrollbar->scrollOffset() != offse
t.y()) | 107 else if (m_verticalScrollbar && m_verticalScrollbar->scrollOffset() != offse
t.y()) |
116 m_verticalScrollbar->setScrollOffset(offset.y()); | 108 m_verticalScrollbar->setScrollOffset(offset.y()); |
117 } | 109 } |
118 | 110 |
119 void ScrollbarGroup::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect
& rect) | 111 void ScrollbarGroup::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect
& rect) |
120 { | 112 { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 m_horizontalScrollbar->scrollbarStyleChanged(); | 253 m_horizontalScrollbar->scrollbarStyleChanged(); |
262 if (m_verticalScrollbar) | 254 if (m_verticalScrollbar) |
263 m_verticalScrollbar->scrollbarStyleChanged(); | 255 m_verticalScrollbar->scrollbarStyleChanged(); |
264 } | 256 } |
265 | 257 |
266 bool ScrollbarGroup::scrollbarsCanBeActive() const | 258 bool ScrollbarGroup::scrollbarsCanBeActive() const |
267 { | 259 { |
268 return true; | 260 return true; |
269 } | 261 } |
270 | 262 |
| 263 bool ScrollbarGroup::userInputScrollable(ScrollbarOrientation orientation) const |
| 264 { |
| 265 return orientation == HorizontalScrollbar ? horizontalScrollbar() : vertical
Scrollbar(); |
| 266 } |
| 267 |
| 268 int ScrollbarGroup::pageStep(ScrollbarOrientation orientation) const |
| 269 { |
| 270 int length; |
| 271 if (orientation == VerticalScrollbar) { |
| 272 if (!m_verticalScrollbar) |
| 273 return 0; |
| 274 |
| 275 length = m_verticalScrollbar->scrollbar()->height(); |
| 276 } else { |
| 277 if (!m_horizontalScrollbar) |
| 278 return 0; |
| 279 |
| 280 length = m_horizontalScrollbar->scrollbar()->width(); |
| 281 } |
| 282 |
| 283 int pageStep = std::max( |
| 284 static_cast<int>(static_cast<float>(length) * ScrollableArea::minFractio
nToStepWhenPaging()), |
| 285 length - ScrollableArea::maxOverlapBetweenPages()); |
| 286 |
| 287 return std::max(pageStep, 1); |
| 288 } |
| 289 |
271 } // namespace WebKit | 290 } // namespace WebKit |
OLD | NEW |