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

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

Issue 2729373003: Bit-mask incorrectly removed first-line pseudo bit. (Closed)
Patch Set: Fixed issues. 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..84b31061660b3108736725d30454336f75a88c8b 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1808,30 +1808,32 @@ 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) {
RefPtr<ComputedStyle> newPseudoStyle;
RefPtr<ComputedStyle> oldPseudoStyle = pseudoStyleCache->at(i);
PseudoId pseudoId = oldPseudoStyle->styleType();
- if (pseudoId == PseudoIdFirstLine || pseudoId == PseudoIdFirstLineInherited)
- newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle);
- else
- newPseudoStyle = layoutObject()->getUncachedPseudoStyle(
- PseudoStyleRequest(pseudoId), newStyle, newStyle);
+ if (pseudoId != PseudoIdFirstLine && pseudoId != PseudoIdFirstLineInherited)
+ continue;
+ newPseudoStyle = layoutObject()->uncachedFirstLineStyle(newStyle);
if (!newPseudoStyle)
- return true;
+ continue;
if (*oldPseudoStyle != *newPseudoStyle ||
oldPseudoStyle->font().loadingCustomFonts() !=
newPseudoStyle->font().loadingCustomFonts()) {
@@ -1839,13 +1841,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 +2033,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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698