Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cf49afd596549fbf1850d1c19a93df8d6e2878eb
      
https://github.com/WebKit/WebKit/commit/cf49afd596549fbf1850d1c19a93df8d6e2878eb
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    A LayoutTests/fast/ruby/ruby-overhang-computed-expected.txt
    A LayoutTests/fast/ruby/ruby-overhang-computed.html
    A LayoutTests/fast/ruby/ruby-overhang-none-alias-expected.html
    A LayoutTests/fast/ruby/ruby-overhang-none-alias.html
    A LayoutTests/fast/ruby/ruby-overhang-spaces-expected.html
    A LayoutTests/fast/ruby/ruby-overhang-spaces-nbsp-expected.html
    A LayoutTests/fast/ruby/ruby-overhang-spaces-nbsp.html
    A LayoutTests/fast/ruby/ruby-overhang-spaces.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/inheritance.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-invalid-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-invalid.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-valid-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-valid.html
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/CSSValueKeywords.in
    M 
Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.h
    M Source/WebCore/style/values/primitives/StyleKeyword+Mappings.h

  Log Message:
  -----------
  [css-ruby] Implement the 'spaces' value for the ruby-overhang property
https://bugs.webkit.org/show_bug.cgi?id=318956
rdar://181808420

Reviewed by Antti Koivisto.

Update 'ruby-overhang' to the current CSS Ruby Layout grammar 'auto | spaces',
with 'none' as a legacy value alias of 'spaces'. Previously the property was
'auto | none', where 'none' fully disabled overhang.
https://drafts.csswg.org/css-ruby-1/#propdef-ruby-overhang

'ruby-overhang: spaces' allows a ruby annotation that is wider than its base to
overhang adjacent content only over "spaces": preserved white space, no-break
space and other space separators, half of the advance of a fullwidth opening
(inline-start) or closing (inline-end) punctuation, and a quarter of the advance
of a fullwidth middle dot punctuation (either side). 'auto' keeps the
user-agent-defined behavior. Because 'none' is now an alias of 'spaces', it no
longer fully disables overhang.

'none' is aliased to 'spaces' at parse time, so both the specified and computed
values serialize as 'spaces'. In layout, RubyFormattingContext caps the overhang
computed for the 'spaces' value to the overhangable advance at the adjacent 
edge,
computed by overhangableSpaceAdvance() from the adjacent edge character's class
plus already-laid-out geometry and the font size, without re-measuring text:
preserved white space and tabs use the word-separator box advance; no-break 
space
and other space separators use the advance by which the box's visual rect 
exceeds
its ink overflow at the edge; and fullwidth opening/closing/middle-dot 
punctuation
expose half/half/quarter of a fullwidth advance (one em), sharing the
fullWidthAdvance() helper with the existing 0.5ic overhang cap. The only case 
not
yet handled is a fullwidth punctuation advance reduced by 'text-spacing-trim'
(see FIXME).

* Source/WebCore/css/CSSValueKeywords.in: Add the 'spaces' keyword.
* Source/WebCore/css/CSSProperties.json: Update ruby-overhang to 'auto | spaces 
| none@(aliased-to=spaces)'.
* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* Source/WebCore/style/values/primitives/StyleKeyword+Mappings.h: Map the 
ruby-overhang keywords.
* 
Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp:
(WebCore::Layout::fullWidthAdvance): Added; the advance of one fullwidth 
character (one em).
(WebCore::Layout::halfOfAFullWidthCharacter): Build on fullWidthAdvance.
(WebCore::Layout::overhangableSpaceAdvance): Overhangable advance over adjacent 
spaces/punctuation.
(WebCore::Layout::RubyFormattingContext::overhangForAnnotationBefore): Cap 
'spaces' overhang to the adjacent trailing spaces.
(WebCore::Layout::RubyFormattingContext::overhangForAnnotationAfter): Cap 
'spaces' overhang to the adjacent leading spaces.
(WebCore::Layout::RubyFormattingContext::applyRubyOverhang): Both 'auto' and 
'spaces' overhang.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-valid.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-valid-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-invalid.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/parsing/ruby-overhang-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/inheritance.html:
* LayoutTests/fast/ruby/ruby-overhang-computed.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-computed-expected.txt: Added.
* LayoutTests/fast/ruby/ruby-overhang-spaces.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-spaces-expected.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-spaces-nbsp.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-spaces-nbsp-expected.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-none-alias.html: Added.
* LayoutTests/fast/ruby/ruby-overhang-none-alias-expected.html: Added.
* Source/WebCore/rendering/style/RenderStyleConstants.h:

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



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

Reply via email to