Chromium Code Reviews| Index: Source/core/dom/Element.cpp |
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
| index c528b8b77d020664125a92a4a8982195bb92fcdb..f9fea35ddab901b7bd03966c8af7b2662a81f7bd 100644 |
| --- a/Source/core/dom/Element.cpp |
| +++ b/Source/core/dom/Element.cpp |
| @@ -1590,9 +1590,14 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) |
| } |
| // If we reattached we don't need to recalc the style of our descendants anymore. |
| - if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc()) |
| + if ((change >= Inherit && change < Reattach) || childNeedsStyleRecalc()) { |
| recalcChildStyle(change); |
| - clearChildNeedsStyleRecalc(); |
| + clearChildNeedsStyleRecalc(); |
| + } else if (change == UpdatePseudoElements) { |
| + updatePseudoElement(BEFORE, change); |
| + updatePseudoElement(AFTER, change); |
| + updatePseudoElement(BACKDROP, change); |
|
esprehn
2014/01/24 22:53:49
Can you just merge this into recalcChildStyle? If
rune
2014/01/25 00:00:38
I've tried in patch set 6. I've changed it so that
|
| + } |
| if (hasCustomStyleCallbacks()) |
| didRecalcStyle(change); |
| @@ -1651,10 +1656,13 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) |
| if (styleChangeType() >= SubtreeStyleChange) |
| return Force; |
| - if (change <= Inherit) |
| - return localChange; |
| + if (change > Inherit || localChange > Inherit) |
| + return max(localChange, change); |
| - return max(localChange, change); |
| + if (localChange < Inherit && (oldStyle->hasContentPseudoStyle() || newStyle->hasContentPseudoStyle())) |
| + return UpdatePseudoElements; |
| + |
| + return localChange; |
| } |
| void Element::recalcChildStyle(StyleRecalcChange change) |
| @@ -2768,8 +2776,10 @@ void Element::normalizeAttributes() |
| void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
| { |
| + ASSERT(!needsStyleRecalc()); |
| PseudoElement* element = pseudoElement(pseudoId); |
| - if (element && (needsStyleRecalc() || shouldRecalcStyle(change, element))) { |
| + if (element && (change == UpdatePseudoElements || shouldRecalcStyle(change, element))) { |
| + |
| // Need to clear the cached style if the PseudoElement wants a recalc so it |
| // computes a new style. |
| if (element->needsStyleRecalc()) |
| @@ -2778,7 +2788,7 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
| // PseudoElement styles hang off their parent element's style so if we needed |
| // a style recalc we should Force one on the pseudo. |
| // FIXME: We should figure out the right text sibling to pass. |
| - element->recalcStyle(needsStyleRecalc() ? Force : change); |
| + element->recalcStyle(change == UpdatePseudoElements ? Force : change); |
| // Wait until our parent is not displayed or pseudoElementRendererIsNeeded |
| // is false, otherwise we could continously create and destroy PseudoElements |
| @@ -2786,8 +2796,9 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
| // PseudoElement's renderer for each style recalc. |
| if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId))) |
| elementRareData()->setPseudoElement(pseudoId, 0); |
| - } else if (change >= Inherit || needsStyleRecalc()) |
| + } else if (change >= UpdatePseudoElements) { |
| createPseudoElementIfNeeded(pseudoId); |
| + } |
| } |
| bool Element::needsPseudoElement(PseudoId pseudoId, const RenderStyle& style) const |