| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/RootFrameViewport.h" | 5 #include "core/frame/RootFrameViewport.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/ScrollAlignment.h" | 8 #include "core/layout/ScrollAlignment.h" |
| 9 #include "core/layout/ScrollAnchor.h" | 9 #include "core/layout/ScrollAnchor.h" |
| 10 #include "platform/geometry/DoubleRect.h" | 10 #include "platform/geometry/DoubleRect.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 ScrollOffset clampedOffset = clampScrollOffset(offset); | 172 ScrollOffset clampedOffset = clampScrollOffset(offset); |
| 173 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); | 173 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); |
| 174 } | 174 } |
| 175 | 175 |
| 176 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { | 176 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { |
| 177 return layoutViewport().scrollBehaviorStyle(); | 177 return layoutViewport().scrollBehaviorStyle(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool RootFrameViewport::hasOverlayScrollbars() const { |
| 181 return layoutViewport().hasOverlayScrollbars(); |
| 182 } |
| 183 |
| 184 void RootFrameViewport::setScrollbarNeedsPaintInvalidation( |
| 185 ScrollbarOrientation orientation) { |
| 186 return layoutViewport().setScrollbarNeedsPaintInvalidation(orientation); |
| 187 } |
| 188 |
| 189 LayoutRect RootFrameViewport::visualRectForScrollbarParts() const { |
| 190 return layoutViewport().visualRectForScrollbarParts(); |
| 191 } |
| 192 |
| 193 ScrollbarOverlayColorTheme RootFrameViewport::getScrollbarOverlayColorTheme() |
| 194 const { |
| 195 return layoutViewport().getScrollbarOverlayColorTheme(); |
| 196 } |
| 197 |
| 198 void RootFrameViewport::setTickmarks(const Vector<IntRect>& tickmarks) { |
| 199 m_tickmarks = tickmarks; |
| 200 } |
| 201 |
| 202 void RootFrameViewport::getTickmarks(Vector<IntRect>& tickmarks) const { |
| 203 if (!m_tickmarks.isEmpty()) |
| 204 tickmarks = m_tickmarks; |
| 205 else |
| 206 layoutViewport().getTickmarks(tickmarks); |
| 207 } |
| 208 |
| 209 void RootFrameViewport::mouseEnteredScrollbar(Scrollbar& scrollbar) const { |
| 210 layoutViewport().mouseEnteredScrollbar(scrollbar); |
| 211 } |
| 212 |
| 213 void RootFrameViewport::mouseExitedScrollbar(Scrollbar& scrollbar) const { |
| 214 layoutViewport().mouseExitedScrollbar(scrollbar); |
| 215 } |
| 216 |
| 217 void RootFrameViewport::scrollbarVisibilityChanged() { |
| 218 layoutViewport().scrollbarVisibilityChanged(); |
| 219 } |
| 220 |
| 221 IntRect RootFrameViewport::convertFromScrollbarToContainingWidget( |
| 222 const Scrollbar& scrollbar, |
| 223 const IntRect& localRect) const { |
| 224 return layoutViewport().convertFromScrollbarToContainingWidget(scrollbar, |
| 225 localRect); |
| 226 } |
| 227 |
| 228 IntRect RootFrameViewport::convertFromContainingWidgetToScrollbar( |
| 229 const Scrollbar& scrollbar, |
| 230 const IntRect& parentRect) const { |
| 231 return layoutViewport().convertFromContainingWidgetToScrollbar(scrollbar, |
| 232 parentRect); |
| 233 } |
| 234 |
| 235 IntPoint RootFrameViewport::convertFromScrollbarToContainingWidget( |
| 236 const Scrollbar& scrollbar, |
| 237 const IntPoint& localPoint) const { |
| 238 return layoutViewport().convertFromScrollbarToContainingWidget(scrollbar, |
| 239 localPoint); |
| 240 } |
| 241 |
| 242 IntPoint RootFrameViewport::convertFromContainingWidgetToScrollbar( |
| 243 const Scrollbar& scrollbar, |
| 244 const IntPoint& parentPoint) const { |
| 245 return layoutViewport().convertFromContainingWidgetToScrollbar(scrollbar, |
| 246 parentPoint); |
| 247 } |
| 248 |
| 249 ScrollOffset RootFrameViewport::scrollAnimatorDesiredTargetOffset() const { |
| 250 return layoutViewport().scrollAnimatorDesiredTargetOffset() + |
| 251 visualViewport().scrollAnimatorDesiredTargetOffset(); |
| 252 } |
| 253 |
| 254 void RootFrameViewport::setScrollCornerNeedsPaintInvalidation() { |
| 255 return layoutViewport().setScrollCornerNeedsPaintInvalidation(); |
| 256 } |
| 257 |
| 180 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, | 258 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, |
| 181 const ScrollAlignment& alignX, | 259 const ScrollAlignment& alignX, |
| 182 const ScrollAlignment& alignY, | 260 const ScrollAlignment& alignY, |
| 183 ScrollType scrollType) { | 261 ScrollType scrollType) { |
| 184 // We want to move the rect into the viewport that excludes the scrollbars so | 262 // We want to move the rect into the viewport that excludes the scrollbars so |
| 185 // we intersect the visual viewport with the scrollbar-excluded frameView | 263 // we intersect the visual viewport with the scrollbar-excluded frameView |
| 186 // content rect. However, we don't use visibleContentRect directly since it | 264 // content rect. However, we don't use visibleContentRect directly since it |
| 187 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset | 265 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset |
| 188 // and construct a LayoutRect from that. | 266 // and construct a LayoutRect from that. |
| 189 LayoutRect frameRectInContent = | 267 LayoutRect frameRectInContent = |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 visualViewport().clearScrollAnimators(); | 506 visualViewport().clearScrollAnimators(); |
| 429 } | 507 } |
| 430 | 508 |
| 431 DEFINE_TRACE(RootFrameViewport) { | 509 DEFINE_TRACE(RootFrameViewport) { |
| 432 visitor->trace(m_visualViewport); | 510 visitor->trace(m_visualViewport); |
| 433 visitor->trace(m_layoutViewport); | 511 visitor->trace(m_layoutViewport); |
| 434 ScrollableArea::trace(visitor); | 512 ScrollableArea::trace(visitor); |
| 435 } | 513 } |
| 436 | 514 |
| 437 } // namespace blink | 515 } // namespace blink |
| OLD | NEW |