[webkit-changes] [WebKit/WebKit] 0d53a8: bug[IFC][Ruby] Add support for ruby align on bidi ...

Alan Baradlay noreply at github.com
Sun Dec 10 08:42:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d53a80e5f559303b8b1377a6849a0b4914216bb
      https://github.com/WebKit/WebKit/commit/0d53a80e5f559303b8b1377a6849a0b4914216bb
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-12-10 (Sun, 10 Dec 2023)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineContentAligner.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentAligner.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLine.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/LineLayoutResult.h
    M Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.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/ruby/RubyFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.h

  Log Message:
  -----------
  bug[IFC][Ruby] Add support for ruby align on bidi content
https://bugs.webkit.org/show_bug.cgi?id=266153

Reviewed by Antti Koivisto.

This patch adds support for "ruby-align: space-around" on both bidi and non-bidi content.

"ruby-align: space-around" consists of 2 adjustments at run level.
- run spacing at justification opportunities (similar to text-align: justify)
- content offsetting to distribute one extra justification opportunity space before/after base content

In this patch we start computing the offset values at step #1 and pass them over to InlineContentBuilder where the final ruby processing happens (using visual order).
InlineContentAligner takes these offset values and adjusts (aligns) the display boxes accordingly.

What makes it a bit more verbose is the fact that while non-bidi base runs have the correct spacing (e.g. when annotation is wider than the base), we lose that information at
visual reordering (<- we essentially have a fast path for non-bidi content, where as we build the Line for line breaking we also compute horizontal content positions)
It simply means that while non-bidi content, offsetting means just moving content inside the base without pushing adjacent content/expanding enclosing inline boxes,
bidi content needs both (see AdjustContentOnlyInsideRubyBase).

* Source/WebCore/layout/formattingContexts/inline/InlineContentAligner.cpp:
(WebCore::Layout::shiftDisplayBox):
(WebCore::Layout::expandInlineBox):
(WebCore::Layout::alignmentOffset):
(WebCore::Layout::expandInlineBoxWithDescendants):
(WebCore::Layout::shiftRubyBaseContentByAlignmentOffset):
(WebCore::Layout::InlineContentAligner::applyRubyAlignSpaceAround):
(WebCore::Layout::InlineContentAligner::applyRubyBaseAlignmentOffset):
(WebCore::Layout::InlineContentAligner::applyRubyAlign): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineContentAligner.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLine.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
* Source/WebCore/layout/formattingContexts/inline/LineLayoutResult.h:
* Source/WebCore/layout/formattingContexts/inline/TextOnlySimpleLineBuilder.cpp:
(WebCore::Layout::TextOnlySimpleLineBuilder::layoutInlineContent):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):
(WebCore::Layout::InlineDisplayContentBuilder::processRubyContent):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp:
(WebCore::Layout::RubyFormattingContext::applyRubyAlignOnBaseContent):
(WebCore::Layout::RubyFormattingContext::applyRubyAlign):
(WebCore::Layout::RubyFormattingContext::applyAlignmentOffsetList):
(WebCore::Layout::applyRubyAlignOnBaseContent): Deleted.
* Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.h:

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




More information about the webkit-changes mailing list