Skip to content
Permalink
Browse files
2011-04-10 Simon Fraser <simon.fraser@apple.com>
        Reviewed by Maciej Stachowiak.

        Car model dropdowns at audiusa.com lay out incorrectly with compositing enabled
        https://bugs.webkit.org/show_bug.cgi?id=56660

        When overflow on an element changes, we need to inform compositing
        layers which create and position an "ancestor clipping" layer based
        on that overflow. Do this by triggering a rebuild of compositing layers
        when overflow changes on a layer whose stacking context has compositing
        descendants. (We can't just check whether the layer itself has compositing
        descendants, because overflow follows the render tree, but compositing
        follows the z-order tree.)

        Test: compositing/geometry/ancestor-overflow-change.html

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::styleChanged):
        * rendering/RenderLayer.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

Canonical link: https://commits.webkit.org/73196@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
smfr committed Apr 11, 2011
1 parent 635a8ff commit f3517a0d85f58f5b42e08dc736a732d9569d31c3
Showing 9 changed files with 138 additions and 4 deletions.
@@ -1,3 +1,17 @@
2011-04-10 Simon Fraser <simon.fraser@apple.com>

Reviewed by Maciej Stachowiak.

Car model dropdowns at audiusa.com lay out incorrectly with compositing enabled
https://bugs.webkit.org/show_bug.cgi?id=56660

Test that toggles overflow on an element with a composited descendent.

* compositing/geometry/ancestor-overflow-change-expected.checksum: Added.
* compositing/geometry/ancestor-overflow-change-expected.png: Added.
* compositing/geometry/ancestor-overflow-change-expected.txt: Added.
* compositing/geometry/ancestor-overflow-change.html: Added.

2011-04-10 Kent Tamura <tkent@chromium.org>

[Chromium] Update test expectation.
@@ -0,0 +1 @@
63c73b1e24b56b9955d6dfad88ae1ed6
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,23 @@
(GraphicsLayer
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
(position -2.00 -2.00)
(bounds 804.00 604.00)
(children 2
(GraphicsLayer
(position 8.00 8.00)
(bounds 104.00 104.00)
(drawsContent 1)
)
(GraphicsLayer
(position 8.00 121.00)
(bounds 788.00 19.00)
(opacity 0.00)
(drawsContent 1)
)
)
)
)
)

@@ -0,0 +1,68 @@
<!DOCTYPE html>

<html>
<head>
<style type="text/css" media="screen">
#container {
position: relative;
height: 50px;
width: 100px;
outline: 2px solid black;
overflow: hidden;
}

#container.changed {
overflow: visible;
height: 100px;
}

.box {
width: 100px;
height: 100px;
background-color: green;
-webkit-transform: translateZ(0);
}

#indicator {
position: absolute;
width: 100px;
height: 100px;
background-color: red;
}

#layers {
opacity: 0; /* Hide from pixel results */
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController) {
layoutTestController.dumpAsText(true);
layoutTestController.waitUntilDone();
}

function changeOverflow()
{
document.getElementById('container').className = 'changed';

if (window.layoutTestController)
document.getElementById('layers').innerText = layoutTestController.layerTreeAsText();

if (window.layoutTestController)
layoutTestController.notifyDone();
}

window.addEventListener('load', function() {
window.setTimeout(changeOverflow, 0);
}, false);
</script>
</head>
<body>

<div id="indicator"></div>
<div id="container">
<div class="box"></div>
</div>

<pre id="layers">Layer tree goes here in DRT</pre>
</body>
</html>
@@ -1,3 +1,26 @@
2011-04-10 Simon Fraser <simon.fraser@apple.com>

Reviewed by Maciej Stachowiak.

Car model dropdowns at audiusa.com lay out incorrectly with compositing enabled
https://bugs.webkit.org/show_bug.cgi?id=56660

When overflow on an element changes, we need to inform compositing
layers which create and position an "ancestor clipping" layer based
on that overflow. Do this by triggering a rebuild of compositing layers
when overflow changes on a layer whose stacking context has compositing
descendants. (We can't just check whether the layer itself has compositing
descendants, because overflow follows the render tree, but compositing
follows the z-order tree.)

Test: compositing/geometry/ancestor-overflow-change.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::styleChanged):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

2011-04-10 Simon Fraser <simon.fraser@apple.com>

Reviewed by Ariya Hidayat.
@@ -3867,7 +3867,7 @@ bool RenderLayer::isSelfPaintingLayer() const
|| renderer()->isRenderIFrame();
}

void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*)
void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle)
{
bool isNormalFlowOnly = shouldBeNormalFlowOnly();
if (isNormalFlowOnly != m_isNormalFlowOnly) {
@@ -3912,7 +3912,11 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*)
compositor()->setCompositingLayersNeedRebuild();
else if (m_backing)
m_backing->updateGraphicsLayerGeometry();

else if (oldStyle && oldStyle->overflowX() != renderer()->style()->overflowX()) {
if (stackingContext()->hasCompositingDescendant())
compositor()->setCompositingLayersNeedRebuild();
}

if (m_backing && diff >= StyleDifferenceRepaint)
m_backing->setContentsNeedDisplay();
#else
@@ -185,7 +185,7 @@ class RenderLayer : public ScrollableArea {
void repaintIncludingNonCompositingDescendants(RenderBoxModelObject* repaintContainer);
#endif

void styleChanged(StyleDifference, const RenderStyle*);
void styleChanged(StyleDifference, const RenderStyle* oldStyle);

RenderMarquee* marquee() const { return m_marquee; }

@@ -683,7 +683,7 @@ class RenderLayer : public ScrollableArea {
bool m_has3DTransformedDescendant : 1; // Set on a stacking context layer that has 3D descendants anywhere
// in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
#if USE(ACCELERATED_COMPOSITING)
bool m_hasCompositingDescendant : 1;
bool m_hasCompositingDescendant : 1; // In the z-order tree.
bool m_mustOverlapCompositedLayers : 1;
#endif

@@ -365,6 +365,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
// layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
// for a compositing layer, rootLayer is the layer itself.
IntRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true);
ASSERT(parentClipRect != PaintInfo::infiniteRect());
m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation));
m_ancestorClippingLayer->setSize(parentClipRect.size());

0 comments on commit f3517a0

Please sign in to comment.