[webkit-changes] [WebKit/WebKit] b6c95e: text-spacing: text-autospace: handle element bound...

Vitor Roriz noreply at github.com
Thu Oct 17 15:44:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b6c95e200020a32e1182f83a5e5b56b388d2977d
      https://github.com/WebKit/WebKit/commit/b6c95e200020a32e1182f83a5e5b56b388d2977d
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h
    M Source/WebCore/layout/formattingContexts/inline/InlineContentCache.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLine.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp

  Log Message:
  -----------
  text-spacing: text-autospace: handle element boundary spacing on IFC (display part) for non-bidi bidi content
https://bugs.webkit.org/show_bug.cgi?id=280718
rdar://137088291

Reviewed by Alan Baradlay.

At [1] we have implemented the layout part of handling element boundary spacing on IFC. Please read the
patch's commit message for a detailed description. There, we have produced a map between indexes
of InlineStartBox items to text spacing to be adjusted. This spacing was added to the width of
the InlineTextItem following the InlineStartBox added to the map. This is because the width of InlineStartBox
doesn't contribute for the overall width calculation during layout. Also, during layout it doesn't matter where
this spacing is added as we don't have a visual representation yet, it just matters that the spacing is
contributing for the width of the text content being processed.

Now we need to use this map for adjusting  display box of the content that needs adjustment.
We want to generate an effect such that the extra spacing appears in-between an element boundary. So, if
there are two <span> elements with text that require adjustment, the spacing should visually appear in-between
them and should not contribute to the width of such elements.

However, We have mentioned that during layout the spacing calculated is contributing to InlineTextItem's width.
Therefore, during the construction of the display box we should decrement such contribution from the correspondent
display box width and move the display box to the logical right by the same amount.

* At candidateContentForLine(...) we build InlineContentBreaker::ContinuousContent::RunList from our LineBuilder.m_inlineItemList
  -> m_inlineItemList still holds the same indexes we used for building our original text-spacing mapping side struct.
* At LineBuilder::processLineBreakingResult we use this ContinuousContent::RunList for building the Line:Runs that get appended to a Line
as a Line::Run.
* At InlineDisplayContentBuilder, we build the display boxes based on such Line::Run items.

Since our original map use indexes of InlineStartBox's, we use the start box's correspondent ContinuousContent::Run and Line::Run
to mark the necessary text-spacing adjustment to InlineDisplayContentBuilder.

Finally, at InlineDisplayContentBuilder::processNonBidiContent we adjust the display box based on such text-spacing adjustments,
decrementing its width (that was expanded during layout) and moving it to its logical right by the same amount for creating
the desired effect.

[1] https://commits.webkit.org/282917@main

* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::ContinuousContent::appendToRunList):
(WebCore::Layout::InlineContentBreaker::ContinuousContent::append):
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h:
(WebCore::Layout::InlineContentBreaker::ContinuousContent::Run::Run):
* Source/WebCore/layout/formattingContexts/inline/InlineContentCache.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layout):
* Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::append):
(WebCore::Layout::Line::appendInlineBoxStart):
(WebCore::Layout::Line::Run::Run):
* Source/WebCore/layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::Run::textSpacingAdjustment const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineCandidate::InlineContent::appendInlineItem):
(WebCore::Layout::LineBuilder::LineBuilder):
(WebCore::Layout::LineBuilder::candidateContentForLine):
(WebCore::Layout::LineBuilder::processLineBreakingResult):
(WebCore::Layout::LineBuilder::commitPartialContent):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list