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 21e6e9cd7f463c54dd4d7ea778c4bf3770bf49ad..6eff4c82fd77ef5a0083738c0bd244bc39a5877c 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
@@ -725,11 +725,6 @@ bool LayoutObject::skipInvalidationWhenLaidOutChildren() const |
return !hasBoxEffect(); |
} |
-LayoutBlock* LayoutObject::firstLineBlock() const |
-{ |
- return nullptr; |
-} |
- |
static inline bool objectIsRelayoutBoundary(const LayoutObject* object) |
{ |
// FIXME: In future it may be possible to broaden these conditions in order to improve performance. |
@@ -1837,12 +1832,25 @@ void LayoutObject::setPseudoStyle(PassRefPtr<ComputedStyle> pseudoStyle) |
void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, const ComputedStyle& newStyle) |
{ |
StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); |
- if (diff.hasDifference()) { |
- // TODO(rune@opera.com): We should use the diff to determine whether a repaint vs. layout |
- // is needed, but for now just assume a layout will be required. The diff code |
- // in LayoutObject::setStyle would need to be factored out so that it could be reused. |
- setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidationReason::StyleChange); |
+ |
+ if (diff.needsPaintInvalidation() || diff.textDecorationOrColorChanged()) { |
+ LayoutBlockFlow* firstLineContainer = nullptr; |
+ if (canHaveFirstLineOrFirstLetterStyle()) { |
chrishtr
2015/12/03 18:41:56
It seems it would be cleaner to make firstLineStyl
Xianzhu
2015/12/03 19:10:40
That would need to duplicate more than half of thi
Xianzhu
2015/12/03 19:45:13
I think it might be be better to separate FIRST_LI
mstensho (USE GERRIT)
2015/12/03 19:58:02
FWIW, I think what we already have here is good.
|
+ firstLineContainer = toLayoutBlock(this)->nearestInnerBlockWithFirstLine(); |
+ } else if (isLayoutInline()) { |
+ if (InlineBox* firstLineBox = toLayoutInline(this)->firstLineBoxIncludingCulling()) { |
+ if (firstLineBox->isFirstLineStyle()) |
+ firstLineContainer = toLayoutBlockFlow(containingBlock()); |
+ } |
+ } |
+ if (firstLineContainer) { |
+ firstLineContainer->invalidateDisplayItemClientsOfFirstLine(); |
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
+ firstLineContainer->setShouldDoFullPaintInvalidation(); |
+ } |
} |
+ if (diff.needsLayout()) |
+ setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); |
} |
void LayoutObject::markContainingBlocksForOverflowRecalc() |
@@ -2802,8 +2810,8 @@ static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS |
if (layoutObject->isBeforeOrAfterContent()) |
layoutObjectForFirstLineStyle = layoutObject->parent(); |
- if (layoutObjectForFirstLineStyle->isLayoutBlockFlow() || layoutObjectForFirstLineStyle->isLayoutButton()) { |
- if (LayoutBlock* firstLineBlock = layoutObjectForFirstLineStyle->firstLineBlock()) { |
+ if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) { |
+ if (LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFirstLineStyle)->enclosingFirstLineStyleBlock()) { |
if (type == Cached) |
return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); |
return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE), style, firstLineBlock == layoutObject ? style : 0); |