Diff
Modified: trunk/LayoutTests/ChangeLog (115988 => 115989)
--- trunk/LayoutTests/ChangeLog 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/LayoutTests/ChangeLog 2012-05-03 17:50:03 UTC (rev 115989)
@@ -1,3 +1,25 @@
+2012-05-03 Simon Fraser <[email protected]>
+
+ Keep overlap testing for compositing on pages with 3d transforms when possible
+ https://bugs.webkit.org/show_bug.cgi?id=62487
+
+ Reviewed by Antti Koivisto.
+
+ Two new tests that check for layer creation outside of an overflow:hidden
+ stacking context.
+
+ Updated results for other tests whose results are affected by the
+ 'compositingConsultsOverlap' flag; their layers are now constrained to
+ the viewport.
+
+ * compositing/geometry/ancestor-overflow-change-expected.txt:
+ * compositing/geometry/foreground-layer-expected.txt:
+ * compositing/iframes/invisible-nested-iframe-show-expected.txt:
+ * compositing/layer-creation/overlap-animation-expected.txt: Added.
+ * compositing/layer-creation/overlap-animation.html: Added.
+ * compositing/layer-creation/overlap-transforms-expected.txt: Added.
+ * compositing/layer-creation/overlap-transforms.html: Added.
+
2012-05-03 Thiago Marcos P. Santos <[email protected]>
[EFL] CSS tests needs gardening
Modified: trunk/LayoutTests/compositing/geometry/ancestor-overflow-change-expected.txt (115988 => 115989)
--- trunk/LayoutTests/compositing/geometry/ancestor-overflow-change-expected.txt 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/LayoutTests/compositing/geometry/ancestor-overflow-change-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -2,17 +2,16 @@
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
- (position -2.00 -2.00)
- (bounds 804.00 604.00)
+ (bounds 800.00 600.00)
(children 2
(GraphicsLayer
- (position 8.00 8.00)
+ (position 6.00 6.00)
(bounds 104.00 104.00)
(drawsContent 1)
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
)
(GraphicsLayer
- (position 8.00 121.00)
+ (position 6.00 119.00)
(bounds 788.00 19.00)
(opacity 0.00)
(drawsContent 1)
Modified: trunk/LayoutTests/compositing/geometry/foreground-layer-expected.txt (115988 => 115989)
--- trunk/LayoutTests/compositing/geometry/foreground-layer-expected.txt 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/LayoutTests/compositing/geometry/foreground-layer-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -4,7 +4,7 @@
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
- (children 3
+ (children 2
(GraphicsLayer
(position 18.00 18.00)
(bounds 320.00 320.00)
@@ -42,11 +42,6 @@
)
)
)
- (GraphicsLayer
- (position 8.00 361.00)
- (bounds 784.00 10.00)
- (opacity 0.00)
- )
)
)
)
Modified: trunk/LayoutTests/compositing/iframes/invisible-nested-iframe-show-expected.txt (115988 => 115989)
--- trunk/LayoutTests/compositing/iframes/invisible-nested-iframe-show-expected.txt 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/LayoutTests/compositing/iframes/invisible-nested-iframe-show-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -6,12 +6,11 @@
(bounds 800.00 600.00)
(children 2
(GraphicsLayer
- (position -12.00 -12.00)
- (bounds 370.00 220.00)
+ (bounds 358.00 208.00)
(drawsContent 1)
(children 1
(GraphicsLayer
- (position 35.00 35.00)
+ (position 23.00 23.00)
(children 1
(GraphicsLayer
(bounds 285.00 150.00)
Added: trunk/LayoutTests/compositing/layer-creation/overlap-animation-expected.txt (0 => 115989)
--- trunk/LayoutTests/compositing/layer-creation/overlap-animation-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-animation-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -0,0 +1,33 @@
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 122.00 242.00)
+ (children 1
+ (GraphicsLayer
+ (position 1.00 1.00)
+ (bounds 120.00 240.00)
+ (children 2
+ (GraphicsLayer
+ (position 10.00 10.00)
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 10.00 120.00)
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/compositing/layer-creation/overlap-animation-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/layer-creation/overlap-animation.html (0 => 115989)
--- trunk/LayoutTests/compositing/layer-creation/overlap-animation.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-animation.html 2012-05-03 17:50:03 UTC (rev 115989)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 240px;
+ width: 120px;
+ overflow: hidden;
+ position: relative;
+ z-index: 0; /* create stacking context */
+ border: 1px solid black;
+ }
+
+ .box {
+ position: relative;
+ width: 100px;
+ height: 100px;
+ margin: 10px;
+ background-color: blue;
+ }
+
+ .animating {
+ -webkit-animation: spin 2s infinite linear;
+ }
+
+ @-webkit-keyframes spin {
+ from { -webkit-transform: rotate(0); }
+ to { -webkit-transform: rotate(360deg); }
+ }
+ </style>
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ function runTest()
+ {
+ var box = document.getElementById('to-animate');
+ box.addEventListener('webkitAnimationStart', animationStarted, false);
+ box.className = 'animating box';
+ }
+
+ function animationStarted()
+ {
+ if (window.layoutTestController) {
+ document.getElementById('layers').innerText = layoutTestController.layerTreeAsText();
+ layoutTestController.notifyDone();
+ }
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+ <div class="container">
+ <div id="to-animate" class="box"></div>
+ <!-- This div will get a layer -->
+ <div class="box"></div>
+ </div>
+ <!-- This div should not get a layer -->
+ <div class="box"></div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/layer-creation/overlap-animation.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/layer-creation/overlap-transforms-expected.txt (0 => 115989)
--- trunk/LayoutTests/compositing/layer-creation/overlap-transforms-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-transforms-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -0,0 +1,34 @@
+(GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 122.00 242.00)
+ (children 1
+ (GraphicsLayer
+ (position 1.00 1.00)
+ (bounds 120.00 240.00)
+ (children 2
+ (GraphicsLayer
+ (position 10.00 10.00)
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
+ )
+ (GraphicsLayer
+ (position 10.00 120.00)
+ (bounds 100.00 100.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Property changes on: trunk/LayoutTests/compositing/layer-creation/overlap-transforms-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/compositing/layer-creation/overlap-transforms.html (0 => 115989)
--- trunk/LayoutTests/compositing/layer-creation/overlap-transforms.html (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/overlap-transforms.html 2012-05-03 17:50:03 UTC (rev 115989)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 240px;
+ width: 120px;
+ overflow: hidden;
+ position: relative;
+ z-index: 0; /* create stacking context */
+ border: 1px solid black;
+ }
+
+ .box {
+ position: relative;
+ width: 100px;
+ height: 100px;
+ margin: 10px;
+ background-color: blue;
+ }
+
+ .transformed {
+ -webkit-transform: translateZ(1px); /* non-affine transform */
+ }
+ </style>
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function testDone()
+ {
+ if (window.layoutTestController)
+ document.getElementById('layers').innerText = layoutTestController.layerTreeAsText();
+ }
+ window.addEventListener('load', testDone, false);
+ </script>
+</head>
+<body>
+ <div class="container">
+ <div class="transformed box"></div>
+ <!-- This div will get a layer -->
+ <div class="box"></div>
+ </div>
+ <!-- This div should not get a layer -->
+ <div class="box"></div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/layer-creation/overlap-transforms.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:keywords
Added: svn:eol-style
Modified: trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt (115988 => 115989)
--- trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/LayoutTests/compositing/overflow/clip-descendents-expected.txt 2012-05-03 17:50:03 UTC (rev 115989)
@@ -28,8 +28,8 @@
(bounds 60.00 70.00)
(children 1
(GraphicsLayer
- (position -9.00 1.00)
- (bounds 122.00 122.00)
+ (position 0.00 1.00)
+ (bounds 60.00 69.00)
(drawsContent 1)
)
)
@@ -67,7 +67,6 @@
(GraphicsLayer
(position 240.00 230.00)
(bounds 60.00 70.00)
- (drawsContent 1)
(children 1
(GraphicsLayer
(bounds 60.00 70.00)
Modified: trunk/Source/WebCore/ChangeLog (115988 => 115989)
--- trunk/Source/WebCore/ChangeLog 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/Source/WebCore/ChangeLog 2012-05-03 17:50:03 UTC (rev 115989)
@@ -1,3 +1,51 @@
+2012-05-03 Simon Fraser <[email protected]>
+
+ Keep overlap testing for compositing on pages with 3d transforms when possible
+ https://bugs.webkit.org/show_bug.cgi?id=62487
+
+ Reviewed by Antti Koivisto.
+
+ Change RenderLayerCompositor to always use overlap testing when possible.
+
+ Rather than turn off overlap testing wholesale when encountering a non-affine
+ transform, or starting an accelerated transform animation, we constrain
+ the disabling of overlap testing to within overflow:hidden areas when possible.
+
+ Tests: compositing/layer-creation/overlap-animation.html
+ compositing/layer-creation/overlap-transforms.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::setCompositedBounds): Whitespace fix.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::CompositingState::CompositingState):
+ (CompositingState): Add a member boolean to track whether we're testing overlap. Add a copy
+ constructor.
+ (WebCore::RenderLayerCompositor::updateCompositingLayers): Initialize the 'testing overlap'
+ setting based on m_compositingConsultsOverlap (though this will always be true until removed
+ in a future commit).
+ (WebCore::RenderLayerCompositor::updateBacking): No longer turn off overlap testing
+ when we see a non-affine transform.
+ (WebCore::RenderLayerCompositor::computeCompositingRequirements): No need for the 'struct'
+ in the arguments.
+ Consult compositingState.m_testingOverlap to see if we want to test overlap.
+ Use the new CompositingState copy ctor for childState, but set m_subtreeIsCompositing to false
+ as before.
+ If this layer is composited, look to see if need to disable over lap testing based on
+ the transform or an animation.
+ Just as we propagate m_subtreeIsCompositing, we have to propagate m_testingOverlap=false
+ for the rest of the traverse.
+ If we've just processed a layer which clips compositing descendants, we can go back
+ to testing for overlap.
+ (WebCore::RenderLayerCompositor::didStartAcceleratedAnimation): No need to do anything
+ here now. It will be removed in future.
+ (WebCore::RenderLayerCompositor::hasNonAffineTransform): No longer check
+ perspective here, since that doesn't affect whether _this_ layer should disable
+ overlap testing. Checking for a non-affine transform is sufficient.
+ (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation):
+ New method to check if AnimationController is running a transform animation.
+ * rendering/RenderLayerCompositor.h:
+ (RenderLayerCompositor):
+
2012-05-03 Chris Fleizach <[email protected]>
accessibility/misspelled-attributed-string.html test sometimes throws exceptions
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (115988 => 115989)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-05-03 17:50:03 UTC (rev 115989)
@@ -1454,8 +1454,8 @@
void RenderLayerBacking::setCompositedBounds(const IntRect& bounds)
{
m_compositedBounds = bounds;
+}
-}
CSSPropertyID RenderLayerBacking::graphicsLayerToCSSProperty(AnimatedPropertyID property)
{
CSSPropertyID cssProperty = CSSPropertyInvalid;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (115988 => 115989)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-05-03 17:50:03 UTC (rev 115989)
@@ -129,17 +129,29 @@
};
struct CompositingState {
- CompositingState(RenderLayer* compAncestor)
+ CompositingState(RenderLayer* compAncestor, bool testOverlap)
: m_compositingAncestor(compAncestor)
, m_subtreeIsCompositing(false)
+ , m_testingOverlap(testOverlap)
#ifndef NDEBUG
, m_depth(0)
#endif
{
}
+ CompositingState(const CompositingState& other)
+ : m_compositingAncestor(other.m_compositingAncestor)
+ , m_subtreeIsCompositing(other.m_subtreeIsCompositing)
+ , m_testingOverlap(other.m_testingOverlap)
+#ifndef NDEBUG
+ , m_depth(other.m_depth + 1)
+#endif
+ {
+ }
+
RenderLayer* m_compositingAncestor;
bool m_subtreeIsCompositing;
+ bool m_testingOverlap;
#ifndef NDEBUG
int m_depth;
#endif
@@ -375,12 +387,12 @@
++m_rootLayerUpdateCount;
startTime = currentTime();
}
-#endif
+#endif
if (checkForHierarchyUpdate) {
// Go through the layers in presentation order, so that we can compute which RenderLayers need compositing layers.
// FIXME: we could maybe do this and the hierarchy udpate in one pass, but the parenting logic would be more complex.
- CompositingState compState(updateRoot);
+ CompositingState compState(updateRoot, m_compositingConsultsOverlap);
bool layersChanged = false;
if (m_compositingConsultsOverlap) {
OverlapMap overlapTestRequestMap;
@@ -469,12 +481,7 @@
if (needsToBeComposited(layer)) {
enableCompositingMode();
- // Non-identity 3D transforms turn off the testing of overlap.
- if (hasNonIdentity3DTransform(layer->renderer()))
- setCompositingConsultsOverlap(false);
-
if (!layer->backing()) {
-
// If we need to repaint, do so before making backing
if (shouldRepaint == CompositingChangeRepaintNow)
repaintOnCompositingChange(layer);
@@ -685,7 +692,7 @@
// must be compositing so that its contents render over that child.
// This implies that its positive z-index children must also be compositing.
//
-void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, OverlapMap* overlapMap, struct CompositingState& compositingState, bool& layersChanged)
+void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged)
{
layer->updateLayerPosition();
layer->updateLayerListsIfNeeded();
@@ -697,7 +704,7 @@
bool haveComputedBounds = false;
IntRect absBounds;
- if (overlapMap && !overlapMap->isEmpty()) {
+ if (overlapMap && !overlapMap->isEmpty() && compositingState.m_testingOverlap) {
// If we're testing for overlap, we only need to composite if we overlap something that is already composited.
absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox();
// Empty rects never intersect, but we need them to for the purposes of overlap testing.
@@ -712,10 +719,8 @@
// The children of this layer don't need to composite, unless there is
// a compositing layer among them, so start by inheriting the compositing
// ancestor with m_subtreeIsCompositing set to false.
- CompositingState childState(compositingState.m_compositingAncestor);
-#ifndef NDEBUG
- childState.m_depth = compositingState.m_depth + 1;
-#endif
+ CompositingState childState(compositingState);
+ childState.m_subtreeIsCompositing = false;
bool willBeComposited = needsToBeComposited(layer);
if (willBeComposited) {
@@ -726,6 +731,11 @@
if (overlapMap)
overlapMap->pushCompositingContainer();
+
+ if (hasNonAffineTransform(layer->renderer()) || isRunningAcceleratedTransformAnimation(layer->renderer())) {
+ // If we have a 3D transform, or are animating transform, then turn overlap testing off.
+ childState.m_testingOverlap = false;
+ }
}
#if ENABLE(VIDEO)
@@ -816,18 +826,27 @@
if (childState.m_subtreeIsCompositing)
compositingState.m_subtreeIsCompositing = true;
+ // We have to keep overlap testing disabled for later layers.
+ if (!childState.m_testingOverlap)
+ compositingState.m_testingOverlap = false;
+
// Set the flag to say that this SC has compositing children.
layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing);
// setHasCompositingDescendant() may have changed the answer to needsToBeComposited() when clipping,
// so test that again.
- if (!willBeComposited && canBeComposited(layer) && clipsCompositingDescendants(layer)) {
- childState.m_compositingAncestor = layer;
- if (overlapMap) {
- overlapMap->pushCompositingContainer();
- addToOverlapMapRecursive(*overlapMap, layer);
- }
- willBeComposited = true;
+ if (canBeComposited(layer) && clipsCompositingDescendants(layer)) {
+ if (!willBeComposited) {
+ childState.m_compositingAncestor = layer;
+ if (overlapMap) {
+ overlapMap->pushCompositingContainer();
+ addToOverlapMapRecursive(*overlapMap, layer);
+ }
+ willBeComposited = true;
+ }
+
+ // We're done processing an element that clips. The container can keep testing overlap.
+ compositingState.m_testingOverlap = true;
}
if (overlapMap && childState.m_compositingAncestor == layer && !layer->isRootLayer())
@@ -1310,13 +1329,9 @@
#endif
}
-void RenderLayerCompositor::didStartAcceleratedAnimation(CSSPropertyID property)
+void RenderLayerCompositor::didStartAcceleratedAnimation(CSSPropertyID)
{
- // If an accelerated animation or transition runs, we have to turn off overlap checking because
- // we don't do layout for every frame, but we have to ensure that the layering is
- // correct between the animating object and other objects on the page.
- if (property == CSSPropertyWebkitTransform)
- setCompositingConsultsOverlap(false);
+ // FIXME: remove this method.
}
bool RenderLayerCompositor::has3DContent() const
@@ -1708,20 +1723,28 @@
return true;
}
-bool RenderLayerCompositor::hasNonIdentity3DTransform(RenderObject* renderer) const
+bool RenderLayerCompositor::hasNonAffineTransform(RenderObject* renderer) const
{
if (!renderer->hasTransform())
return false;
- if (renderer->style()->hasPerspective())
- return true;
-
if (TransformationMatrix* transform = toRenderBoxModelObject(renderer)->layer()->transform())
return !transform->isAffine();
return false;
}
+bool RenderLayerCompositor::isRunningAcceleratedTransformAnimation(RenderObject* renderer) const
+{
+ if (!(m_compositingTriggers & ChromeClient::AnimationTrigger))
+ return false;
+
+ if (AnimationController* animController = renderer->animation())
+ return animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform);
+
+ return false;
+}
+
// If an element has negative z-index children, those children render in front of the
// layer background, so we need an extra 'contents' layer for the foreground of the layer
// object.
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (115988 => 115989)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2012-05-03 17:18:11 UTC (rev 115988)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2012-05-03 17:50:03 UTC (rev 115989)
@@ -259,8 +259,9 @@
void removeCompositedChildren(RenderLayer*);
bool layerHas3DContent(const RenderLayer*) const;
- bool hasNonIdentity3DTransform(RenderObject*) const;
-
+ bool hasNonAffineTransform(RenderObject*) const;
+ bool isRunningAcceleratedTransformAnimation(RenderObject*) const;
+
bool hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const;
void ensureRootLayer();