ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLa...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 22:13:11 +0000 (22:13 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 22:13:11 +0000 (22:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151097
<rdar://problem/27711678>

Reviewed by Simon Fraser.

Source/WebCore:

This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer.
(This is similar to what any other stacking context-triggering CSS property does.)

Test: compositing/assert-on-will-change-transform-with-composited-descendant.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):

LayoutTests:

* compositing/assert-on-will-change-transform-with-composited-descendant-expected.txt: Added.
* compositing/assert-on-will-change-transform-with-composited-descendant.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205999 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant-expected.txt [new file with mode: 0644]
LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/style/WillChangeData.cpp
Source/WebCore/rendering/style/WillChangeData.h

index 4c8e796..234aa9a 100644 (file)
@@ -1,3 +1,14 @@
+2016-09-15  Zalan Bujtas  <zalan@apple.com>
+
+        ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements
+        https://bugs.webkit.org/show_bug.cgi?id=151097
+        <rdar://problem/27711678>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/assert-on-will-change-transform-with-composited-descendant-expected.txt: Added.
+        * compositing/assert-on-will-change-transform-with-composited-descendant.html: Added.
+
 2016-09-15  Ryan Haddad  <ryanhaddad@apple.com>
 
         Marking js/date-constructor.html as flaky on ios-simulator-wk2
diff --git a/LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant-expected.txt b/LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant-expected.txt
new file mode 100644 (file)
index 0000000..e424d77
--- /dev/null
@@ -0,0 +1,2 @@
+PASS if no assert in debug.
+
diff --git a/LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant.html b/LayoutTests/compositing/assert-on-will-change-transform-with-composited-descendant.html
new file mode 100644 (file)
index 0000000..83f1207
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title></title>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+</script>
+<style>
+.container {
+    overflow: hidden;
+    will-change: -webkit-transform;
+}
+
+.inner {
+    z-index: -1;
+    position: relative;
+    transform: translateZ(0);
+}
+</style>
+</head>
+<body>
+PASS if no assert in debug.
+<div class=container><div class=inner></div></div>
+</body>
+</html>
index c0f99c3..9464ee7 100644 (file)
@@ -1,5 +1,21 @@
 2016-09-15  Zalan Bujtas  <zalan@apple.com>
 
+        ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements
+        https://bugs.webkit.org/show_bug.cgi?id=151097
+        <rdar://problem/27711678>
+
+        Reviewed by Simon Fraser.
+
+        This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer.
+        (This is similar to what any other stacking context-triggering CSS property does.)  
+
+        Test: compositing/assert-on-will-change-transform-with-composited-descendant.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+
+2016-09-15  Zalan Bujtas  <zalan@apple.com>
+
         Move RenderObject::shouldRespectImageOrientation to RenderElement.
         https://bugs.webkit.org/show_bug.cgi?id=162028
 
index b8d6947..2087a8f 100644 (file)
@@ -6464,33 +6464,27 @@ void RenderLayer::repaintIncludingNonCompositingDescendants(RenderLayerModelObje
     }
 }
 
-static bool mayCreateGraphicalGroup(const RenderElement& renderer)
+static bool createsStackingContext(const RenderLayer& layer)
 {
-    bool createsGraphicalGroup = renderer.hasClipPath()
+    auto& renderer = layer.renderer();
+    return renderer.hasTransformRelatedProperty()
+        || renderer.hasClipPath()
         || renderer.hasFilter()
+        || renderer.hasMask()
         || renderer.hasBackdropFilter()
 #if ENABLE(CSS_COMPOSITING)
         || renderer.hasBlendMode()
 #endif
         || renderer.isTransparent()
-        || renderer.hasMask();
-    return createsGraphicalGroup || (renderer.style().willChange() && renderer.style().willChange()->canCreateGraphicalGroup());
-}
-
-static bool createsStackingContext(const RenderLayer& layer)
-{
-    auto& renderer = layer.renderer();
-    return renderer.hasTransformRelatedProperty()
         || renderer.isPositioned()
-        || layer.needsCompositedScrolling()
         || renderer.style().hasFlowFrom()
         || renderer.hasReflection()
         || renderer.style().hasIsolation()
+        || layer.needsCompositedScrolling()
 #if PLATFORM(IOS)
         || layer.hasAcceleratedTouchScrolling()
 #endif
-        // FIXME: Check if willChange()->canCreateStackingContext() is more accurate here.
-        || mayCreateGraphicalGroup(renderer);
+        || (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext());
 }
 
 bool RenderLayer::shouldBeNormalFlowOnly() const
index cff2e7c..77d4aa8 100644 (file)
@@ -99,30 +99,6 @@ static bool propertyCreatesStackingContext(CSSPropertyID property)
     }
 }
 
-static bool propertyCreatesGraphicalGroup(CSSPropertyID property)
-{
-    switch (property) {
-    case CSSPropertyClipPath:
-    case CSSPropertyWebkitClipPath:
-    case CSSPropertyMask:
-    case CSSPropertyOpacity:
-#if ENABLE(CSS_COMPOSITING)
-    case CSSPropertyMixBlendMode:
-    case CSSPropertyIsolation:
-#endif
-    case CSSPropertyFilter:
-#if ENABLE(FILTERS_LEVEL_2)
-    case CSSPropertyWebkitBackdropFilter:
-#endif
-    case CSSPropertyWebkitMask:
-    case CSSPropertyWebkitMaskImage:
-    case CSSPropertyWebkitMaskBoxImage:
-        return true;
-    default:
-        return false;
-    }
-}
-
 static bool propertyTriggersCompositing(CSSPropertyID property)
 {
     switch (property) {
@@ -161,8 +137,6 @@ void WillChangeData::addFeature(Feature feature, CSSPropertyID propertyID)
 
     m_canTriggerCompositingOnInline |= propertyTriggersCompositing(propertyID);
     m_canTriggerCompositing |= m_canTriggerCompositingOnInline | propertyTriggersCompositingOnBoxesOnly(propertyID);
-
-    m_canCreateGraphicalGroup |= propertyCreatesGraphicalGroup(propertyID);
 }
 
 WillChangeData::FeaturePropertyPair WillChangeData::featureAt(size_t index) const
index 6bab28d..49e7608 100644 (file)
@@ -57,7 +57,6 @@ public:
     bool canCreateStackingContext() const { return m_canCreateStackingContext; }
     bool canTriggerCompositing() const { return m_canTriggerCompositing; }
     bool canTriggerCompositingOnInline() const { return m_canTriggerCompositingOnInline; }
-    bool canCreateGraphicalGroup() const { return m_canCreateGraphicalGroup; }
 
     enum Feature {
         ScrollPosition,
@@ -125,7 +124,6 @@ private:
     bool m_canCreateStackingContext { false };
     bool m_canTriggerCompositing { false };
     bool m_canTriggerCompositingOnInline { false };
-    bool m_canCreateGraphicalGroup { false };
 };