Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 1b88ddbf87c87a51d523e8985ea2cfadeba4c3c7..862c4e4eb991419bf022b534515b98b661b843b4 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1829,14 +1829,16 @@ void Element::checkForSiblingStyleChanges(bool finishedParsingCallback, Node* be |
if (!style || (needsStyleRecalc() && childrenAffectedByPositionalRules())) |
return; |
- // Forward positional selectors include the ~ selector, nth-child, nth-of-type, first-of-type and only-of-type. |
+ // Forward positional selectors include nth-child, nth-of-type, first-of-type and only-of-type. |
+ // The indirect adjacent selector is the ~ selector. |
// Backward positional selectors include nth-last-child, nth-last-of-type, last-of-type and only-of-type. |
- // We have to invalidate everything following the insertion point in the forward case, and everything before the insertion point in the |
- // backward case. |
+ // We have to invalidate everything following the insertion point in the forward and indirect adjacent case, |
+ // and everything before the insertion point in the backward case. |
// |afterChange| is 0 in the parser callback case, so we won't do any work for the forward case if we don't have to. |
// For performance reasons we just mark the parent node as changed, since we don't want to make childrenChanged O(n^2) by crawling all our kids |
// here. recalcStyle will then force a walk of the children when it sees that this has happened. |
- if ((childrenAffectedByForwardPositionalRules() && afterChange) || (childrenAffectedByBackwardPositionalRules() && beforeChange)) { |
+ if (((childrenAffectedByForwardPositionalRules() || childrenAffectedByIndirectAdjacentRules()) && afterChange) |
+ || (childrenAffectedByBackwardPositionalRules() && beforeChange)) { |
setNeedsStyleRecalc(SubtreeStyleChange); |
return; |
} |
@@ -2542,6 +2544,11 @@ void Element::setChildrenAffectedByDirectAdjacentRules() |
ensureElementRareData().setChildrenAffectedByDirectAdjacentRules(true); |
} |
+void Element::setChildrenAffectedByIndirectAdjacentRules() |
+{ |
+ ensureElementRareData().setChildrenAffectedByIndirectAdjacentRules(true); |
+} |
+ |
void Element::setChildrenAffectedByForwardPositionalRules() |
{ |
ensureElementRareData().setChildrenAffectedByForwardPositionalRules(true); |
@@ -2571,6 +2578,7 @@ bool Element::childrenSupportStyleSharing() const |
&& !rareDataChildrenAffectedByFirstChildRules() |
&& !rareDataChildrenAffectedByLastChildRules() |
&& !rareDataChildrenAffectedByDirectAdjacentRules() |
+ && !rareDataChildrenAffectedByIndirectAdjacentRules() |
&& !rareDataChildrenAffectedByForwardPositionalRules() |
&& !rareDataChildrenAffectedByBackwardPositionalRules(); |
} |
@@ -2623,6 +2631,12 @@ bool Element::rareDataChildrenAffectedByDirectAdjacentRules() const |
return elementRareData()->childrenAffectedByDirectAdjacentRules(); |
} |
+bool Element::rareDataChildrenAffectedByIndirectAdjacentRules() const |
+{ |
+ ASSERT(hasRareData()); |
+ return elementRareData()->childrenAffectedByIndirectAdjacentRules(); |
+} |
+ |
bool Element::rareDataChildrenAffectedByForwardPositionalRules() const |
{ |
ASSERT(hasRareData()); |