Changeset 165652 in webkit
- Timestamp:
- Mar 14, 2014 2:50:57 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r165651 r165652 1 2014-03-14 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Improve behavior of fixed elments on zooming 4 https://bugs.webkit.org/show_bug.cgi?id=130253 5 6 Reviewed by Beth Dakin. 7 8 Correctly reposition right- and bottom-relative position:fixed 9 elements on zooming in WK2 iOS by telling the scrolling tree 10 about zoom-related viewport changes. 11 12 * WebCore.exp.in: 13 * page/FrameView.cpp: 14 (WebCore::FrameView::rectForViewportConstrainedObjects): 15 (WebCore::FrameView::viewportConstrainedObjectsRect): We need to be able to 16 recompute the fixed position rect from the scrolling tree on iOS, so we need 17 a static function, similar to scrollOffsetForFixedPosition(), that computes 18 the constrained viewport. 19 * page/FrameView.h: 20 * page/Page.cpp: 21 (WebCore::Page::setPageScaleFactor): When scrolling (and, by implication, zooming) 22 is delegated, then setPageScaleFactor() should not affect the scroll position. 23 * page/scrolling/AsyncScrollingCoordinator.cpp: 24 (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Go back to just 25 passing the visibleContentRect() for iOS. 26 * page/scrolling/ScrollingTree.cpp: 27 (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Entrypoint to 28 the scrolling tree, called when the viewport is changed by zooming. 29 * page/scrolling/ScrollingTree.h: 30 * page/scrolling/ScrollingTreeScrollingNode.h: 31 * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h: 32 * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm: 33 (WebCore::ScrollingTreeScrollingNodeIOS::setScrollLayerPosition): Use the 34 new FrameView::rectForViewportConstrainedObjects() to compute the correct viewport 35 for fixed/sticky child nodes. 36 (WebCore::ScrollingTreeScrollingNodeIOS::updateForViewport): 37 * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h: 38 * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm: 39 (WebCore::ScrollingTreeScrollingNodeMac::updateForViewport): 40 1 41 2014-03-14 Dirk Schulze <krit@webkit.org> 2 42 -
trunk/Source/WebCore/WebCore.exp.in
r165640 r165652 807 807 __ZN7WebCore19TextResourceDecoderC1ERKN3WTF6StringERKNS_12TextEncodingEb 808 808 __ZN7WebCore19TextResourceDecoderD1Ev 809 __ZN7WebCore19enclosingLayoutRectERKNS_9FloatRectE 809 810 __ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl 810 811 __ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE … … 2614 2615 __ZN7WebCore9FrameView30graphicsLayerForPlatformWidgetEP7WAKView 2615 2616 __ZN7WebCore9FrameView32setCustomFixedPositionLayoutRectERKNS_7IntRectE 2617 __ZN7WebCore9FrameView33rectForViewportConstrainedObjectsERKNS_10LayoutRectERKNS_10LayoutSizeEfbNS_30ScrollBehaviorForFixedElementsE 2616 2618 __ZN7WebCore9FrameView35setUseCustomFixedPositionLayoutRectEb 2617 2619 __ZN7WebCore9FrameView36scheduleLayerFlushAllowingThrottlingEv … … 2722 2724 __ZN7WebCore13ScrollingTree32isPointInNonFastScrollableRegionENS_8IntPointE 2723 2725 __ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE 2726 __ZN7WebCore13ScrollingTree36viewportChangedViaDelegatedScrollingEyRKNS_9FloatRectEd 2724 2727 __ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb 2725 __ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_10FloatPointE2726 2728 __ZN7WebCore13ScrollingTreeC2Ev 2727 2729 __ZN7WebCore13ScrollingTreeD1Ev -
trunk/Source/WebCore/page/FrameView.cpp
r165548 r165652 1585 1585 } 1586 1586 1587 #if PLATFORM(IOS) 1588 LayoutRect FrameView::rectForViewportConstrainedObjects(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements scrollBehavior) 1589 { 1590 if (fixedElementsLayoutRelativeToFrame) 1591 return visibleContentRect; 1592 1593 // We impose an lower limit on the size (so an upper limit on the scale) of 1594 // the rect used to position fixed objects so that they don't crowd into the 1595 // center of the screen at larger scales. 1596 const float constraintThresholdScale = 1.2; 1597 1598 float maxPostionedObjectsRectScale = std::min(frameScaleFactor, constraintThresholdScale); 1599 1600 LayoutRect viewportConstrainedObjectsRect = visibleContentRect; 1601 1602 if (frameScaleFactor > constraintThresholdScale) { 1603 FloatRect contentRect(FloatPoint(), totalContentsSize); 1604 FloatRect viewportRect = visibleContentRect; 1605 1606 // Scale the rect up from a point that is relative to its position in the viewport. 1607 FloatSize sizeDelta = contentRect.size() - viewportRect.size(); 1608 1609 FloatPoint scaleOrigin; 1610 scaleOrigin.setX(contentRect.x() + sizeDelta.width() > 0 ? contentRect.width() * (viewportRect.x() - contentRect.x()) / sizeDelta.width() : 0); 1611 scaleOrigin.setY(contentRect.y() + sizeDelta.height() > 0 ? contentRect.height() * (viewportRect.y() - contentRect.y()) / sizeDelta.height() : 0); 1612 1613 AffineTransform rescaleTransform = AffineTransform::translation(scaleOrigin.x(), scaleOrigin.y()); 1614 rescaleTransform.scale(frameScaleFactor / maxPostionedObjectsRectScale, frameScaleFactor / maxPostionedObjectsRectScale); 1615 rescaleTransform = CGAffineTransformTranslate(rescaleTransform, -scaleOrigin.x(), -scaleOrigin.y()); 1616 1617 viewportConstrainedObjectsRect = enclosingLayoutRect(rescaleTransform.mapRect(visibleContentRect)); 1618 } 1619 1620 if (scrollBehavior == StickToDocumentBounds) { 1621 LayoutRect documentBounds(LayoutPoint(), totalContentsSize); 1622 viewportConstrainedObjectsRect.intersect(documentBounds); 1623 } 1624 1625 return viewportConstrainedObjectsRect; 1626 } 1627 1628 LayoutRect FrameView::viewportConstrainedObjectsRect() const 1629 { 1630 return rectForViewportConstrainedObjects(visibleContentRect(), totalContentsSize(), frame().frameScaleFactor(), fixedElementsLayoutRelativeToFrame(), scrollBehaviorForFixedElements()); 1631 } 1632 #endif 1633 1587 1634 IntPoint FrameView::minimumScrollPosition() const 1588 1635 { -
trunk/Source/WebCore/page/FrameView.h
r165534 r165652 266 266 // Static function can be called from another thread. 267 267 static LayoutSize scrollOffsetForFixedPosition(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight); 268 268 269 #if PLATFORM(IOS) 270 LayoutRect viewportConstrainedObjectsRect() const; 271 // Static function can be called from another thread. 272 static LayoutRect rectForViewportConstrainedObjects(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements); 273 #endif 274 269 275 bool fixedElementsLayoutRelativeToFrame() const; 270 276 -
trunk/Source/WebCore/page/Page.cpp
r165629 r165652 724 724 if (!m_settings->delegatesPageScaling() && document->renderView() && document->renderView()->needsLayout() && view->didFirstLayout()) 725 725 view->layout(); 726 view->setScrollPosition(origin); 726 727 if (!view->delegatesScrolling()) 728 view->setScrollPosition(origin); 727 729 } 728 730 } -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r165493 r165652 90 90 91 91 node->setScrollOrigin(frameView->scrollOrigin()); 92 #if PLATFORM(IOS)93 node->setViewportSize(frameView->viewportConstrainedVisibleContentRect().size());94 #else95 92 node->setViewportSize(frameView->visibleContentRect().size()); 96 #endif97 93 node->setTotalContentsSize(frameView->totalContentsSize()); 98 94 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r165091 r165652 99 99 } 100 100 101 void ScrollingTree:: scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatPoint& scrollPosition)101 void ScrollingTree::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatRect& viewportRect, double scale) 102 102 { 103 103 ScrollingTreeNode* node = nodeForID(nodeID); … … 108 108 return; 109 109 110 toScrollingTreeScrollingNode(node)-> setScrollPositionWithoutContentEdgeConstraints(scrollPosition);110 toScrollingTreeScrollingNode(node)->updateForViewport(viewportRect, scale); 111 111 } 112 112 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r165086 r165652 64 64 bool shouldHandleWheelEventSynchronously(const PlatformWheelEvent&); 65 65 66 virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const FloatPoint&);66 virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect& viewportRect, double scale); 67 67 68 68 void setMainFrameIsRubberBanding(bool); -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r165493 r165652 53 53 virtual void setScrollPosition(const FloatPoint&) = 0; 54 54 virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) = 0; 55 55 virtual void updateForViewport(const FloatRect& viewportRect, double scale) = 0; 56 56 57 SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; } 57 58 bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; } -
trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h
r165091 r165652 52 52 virtual void setScrollPosition(const FloatPoint&) override; 53 53 virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) override; 54 virtual void updateForViewport(const FloatRect& viewportRect, double scale); 54 55 55 56 void setScrollLayerPosition(const FloatPoint&); -
trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm
r165493 r165652 161 161 if (!m_children) 162 162 return; 163 164 viewportRect.setLocation(FloatPoint() + scrollOffsetForFixedChildren); 165 163 164 viewportRect.setLocation(scrollOffset); 165 166 FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), totalContentsSize(), frameScaleFactor(), false, behaviorForFixed); 167 166 168 size_t size = m_children->size(); 167 169 for (size_t i = 0; i < size; ++i) 168 m_children->at(i)->parentScrollPositionDidChange(viewportRect, FloatSize()); 170 m_children->at(i)->parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize()); 171 } 172 173 void ScrollingTreeScrollingNodeIOS::updateForViewport(const FloatRect& viewportRect, double scale) 174 { 175 if (!m_children) 176 return; 177 178 FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), totalContentsSize(), scale, false, scrollBehaviorForFixedElements()); 179 180 size_t size = m_children->size(); 181 for (size_t i = 0; i < size; ++i) 182 m_children->at(i)->parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize()); 169 183 } 170 184 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h
r165091 r165652 69 69 virtual void setScrollPosition(const FloatPoint&) override; 70 70 virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) override; 71 virtual void updateForViewport(const FloatRect& viewportRect, double scale) override; 71 72 72 73 void setScrollLayerPosition(const FloatPoint&); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm
r165493 r165652 401 401 } 402 402 403 void ScrollingTreeScrollingNodeMac::updateForViewport(const FloatRect& viewportRect, double scale) 404 { 405 // FIXME: correctly handle updates for zooming. 406 UNUSED_PARAM(scale); 407 FloatPoint scrollPosition = viewportRect.location(); 408 updateMainFramePinState(scrollPosition); 409 410 if (shouldUpdateScrollLayerPositionSynchronously()) { 411 m_probableMainThreadScrollPosition = scrollPosition; 412 scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, SetScrollingLayerPosition); 413 return; 414 } 415 416 setScrollLayerPosition(scrollPosition); 417 scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition); 418 } 419 403 420 FloatPoint ScrollingTreeScrollingNodeMac::minimumScrollPosition() const 404 421 { -
trunk/Source/WebKit2/ChangeLog
r165647 r165652 1 2014-03-14 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Improve behavior of fixed elments on zooming 4 https://bugs.webkit.org/show_bug.cgi?id=130253 5 6 Reviewed by Beth Dakin. 7 8 Correctly reposition right- and bottom-relative position:fixed 9 elements on zooming in WK2 iOS by telling the scrolling tree 10 about zoom-related viewport changes. 11 12 * Shared/mac/RemoteLayerTreeTransaction.h: 13 (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged): 14 Drive-by cleanup; typedef the flags field to an unsigned, to avoid ugly casting. 15 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp: 16 (WebKit::RemoteScrollingCoordinatorProxy::updateScrollingTree): Pass out a flag to say 17 if the update contained a new fixed or sticky layer. 18 (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): 19 (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling): 20 Call into the new ScrolingTree::viewportChangedViaDelegatedScrolling(). 21 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h: 22 * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: If we got a new fixed 23 or sticky layer, set fixedOrStickyLayerChanged to true. 24 (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto. 25 * UIProcess/ios/WKContentView.mm: 26 (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]): 27 Remember both the old zoomScale and the filteredScale, since the fixed position rect 28 should be computed using the unfiltered scale. 29 Some FloatRect -> CGRect changes. 30 Now call viewportChangedViaDelegatedScrolling() on the scrolling coordinator. 31 (-[WKContentView fixedPositionRectFromExposedRect:scale:]): Call the 32 FrameView function to compute the iOS fixed position rect. 33 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: 34 (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): If the update 35 got a new fixed or sticky layer, run the scrolling tree logic to make sure 36 it gets into the right place. 37 * UIProcess/mac/RemoteLayerTreeHost.mm: 38 (WebKit::RemoteLayerTreeHost::updateLayerTree): If we logged here, 39 we'd log twice if the tiled scrolling indicator was enabled, so 40 hoisted the logging out into the caller. 41 1 42 2014-03-14 Landry Breuil <landry@openbsd.org> 2 43 -
trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
r165409 r165652 48 48 class RemoteLayerTreeTransaction { 49 49 public: 50 enum LayerChange {50 enum LayerChanges { 51 51 NoChange = 0, 52 52 NameChanged = 1 << 1, … … 78 78 CustomAppearanceChanged = 1 << 27 79 79 }; 80 typedef unsigned LayerChange; 80 81 81 82 struct LayerCreationProperties { … … 98 99 static bool decode(IPC::ArgumentDecoder&, LayerProperties&); 99 100 100 void notePropertiesChanged(LayerChange layerChanges)101 void notePropertiesChanged(LayerChange changeFlags) 101 102 { 102 changedProperties = static_cast<LayerChange>(changedProperties | layerChanges);103 everChangedProperties = static_cast<LayerChange>(everChangedProperties | layerChanges);103 changedProperties |= changeFlags; 104 everChangedProperties |= changeFlags; 104 105 } 105 106 -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp
r165086 r165652 76 76 } 77 77 78 void RemoteScrollingCoordinatorProxy::updateScrollingTree(const RemoteScrollingCoordinatorTransaction& transaction )78 void RemoteScrollingCoordinatorProxy::updateScrollingTree(const RemoteScrollingCoordinatorTransaction& transaction, bool& fixedOrStickyLayerChanged) 79 79 { 80 80 OwnPtr<ScrollingStateTree> stateTree = const_cast<RemoteScrollingCoordinatorTransaction&>(transaction).scrollingStateTree().release(); … … 85 85 return; 86 86 } 87 88 connectStateNodeLayers(*stateTree, *layerTreeHost );87 88 connectStateNodeLayers(*stateTree, *layerTreeHost, fixedOrStickyLayerChanged); 89 89 m_scrollingTree->commitNewTreeState(stateTree.release()); 90 90 } 91 91 92 92 #if !PLATFORM(IOS) 93 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost )93 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost, bool& fixedOrStickyLayerChanged) 94 94 { 95 95 for (auto& currNode : stateTree.nodeMap().values()) { … … 116 116 } 117 117 case FixedNode: 118 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) 118 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) { 119 119 currNode->setLayer(layerTreeHost.getLayer(currNode->layer())); 120 fixedOrStickyLayerChanged = true; 121 } 120 122 break; 121 123 case StickyNode: 122 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) 124 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) { 123 125 currNode->setLayer(layerTreeHost.getLayer(currNode->layer())); 126 fixedOrStickyLayerChanged = true; 127 } 124 128 break; 125 129 } … … 139 143 } 140 144 141 void RemoteScrollingCoordinatorProxy:: scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatPoint& offset)145 void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatRect& viewportRect, double scale) 142 146 { 143 m_scrollingTree-> scrollPositionChangedViaDelegatedScrolling(nodeID, offset);147 m_scrollingTree->viewportChangedViaDelegatedScrolling(nodeID, viewportRect, scale); 144 148 } 145 149 -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h
r165086 r165652 58 58 59 59 // Called externally when native views move around. 60 void scrollPositionChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatPoint&);60 void viewportChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatRect& viewportRect, double scale); 61 61 62 62 // FIXME: expose the tree and pass this to that? … … 67 67 const RemoteLayerTreeHost* layerTreeHost() const; 68 68 69 void updateScrollingTree(const RemoteScrollingCoordinatorTransaction& );69 void updateScrollingTree(const RemoteScrollingCoordinatorTransaction&, bool& fixedOrStickyLayerChanged); 70 70 71 71 private: 72 void connectStateNodeLayers(WebCore::ScrollingStateTree&, const RemoteLayerTreeHost& );72 void connectStateNodeLayers(WebCore::ScrollingStateTree&, const RemoteLayerTreeHost&, bool& fixedOrStickyLayerChanged); 73 73 74 74 WebPageProxy& m_webPageProxy; -
trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm
r164890 r165652 44 44 } 45 45 46 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost )46 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost, bool& fixedOrStickyLayerChanged) 47 47 { 48 48 for (auto& currNode : stateTree.nodeMap().values()) { … … 69 69 } 70 70 case FixedNode: 71 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) 71 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) { 72 72 currNode->setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode->layer()))); 73 fixedOrStickyLayerChanged = true; 74 } 73 75 break; 74 76 case StickyNode: 75 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) 77 if (currNode->hasChangedProperty(ScrollingStateNode::ScrollLayer)) { 76 78 currNode->setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode->layer()))); 79 fixedOrStickyLayerChanged = true; 80 } 77 81 break; 78 82 } -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r165303 r165652 47 47 #import "WebSystemInterface.h" 48 48 #import "WebKitSystemInterfaceIOS.h" 49 #import <WebCore/FrameView.h> 49 50 #import <UIKit/UIWindow_Private.h> 50 51 #import <wtf/RetainPtr.h> … … 164 165 } 165 166 166 - (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat) scale inStableState:(BOOL)isStableState167 - (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)zoomScale inStableState:(BOOL)isStableState 167 168 { 168 169 double scaleNoiseThreshold = 0.0005; 169 if (!isStableState && fabs(scale - _page->displayedContentScale()) < scaleNoiseThreshold) { 170 CGFloat filteredScale = zoomScale; 171 if (!isStableState && fabs(filteredScale - _page->displayedContentScale()) < scaleNoiseThreshold) { 170 172 // Tiny changes of scale during interactive zoom cause content to jump by one pixel, creating 171 173 // visual noise. We filter those useless updates. 172 scale = _page->displayedContentScale();174 filteredScale = _page->displayedContentScale(); 173 175 } 174 176 175 FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:scale];176 _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));177 177 CGRect customFixedPositionRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:zoomScale]; 178 _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, customFixedPositionRect, filteredScale, isStableState)); 179 178 180 RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy(); 179 scrollingCoordinator-> scrollPositionChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), unobscuredRect.origin);181 scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), unobscuredRect, zoomScale); 180 182 181 183 if (auto drawingArea = _page->drawingArea()) … … 188 190 } 189 191 190 - (FloatRect)fixedPositionRectFromExposedRect:(FloatRect)exposedRect scale:(float)scale 191 { 192 // FIXME: This should modify the rect based on the scale. 193 UNUSED_PARAM(scale); 194 return exposedRect; 192 - (CGRect)fixedPositionRectFromExposedRect:(CGRect)unobscuredRect scale:(CGFloat)scale 193 { 194 return (FloatRect)FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(unobscuredRect), roundedLayoutSize(FloatSize([self bounds].size)), scale, false, StickToViewportBounds); 195 195 } 196 196 -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
r164890 r165652 27 27 #import "RemoteLayerTreeDrawingAreaProxy.h" 28 28 29 #import "Logging.h" 29 30 #import "RemoteLayerTreeDrawingAreaProxyMessages.h" 30 31 #import "DrawingAreaMessages.h" … … 101 102 void RemoteLayerTreeDrawingAreaProxy::commitLayerTree(const RemoteLayerTreeTransaction& layerTreeTransaction, const RemoteScrollingCoordinatorTransaction& scrollingTreeTransaction) 102 103 { 104 LOG(RemoteLayerTree, "%s", layerTreeTransaction.description().data()); 105 103 106 if (m_remoteLayerTreeHost.updateLayerTree(layerTreeTransaction)) 104 107 m_webPageProxy->setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost.rootLayer()); 105 108 106 109 #if ENABLE(ASYNC_SCROLLING) 107 m_webPageProxy->scrollingCoordinatorProxy()->updateScrollingTree(scrollingTreeTransaction); 110 bool fixedOrStickyLayerChanged = false; 111 m_webPageProxy->scrollingCoordinatorProxy()->updateScrollingTree(scrollingTreeTransaction, fixedOrStickyLayerChanged); 108 112 #endif 109 113 #if PLATFORM(IOS) 110 114 m_webPageProxy->didCommitLayerTree(layerTreeTransaction); 115 116 #if ENABLE(ASYNC_SCROLLING) 117 if (fixedOrStickyLayerChanged) { 118 // If we got a new layer for a fixed or sticky node, its position from the WebProcess is probably stale. We need to re-run the "viewport" changed logic to udpate it with our UI-side state. 119 m_webPageProxy->scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(m_webPageProxy->scrollingCoordinatorProxy()->rootScrollingNodeID(), m_webPageProxy->unobscuredContentRect(), m_webPageProxy->displayedContentScale()); 120 } 121 #endif 111 122 #endif 112 123 -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm
r165546 r165652 27 27 #import "RemoteLayerTreeHost.h" 28 28 29 #import "Logging.h"30 29 #import "RemoteLayerTreePropertyApplier.h" 31 30 #import "RemoteLayerTreeTransaction.h" … … 55 54 bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction& transaction, float indicatorScaleFactor) 56 55 { 57 LOG(RemoteLayerTree, "%s", transaction.description().data());58 59 56 for (const auto& createdLayer : transaction.createdLayers()) 60 57 createLayer(createdLayer);
Note: See TracChangeset
for help on using the changeset viewer.