[webkit-changes] [WebKit/WebKit] 0efbdb: [Ruby] duolingo.com: Listening text is cut off on ...

Alan Baradlay noreply at github.com
Tue Oct 29 08:46:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0efbdbf5ca5aab2f41694b72df8c1a830618b1bc
      https://github.com/WebKit/WebKit/commit/0efbdbf5ca5aab2f41694b72df8c1a830618b1bc
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

  Changed paths:
    A LayoutTests/fast/ruby/breaking-opportunity-between-bases-expected.html
    A LayoutTests/fast/ruby/breaking-opportunity-between-bases.html
    M Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h
    M Source/WebCore/rendering/InlineWalker.h
    M Source/WebCore/rendering/RenderBlockFlow.cpp

  Log Message:
  -----------
  [Ruby] duolingo.com: Listening text is cut off on several prompts
https://bugs.webkit.org/show_bug.cgi?id=282235
<rdar://131571396>

Reviewed by Antti Koivisto.

This change fixes ruby content (min) sizing when there's breaking opportunity between adjacent bases.
Legacy preferred width computation ignores soft wrap opportunities between inline boxes

e.g. <span>A</span><span>B</span> (assume language rules allow to break between A and B)

^ RenderBlockFlow::computeInlinePreferredLogicalWidths simply does not check for such breaking opportunities between these <span>s.
This is specific to legacy preferred width codepath as IFC runs regular layout which finds such breaking positions (also same content works fine when instead of using 'width: min-width", we force non-preferred with codepath by "width: 0px;")

1. In RenderBlockFlow::computeInlinePreferredLogicalWidths, when at the end of the ruby base, look forward
by calling hasTrailingSoftWrapOpportunity to check for breaking opportunity.
2. hasTrailingSoftWrapOpportunity collects adjacent renderers and calls ICU to figure out whether content can be split.

* LayoutTests/fast/ruby/breaking-opportunity-between-bases-expected.html: Added.
* LayoutTests/fast/ruby/breaking-opportunity-between-bases.html: Added.
* Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp:
(WebCore::Layout::RubyFormattingContext::isAtSoftWrapOpportunity):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::mayBreakInBetween):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h:
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForPreferredWidthComputation):
* Source/WebCore/rendering/InlineWalker.h:
(WebCore::InlineWalker::InlineWalker):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::trailingRubyBaseAndAdjacentTextContent):
(WebCore::hasTrailingSoftWrapOpportunity):
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):

Canonical link: https://commits.webkit.org/285835@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