RESOLVED FIXED295694
Changing ruby-overhang values does not trigger layout
https://bugs.webkit.org/show_bug.cgi?id=295694
Summary Changing ruby-overhang values does not trigger layout
brian
Reported 2025-07-10 01:23:40 PDT
The `ruby-overhang` property can have values of `none` or `auto`. Switching between these values requires a DOM re-render or other recalculations for it to be applied. Steps to reproduce: 1. Navigate to https://developer.mozilla.org/en-US/docs/Web/CSS/ruby-overhang#try_it 2. Switch between the options `ruby-overhang: auto;` and `ruby-overhang: none;` in the interactive example The changes are not applied, but if I use the following declarations in the interactive example (the options are editable in the "Try it" section): ``` ruby-overhang: auto; ruby-position: over; ``` And: ``` ruby-overhang: none; ruby-position: under; ``` Changing the ruby-overhang and the ruby-position properties applies the styles as expected.
Attachments
Patch (4.42 KB, patch)
2025-08-22 20:15 PDT, alan
no flags
[fast-cq]Patch (4.41 KB, patch)
2025-08-23 05:11 PDT, alan
no flags
Radar WebKit Bug Importer
Comment 1 2025-07-17 01:24:33 PDT
fantasai
Comment 2 2025-07-28 12:13:07 PDT
I believe the problem is in rareInheritedDataChangesRequiresLayout() https://searchfox.org/wubkat/source/Source/WebCore/rendering/style/RenderStyle.cpp#925 We need to return true if ruby-overhang changes, just like we do for ruby-position (see the line reading `first.rubyPosition != second.rubyPosition`; we need to add one for `first.rubyOverhang != second.rubyOverhang`). Brian, if you want to take a stab at submitting a WPT test for this, I can do the code changes for you so you don't have to set up a development environment. Alternatively if you want to try submitting a patch yourself, this seems like a good first bug. :) The WPT repo is at https://github.com/web-platform-tests/wpt Probably the easiest thing would be to search the /css directory for a few tests that use the `reftest-wait` class and copy how they're written. You need to trigger layout with the old value, then change it, then trigger layout with the new value, and then remove the reftest-wait.
brian
Comment 3 2025-08-22 04:33:54 PDT
Thanks a lot for the hints. I was looking at creating a `reftest-wait` test for this, but I'm a bit lost, so I'd prefer to leave that to someone else who'd be faster at this if that's okay! I appreciate the encouragement, though.
alan
Comment 4 2025-08-22 20:15:47 PDT
Tim Nguyen (:ntim)
Comment 5 2025-08-23 03:24:01 PDT
Comment on attachment 476496 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=476496&action=review > COMMIT_MESSAGE:1 > +changing ruby-overhang values does not trigger style recalculation Changing ruby-overhang values does not trigger layout is probably more accurate > LayoutTests/imported/w3c/web-platform-tests/css/css-ruby/ruby-overhang-dynamic-ref.html:10 > + font-size: 8px; /* annotation -> 50% */ (here and the -expected.html): you could use 50% directly unless there's something preventing that :)
alan
Comment 6 2025-08-23 05:11:21 PDT
Created attachment 476497 [details] [fast-cq]Patch
EWS
Comment 7 2025-08-23 07:08:15 PDT
Committed 299091@main (33300160d33d): <https://commits.webkit.org/299091@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 476497 [details].
Tim Nguyen (:ntim)
Comment 8 2025-08-24 05:05:41 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/54489
Note You need to log in before you can comment on or make changes to this bug.