Border-radius clipping on a stacking context causes descendants to not render
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jan 2015 22:57:53 +0000 (22:57 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jan 2015 22:57:53 +0000 (22:57 +0000)
commitdf255dc3ab4184f55a81a32210eed1cecd22e5f5
tree3951df2ffa84fd7fa89ab9ef566eba45b80b91df
parent5804230c078f665554c9ea82f0574a97e87714e8
Border-radius clipping on a stacking context causes descendants to not render
https://bugs.webkit.org/show_bug.cgi?id=140536

Reviewed by Zalan Bujtas.

Source/WebCore:

Fix one of the issues introduced in r178029. The changes in GraphicsLayerCA
failed to adhere to the "set a bit and flush later" pattern that this class uses,
instead poking the platform layers directly. This caused an issue where the bounds
of the clipping layer would later be set to 0x0, causing content to disappear.

Fix by changing the "applyClippingBorder" function to "setMasksToBoundsRect"
and have it update via a new MasksToBoundsRectChanged dirty bit.

In order to avoid clobbering the mask layer used to clip contents, we need another
shape mask layer, so rename m_shapeMaskLayer to m_contentsShapeMaskLayer, then
introduce a new m_shapeMaskLayer which is used for masks-to-bounds clipping. Update
the reflection cloning code to correctly clone this layer.

Test: compositing/clipping/border-radius-stacking-context-clip.html

* WebCore.exp.in:
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::maskToBoundsRect):
(WebCore::GraphicsLayer::setMasksToBoundsRect):
(WebCore::GraphicsLayer::applyClippingBorder): Deleted.
(WebCore::GraphicsLayer::clearClippingBorder): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::willBeDestroyed):
(WebCore::GraphicsLayerCA::setMasksToBoundsRect):
(WebCore::GraphicsLayerCA::setContentsToSolidColor):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateContentsImage):
(WebCore::GraphicsLayerCA::updateContentsRects):
(WebCore::GraphicsLayerCA::updateMasksToBoundsRect):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties):
(WebCore::GraphicsLayerCA::applyClippingBorder): Deleted.
(WebCore::GraphicsLayerCA::clearClippingBorder): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateChildClippingStrategy): Add a FIXME since
this code is trying to access geometry and we may not have done layout yet.
Also, to clear the rounded rect, just set a non-rounded rect the size of the layer.

LayoutTests:

Ref test that clips out the middle of a composited rounded-rect overflow element,
and also tests reflections.

* compositing/clipping/border-radius-stacking-context-clip-expected.html: Added.
* compositing/clipping/border-radius-stacking-context-clip.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/compositing/clipping/border-radius-stacking-context-clip-expected.html [new file with mode: 0644]
LayoutTests/compositing/clipping/border-radius-stacking-context-clip.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/rendering/RenderLayerBacking.cpp