| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 delta = targetOffset - scrollOffset(); | 88 delta = targetOffset - scrollOffset(); |
| 89 visualViewport().setScrollOffset(visualViewport().scrollOffset() + delta, | 89 visualViewport().setScrollOffset(visualViewport().scrollOffset() + delta, |
| 90 ProgrammaticScroll); | 90 ProgrammaticScroll); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void RootFrameViewport::didUpdateVisualViewport() { | 93 void RootFrameViewport::didUpdateVisualViewport() { |
| 94 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) { | 94 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) { |
| 95 if (ScrollAnchor* anchor = layoutViewport().scrollAnchor()) | 95 if (ScrollAnchor* anchor = layoutViewport().scrollAnchor()) |
| 96 anchor->clear(); | 96 anchor->clear(); |
| 97 } | 97 } |
| 98 |
| 99 layoutViewport().updateScrollbars(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 LayoutBox* RootFrameViewport::layoutBox() const { | 102 LayoutBox* RootFrameViewport::layoutBox() const { |
| 101 return layoutViewport().layoutBox(); | 103 return layoutViewport().layoutBox(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 FloatQuad RootFrameViewport::localToVisibleContentQuad( | 106 FloatQuad RootFrameViewport::localToVisibleContentQuad( |
| 105 const FloatQuad& quad, | 107 const FloatQuad& quad, |
| 106 const LayoutObject* localObject, | 108 const LayoutObject* localObject, |
| 107 unsigned flags) const { | 109 unsigned flags) const { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 197 } |
| 196 | 198 |
| 197 ScrollOffset clampedOffset = clampScrollOffset(offset); | 199 ScrollOffset clampedOffset = clampScrollOffset(offset); |
| 198 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); | 200 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); |
| 199 } | 201 } |
| 200 | 202 |
| 201 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { | 203 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { |
| 202 return layoutViewport().scrollBehaviorStyle(); | 204 return layoutViewport().scrollBehaviorStyle(); |
| 203 } | 205 } |
| 204 | 206 |
| 207 Scrollbar* RootFrameViewport::horizontalScrollbar() const { |
| 208 return layoutViewport().horizontalScrollbar(); |
| 209 } |
| 210 |
| 211 Scrollbar* RootFrameViewport::verticalScrollbar() const { |
| 212 return layoutViewport().verticalScrollbar(); |
| 213 } |
| 214 |
| 215 bool RootFrameViewport::hasOverlayScrollbars() const { |
| 216 return layoutViewport().hasOverlayScrollbars(); |
| 217 } |
| 218 |
| 219 void RootFrameViewport::setScrollbarNeedsPaintInvalidation( |
| 220 ScrollbarOrientation orientation) { |
| 221 return layoutViewport().setScrollbarNeedsPaintInvalidation(orientation); |
| 222 } |
| 223 |
| 224 LayoutRect RootFrameViewport::visualRectForScrollbarParts() const { |
| 225 return layoutViewport().visualRectForScrollbarParts(); |
| 226 } |
| 227 |
| 228 ScrollbarOverlayColorTheme RootFrameViewport::getScrollbarOverlayColorTheme() |
| 229 const { |
| 230 return layoutViewport().getScrollbarOverlayColorTheme(); |
| 231 } |
| 232 |
| 233 void RootFrameViewport::getTickmarks(Vector<IntRect>& tickmarks) const { |
| 234 layoutViewport().getTickmarks(tickmarks); |
| 235 } |
| 236 |
| 237 void RootFrameViewport::mouseEnteredScrollbar(Scrollbar& scrollbar) { |
| 238 layoutViewport().mouseEnteredScrollbar(scrollbar); |
| 239 } |
| 240 |
| 241 void RootFrameViewport::mouseExitedScrollbar(Scrollbar& scrollbar) { |
| 242 layoutViewport().mouseExitedScrollbar(scrollbar); |
| 243 } |
| 244 |
| 245 void RootFrameViewport::scrollbarVisibilityChanged() { |
| 246 layoutViewport().scrollbarVisibilityChanged(); |
| 247 } |
| 248 |
| 249 bool RootFrameViewport::scrollbarsHidden() const { |
| 250 return layoutViewport().scrollbarsHidden(); |
| 251 } |
| 252 |
| 253 IntRect RootFrameViewport::convertFromScrollbarToContainingWidget( |
| 254 const Scrollbar& scrollbar, |
| 255 const IntRect& localRect) const { |
| 256 return layoutViewport().convertFromScrollbarToContainingWidget(scrollbar, |
| 257 localRect); |
| 258 } |
| 259 |
| 260 IntRect RootFrameViewport::convertFromContainingWidgetToScrollbar( |
| 261 const Scrollbar& scrollbar, |
| 262 const IntRect& parentRect) const { |
| 263 return layoutViewport().convertFromContainingWidgetToScrollbar(scrollbar, |
| 264 parentRect); |
| 265 } |
| 266 |
| 267 IntPoint RootFrameViewport::convertFromScrollbarToContainingWidget( |
| 268 const Scrollbar& scrollbar, |
| 269 const IntPoint& localPoint) const { |
| 270 return layoutViewport().convertFromScrollbarToContainingWidget(scrollbar, |
| 271 localPoint); |
| 272 } |
| 273 |
| 274 IntPoint RootFrameViewport::convertFromContainingWidgetToScrollbar( |
| 275 const Scrollbar& scrollbar, |
| 276 const IntPoint& parentPoint) const { |
| 277 return layoutViewport().convertFromContainingWidgetToScrollbar(scrollbar, |
| 278 parentPoint); |
| 279 } |
| 280 |
| 281 ScrollOffset RootFrameViewport::scrollAnimatorDesiredTargetOffset() const { |
| 282 return layoutViewport().scrollAnimatorDesiredTargetOffset() + |
| 283 visualViewport().scrollAnimatorDesiredTargetOffset(); |
| 284 } |
| 285 |
| 286 void RootFrameViewport::setScrollCornerNeedsPaintInvalidation() { |
| 287 return layoutViewport().setScrollCornerNeedsPaintInvalidation(); |
| 288 } |
| 289 |
| 205 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, | 290 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, |
| 206 const ScrollAlignment& alignX, | 291 const ScrollAlignment& alignX, |
| 207 const ScrollAlignment& alignY, | 292 const ScrollAlignment& alignY, |
| 208 ScrollType scrollType) { | 293 ScrollType scrollType) { |
| 209 // We want to move the rect into the viewport that excludes the scrollbars so | 294 // We want to move the rect into the viewport that excludes the scrollbars so |
| 210 // we intersect the visual viewport with the scrollbar-excluded frameView | 295 // we intersect the visual viewport with the scrollbar-excluded frameView |
| 211 // content rect. However, we don't use visibleContentRect directly since it | 296 // content rect. However, we don't use visibleContentRect directly since it |
| 212 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset | 297 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset |
| 213 // and construct a LayoutRect from that. | 298 // and construct a LayoutRect from that. |
| 214 LayoutRect frameRectInContent = | 299 LayoutRect frameRectInContent = |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 visualViewport().clearScrollableArea(); | 538 visualViewport().clearScrollableArea(); |
| 454 } | 539 } |
| 455 | 540 |
| 456 DEFINE_TRACE(RootFrameViewport) { | 541 DEFINE_TRACE(RootFrameViewport) { |
| 457 visitor->trace(m_visualViewport); | 542 visitor->trace(m_visualViewport); |
| 458 visitor->trace(m_layoutViewport); | 543 visitor->trace(m_layoutViewport); |
| 459 ScrollableArea::trace(visitor); | 544 ScrollableArea::trace(visitor); |
| 460 } | 545 } |
| 461 | 546 |
| 462 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |