Inline ruby does not get justified correctly
https://bugs.webkit.org/show_bug.cgi?id=137421
Source/WebCore:
Patch by Myles C. Maxfield <litherum@gmail.com> on 2014-10-08
Reviewed by Dave Hyatt.
We justify text in two passes: one counts expansion opportunities within a line,
and the other doles out widths and expansion amounts to constituent inline boxes.
This patch simply modifies both passes to descend into ruby bases. Once it has
done so, we then re-layout the ruby run with the newly found width.
Tests: fast/ruby/ruby-justification-hittest.html
fast/ruby/ruby-justification.html
* rendering/InlineBox.h:
(WebCore::InlineBox::setExpansion): updateRubyForJustifiedText() has to set the
expansion for an inline box, so make setExpansion() public.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::updateRubyForJustifiedText): Given values that have already been
computed in computeInlineDirectionPositionsForSegment(), adjust the widths and
expansion values for all the various pieces of ruby.
(WebCore::computeExpansionForJustifiedText): Call updateRubyForJustifiedText() if
necessary.
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): When
counting expansion opportunities in a line, include ruby bases.
* rendering/RenderRubyRun.h: Fix grammar in comment.
* rendering/RenderText.cpp:
(WebCore::RenderText::stringView): Give default arguments to function.
* rendering/RenderText.h: Ditto.
LayoutTests:
Reviewed by Dave Hyatt.
Test that ruby gets spaces inside the ruby base, and that hit testing the
ruby base gives us correct answers.
* fast/ruby/ruby-justification-expected.html: Added.
* fast/ruby/ruby-justification-hittest-expected.txt: Added.
* fast/ruby/ruby-justification-hittest.html: Added.
* fast/ruby/ruby-justification.html: Added.
* platform/mac/fast/ruby/bopomofo-rl-expected.txt: Ruby text gets the CSS
property text-align: justify, which worked prior to this patch. However, this
patch now justifies ruby bases, so now if there is text that is both a ruby
base and ruby text (such as ruby in ruby) it correctly gets justified. This
test does such, and therefore needs to be rebaselined.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed