[webkit-changes] [WebKit/WebKit] 8f9288: Remove LineBox::rootInlineBoxAlignmentOffset

Alan Baradlay noreply at github.com
Tue Jan 3 17:48:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f928849b0796ce12b76247ce99b78f17cafa008
      https://github.com/WebKit/WebKit/commit/8f928849b0796ce12b76247ce99b78f17cafa008
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-01-03 (Tue, 03 Jan 2023)

  Changed paths:
    M LayoutTests/platform/ios/fast/text/international/bidi-neutral-run-expected.txt
    M LayoutTests/platform/ios/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
    M LayoutTests/platform/mac/fast/text/international/bidi-neutral-run-expected.txt
    M Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBox.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBox.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp

  Log Message:
  -----------
  Remove LineBox::rootInlineBoxAlignmentOffset
https://bugs.webkit.org/show_bug.cgi?id=250030

Reviewed by Antti Koivisto.

text-align property can introduce a gap between the line box and the root inline box.
e.g.
  <div style="width: 1000px; text-align: right">
    right aligned text
  </div>
The visual left of the root inline box is > 0 (provided the text width is < 1000px)

However in logical context, the root inline box's left is always 0 while LineBox::rootInlineBoxAlignmentOffset returns the offset.
Because of this, we usually do "rootInlineBox.left() + LineBox::rootInlineBoxAlignmentOffset()"" to find the actual logical left of the root inline box.

In this patch, we change this behavior by offsetting the root inline box/removing LineBox::rootInlineBoxAlignmentOffset.
This patch fixes some logic issues which were hidden by the fact that the root inline box's left was always assumed to be 0.
(and it is also in preparation for fixing webkit.org/b/249974)

* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:
(WebCore::Layout::InlineLevelBox::logicalRight const):
(WebCore::Layout::InlineLevelBox::createRootInlineBox):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBox.cpp:
(WebCore::Layout::LineBox::LineBox):
(WebCore::Layout::LineBox::logicalRectForTextRun const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBox.h:
(WebCore::Layout::LineBox::rootInlineBoxAlignmentOffset const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::adjustOutsideListMarkersPosition):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):
(WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
(WebCore::Layout::InlineDisplayContentBuilder::flipRootInlineBoxRectToVisualForWritingMode const):
(WebCore::Layout::InlineDisplayContentBuilder::movePointHorizontallyForWritingMode const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::InlineDisplayLineBuilder::build const):

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




More information about the webkit-changes mailing list