Changeset 169733 in webkit
- Timestamp:
- Jun 9, 2014, 5:37:06 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r169725 r169733 1 2014-06-09 Simon Fraser <simon.fraser@apple.com> 2 3 Work towards having frames in the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=133665 5 6 Reviewed by Tim Horton. 7 8 Tests that dump the scrolling tree with subframes. 9 10 * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt: Added. 11 * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt: Added. 12 * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html: Added. 13 * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html: Added. 14 * platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html: Added. 15 1 16 2014-06-09 Eric Carlson <eric.carlson@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r169731 r169733 1 2014-06-09 Simon Fraser <simon.fraser@apple.com> 2 3 Work towards having frames in the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=133665 5 6 Reviewed by Tim Horton. 7 8 Optionally (based on Setting) create nodes in the scrolling tree for frames which 9 contain async-scrollable content. This will be used on iOS/WK2 to support accelerated 10 overflow-scroll in iframes. The setting allows for testing on OS X. 11 12 The change breaks an assumption in ScrollingCoordinator/AsyncScrollingCoordinator 13 that we're always dealing with the main frame, and changes logic in RenderLayerCompositor 14 so that we can connect the scrolling tree across frame boundaries. RenderLayerCompositor 15 maintains a m_subframeScrollLayersNeedReattach flag that gets set whenever we add or remove 16 scroll-coordinated layers in the current frame. When set, after updating compositing 17 layers we walk child frames, and, if they have scrolling nodes, re-attach them to the 18 scrolling tree (which will find the new ancestor node). 19 20 Tests: platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html 21 platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html 22 23 * WebCore.exp.in: 24 * page/FrameView.cpp: 25 (WebCore::FrameView::scrollLayerID): Use the new "for role" way of getting the node ID. 26 * page/Settings.cpp: 27 * page/Settings.in: Add scrollingTreeIncludesFrames. 28 * page/scrolling/AsyncScrollingCoordinator.cpp: 29 (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): 30 (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged): Only set 31 the region for the main frame. 32 (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode): updateScrollPositionAfterAsyncScroll() 33 needs to know which FrameView a given nodeID is hosted in; doing a walk of the frame tree for 34 non-main frames seems to be the safest way. 35 (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): 36 (WebCore::AsyncScrollingCoordinator::syncChildPositions): 37 * page/scrolling/AsyncScrollingCoordinator.h: 38 * page/scrolling/ScrollingCoordinator.cpp: 39 (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Consult the new setting. 40 (WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange): 41 (WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange): 42 (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange): 43 (WebCore::ScrollingCoordinator::synchronousScrollingReasons): 44 (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons): 45 (WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates): 46 (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously): 47 (WebCore::ScrollingCoordinator::replaySessionStateDidChange): 48 (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText): 49 * page/scrolling/ScrollingCoordinator.h: 50 (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously): Deleted. 51 * rendering/RenderLayerBacking.h: Rather than separate functions to get the two scrolling 52 node IDs, having one scrollingNodeIDForRole() makes calling code cleaner. 53 * rendering/RenderLayerCompositor.cpp: 54 (WebCore::RenderLayerCompositor::RenderLayerCompositor): 55 (WebCore::RenderLayerCompositor::updateCompositingLayers): call reattachSubframeScrollLayers() 56 after a compositing tree update. 57 (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer): Deals with the various configurations 58 in which we can do async scrolling of sticky elements. 59 (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer): 60 (WebCore::useCoordinatedScrollingForLayer): 61 (WebCore::RenderLayerCompositor::requiresCompositingForPosition): 62 (WebCore::RenderLayerCompositor::requiresCompositingForScrolling): Moved. 63 (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This is a bug fix; 64 we only need to notify child frames, not all descendant frames. 65 (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): 66 (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers): 67 (WebCore::enclosingScrollingNodeID): 68 (WebCore::scrollCoordinatedAncestorInParentOfFrame): 69 (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): 70 (WebCore::RenderLayerCompositor::attachScrollingNode): 71 (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): 72 (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): 73 (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer): 74 (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): 75 (WebCore::RenderLayerCompositor::willRemoveScrollingLayer): 76 (WebCore::isStickyInAcceleratedScrollingLayerOrViewport): Deleted. 77 (WebCore::isViewportConstrainedFixedOrStickyLayer): Deleted. 78 (WebCore::isMainFrameScrollingOrOverflowScrolling): Deleted. 79 (WebCore::nearestScrollCoordinatedAncestor): Deleted. 80 * rendering/RenderLayerCompositor.h: 81 * rendering/RenderView.cpp: 82 (WebCore::RenderView::setSelection): Added comment. 83 * testing/InternalSettings.cpp: 84 (WebCore::InternalSettings::setScrollingTreeIncludesFrames): 85 * testing/InternalSettings.h: Removed some useless parameter names. 86 * testing/InternalSettings.idl: Added setScrollingTreeIncludesFrames() setting. 87 1 88 2014-06-09 Benjamin Poulain <bpoulain@apple.com> 2 89 -
trunk/Source/WebCore/WebCore.exp.in
r169679 r169733 1522 1522 __ZNK7WebCore10RenderText16linesBoundingBoxEv 1523 1523 __ZNK7WebCore10RenderView12documentRectEv 1524 __ZNK7WebCore10RenderView15usesCompositingEv 1524 1525 __ZNK7WebCore10RenderView20unscaledDocumentRectEv 1525 1526 __ZNK7WebCore10ScrollView12contentsSizeEv -
trunk/Source/WebCore/page/FrameView.cpp
r169651 r169733 805 805 return 0; 806 806 807 return backing->scrollingNodeID ();807 return backing->scrollingNodeIDForRole(FrameScrollingNode); 808 808 } 809 809 -
trunk/Source/WebCore/page/Settings.cpp
r168726 r169733 128 128 static const bool defaultMediaPlaybackRequiresUserGesture = true; 129 129 static const bool defaultShouldRespectImageOrientation = true; 130 static const bool defaultScrollingTreeIncludesFrames = true; 130 131 #else 131 132 static const bool defaultFixedPositionCreatesStackingContext = false; … … 135 136 static const bool defaultMediaPlaybackRequiresUserGesture = false; 136 137 static const bool defaultShouldRespectImageOrientation = false; 138 static const bool defaultScrollingTreeIncludesFrames = false; 137 139 #endif 138 140 -
trunk/Source/WebCore/page/Settings.in
r168978 r169733 133 133 shouldDisplayTextDescriptions initial=false, conditional=VIDEO_TRACK 134 134 scrollingCoordinatorEnabled initial=false 135 scrollingTreeIncludesFrames initial=defaultScrollingTreeIncludesFrames 135 136 scrollAnimatorEnabled initial=true, conditional=SMOOTH_SCROLLING 136 137 notificationsEnabled initial=true -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r169123 r169733 73 73 // In the future, we may want to have the ability to set non-fast scrolling regions for more than 74 74 // just the root node. But right now, this concept only applies to the root. 75 m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint())); 75 if (frameView->frame().isMainFrame()) 76 m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&frameView->frame(), IntPoint())); 76 77 77 78 if (!coordinatesScrollingForFrameView(frameView)) … … 106 107 } 107 108 108 void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView* )109 void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView* frameView) 109 110 { 110 111 if (!m_scrollingStateTree->rootStateNode()) 111 112 return; 112 113 113 m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint())); 114 if (frameView->frame().isMainFrame()) 115 m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&frameView->frame(), IntPoint())); 114 116 } 115 117 … … 194 196 } 195 197 198 FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID scrollingNodeID) const 199 { 200 if (scrollingNodeID == m_scrollingStateTree->rootStateNode()->scrollingNodeID()) 201 return m_page->mainFrame().view(); 202 203 ScrollingStateNode* stateNode = m_scrollingStateTree->stateNodeForID(scrollingNodeID); 204 if (!stateNode) 205 return nullptr; 206 207 // Find the enclosing frame scrolling node. 208 ScrollingStateNode* parentNode = stateNode; 209 while (parentNode && parentNode->nodeType() != FrameScrollingNode) 210 parentNode = parentNode->parent(); 211 212 if (!parentNode) 213 return nullptr; 214 215 // Walk the frame tree to find the matching FrameView. This is not ideal, but avoids back pointers to FrameViews 216 // from ScrollingTreeStateNodes. 217 for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) { 218 if (FrameView* view = frame->view()) { 219 if (view->scrollLayerID() == parentNode->scrollingNodeID()) 220 return view; 221 } 222 } 223 224 return nullptr; 225 } 226 196 227 void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) 197 228 { … … 201 232 return; 202 233 203 FrameView* frameView = m_page->mainFrame().view();234 FrameView* frameView = frameViewForScrollingNode(scrollingNodeID); 204 235 if (!frameView) 205 236 return; 206 237 207 // Main frame.208 238 if (scrollingNodeID == frameView->scrollLayerID()) { 209 239 bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); … … 317 347 318 348 // FIXME: We'll have to traverse deeper into the tree at some point. 319 size_t size = children->size(); 320 for (size_t i = 0; i < size; ++i) { 321 ScrollingStateNode* child = children->at(i).get(); 349 for (auto& child : *children) 322 350 child->syncLayerPositionForViewportRect(viewportRect); 323 }324 351 } 325 352 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r169123 r169733 71 71 void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition); 72 72 73 virtual String scrollingStateTreeAsText() const override; 74 73 75 private: 74 76 virtual bool isAsyncScrollingCoordinator() const override { return true; } … … 92 94 virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry* = nullptr); 93 95 94 virtual String scrollingStateTreeAsText() const override;95 96 virtual bool isRubberBandInProgress() const override; 96 97 virtual void setScrollPinningBehavior(ScrollPinningBehavior) override; … … 108 109 109 110 void updateScrollPositionAfterAsyncScrollTimerFired(Timer<AsyncScrollingCoordinator>*); 111 112 FrameView* frameViewForScrollingNode(ScrollingNodeID) const; 110 113 111 114 Timer<AsyncScrollingCoordinator> m_updateNodeScrollPositionTimer; -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r168665 r169733 40 40 #include "RenderView.h" 41 41 #include "ScrollAnimator.h" 42 #include "Settings.h" 42 43 #include <wtf/MainThread.h> 43 44 #include <wtf/text/StringBuilder.h> … … 87 88 ASSERT(m_page); 88 89 89 // We currently only handle the main frame. 90 if (!frameView->frame().isMainFrame()) 90 if (!frameView->frame().isMainFrame() && !m_page->settings().scrollingTreeIncludesFrames()) 91 91 return false; 92 92 93 // We currently only support composited mode.94 93 RenderView* renderView = m_page->mainFrame().contentRenderer(); 95 94 if (!renderView) … … 182 181 return; 183 182 184 updateSynchronousScrollingReasons( );183 updateSynchronousScrollingReasons(frameView); 185 184 } 186 185 … … 193 192 return; 194 193 195 updateSynchronousScrollingReasons( );194 updateSynchronousScrollingReasons(frameView); 196 195 } 197 196 … … 286 285 frameViewLayoutUpdated(frameView); 287 286 recomputeWheelEventHandlerCountForFrameView(frameView); 288 updateSynchronousScrollingReasons( );287 updateSynchronousScrollingReasons(frameView); 289 288 } 290 289 … … 323 322 } 324 323 325 SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons() const 326 { 327 FrameView* frameView = m_page->mainFrame().view(); 324 SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons(FrameView* frameView) const 325 { 328 326 if (!frameView) 329 327 return static_cast<SynchronousScrollingReasons>(0); … … 344 342 if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstrainedObjects(frameView)) 345 343 synchronousScrollingReasons |= HasNonLayerViewportConstrainedObjects; 346 if ( m_page->mainFrame().document() && m_page->mainFrame().document()->isImageDocument())344 if (frameView->frame().mainFrame().document() && frameView->frame().document()->isImageDocument()) 347 345 synchronousScrollingReasons |= IsImageDocument; 348 346 … … 350 348 } 351 349 352 void ScrollingCoordinator::updateSynchronousScrollingReasons() 353 { 354 setSynchronousScrollingReasons(synchronousScrollingReasons()); 350 void ScrollingCoordinator::updateSynchronousScrollingReasons(FrameView* frameView) 351 { 352 // FIXME: Once we support async scrolling of iframes, we'll have to track the synchronous scrolling 353 // reasons per frame (maybe on scrolling tree nodes). 354 if (!frameView->frame().isMainFrame()) 355 return; 356 357 setSynchronousScrollingReasons(synchronousScrollingReasons(frameView)); 355 358 } 356 359 … … 361 364 362 365 m_forceSynchronousScrollLayerPositionUpdates = forceSynchronousScrollLayerPositionUpdates; 363 updateSynchronousScrollingReasons(); 366 updateSynchronousScrollingReasons(m_page->mainFrame().view()); 367 } 368 369 bool ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously() const 370 { 371 return synchronousScrollingReasons(m_page->mainFrame().view()); 364 372 } 365 373 … … 367 375 void ScrollingCoordinator::replaySessionStateDidChange() 368 376 { 369 updateSynchronousScrollingReasons(); 377 // FIXME: Once we support async scrolling of iframes, this should go through all subframes. 378 updateSynchronousScrollingReasons(m_page->mainFrame().view()); 370 379 } 371 380 #endif … … 404 413 String ScrollingCoordinator::synchronousScrollingReasonsAsText() const 405 414 { 406 return synchronousScrollingReasonsAsText(synchronousScrollingReasons( ));415 return synchronousScrollingReasonsAsText(synchronousScrollingReasons(m_page->mainFrame().view())); 407 416 } 408 417 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r169123 r169733 111 111 112 112 // Return whether this scrolling coordinator handles scrolling for the given frame view. 113 bool coordinatesScrollingForFrameView(FrameView*) const;113 virtual bool coordinatesScrollingForFrameView(FrameView*) const; 114 114 115 115 // Should be called whenever the given frame view has been laid out. … … 184 184 }; 185 185 186 SynchronousScrollingReasons synchronousScrollingReasons( ) const;187 bool shouldUpdateScrollLayerPositionSynchronously() const { return synchronousScrollingReasons(); }186 SynchronousScrollingReasons synchronousScrollingReasons(FrameView*) const; 187 bool shouldUpdateScrollLayerPositionSynchronously() const; 188 188 189 189 virtual void willDestroyScrollableArea(ScrollableArea*) { } … … 219 219 220 220 virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; 221 void updateSynchronousScrollingReasons( );221 void updateSynchronousScrollingReasons(FrameView*); 222 222 223 223 bool m_forceSynchronousScrollLayerPositionUpdates; -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r169161 r169733 109 109 110 110 void detachFromScrollingCoordinator(); 111 112 ScrollingNodeID viewportConstrainedNodeID() const { return m_viewportConstrainedNodeID; } 113 void setViewportConstrainedNodeID(ScrollingNodeID nodeID) { m_viewportConstrainedNodeID = nodeID; } 114 115 ScrollingNodeID scrollingNodeID() const { return m_scrollingNodeID; } 116 void setScrollingNodeID(ScrollingNodeID nodeID) { m_scrollingNodeID = nodeID; } 111 112 ScrollingNodeID scrollingNodeIDForRole(ScrollingNodeType nodeType) const 113 { 114 switch (nodeType) { 115 case FrameScrollingNode: 116 case OverflowScrollingNode: 117 return m_scrollingNodeID; 118 case FixedNode: 119 case StickyNode: 120 return m_viewportConstrainedNodeID; 121 } 122 return 0; 123 } 124 125 void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollingNodeType nodeType) 126 { 127 switch (nodeType) { 128 case FrameScrollingNode: 129 case OverflowScrollingNode: 130 m_scrollingNodeID = nodeID; 131 break; 132 case FixedNode: 133 case StickyNode: 134 m_viewportConstrainedNodeID = nodeID; 135 break; 136 } 137 } 117 138 118 139 ScrollingNodeID scrollingNodeIDForChildren() const { return m_scrollingNodeID ? m_scrollingNodeID : m_viewportConstrainedNodeID; } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r169651 r169733 280 280 , m_forceCompositingMode(false) 281 281 , m_inPostLayoutUpdate(false) 282 , m_subframeScrollLayersNeedReattach(false) 282 283 , m_isTrackingRepaints(false) 283 284 , m_layersWithTiledBackingCount(0) … … 730 731 m_rootContentLayer->setChildren(childList); 731 732 } 733 734 reattachSubframeScrollLayers(); 732 735 } else if (needGeometryUpdate) { 733 736 // We just need to do a geometry update. This is only used for position:fixed scrolling; 734 737 // most of the time, geometry is updated via RenderLayer::styleChanged(). 735 738 updateLayerTreeGeometry(*updateRoot, 0); 739 ASSERT(!isFullUpdate || !m_subframeScrollLayersNeedReattach); 736 740 } 737 741 … … 2524 2528 } 2525 2529 2526 #if PLATFORM(IOS)2527 bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const2528 {2529 if (!layer.hasAcceleratedTouchScrolling())2530 return false;2531 2532 if (!m_inPostLayoutUpdate) {2533 m_reevaluateCompositingAfterLayout = true;2534 return layer.isComposited();2535 }2536 2537 return layer.hasTouchScrollableOverflow();2538 }2539 #endif2540 2541 2530 bool RenderLayerCompositor::requiresCompositingForFilters(RenderLayerModelObject& renderer) const 2542 2531 { … … 2552 2541 } 2553 2542 2543 bool RenderLayerCompositor::isAsyncScrollableStickyLayer(const RenderLayer& layer, const RenderLayer** enclosingAcceleratedOverflowLayer) const 2544 { 2545 ASSERT(layer.renderer().isStickyPositioned()); 2546 2547 RenderLayer* enclosingOverflowLayer = layer.enclosingOverflowClipLayer(ExcludeSelf); 2548 2554 2549 #if PLATFORM(IOS) 2555 static bool isStickyInAcceleratedScrollingLayerOrViewport(const RenderLayer& layer, const RenderLayer** enclosingAcceleratedOverflowLayer = 0)2556 {2557 ASSERT(layer.renderer().isStickyPositioned());2558 2559 RenderLayer* enclosingOverflowLayer = layer.enclosingOverflowClipLayer(ExcludeSelf);2560 2550 if (enclosingOverflowLayer && enclosingOverflowLayer->hasTouchScrollableOverflow()) { 2561 2551 if (enclosingAcceleratedOverflowLayer) … … 2563 2553 return true; 2564 2554 } 2565 2566 return !enclosingOverflowLayer; 2567 } 2568 #endif 2569 2570 static bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer& layer) 2571 { 2555 #else 2556 UNUSED_PARAM(enclosingAcceleratedOverflowLayer); 2557 #endif 2558 // If the layer is inside normal overflow, it's not async-scrollable. 2559 if (enclosingOverflowLayer) 2560 return false; 2561 2562 // No overflow ancestor, so see if the frame supports async scrolling. 2563 if (hasCoordinatedScrolling()) 2564 return true; 2565 2572 2566 #if PLATFORM(IOS) 2567 // iOS WK1 has fixed/sticky support in the main frame via WebFixedPositionContent. 2568 return m_renderView.frameView().frame().isMainFrame(); 2569 #else 2570 return false; 2571 #endif 2572 } 2573 2574 bool RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer(const RenderLayer& layer) const 2575 { 2573 2576 if (layer.renderer().isStickyPositioned()) 2574 return isStickyInAcceleratedScrollingLayerOrViewport(layer); 2575 #else 2576 if (layer.renderer().isStickyPositioned()) 2577 return !layer.enclosingOverflowClipLayer(ExcludeSelf); 2578 #endif 2577 return isAsyncScrollableStickyLayer(layer); 2579 2578 2580 2579 if (layer.renderer().style().position() != FixedPosition) … … 2590 2589 } 2591 2590 2592 static bool isMainFrameScrollingOrOverflowScrolling(RenderView& view, const RenderLayer& layer)2593 { 2594 if (layer.isRootLayer() && !view.document().ownerElement())2591 static bool useCoordinatedScrollingForLayer(RenderView& view, const RenderLayer& layer) 2592 { 2593 if (layer.isRootLayer() && view.frameView().frame().isMainFrame()) 2595 2594 return true; 2596 2595 … … 2625 2624 2626 2625 if (isSticky) 2627 return hasCoordinatedScrolling() && isViewportConstrainedFixedOrStickyLayer(layer);2626 return isAsyncScrollableStickyLayer(layer); 2628 2627 2629 2628 auto container = renderer.container(); … … 2674 2673 return layer.needsCompositedScrolling(); 2675 2674 } 2675 2676 #if PLATFORM(IOS) 2677 bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const 2678 { 2679 if (!layer.hasAcceleratedTouchScrolling()) 2680 return false; 2681 2682 if (!m_inPostLayoutUpdate) { 2683 m_reevaluateCompositingAfterLayout = true; 2684 return layer.isComposited(); 2685 } 2686 2687 return layer.hasTouchScrollableOverflow(); 2688 } 2689 #endif 2676 2690 2677 2691 bool RenderLayerCompositor::isRunningAcceleratedTransformAnimation(RenderLayerModelObject& renderer) const … … 3427 3441 void RenderLayerCompositor::notifyIFramesOfCompositingChange() 3428 3442 { 3429 Frame& frame = m_renderView.frameView().frame(); 3430 3431 for (Frame* child = frame.tree().firstChild(); child; child = child->tree().traverseNext(&frame)) { 3443 for (Frame* child = m_renderView.frameView().frame().tree().firstChild(); child; child = child->tree().nextSibling()) { 3432 3444 if (child->document() && child->document()->ownerElement()) 3433 3445 child->document()->ownerElement()->scheduleSetNeedsStyleRecalc(SyntheticStyleChange); … … 3494 3506 coordinationReasons |= FixedOrSticky; 3495 3507 3496 if ( isMainFrameScrollingOrOverflowScrolling(m_renderView, layer))3508 if (useCoordinatedScrollingForLayer(m_renderView, layer)) 3497 3509 coordinationReasons |= Scrolling; 3498 3510 3499 3511 if (coordinationReasons) { 3500 m_scrollCoordinatedLayers.add(&layer); 3512 if (m_scrollCoordinatedLayers.add(&layer).isNewEntry) 3513 m_subframeScrollLayersNeedReattach = true; 3514 3501 3515 updateScrollCoordinatedLayer(layer, coordinationReasons); 3502 3516 } else … … 3509 3523 return; 3510 3524 3525 m_subframeScrollLayersNeedReattach = true; 3526 3511 3527 m_scrollCoordinatedLayers.remove(&layer); 3512 3528 m_scrollCoordinatedLayersNeedingUpdate.remove(&layer); … … 3572 3588 } 3573 3589 3574 static RenderLayerBacking* nearestScrollCoordinatedAncestor(RenderLayer& layer) 3575 { 3576 RenderLayer* ancestor = layer.parent(); 3577 while (ancestor) { 3578 if (RenderLayerBacking* backing = ancestor->backing()) { 3579 if (backing->scrollingNodeIDForChildren()) 3580 return backing; 3581 } 3582 ancestor = ancestor->parent(); 3583 } 3584 3585 return nullptr; 3590 static ScrollingNodeID enclosingScrollingNodeID(RenderLayer& layer, IncludeSelfOrNot includeSelf) 3591 { 3592 RenderLayer* currLayer = includeSelf == IncludeSelf ? &layer : layer.parent(); 3593 while (currLayer) { 3594 if (RenderLayerBacking* backing = currLayer->backing()) { 3595 if (ScrollingNodeID nodeID = backing->scrollingNodeIDForChildren()) 3596 return nodeID; 3597 } 3598 currLayer = currLayer->parent(); 3599 } 3600 3601 return 0; 3602 } 3603 3604 static ScrollingNodeID scrollCoordinatedAncestorInParentOfFrame(Frame& frame) 3605 { 3606 if (!frame.document() || !frame.view()) 3607 return 0; 3608 3609 // Find the frame's enclosing layer in our render tree. 3610 HTMLFrameOwnerElement* ownerElement = frame.document()->ownerElement(); 3611 RenderElement* frameRenderer = ownerElement ? ownerElement->renderer() : nullptr; 3612 if (!frameRenderer) 3613 return 0; 3614 3615 RenderLayer* layerInParentDocument = frameRenderer->enclosingLayer(); 3616 if (!layerInParentDocument) 3617 return 0; 3618 3619 return enclosingScrollingNodeID(*layerInParentDocument, IncludeSelf); 3620 } 3621 3622 void RenderLayerCompositor::reattachSubframeScrollLayers() 3623 { 3624 if (!m_subframeScrollLayersNeedReattach) 3625 return; 3626 3627 m_subframeScrollLayersNeedReattach = false; 3628 3629 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 3630 3631 for (Frame* child = m_renderView.frameView().frame().tree().firstChild(); child; child = child->tree().nextSibling()) { 3632 if (!child->document() || !child->view()) 3633 continue; 3634 3635 // Ignore frames that are not scroll-coordinated. 3636 FrameView* childFrameView = child->view(); 3637 ScrollingNodeID frameScrollingNodeID = childFrameView->scrollLayerID(); 3638 if (!frameScrollingNodeID) 3639 continue; 3640 3641 ScrollingNodeID parentNodeID = scrollCoordinatedAncestorInParentOfFrame(*child); 3642 if (!parentNodeID) 3643 continue; 3644 3645 scrollingCoordinator->attachToStateTree(FrameScrollingNode, frameScrollingNodeID, parentNodeID); 3646 } 3647 } 3648 3649 ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, ScrollingNodeType nodeType, ScrollingNodeID parentNodeID) 3650 { 3651 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 3652 RenderLayerBacking* backing = layer.backing(); 3653 3654 ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(nodeType); 3655 if (!nodeID) 3656 nodeID = scrollingCoordinator->uniqueScrollLayerID(); 3657 3658 nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID); 3659 if (!nodeID) 3660 return 0; 3661 3662 backing->setScrollingNodeIDForRole(nodeID, nodeType); 3663 m_scrollingNodeToLayerMap.add(nodeID, &layer); 3664 3665 return nodeID; 3666 } 3667 3668 void RenderLayerCompositor::updateScrollCoordinationForThisFrame(ScrollingNodeID parentNodeID) 3669 { 3670 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 3671 ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView())); 3672 3673 ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), FrameScrollingNode, parentNodeID); 3674 scrollingCoordinator->updateFrameScrollingNode(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer()); 3586 3675 } 3587 3676 3588 3677 void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, ScrollCoordinationReasons reasons) 3589 3678 { 3590 // FIXME: support scrolling layers in iframes.3591 if (m_renderView.document().ownerElement())3592 return;3593 3594 3679 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 3595 if (!scrollingCoordinator )3596 return; 3597 3680 if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView())) 3681 return; 3682 3598 3683 bool isRootLayer = &layer == m_renderView.layer(); 3599 3684 … … 3609 3694 return; 3610 3695 3611 RenderLayerBacking* parent = nearestScrollCoordinatedAncestor(layer); 3612 if (!parent && !isRootLayer) 3613 return; 3614 3615 ScrollingNodeID parentNodeID = parent ? parent->scrollingNodeIDForChildren() : 0; 3696 if (!m_renderView.frame().isMainFrame()) { 3697 ScrollingNodeID parentDocumentHostingNodeID = scrollCoordinatedAncestorInParentOfFrame(m_renderView.frame()); 3698 if (!parentDocumentHostingNodeID) 3699 return; 3700 3701 updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID); 3702 if (!(reasons & FixedOrSticky) && isRootLayer) 3703 return; 3704 } 3705 3706 ScrollingNodeID parentNodeID = enclosingScrollingNodeID(layer, ExcludeSelf); 3707 if (!parentNodeID && !isRootLayer) 3708 return; 3616 3709 3617 3710 // Always call this even if the backing is already attached because the parent may have changed. 3618 3711 // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling. 3619 3712 if (reasons & FixedOrSticky) { 3620 ScrollingNodeID nodeID = backing->viewportConstrainedNodeID();3621 if (!nodeID)3622 nodeID = scrollingCoordinator->uniqueScrollLayerID();3623 3624 3713 ScrollingNodeType nodeType = FrameScrollingNode; 3625 3714 if (layer.renderer().style().position() == FixedPosition) … … 3630 3719 ASSERT_NOT_REACHED(); 3631 3720 3632 nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);3721 ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID); 3633 3722 if (!nodeID) 3634 3723 return; 3635 3636 backing->setViewportConstrainedNodeID(nodeID);3637 3724 3638 3725 switch (nodeType) { … … 3652 3739 3653 3740 if (reasons & Scrolling) { 3654 ScrollingNodeID nodeID = backing->scrollingNodeID(); 3655 if (!nodeID) 3656 nodeID = scrollingCoordinator->uniqueScrollLayerID(); 3657 3658 nodeID = scrollingCoordinator->attachToStateTree(isRootLayer ? FrameScrollingNode : OverflowScrollingNode, nodeID, parentNodeID); 3659 if (!nodeID) 3660 return; 3661 3662 backing->setScrollingNodeID(nodeID); 3663 m_scrollingNodeToLayerMap.add(nodeID, &layer); 3664 3665 GraphicsLayer* scrollingLayer = backing->scrollingLayer(); 3666 GraphicsLayer* scrolledContentsLayer = backing->scrollingContentsLayer(); 3667 GraphicsLayer* counterScrollingLayer = nullptr; 3668 GraphicsLayer* insetClipLayer = nullptr; 3669 3670 if (isRootLayer) { 3671 scrollingLayer = m_scrollLayer.get(); 3672 scrolledContentsLayer = m_rootContentLayer.get(); 3673 counterScrollingLayer = fixedRootBackgroundLayer(); 3674 insetClipLayer = clipLayer(); 3675 scrollingCoordinator->updateFrameScrollingNode(nodeID, scrollingLayer, scrolledContentsLayer, counterScrollingLayer, insetClipLayer); 3676 } else { 3741 if (isRootLayer) 3742 updateScrollCoordinationForThisFrame(parentNodeID); 3743 else { 3744 ScrollingNodeType nodeType = isRootLayer ? FrameScrollingNode : OverflowScrollingNode; 3745 ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID); 3746 if (!nodeID) 3747 return; 3748 3677 3749 ScrollingCoordinator::ScrollingGeometry scrollingGeometry; 3678 3750 scrollingGeometry.scrollOrigin = layer.scrollOrigin(); … … 3680 3752 scrollingGeometry.scrollableAreaSize = layer.visibleSize(); 3681 3753 scrollingGeometry.contentSize = layer.contentsSize(); 3682 scrollingCoordinator->updateOverflowScrollingNode(nodeID, scrollingLayer, scrolledContentsLayer, &scrollingGeometry);3754 scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry); 3683 3755 } 3684 3756 } … … 3691 3763 return; 3692 3764 3765 if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FrameScrollingNode)) 3766 m_scrollingNodeToLayerMap.remove(nodeID); 3767 3768 if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FixedNode)) 3769 m_scrollingNodeToLayerMap.remove(nodeID); 3770 3693 3771 backing->detachFromScrollingCoordinator(); 3694 3695 if (ScrollingNodeID nodeID = backing->scrollingNodeID())3696 m_scrollingNodeToLayerMap.remove(nodeID);3697 3772 } 3698 3773 … … 3729 3804 constraints = std::make_unique<StickyPositionViewportConstraints>(computeStickyViewportConstraints(layer)); 3730 3805 const RenderLayer* enclosingTouchScrollableLayer = nullptr; 3731 if (is StickyInAcceleratedScrollingLayerOrViewport(layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) {3806 if (isAsyncScrollableStickyLayer(layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) { 3732 3807 ASSERT(enclosingTouchScrollableLayer->isComposited()); 3733 3808 stickyContainerMap.add(layer.backing()->graphicsLayer()->platformLayer(), enclosingTouchScrollableLayer->backing()->scrollingLayer()->platformLayer()); … … 3792 3867 3793 3868 if (backing) 3794 scrollingCoordinator->detachFromStateTree(backing->scrollingNodeID());3869 backing->detachFromScrollingCoordinator(); 3795 3870 3796 3871 // For Coordinated Graphics. -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r169299 r169733 396 396 #endif 397 397 398 // Whether a running transition or animation enforces the need for a compositing layer.399 398 bool requiresCompositingForAnimation(RenderLayerModelObject&) const; 400 399 bool requiresCompositingForTransform(RenderLayerModelObject&) const; … … 425 424 typedef unsigned ScrollCoordinationReasons; 426 425 426 void updateScrollCoordinationForThisFrame(ScrollingNodeID); 427 ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID); 427 428 void updateScrollCoordinatedLayer(RenderLayer&, ScrollCoordinationReasons); 428 429 void detachScrollCoordinatedLayer(RenderLayer&); 429 430 void reattachSubframeScrollLayers(); 431 430 432 FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const; 431 433 StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const; … … 440 442 #endif 441 443 444 // True if the FrameView uses a ScrollingCoordinator. 442 445 bool hasCoordinatedScrolling() const; 446 447 bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const; 448 bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const; 449 443 450 bool shouldCompositeOverflowControls() const; 444 451 … … 481 488 bool m_forceCompositingMode; 482 489 bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions) 490 bool m_subframeScrollLayersNeedReattach; 483 491 484 492 bool m_isTrackingRepaints; // Used for testing. -
trunk/Source/WebCore/rendering/RenderView.cpp
r169407 r169733 840 840 return; 841 841 842 // FIXME: view() is just *this here. 842 843 bool caretChanged = m_selectionWasCaret != view().frame().selection().isCaret(); 843 844 m_selectionWasCaret = view().frame().selection().isCaret(); -
trunk/Source/WebCore/testing/InternalSettings.cpp
r168144 r169733 487 487 } 488 488 489 } 489 void InternalSettings::setScrollingTreeIncludesFrames(bool enabled, ExceptionCode& ec) 490 { 491 InternalSettingsGuardForSettings(); 492 settings()->setScrollingTreeIncludesFrames(enabled); 493 } 494 495 } -
trunk/Source/WebCore/testing/InternalSettings.h
r167732 r169733 101 101 void resetToConsistentState(); 102 102 103 void setUsesOverlayScrollbars(bool enabled, ExceptionCode&);104 void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&);103 void setUsesOverlayScrollbars(bool, ExceptionCode&); 104 void setTouchEventEmulationEnabled(bool, ExceptionCode&); 105 105 void setStandardFontFamily(const String& family, const String& script, ExceptionCode&); 106 106 void setSerifFontFamily(const String& family, const String& script, ExceptionCode&); … … 114 114 void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&); 115 115 void setMediaTypeOverride(const String& mediaType, ExceptionCode&); 116 void setCSSExclusionsEnabled(bool enabled, ExceptionCode&);117 void setCSSShapesEnabled(bool enabled, ExceptionCode&);116 void setCSSExclusionsEnabled(bool, ExceptionCode&); 117 void setCSSShapesEnabled(bool, ExceptionCode&); 118 118 void setCanStartMedia(bool, ExceptionCode&); 119 119 void setEditingBehavior(const String&, ExceptionCode&); … … 122 122 void setStorageBlockingPolicy(const String&, ExceptionCode&); 123 123 void setLangAttributeAwareFormControlUIEnabled(bool); 124 void setImagesEnabled(bool enabled, ExceptionCode&);124 void setImagesEnabled(bool, ExceptionCode&); 125 125 void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&); 126 126 void setDefaultVideoPosterURL(const String& url, ExceptionCode&); 127 127 void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&); 128 void setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, ExceptionCode&);129 void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);130 void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&);128 void setUseLegacyBackgroundSizeShorthandBehavior(bool, ExceptionCode&); 129 void setAutoscrollForDragAndDropEnabled(bool, ExceptionCode&); 130 void setFontFallbackPrefersPictographs(bool, ExceptionCode&); 131 131 void setPluginReplacementEnabled(bool); 132 void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);133 void setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode&);134 132 void setBackgroundShouldExtendBeyondPage(bool, ExceptionCode&); 133 void setShouldConvertPositionStyleOnCopy(bool, ExceptionCode&); 134 void setScrollingTreeIncludesFrames(bool, ExceptionCode&); 135 135 136 136 private: -
trunk/Source/WebCore/testing/InternalSettings.idl
r169706 r169733 69 69 [RaisesException] void setAutoscrollForDragAndDropEnabled(boolean enabled); 70 70 [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground); 71 [RaisesException] void setScrollingTreeIncludesFrames(boolean enabled); 71 72 72 73 [RaisesException] void setMinimumTimerInterval(unrestricted double intervalInSeconds); -
trunk/Source/WebKit2/ChangeLog
r169732 r169733 1 2014-06-09 Simon Fraser <simon.fraser@apple.com> 2 3 Work towards having frames in the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=133665 5 6 Reviewed by Tim Horton. 7 8 Override coordinatesScrollingForFrameView() to always return true for composited 9 frames, for iOS WK2 (eventually this class will have to be specialized for iOS and OS X). 10 11 * WebProcess/Scrolling/RemoteScrollingCoordinator.h: 12 * WebProcess/Scrolling/RemoteScrollingCoordinator.mm: 13 (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView): 14 1 15 2014-06-09 Anders Carlsson <andersca@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h
r168338 r169733 62 62 63 63 // ScrollingCoordinator 64 virtual bool coordinatesScrollingForFrameView(WebCore::FrameView*) const override; 64 65 virtual void scheduleTreeStateCommit() override; 65 66 -
trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm
r168338 r169733 75 75 } 76 76 77 bool RemoteScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const 78 { 79 RenderView* renderView = frameView->renderView(); 80 return renderView && renderView->usesCompositing(); 81 } 82 77 83 bool RemoteScrollingCoordinator::isRubberBandInProgress() const 78 84 {
Note:
See TracChangeset
for help on using the changeset viewer.