Title: [177074] trunk/Source/WebCore
Revision
177074
Author
akl...@apple.com
Date
2014-12-10 09:42:45 -0800 (Wed, 10 Dec 2014)

Log Message

REGRESSION(r177048) 11 failures on layout tests fast/selectors.
<https://webkit.org/b/139483>

Unreviewed fix for bots.

When rolling out the broken change, I accidentally also rolled out
a bug fix that Benjamin had made to sibling invalidation.
Restore his implementation of nodeOrItsAncestorNeedsStyleRecalc().

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::nodeOrItsAncestorNeedsStyleRecalc):
(WebCore::updateStyleIfNeededForNode):
(WebCore::ComputedStyleExtractor::propertyValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (177073 => 177074)


--- trunk/Source/WebCore/ChangeLog	2014-12-10 17:36:40 UTC (rev 177073)
+++ trunk/Source/WebCore/ChangeLog	2014-12-10 17:42:45 UTC (rev 177074)
@@ -1,3 +1,19 @@
+2014-12-10  Andreas Kling  <akl...@apple.com>
+
+        REGRESSION(r177048) 11 failures on layout tests fast/selectors.
+        <https://webkit.org/b/139483>
+
+        Unreviewed fix for bots.
+
+        When rolling out the broken change, I accidentally also rolled out
+        a bug fix that Benjamin had made to sibling invalidation.
+        Restore his implementation of nodeOrItsAncestorNeedsStyleRecalc().
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::nodeOrItsAncestorNeedsStyleRecalc):
+        (WebCore::updateStyleIfNeededForNode):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+
 2014-12-08  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] AudioSourceProvider support in the MediaPlayer

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (177073 => 177074)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-12-10 17:36:40 UTC (rev 177073)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-12-10 17:42:45 UTC (rev 177074)
@@ -1671,17 +1671,35 @@
     return ComputedStyleExtractor(m_node, m_allowVisitedStyle, m_pseudoElementSpecifier).copyProperties();
 }
 
-static inline bool nodeOrItsAncestorNeedsStyleRecalc(Node* styledNode)
+static inline bool nodeOrItsAncestorNeedsStyleRecalc(const Node& node)
 {
-    if (styledNode->document().hasPendingForcedStyleRecalc())
+    if (node.needsStyleRecalc())
         return true;
-    for (Node* n = styledNode; n; n = n->parentNode()) {// FIXME: parentOrShadowHostNode() instead
-        if (n->needsStyleRecalc())
+
+    const Node* currentNode = &node;
+    const Element* ancestor = currentNode->parentOrShadowHostElement();
+    while (ancestor) {
+        if (ancestor->needsStyleRecalc())
             return true;
+
+        if (ancestor->directChildNeedsStyleRecalc() && currentNode->styleIsAffectedByPreviousSibling())
+            return true;
+
+        currentNode = ancestor;
+        ancestor = currentNode->parentOrShadowHostElement();
     }
     return false;
 }
 
+static inline bool updateStyleIfNeededForNode(const Node& node)
+{
+    Document& document = node.document();
+    if (!document.hasPendingForcedStyleRecalc() && !(document.childNeedsStyleRecalc() && nodeOrItsAncestorNeedsStyleRecalc(node)))
+        return false;
+    document.updateStyleIfNeeded();
+    return true;
+}
+
 static inline PassRefPtr<RenderStyle> computeRenderStyleForProperty(Node* styledNode, PseudoId pseudoElementSpecifier, CSSPropertyID propertyID)
 {
     RenderObject* renderer = styledNode->renderer();
@@ -1736,8 +1754,7 @@
     if (updateLayout) {
         Document& document = styledNode->document();
 
-        if (nodeOrItsAncestorNeedsStyleRecalc(styledNode)) {
-            document.updateStyleIfNeeded();
+        if (updateStyleIfNeededForNode(*styledNode)) {
             // The style recalc could have caused the styled node to be discarded or replaced
             // if it was a PseudoElement so we need to update it.
             styledNode = this->styledNode();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to