Changeset 147163 in webkit
- Timestamp:
- Mar 28, 2013 2:50:39 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/Platform/ChangeLog
r147137 r147163 1 2013-03-28 Tien-Ren Chen <trchen@chromium.org> 2 3 Support bottom-right anchored fixed-position elements during a pinch gesture 4 https://bugs.webkit.org/show_bug.cgi?id=111670 5 6 Reviewed by James Robinson. 7 8 Added WebLayerPositionConstraint for layers that need position 9 adjustment during threaded scrolling. 10 Currently it is only used for fixed-position layers. 11 12 * Platform.gypi: 13 * chromium/public/WebLayer.h: 14 (WebKit): 15 (WebLayer): 16 (WebKit::WebLayer::setPositionConstraint): 17 (WebKit::WebLayer::positionConstraint): 18 (WebKit::WebLayer::setFixedToContainerLayer): 19 (WebKit::WebLayer::fixedToContainerLayer): 20 * chromium/public/WebLayerPositionConstraint.h: Added. 21 (WebKit): 22 (WebLayerPositionConstraint): 23 (WebKit::WebLayerPositionConstraint::WebLayerPositionConstraint): 24 (WebKit::WebLayerPositionConstraint::fixedPosition): 25 1 26 2013-03-28 Zan Dobersek <zdobersek@igalia.com> 2 27 -
trunk/Source/Platform/Platform.gypi
r146957 r147163 84 84 'chromium/public/WebImageLayer.h', 85 85 'chromium/public/WebLayer.h', 86 'chromium/public/WebLayerPositionConstraint.h', 86 87 'chromium/public/WebLayerScrollClient.h', 87 88 'chromium/public/WebLayerTreeView.h', -
trunk/Source/Platform/chromium/public/WebLayer.h
r146487 r147163 30 30 #include "WebColor.h" 31 31 #include "WebCommon.h" 32 33 // Remove after making setPositionConstraint() pure virtual. 34 #include "WebLayerPositionConstraint.h" 35 32 36 #include "WebPoint.h" 33 37 #include "WebPrivatePtr.h" … … 45 49 struct WebFloatPoint; 46 50 struct WebFloatRect; 51 struct WebLayerPositionConstraint; 47 52 struct WebSize; 48 53 … … 190 195 virtual bool isContainerForFixedPositionLayers() const = 0; 191 196 192 virtual void setFixedToContainerLayer(bool) = 0; 193 virtual bool fixedToContainerLayer() const = 0; 197 // This function sets layer position constraint. The constraint will be used 198 // to adjust layer position during threaded scrolling. 199 // FIXME: Make pure virtual after implementation lands. 200 virtual void setPositionConstraint(const WebLayerPositionConstraint& constraint) { setFixedToContainerLayer(constraint.isFixedPosition); } 201 virtual WebLayerPositionConstraint positionConstraint() const { return WebLayerPositionConstraint(); } 194 202 195 203 // The scroll client is notified when the scroll position of the WebLayer … … 206 214 // True if the layer is not part of a tree attached to a WebLayerTreeView. 207 215 virtual bool isOrphan() const = 0; 216 217 // DEPRECATED 218 virtual void setFixedToContainerLayer(bool) { } 219 virtual bool fixedToContainerLayer() const { return positionConstraint().isFixedPosition; } 208 220 }; 209 221 -
trunk/Source/WebCore/ChangeLog
r147157 r147163 1 2013-03-28 Tien-Ren Chen <trchen@chromium.org> 2 3 Support bottom-right anchored fixed-position elements during a pinch gesture 4 https://bugs.webkit.org/show_bug.cgi?id=111670 5 6 Reviewed by James Robinson. 7 8 This patch adds support to bottom-right fixed-position elements by 9 introducing WebLayerPositionConstraint to WebLayer. 10 11 No new tests. Can't test until chromium patch landed. 12 13 * page/scrolling/ScrollingCoordinator.h: 14 (WebCore::ScrollingCoordinator::updateLayerPositionConstraint): 15 * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp: 16 (WebCore::clearPositionConstraintExceptForLayer): 17 (WebCore): 18 (WebCore::computePositionConstraint): 19 (WebCore::ScrollingCoordinatorChromium::updateLayerPositionConstraint): 20 * page/scrolling/chromium/ScrollingCoordinatorChromium.h: 21 (ScrollingCoordinatorChromium): 22 * rendering/RenderLayerBacking.cpp: 23 (WebCore::RenderLayerBacking::registerScrollingLayers): 24 * rendering/RenderLayerBacking.h: 25 (WebCore::RenderLayerBacking::contentsContainmentLayer): 26 (RenderLayerBacking): 27 * rendering/RenderLayerCompositor.cpp: 28 * rendering/RenderLayerCompositor.h: 29 1 30 2013-03-28 James Robinson <jamesr@chromium.org> 2 31 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r144823 r147163 154 154 virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation) { } 155 155 virtual void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool) { } 156 virtual void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool) { }156 virtual void updateLayerPositionConstraint(RenderLayer*) { } 157 157 virtual void touchEventTargetRectsDidChange(const Document*) { } 158 158 -
trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
r146399 r147163 33 33 #include "Page.h" 34 34 #include "Region.h" 35 #include "RenderLayerBacking.h" 35 36 #include "RenderLayerCompositor.h" 36 37 #include "RenderView.h" … … 40 41 #include <public/Platform.h> 41 42 #include <public/WebCompositorSupport.h> 43 #include <public/WebLayerPositionConstraint.h> 42 44 #include <public/WebScrollbar.h> 43 45 #include <public/WebScrollbarLayer.h> … … 46 48 47 49 using WebKit::WebLayer; 50 using WebKit::WebLayerPositionConstraint; 48 51 using WebKit::WebRect; 49 52 using WebKit::WebScrollbarLayer; … … 234 237 } 235 238 236 void ScrollingCoordinatorChromium::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable) 237 { 238 if (WebLayer* scrollableLayer = scrollingWebLayerForGraphicsLayer(layer)) 239 scrollableLayer->setFixedToContainerLayer(enable); 239 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, GraphicsLayer* except) 240 { 241 if (layer && layer != except && scrollingWebLayerForGraphicsLayer(layer)) 242 scrollingWebLayerForGraphicsLayer(layer)->setPositionConstraint(WebLayerPositionConstraint()); 243 } 244 245 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* layer) 246 { 247 ASSERT(layer->isComposited()); 248 do { 249 if (layer->renderer()->style()->position() == FixedPosition) { 250 const RenderObject* fixedPositionObject = layer->renderer(); 251 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); 252 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto(); 253 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixedToBottom); 254 } 255 256 layer = layer->parent(); 257 } while (layer && !layer->isComposited()); 258 return WebLayerPositionConstraint(); 259 } 260 261 void ScrollingCoordinatorChromium::updateLayerPositionConstraint(RenderLayer* layer) 262 { 263 ASSERT(layer->backing()); 264 RenderLayerBacking* backing = layer->backing(); 265 GraphicsLayer* mainLayer = backing->childForSuperlayers(); 266 267 // Avoid unnecessary commits 268 clearPositionConstraintExceptForLayer(backing->ancestorClippingLayer(), mainLayer); 269 clearPositionConstraintExceptForLayer(backing->contentsContainmentLayer(), mainLayer); 270 clearPositionConstraintExceptForLayer(backing->graphicsLayer(), mainLayer); 271 272 if (WebLayer* scrollableLayer = scrollingWebLayerForGraphicsLayer(mainLayer)) 273 scrollableLayer->setPositionConstraint(computePositionConstraint(layer)); 240 274 } 241 275 -
trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.h
r144024 r147163 54 54 55 55 // Attach/detach layer position to ancestor fixed position container. 56 virtual void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool);56 virtual void updateLayerPositionConstraint(RenderLayer*); 57 57 58 58 // Should be called when a ScrollableArea is getting destroyed. -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r146531 r147163 861 861 compositor()->updateViewportConstraintStatus(m_owningLayer); 862 862 863 // FIXME: it would be nice to avoid all this work if the platform doesn't implement setLayerIsFixedToContainerLayer(). 864 if (renderer()->style()->position() == FixedPosition || compositor()->fixedPositionedByAncestor(m_owningLayer)) 865 scrollingCoordinator->setLayerIsFixedToContainerLayer(childForSuperlayers(), true); 866 else { 867 if (m_ancestorClippingLayer) 868 scrollingCoordinator->setLayerIsFixedToContainerLayer(m_ancestorClippingLayer.get(), false); 869 scrollingCoordinator->setLayerIsFixedToContainerLayer(m_graphicsLayer.get(), false); 870 } 863 if (!scrollingCoordinator->supportsFixedPositionLayers()) 864 return; 865 866 scrollingCoordinator->updateLayerPositionConstraint(m_owningLayer); 867 871 868 // Page scale is applied as a transform on the root render view layer. Because the scroll 872 869 // layer is further up in the hierarchy, we need to avoid marking the root render view -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r145563 r147163 88 88 GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); } 89 89 90 GraphicsLayer* contentsContainmentLayer() const { return m_contentsContainmentLayer.get(); } 91 90 92 bool hasContentsLayer() const { return m_foregroundLayer != 0; } 91 93 GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r147120 r147163 1938 1938 } 1939 1939 1940 // Return true if there is an ancestor layer that is fixed positioned to the view.1941 // Note that if the ancestor has a stacking context and is fixed position then this method1942 // will return false.1943 bool RenderLayerCompositor::fixedPositionedByAncestor(const RenderLayer* layer) const1944 {1945 if (!layer->isComposited() || !layer->parent())1946 return false;1947 1948 const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer();1949 if (!compositingAncestor)1950 return false;1951 1952 const RenderLayer* curr = layer;1953 while (curr) {1954 const RenderLayer* next = curr->parent();1955 if (next == compositingAncestor)1956 return false;1957 1958 if (next && next->renderer()->style()->position() == FixedPosition)1959 return true;1960 curr = next;1961 }1962 return false;1963 }1964 1965 1940 bool RenderLayerCompositor::requiresCompositingForScrollableFrame() const 1966 1941 { -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r147039 r147163 155 155 bool clipsCompositingDescendants(const RenderLayer*) const; 156 156 157 // Whether the layer is fixed positioned to the view by an ancestor layer.158 bool fixedPositionedByAncestor(const RenderLayer*) const;159 160 157 // Whether the given layer needs an extra 'contents' layer. 161 158 bool needsContentsCompositingLayer(const RenderLayer*) const;
Note: See TracChangeset
for help on using the changeset viewer.