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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2728383002: Make ::first-line invalidation work when added or removed. (Closed)
Patch Set: Fixed review 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/layout/LayoutObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index eaf131347ee76602bf0b2eefd5e9eff3e529bf2f..f9660903f4b0737c6183822d5baf5c0f4d9d1f0c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1930,6 +1930,36 @@ void LayoutObject::styleDidChange(StyleDifference diff,
oldStyle->backgroundLayers() != styleRef().backgroundLayers())
setBackgroundChangedSinceLastPaintInvalidation();
}
+
+ if (oldStyle && oldStyle->styleType() == PseudoIdNone)
+ applyPseudoStyleChanges(*oldStyle);
+}
+
+void LayoutObject::applyPseudoStyleChanges(const ComputedStyle& oldStyle) {
+ if (oldStyle.hasPseudoStyle(PseudoIdFirstLine) ||
+ styleRef().hasPseudoStyle(PseudoIdFirstLine))
+ applyFirstLineChanges(oldStyle);
+
+ // TODO(rune@opera.com): Move the invalidation for ::selection here.
+ // Instead of having a PaintInvalidationSelectionOnly PaintInvalidationType
+ // used for the element diff, we should use PaintInvalidationObject diff on
+ // the pseudo element style here instead.
+}
+
+void LayoutObject::applyFirstLineChanges(const ComputedStyle& oldStyle) {
+ if (oldStyle.hasPseudoStyle(PseudoIdFirstLine)) {
+ RefPtr<ComputedStyle> oldPseudoStyle =
+ oldStyle.getCachedPseudoStyle(PseudoIdFirstLine);
+ if (styleRef().hasPseudoStyle(PseudoIdFirstLine) && oldPseudoStyle) {
+ RefPtr<ComputedStyle> newPseudoStyle =
+ uncachedFirstLineStyle(mutableStyle());
+ if (newPseudoStyle) {
+ firstLineStyleDidChange(*oldPseudoStyle, *newPseudoStyle);
+ return;
+ }
+ }
+ }
+ setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange);
}
void LayoutObject::propagateStyleToAnonymousChildren() {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698