Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index e785c06dfc53d2423487e8af18cf389fe9095aa8..84f498ed0bd828c9867466b2059d4992a7a64466 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -1623,7 +1623,7 @@ void Element::detach(const AttachContext& context) |
ASSERT(needsAttach()); |
} |
-bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, ComputedStyle* newStyle) |
+bool Element::updatePseudoStyleCache(const ComputedStyle* currentStyle, ComputedStyle* newStyle) |
{ |
ASSERT(currentStyle == computedStyle()); |
ASSERT(layoutObject()); |
@@ -1636,6 +1636,7 @@ bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, Compu |
return false; |
size_t cacheSize = pseudoStyleCache->size(); |
+ bool result = false; |
for (size_t i = 0; i < cacheSize; ++i) { |
RefPtr<ComputedStyle> newPseudoStyle; |
RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i); |
@@ -1644,15 +1645,17 @@ bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, Compu |
newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle); |
else |
newPseudoStyle = layoutObject()->getUncachedPseudoStyle(PseudoStyleRequest(pseudoId), newStyle, newStyle); |
- if (!newPseudoStyle) |
- return true; |
+ if (!newPseudoStyle) { |
+ result = true; |
+ continue; |
+ } |
if (*oldPseudoStyle != *newPseudoStyle || oldPseudoStyle->font().loadingCustomFonts() != newPseudoStyle->font().loadingCustomFonts()) { |
if (pseudoId < FIRST_INTERNAL_PSEUDOID) |
newStyle->setHasPseudoStyle(pseudoId); |
newStyle->addCachedPseudoStyle(newPseudoStyle); |
if (pseudoId == FIRST_LINE || pseudoId == FIRST_LINE_INHERITED) |
layoutObject()->firstLineStyleDidChange(*oldPseudoStyle, *newPseudoStyle); |
- return true; |
+ result = true; |
} |
} |
return false; |
@@ -1791,7 +1794,8 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) |
updateCallbackSelectors(oldStyle.get(), newStyle.get()); |
if (LayoutObject* layoutObject = this->layoutObject()) { |
- if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || svgFilterNeedsLayerUpdate()) { |
+ bool pseudoStyleCacheUpdated = updatePseudoStyleCache(oldStyle.get(), newStyle.get()); |
+ if (localChange != NoChange || pseudoStyleCacheUpdated || svgFilterNeedsLayerUpdate()) { |
layoutObject->setStyle(newStyle.get()); |
} else { |
// Although no change occurred, we use the new style so that the cousin style sharing code won't get |