Title: [218345] trunk/Source/WebCore
Revision
218345
Author
cdu...@apple.com
Date
2017-06-15 11:59:28 -0700 (Thu, 15 Jun 2017)

Log Message

Unreviewed, rolling out r218318.

Seems to have caused an 11% PLT regression. Rolling out to
confirm.

Reverted changeset:

"Don't always recalc the style of display: contents elements."
https://bugs.webkit.org/show_bug.cgi?id=172753
http://trac.webkit.org/changeset/218318

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (218344 => 218345)


--- trunk/Source/WebCore/ChangeLog	2017-06-15 18:44:42 UTC (rev 218344)
+++ trunk/Source/WebCore/ChangeLog	2017-06-15 18:59:28 UTC (rev 218345)
@@ -1,3 +1,16 @@
+2017-06-15  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, rolling out r218318.
+
+        Seems to have caused an 11% PLT regression. Rolling out to
+        confirm.
+
+        Reverted changeset:
+
+        "Don't always recalc the style of display: contents elements."
+        https://bugs.webkit.org/show_bug.cgi?id=172753
+        http://trac.webkit.org/changeset/218318
+
 2017-06-15  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading

Modified: trunk/Source/WebCore/dom/Element.cpp (218344 => 218345)


--- trunk/Source/WebCore/dom/Element.cpp	2017-06-15 18:44:42 UTC (rev 218344)
+++ trunk/Source/WebCore/dom/Element.cpp	2017-06-15 18:59:28 UTC (rev 218345)
@@ -2663,7 +2663,7 @@
     }
 }
 
-const RenderStyle* Element::existingComputedStyle() const
+const RenderStyle* Element::existingComputedStyle()
 {
     if (auto* renderTreeStyle = renderStyle())
         return renderTreeStyle;

Modified: trunk/Source/WebCore/dom/Element.h (218344 => 218345)


--- trunk/Source/WebCore/dom/Element.h	2017-06-15 18:44:42 UTC (rev 218344)
+++ trunk/Source/WebCore/dom/Element.h	2017-06-15 18:59:28 UTC (rev 218345)
@@ -505,8 +505,6 @@
 
     LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override;
 
-    const RenderStyle* existingComputedStyle() const;
-
     void setBeforePseudoElement(Ref<PseudoElement>&&);
     void setAfterPseudoElement(Ref<PseudoElement>&&);
     void clearBeforePseudoElement();
@@ -645,6 +643,7 @@
 
     void removeShadowRoot();
 
+    const RenderStyle* existingComputedStyle();
     const RenderStyle& resolveComputedStyle();
 
     bool rareDataStyleAffectedByEmpty() const;

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (218344 => 218345)


--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-06-15 18:44:42 UTC (rev 218344)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-06-15 18:59:28 UTC (rev 218345)
@@ -157,8 +157,6 @@
 
         if (auto* renderer = node.renderer())
             renderTreePosition().invalidateNextSibling(*renderer);
-        else if (is<Element>(node) && downcast<Element>(node).hasDisplayContents())
-            renderTreePosition().invalidateNextSibling();
 
         if (is<Text>(node)) {
             auto& text = downcast<Text>(node);
@@ -172,16 +170,12 @@
         auto& element = downcast<Element>(node);
 
         auto* elementUpdate = m_styleUpdate->elementUpdate(element);
-
-        // We hop through display: contents elements in findRenderingRoot, so
-        // there may be other updates down the tree.
-        if (!elementUpdate && !element.hasDisplayContents()) {
+        if (!elementUpdate) {
             it.traverseNextSkippingChildren();
             continue;
         }
 
-        if (elementUpdate)
-            updateElementRenderer(element, *elementUpdate);
+        updateElementRenderer(element, *elementUpdate);
 
         bool mayHaveRenderedDescendants = element.renderer() || (element.hasDisplayContents() && shouldCreateRenderer(element, renderTreePosition().parent()));
         if (!mayHaveRenderedDescendants) {
@@ -280,6 +274,8 @@
             element.resetComputedStyle();
         else
             element.storeDisplayContentsStyle(RenderStyle::clonePtr(*update.style));
+        // Render tree position needs to be recomputed as rendering siblings may be found from the display:contents subtree.
+        renderTreePosition().invalidateNextSibling();
     }
 
     bool shouldCreateNewRenderer = !element.renderer() && !hasDisplayContents;

Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (218344 => 218345)


--- trunk/Source/WebCore/style/StyleTreeResolver.cpp	2017-06-15 18:44:42 UTC (rev 218344)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp	2017-06-15 18:59:28 UTC (rev 218345)
@@ -179,7 +179,7 @@
     if (!affectsRenderedSubtree(element, *newStyle))
         return { };
 
-    auto* existingStyle = element.existingComputedStyle();
+    auto* existingStyle = element.renderStyle();
 
     if (m_didSeePendingStylesheet && (!existingStyle || existingStyle->isNotFinal())) {
         newStyle->setIsNotFinal();
@@ -248,10 +248,9 @@
         return makeUpdate(WTFMove(newStyle), Detach);
 
     if (!renderer) {
-        auto change = Detach;
-        if (auto* oldStyle = element.existingComputedStyle())
-            change = determineChange(*oldStyle, *newStyle);
-        return makeUpdate(WTFMove(newStyle), change);
+        auto keepsDisplayContents = newStyle->display() == CONTENTS && element.hasDisplayContents();
+        // Some inherited property might have changed.
+        return makeUpdate(WTFMove(newStyle), keepsDisplayContents ? Inherit : Detach);
     }
 
     std::unique_ptr<RenderStyle> animatedStyle;
@@ -332,12 +331,14 @@
     if (parentChange >= Inherit)
         return true;
     if (parentChange == NoInherit) {
-        auto* existingStyle = element.existingComputedStyle();
+        auto* existingStyle = element.renderStyle();
         if (existingStyle && existingStyle->hasExplicitlyInheritedProperties())
             return true;
     }
     if (element.needsStyleRecalc())
         return true;
+    if (element.hasDisplayContents())
+        return true;
     if (shouldResolvePseudoElement(element.beforePseudoElement()))
         return true;
     if (shouldResolvePseudoElement(element.afterPseudoElement()))
@@ -416,7 +417,7 @@
         if (element.needsStyleRecalc() || parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle)
             parent.elementNeedingStyleRecalcAffectsNextSiblingElementStyle = element.affectsNextSiblingElementStyle();
 
-        auto* style = element.existingComputedStyle();
+        auto* style = element.renderStyle();
         auto change = NoChange;
 
         bool shouldResolve = shouldResolveElement(element, parent.change) || affectedByPreviousSibling;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to