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

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

Issue 2729373003: Bit-mask incorrectly removed first-line pseudo bit. (Closed)
Patch Set: Created 3 years, 9 months 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 945e0dc673290e2e4f6a04363892934c68ea2543..4c2b1427b8f0c566943e64deeb6dc2a96b245f21 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1808,17 +1808,21 @@ void Element::detachLayoutTree(const AttachContext& context) {
DCHECK(needsAttach());
}
-bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle,
+void Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle,
ComputedStyle* newStyle) {
+ // TODO(rune@opera.com): This method does not take into account pseudo style
+ // which is only present for the newStyle. Also the first-line part should
+ // probably be moved to where we handle visual invalidation diff for setStyle.
+ // setHasPseudoStyle() calls are probably unnecessary.
DCHECK_EQ(currentStyle, computedStyle());
DCHECK(layoutObject());
if (!currentStyle)
- return false;
+ return;
const PseudoStyleCache* pseudoStyleCache = currentStyle->cachedPseudoStyles();
if (!pseudoStyleCache)
- return false;
+ return;
size_t cacheSize = pseudoStyleCache->size();
for (size_t i = 0; i < cacheSize; ++i) {
@@ -1831,7 +1835,7 @@ bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle,
newPseudoStyle = layoutObject()->getUncachedPseudoStyle(
PseudoStyleRequest(pseudoId), newStyle, newStyle);
if (!newPseudoStyle)
- return true;
+ continue;
if (*oldPseudoStyle != *newPseudoStyle ||
oldPseudoStyle->font().loadingCustomFonts() !=
newPseudoStyle->font().loadingCustomFonts()) {
@@ -1839,13 +1843,12 @@ bool Element::pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle,
newStyle->setHasPseudoStyle(pseudoId);
newStyle->addCachedPseudoStyle(newPseudoStyle);
if (pseudoId == PseudoIdFirstLine ||
- pseudoId == PseudoIdFirstLineInherited)
+ pseudoId == PseudoIdFirstLineInherited) {
layoutObject()->firstLineStyleDidChange(*oldPseudoStyle,
*newPseudoStyle);
- return true;
+ }
}
}
- return false;
}
PassRefPtr<ComputedStyle> Element::styleForLayoutObject() {
@@ -2032,8 +2035,8 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change,
updateCallbackSelectors(oldStyle.get(), newStyle.get());
if (LayoutObject* layoutObject = this->layoutObject()) {
- if (localChange != NoChange ||
- pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get())) {
+ if (localChange != NoChange) {
+ pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get());
layoutObject->setStyle(newStyle.get());
} else {
// Although no change occurred, we use the new style so that the cousin

Powered by Google App Engine
This is Rietveld 408576698