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

Changeset 286789 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 11:01:10 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Add support for ink overflow on bidi inline boxes
https://bugs.webkit.org/show_bug.cgi?id=233968

Reviewed by Antti Koivisto.

  • layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:

(WebCore::Layout::InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary):
(WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
(WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForChildNode):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):

  • layout/formattingContexts/inline/InlineDisplayContentBuilder.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286786 r286789  
     12021-12-09  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Add support for ink overflow on bidi inline boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=233968
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
     9        (WebCore::Layout::InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary):
     10        (WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
     11        (WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForChildNode):
     12        (WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
     13        * layout/formattingContexts/inline/InlineDisplayContentBuilder.h:
     14
    1152021-12-09  Alan Bujtas  <zalan@apple.com>
    216
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp

    r286786 r286789  
    129129        , InlineDisplay::Box::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen }
    130130        , true
    131         , { } });
     131        , { }
     132    });
    132133}
    133134
     
    146147        , softLineBreakRunRect
    147148        , lineRun.expansion()
    148         , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
     149        , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() }
     150    });
    149151}
    150152
     
    160162        , lineBreakBoxRect
    161163        , lineRun.expansion()
    162         , { } });
     164        , { }
     165    });
    163166
    164167    auto& boxGeometry = formattingState().boxGeometry(layoutBox);
     
    186189        , inkOverflow()
    187190        , lineRun.expansion()
    188         , { } });
     191        , { }
     192    });
    189193    // Note that inline boxes are relative to the line and their top position can be negative.
    190194    // Atomic inline boxes are all set. Their margin/border/content box geometries are already computed. We just have to position them here.
     
    237241        , { }
    238242        , inlineBox.hasContent()
    239         , isFirstLastBox(inlineBox) });
     243        , isFirstLastBox(inlineBox)
     244    });
    240245    // This inline box showed up first on this line.
    241246    setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, true);
     
    262267        , { }
    263268        , inlineBox.hasContent()
    264         , isFirstLastBox(inlineBox) });
     269        , isFirstLastBox(inlineBox)
     270    });
    265271    // Middle or end of the inline box. Let's stretch the box as needed.
    266272    setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, false);
     273}
     274
     275void InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary(const Box& layoutBox, DisplayBoxes& boxes)
     276{
     277    // Geometries for inline boxes at bidi boundaries are computed at a post-process step.
     278    boxes.append({ m_lineIndex
     279        , InlineDisplay::Box::Type::NonRootInlineBox
     280        , layoutBox
     281        , UBIDI_DEFAULT_LTR
     282        , { }
     283        , { }
     284        , { }
     285        , { }
     286    });
    267287}
    268288
     
    378398        return *lowestCommonAncestor;
    379399    auto& enclosingDisplayBoxNodeForContainer = ensureDisplayBoxForContainer(containerBox.parent(), ancestorStack, boxes);
    380     boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, containerBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
     400    appendInlineDisplayBoxAtBidiBoundary(containerBox, boxes);
    381401    return createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(containerBox, boxes.size() - 1, enclosingDisplayBoxNodeForContainer, ancestorStack);
    382402}
     
    404424        auto logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
    405425        auto visualRect = InlineRect { lineBoxLogicalTop + logicalRect.top(), contentRightInVisualOrder, { }, logicalRect.height() };
    406         // FIXME: Add support for ink overflow.
    407426        if (!displayBox.isFirstForLayoutBox())
    408427            return displayBox.setLogicalRect(visualRect, visualRect);
     
    427446    };
    428447    afterInlineBoxContent();
     448
     449    auto computeInkOverflow = [&] {
     450        auto inkOverflow = displayBox.logicalRect();
     451        m_contentHasInkOverflow = computeBoxShadowInkOverflow(!m_lineIndex ? layoutBox.firstLineStyle() : layoutBox.style(), inkOverflow) || m_contentHasInkOverflow;
     452        displayBox.adjustInkOverflow(inkOverflow);
     453    };
     454    computeInkOverflow();
    429455
    430456    setInlineBoxGeometry(layoutBox, displayBox.logicalRect(), displayBox.isFirstForLayoutBox());
     
    499525            }
    500526            if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()) {
    501                 boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
     527                appendInlineDisplayBoxAtBidiBoundary(layoutBox, boxes);
    502528                createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(downcast<ContainerBox>(layoutBox), boxes.size() - 1, parentDisplayBoxNode, ancestorStack);
    503529                continue;
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h

    r286784 r286789  
    6060    void appendInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, bool linehasContent, DisplayBoxes&);
    6161    void appendSpanningInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, DisplayBoxes&);
     62    void appendInlineDisplayBoxAtBidiBoundary(const Box&, DisplayBoxes&);
    6263
    6364    void setInlineBoxGeometry(const Box&, const InlineRect&, bool isFirstInlineBoxFragment);
Note: See TracChangeset for help on using the changeset viewer.