⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283312 in webkit


Ignore:
Timestamp:
Sep 30, 2021, 8:26:21 AM (5 years ago)
Author:
Alan Bujtas
Message:

(REGRESSION r282150) Missing background-color on inline box while hovering
https://bugs.webkit.org/show_bug.cgi?id=230977
<rdar://problem/83682736>

Reviewed by Antti Koivisto.

Source/WebCore:

Check if the RenderInline is still eligible for the modern line layout codepath after style change.

Test: fast/inline/inline-box-background-dynamic.html

  • layout/integration/LayoutIntegrationCoverage.cpp:

(WebCore::LayoutIntegration::canUseForRenderInlineChild):
(WebCore::LayoutIntegration::canUseForChild):
(WebCore::LayoutIntegration::canUseForLineLayoutAfterInlineBoxStyleChange):

  • layout/integration/LayoutIntegrationCoverage.h:
  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::canUseForAfterInlineBoxStyleChange):

  • layout/integration/LayoutIntegrationLineLayout.h:
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::styleDidChange):

LayoutTests:

  • fast/inline/inline-box-background-dynamic-expected.html: Added.
  • fast/inline/inline-box-background-dynamic.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r283311 r283312  
     12021-09-30  Alan Bujtas  <zalan@apple.com>
     2
     3        (REGRESSION r282150) Missing background-color on inline box while hovering
     4        https://bugs.webkit.org/show_bug.cgi?id=230977
     5        <rdar://problem/83682736>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/inline/inline-box-background-dynamic-expected.html: Added.
     10        * fast/inline/inline-box-background-dynamic.html: Added.
     11
    1122021-09-30  Antti Koivisto  <antti@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r283311 r283312  
     12021-09-30  Alan Bujtas  <zalan@apple.com>
     2
     3        (REGRESSION r282150) Missing background-color on inline box while hovering
     4        https://bugs.webkit.org/show_bug.cgi?id=230977
     5        <rdar://problem/83682736>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Check if the RenderInline is still eligible for the modern line layout codepath after style change.
     10
     11        Test: fast/inline/inline-box-background-dynamic.html
     12
     13        * layout/integration/LayoutIntegrationCoverage.cpp:
     14        (WebCore::LayoutIntegration::canUseForRenderInlineChild):
     15        (WebCore::LayoutIntegration::canUseForChild):
     16        (WebCore::LayoutIntegration::canUseForLineLayoutAfterInlineBoxStyleChange):
     17        * layout/integration/LayoutIntegrationCoverage.h:
     18        * layout/integration/LayoutIntegrationLineLayout.cpp:
     19        (WebCore::LayoutIntegration::LineLayout::canUseForAfterInlineBoxStyleChange):
     20        * layout/integration/LayoutIntegrationLineLayout.h:
     21        * rendering/RenderInline.cpp:
     22        (WebCore::RenderInline::styleDidChange):
     23
    1242021-09-30  Antti Koivisto  <antti@apple.com>
    225
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp

    r282874 r283312  
    474474}
    475475
     476static OptionSet<AvoidanceReason> canUseForRenderInlineChild(const RenderInline& renderInline, IncludeReasons includeReasons)
     477{
     478    OptionSet<AvoidanceReason> reasons;
     479
     480    if (renderInline.isSVGInline())
     481        SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
     482    if (renderInline.isRubyInline() || renderInline.isQuote())
     483        SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
     484    if (renderInline.requiresLayer())
     485        SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxNeedsLayer, reasons, includeReasons)
     486
     487    auto& style = renderInline.style();
     488    if (style.boxShadow() || !style.hangingPunctuation().isEmpty())
     489        SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
     490    if (style.hasBorder() || style.borderImage().hasImage())
     491        SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBorderOrBorderImage, reasons, includeReasons);
     492    if (style.hasBackground())
     493        SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackground, reasons, includeReasons);
     494    if (style.hasOutline())
     495        SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
     496    if (renderInline.isInFlowPositioned())
     497        SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons);
     498    if (renderInline.containingBlock()->style().lineBoxContain() != RenderStyle::initialLineBoxContain())
     499        SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
     500    auto fontAndTextReasons = canUseForFontAndText(renderInline, includeReasons);
     501    if (fontAndTextReasons)
     502        ADD_REASONS_AND_RETURN_IF_NEEDED(fontAndTextReasons, reasons, includeReasons);
     503    auto styleReasons = canUseForStyle(style, includeReasons);
     504    if (styleReasons)
     505        ADD_REASONS_AND_RETURN_IF_NEEDED(styleReasons, reasons, includeReasons);
     506
     507    return reasons;
     508}
     509
    476510static OptionSet<AvoidanceReason> canUseForChild(const RenderBlockFlow& flow, const RenderObject& child, IncludeReasons includeReasons)
    477511{
     
    544578    }
    545579
    546     if (is<RenderInline>(child)) {
    547         auto& renderInline = downcast<RenderInline>(child);
    548         if (renderInline.isSVGInline())
    549             SET_REASON_AND_RETURN_IF_NEEDED(ContentIsSVG, reasons, includeReasons);
    550         if (renderInline.isRubyInline() || renderInline.isQuote())
    551             SET_REASON_AND_RETURN_IF_NEEDED(ContentIsRuby, reasons, includeReasons);
    552         if (renderInline.requiresLayer())
    553             SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxNeedsLayer, reasons, includeReasons)
    554         if (flow.fragmentedFlowState() != RenderObject::NotInsideFragmentedFlow)
    555             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
    556 
    557         auto& style = renderInline.style();
    558         if (!isSupportedStyle(style))
    559             SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxHasUnsupportedStyle, reasons, includeReasons)
    560         if (style.hasBorder() || style.borderImage().hasImage())
    561             SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBorderOrBorderImage, reasons, includeReasons);
    562         if (style.hasBackground())
    563             SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackground, reasons, includeReasons);
    564         if (style.hasOutline())
    565             SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
    566         if (renderInline.isInFlowPositioned())
    567             SET_REASON_AND_RETURN_IF_NEEDED(ChildBoxIsFloatingOrPositioned, reasons, includeReasons);
    568         if (renderInline.containingBlock()->style().lineBoxContain() != RenderStyle::initialLineBoxContain())
    569             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons);
    570         auto fontAndTextReasons = canUseForFontAndText(downcast<RenderInline>(child), includeReasons);
    571         if (fontAndTextReasons)
    572             ADD_REASONS_AND_RETURN_IF_NEEDED(fontAndTextReasons, reasons, includeReasons);
    573         auto styleReasons = canUseForStyle(style, includeReasons);
    574         if (styleReasons)
    575             ADD_REASONS_AND_RETURN_IF_NEEDED(styleReasons, reasons, includeReasons);
    576 
    577         return reasons;
    578     }
     580    if (is<RenderInline>(child))
     581        return canUseForRenderInlineChild(downcast<RenderInline>(child), includeReasons);
    579582
    580583    SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
     
    697700}
    698701
     702bool canUseForLineLayoutAfterInlineBoxStyleChange(const RenderInline& renderer, StyleDifference)
     703{
     704    return canUseForRenderInlineChild(renderer, IncludeReasons::First).isEmpty();
     705}
     706
    699707}
    700708}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h

    r282874 r283312  
    105105bool canUseForLineLayout(const RenderBlockFlow&);
    106106bool canUseForLineLayoutAfterStyleChange(const RenderBlockFlow&, StyleDifference);
     107bool canUseForLineLayoutAfterInlineBoxStyleChange(const RenderInline&, StyleDifference);
    107108
    108109enum class IncludeReasons { First , All };
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r283311 r283312  
    124124}
    125125
     126bool LineLayout::canUseForAfterInlineBoxStyleChange(const RenderInline& inlineBox, StyleDifference diff)
     127{
     128    ASSERT(isEnabled());
     129    return canUseForLineLayoutAfterInlineBoxStyleChange(inlineBox, diff);
     130}
     131
    126132bool LineLayout::shouldSwitchToLegacyOnInvalidation() const
    127133{
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r283311 r283312  
    7171    static bool canUseFor(const RenderBlockFlow&);
    7272    static bool canUseForAfterStyleChange(const RenderBlockFlow&, StyleDifference);
     73    static bool canUseForAfterInlineBoxStyleChange(const RenderInline&, StyleDifference);
    7374
    7475    bool shouldSwitchToLegacyOnInvalidation() const;
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r282873 r283312  
    188188
    189189#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    190     if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this)) {
    191         if (diff >= StyleDifference::Repaint && selfNeedsLayout()) {
    192             // FIXME: Add support for partial invalidation.
    193             if (auto* container = LayoutIntegration::LineLayout::blockContainer(*this))
    194                 container->invalidateLineLayoutPath();
    195         } else
    196             lineLayout->updateStyle(*this, *oldStyle);
     190    if (diff >= StyleDifference::Repaint) {
     191        if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this)) {
     192            auto shouldInvalidateLineLayoutPath = selfNeedsLayout() || !LayoutIntegration::LineLayout::canUseForAfterInlineBoxStyleChange(*this, diff);
     193            if (shouldInvalidateLineLayoutPath)
     194                lineLayout->flow().invalidateLineLayoutPath();
     195            else
     196                lineLayout->updateStyle(*this, *oldStyle);
     197        }
    197198    }
    198199#endif
Note: See TracChangeset for help on using the changeset viewer.