[webkit-changes] [WebKit/WebKit] 71747c: [IFC][Partial layout] InlineItemRange should be ab...

Alan Baradlay noreply at github.com
Sat Feb 11 13:30:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 71747ca98df193e477568a86acee0d4bd91eff25
      https://github.com/WebKit/WebKit/commit/71747ca98df193e477568a86acee0d4bd91eff25
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-02-11 (Sat, 11 Feb 2023)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h

  Log Message:
  -----------
  [IFC][Partial layout] InlineItemRange should be able to provide partial overflowing info
https://bugs.webkit.org/show_bug.cgi?id=252072

Reviewed by Antti Koivisto.

Now that InlineItemPosition has support for partial content (offset member), InlineItemRange (with start/end as InlineItemPosition) can hold
partial range information (e.g. when the range end points inside an InlineTextItem as the result of a mid-word break).
This enables us to remove PartialInlineItem and use LineContent::committedRange (InlineItemRange) instead.

Before having partial support on InlineItemPosition, range was a simple [first index, last index + 1] struct
and we used PartialInlineItem to point inside the trailing InlineItem (offset) in case of mid-word break, which now can
be done using InlineItemRange.

e.g.
content:          "first second"
inline item list: [first][ ][second]

[first][ ]   -> [0, 0][2, 0]
[second]     -> [2, 0][3, 0]

[fir]        -> [0, 0][0, 3]
[st][ ]      -> [0, 3][2, 0]
[seco]       -> [2, 0][2, 4]
[nd]         -> [2, 4][3, 0]

* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::leadingInlineItemPositionForNextLine): This returns the end of the committed range as the leading position for the next line (with the speculative fix of moving the index if we get stuck on a partial offset)
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
(WebCore::Layout::indexOfFirstInlineItemForNextLine): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::logicalTopForNextLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
(WebCore::Layout::LineBuilder::computedIntrinsicWidth):
(WebCore::Layout::LineBuilder::initialize): Use the incoming needsLayoutRange to check if there's partial leading content -this replaces PreviousLine's PartialInlineItem.
(WebCore::Layout::LineBuilder::close):
(WebCore::Layout::partialOverflowingContent): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h: Move PreviousLine out of LineBuilder. It does not need to have PartialInlineItem anymore. We use range instead.
(WebCore::Layout::InlineItemPosition::operator== const):
(WebCore::Layout::PartialInlineItem::inlineItemIndex const): Deleted.
(WebCore::Layout::PartialInlineItem::endOffset const): Deleted.
(WebCore::Layout::PartialInlineItem::PartialInlineItem): Deleted.

Canonical link: https://commits.webkit.org/260158@main




More information about the webkit-changes mailing list