Justified ruby can cause lines to grow beyond their container
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 19:39:17 +0000 (19:39 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2015 19:39:17 +0000 (19:39 +0000)
commit804a30138fe4c7c2a9f6d301ed9c0d8469e484c8
treed4f12e09e0e14edfbd5368d51e66fb6a32764d2b
parentf80867fcbedc30fb7a7d28a34ac5ce8bee9e0eb6
Justified ruby can cause lines to grow beyond their container
https://bugs.webkit.org/show_bug.cgi?id=141732

Reviewed by David Hyatt.

Source/WebCore:

After we re-layout RenderRubyRuns, this can change the environment upon which
ruby's overhang calculation is sensitive to. Before this patch, we would recalculate
the overhang after the RenderRubyRun gets relaid out. However, doing such causes the
effective width of the RenderRubyRun to change, which causes out subsequent
justification calculations to be off.

Therefore, we have a cycle; the amount of ruby overhang can change the justification
in a line, and the layout of the line affects the ruby overhang calculation. Instead
of performing a layout in a loop until it converges, this patch simply observes that
having a flush right edge is more valuable than having a perfectly correct overhang.
It therefore simply removes the secondary overhang calculation.

Test: fast/text/ruby-justification-flush.html

* rendering/RenderBlockFlow.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::updateRubyForJustifiedText):
(WebCore::RenderBlockFlow::computeExpansionForJustifiedText):
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):

LayoutTests:

Make sure that the right edge of a justified ruby line matches up with
the same line without ruby.

* fast/text/ruby-justification-flush-expected.html: Added.
* fast/text/ruby-justification-flush.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180278 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/ruby-justification-flush-expected.html [new file with mode: 0644]
LayoutTests/fast/text/ruby-justification-flush.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlockFlow.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp