Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1473363003: Invalidate first line display item clients when first line style changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invalidate the whole first line Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698