Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (283311 => 283312)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-09-30 14:53:33 UTC (rev 283311)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-09-30 15:26:21 UTC (rev 283312)
@@ -473,6 +473,40 @@
return reasons;
}
+static OptionSet<AvoidanceReason> canUseForRenderInlineChild(const RenderInline& renderInline, IncludeReasons includeReasons)
+{
+ OptionSet<AvoidanceReason> reasons;
+
+ if (renderInline.isSVGInline())
+ SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
+ if (renderInline.isRubyInline() || renderInline.isQuote())
+ SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
+ if (renderInline.requiresLayer())
+ SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxNeedsLayer, reasons, includeReasons)
+
+ auto& style = renderInline.style();
+ if (style.boxShadow() || !style.hangingPunctuation().isEmpty())
+ SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
+ if (style.hasBorder() || style.borderImage().hasImage())
+ SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBorderOrBorderImage, reasons, includeReasons);
+ if (style.hasBackground())
+ SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackground, reasons, includeReasons);
+ if (style.hasOutline())
+ SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
+ if (renderInline.isInFlowPositioned())
+ SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons);
+ if (renderInline.containingBlock()->style().lineBoxContain() != RenderStyle::initialLineBoxContain())
+ SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
+ auto fontAndTextReasons = canUseForFontAndText(renderInline, includeReasons);
+ if (fontAndTextReasons)
+ ADD_REASONS_AND_RETURN_IF_NEEDED(fontAndTextReasons, reasons, includeReasons);
+ auto styleReasons = canUseForStyle(style, includeReasons);
+ if (styleReasons)
+ ADD_REASONS_AND_RETURN_IF_NEEDED(styleReasons, reasons, includeReasons);
+
+ return reasons;
+}
+
static OptionSet<AvoidanceReason> canUseForChild(const RenderBlockFlow& flow, const RenderObject& child, IncludeReasons includeReasons)
{
OptionSet<AvoidanceReason> reasons;
@@ -543,40 +577,9 @@
return reasons;
}
- if (is<RenderInline>(child)) {
- auto& renderInline = downcast<RenderInline>(child);
- if (renderInline.isSVGInline())
- SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
- if (renderInline.isRubyInline() || renderInline.isQuote())
- SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
- if (renderInline.requiresLayer())
- SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxNeedsLayer, reasons, includeReasons)
- if (flow.fragmentedFlowState() != RenderObject::NotInsideFragmentedFlow)
- SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+ if (is<RenderInline>(child))
+ return canUseForRenderInlineChild(downcast<RenderInline>(child), includeReasons);
- auto& style = renderInline.style();
- if (!isSupportedStyle(style))
- SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
- if (style.hasBorder() || style.borderImage().hasImage())
- SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBorderOrBorderImage, reasons, includeReasons);
- if (style.hasBackground())
- SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackground, reasons, includeReasons);
- if (style.hasOutline())
- SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
- if (renderInline.isInFlowPositioned())
- SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons);
- if (renderInline.containingBlock()->style().lineBoxContain() != RenderStyle::initialLineBoxContain())
- SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
- auto fontAndTextReasons = canUseForFontAndText(downcast<RenderInline>(child), includeReasons);
- if (fontAndTextReasons)
- ADD_REASONS_AND_RETURN_IF_NEEDED(fontAndTextReasons, reasons, includeReasons);
- auto styleReasons = canUseForStyle(style, includeReasons);
- if (styleReasons)
- ADD_REASONS_AND_RETURN_IF_NEEDED(styleReasons, reasons, includeReasons);
-
- return reasons;
- }
-
SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
return reasons;
}
@@ -696,7 +699,12 @@
return canUseForLineLayout(blockContainer);
}
+bool canUseForLineLayoutAfterInlineBoxStyleChange(const RenderInline& renderer, StyleDifference)
+{
+ return canUseForRenderInlineChild(renderer, IncludeReasons::First).isEmpty();
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (283311 => 283312)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-09-30 14:53:33 UTC (rev 283311)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-09-30 15:26:21 UTC (rev 283312)
@@ -104,6 +104,7 @@
bool canUseForLineLayout(const RenderBlockFlow&);
bool canUseForLineLayoutAfterStyleChange(const RenderBlockFlow&, StyleDifference);
+bool canUseForLineLayoutAfterInlineBoxStyleChange(const RenderInline&, StyleDifference);
enum class IncludeReasons { First , All };
OptionSet<AvoidanceReason> canUseForLineLayoutWithReason(const RenderBlockFlow&, IncludeReasons);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (283311 => 283312)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-30 14:53:33 UTC (rev 283311)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-09-30 15:26:21 UTC (rev 283312)
@@ -123,6 +123,12 @@
return canUseForLineLayoutAfterStyleChange(flow, diff);
}
+bool LineLayout::canUseForAfterInlineBoxStyleChange(const RenderInline& inlineBox, StyleDifference diff)
+{
+ ASSERT(isEnabled());
+ return canUseForLineLayoutAfterInlineBoxStyleChange(inlineBox, diff);
+}
+
bool LineLayout::shouldSwitchToLegacyOnInvalidation() const
{
// FIXME: Support partial invalidation in LFC.
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (283311 => 283312)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2021-09-30 14:53:33 UTC (rev 283311)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2021-09-30 15:26:21 UTC (rev 283312)
@@ -187,13 +187,14 @@
}
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this)) {
- if (diff >= StyleDifference::Repaint && selfNeedsLayout()) {
- // FIXME: Add support for partial invalidation.
- if (auto* container = LayoutIntegration::LineLayout::blockContainer(*this))
- container->invalidateLineLayoutPath();
- } else
- lineLayout->updateStyle(*this, *oldStyle);
+ if (diff >= StyleDifference::Repaint) {
+ if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this)) {
+ auto shouldInvalidateLineLayoutPath = selfNeedsLayout() || !LayoutIntegration::LineLayout::canUseForAfterInlineBoxStyleChange(*this, diff);
+ if (shouldInvalidateLineLayoutPath)
+ lineLayout->flow().invalidateLineLayoutPath();
+ else
+ lineLayout->updateStyle(*this, *oldStyle);
+ }
}
#endif
}