| 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(); | |
| 100 } | 98 } |
| 101 | 99 |
| 102 LayoutBox* RootFrameViewport::layoutBox() const { | 100 LayoutBox* RootFrameViewport::layoutBox() const { |
| 103 return layoutViewport().layoutBox(); | 101 return layoutViewport().layoutBox(); |
| 104 } | 102 } |
| 105 | 103 |
| 106 FloatQuad RootFrameViewport::localToVisibleContentQuad( | 104 FloatQuad RootFrameViewport::localToVisibleContentQuad( |
| 107 const FloatQuad& quad, | 105 const FloatQuad& quad, |
| 108 const LayoutObject* localObject, | 106 const LayoutObject* localObject, |
| 109 unsigned flags) const { | 107 unsigned flags) const { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 195 } |
| 198 | 196 |
| 199 ScrollOffset clampedOffset = clampScrollOffset(offset); | 197 ScrollOffset clampedOffset = clampScrollOffset(offset); |
| 200 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); | 198 ScrollableArea::setScrollOffset(clampedOffset, scrollType, scrollBehavior); |
| 201 } | 199 } |
| 202 | 200 |
| 203 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { | 201 ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const { |
| 204 return layoutViewport().scrollBehaviorStyle(); | 202 return layoutViewport().scrollBehaviorStyle(); |
| 205 } | 203 } |
| 206 | 204 |
| 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 | |
| 290 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, | 205 LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, |
| 291 const ScrollAlignment& alignX, | 206 const ScrollAlignment& alignX, |
| 292 const ScrollAlignment& alignY, | 207 const ScrollAlignment& alignY, |
| 293 ScrollType scrollType) { | 208 ScrollType scrollType) { |
| 294 // We want to move the rect into the viewport that excludes the scrollbars so | 209 // We want to move the rect into the viewport that excludes the scrollbars so |
| 295 // we intersect the visual viewport with the scrollbar-excluded frameView | 210 // we intersect the visual viewport with the scrollbar-excluded frameView |
| 296 // content rect. However, we don't use visibleContentRect directly since it | 211 // content rect. However, we don't use visibleContentRect directly since it |
| 297 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset | 212 // floors the scroll offset. Instead, we use ScrollAnimatorBase::currentOffset |
| 298 // and construct a LayoutRect from that. | 213 // and construct a LayoutRect from that. |
| 299 LayoutRect frameRectInContent = | 214 LayoutRect frameRectInContent = |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 visualViewport().clearScrollableArea(); | 453 visualViewport().clearScrollableArea(); |
| 539 } | 454 } |
| 540 | 455 |
| 541 DEFINE_TRACE(RootFrameViewport) { | 456 DEFINE_TRACE(RootFrameViewport) { |
| 542 visitor->trace(m_visualViewport); | 457 visitor->trace(m_visualViewport); |
| 543 visitor->trace(m_layoutViewport); | 458 visitor->trace(m_layoutViewport); |
| 544 ScrollableArea::trace(visitor); | 459 ScrollableArea::trace(visitor); |
| 545 } | 460 } |
| 546 | 461 |
| 547 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |