Disallow ruby base from having leading or trailing expansions
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Apr 2015 20:29:23 +0000 (20:29 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Apr 2015 20:29:23 +0000 (20:29 +0000)
commitb6bb93f71a80e9d1bd1515e3f9a9d8c4ce956ca3
tree389d958f99342f92383ca1b9fc92662cad9b4879
parent1d53747c8d3f19488283b3b2c63420845661f3e0
Disallow ruby base from having leading or trailing expansions
https://bugs.webkit.org/show_bug.cgi?id=142608

Reviewed by David Hyatt.

Source/WebCore:

If we determine that a ruby base should have either a leading or trailing expansion,
we shunt that expansion over to the neighboring RenderText, assuming one exists. This
requires that we teach RenderText how to force leading or trailing expansions if one
wouldn't naturally be present.

Tests: fast/ruby/ruby-expansion-cjk-2.html
       fast/ruby/ruby-expansion-cjk-3.html
       fast/ruby/ruby-expansion-cjk-4.html
       fast/ruby/ruby-expansion-cjk-5.html
       fast/ruby/ruby-expansion-cjk.html

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::removeChild): Delete contentIsKnownToFollow.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::expansionBehavior): Support forced leading and trailing
expansions.
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::expansionBehavior): Moved to .cpp
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::updateRubyForJustifiedText): Perform relayout even if
there are no expansions left. This is so that ruby bases with no expansions will get
centered.
(WebCore::expansionBehaviorForInlineTextBox): Update to inspect neighboring rubies.
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): Use updated
expansionBehaviorForInlineTextBox(). Also center ruby bases if they have no expansion
opportunities.
(WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns): Use nullptr.
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): Ditto.
* rendering/RenderText.cpp:
(WebCore::RenderText::RenderText): Delete contentIsKnownToFollow.
* rendering/RenderText.h:
(WebCore::RenderText::contentIsKnownToFollow): Deleted.
(WebCore::RenderText::setContentIsKnownToFollow): Deleted.

LayoutTests:

Test combinations of CJK, Latin, ruby-in-ruby, simple text codepath, complex
text codepath, RTL, and LTR codepaths.

* fast/ruby/positioned-ruby-text-expected.txt:
* fast/ruby/positioned-ruby-text.html:
* fast/ruby/resources/green.png: Added.
* fast/ruby/resources/ruby-expansion.svg: Added.
* fast/ruby/ruby-expansion-cjk-2-expected.html: Added.
* fast/ruby/ruby-expansion-cjk-2.html: Added.
* fast/ruby/ruby-expansion-cjk-3-expected.html: Added.
* fast/ruby/ruby-expansion-cjk-3.html: Added.
* fast/ruby/ruby-expansion-cjk-4-expected.html: Added.
* fast/ruby/ruby-expansion-cjk-4.html: Added.
* fast/ruby/ruby-expansion-cjk-5-expected.html: Added.
* fast/ruby/ruby-expansion-cjk-5.html: Added.
* fast/ruby/ruby-expansion-cjk-expected.html: Added.
* fast/ruby/ruby-expansion-cjk.html: Added.
* fast/ruby/ruby-justification-expected.html:
* fast/ruby/ruby-justification.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/ruby/positioned-ruby-text-expected.txt
LayoutTests/fast/ruby/positioned-ruby-text.html
LayoutTests/fast/ruby/resources/green.png [new file with mode: 0644]
LayoutTests/fast/ruby/resources/ruby-expansion.svg [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-2-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-2.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-3-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-3.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-4-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-4.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-5-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-5.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk-expected.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-expansion-cjk.html [new file with mode: 0644]
LayoutTests/fast/ruby/ruby-justification-expected.html
LayoutTests/fast/ruby/ruby-justification.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderText.h