| 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..86daec948ee12a2f79c2d611f54c155629a7498e 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()) {
|
| + firstLineContainer = toLayoutBlock(this)->firstLineContainer();
|
| + } 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)->firstLineStyleBlock()) {
|
| if (type == Cached)
|
| return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);
|
| return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE), style, firstLineBlock == layoutObject ? style : 0);
|
|
|