Title: [179366] trunk
Revision
179366
Author
[email protected]
Date
2015-01-29 14:03:40 -0800 (Thu, 29 Jan 2015)

Log Message

Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
Japanese line breaking rules need to be respected before and after Ruby.
https://bugs.webkit.org/show_bug.cgi?id=91588
<rdar://problem/17306535>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/ruby/ruby-punctuation-avoid-breaking.html.

This patch has to add support for following line breaking rules at both
sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
just hard-code the rules (and apply this hard-coding only to Ruby and not
to other inline replaced elements).

For breaking after a Ruby we do better. The Ruby run caches its prior characters
and line layout is able to obtain them and use them when deciding whether or not
to break. This means for the "after" side of a Ruby, we're able to behave the same
as if no Ruby was used.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
* rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* rendering/RenderRubyBase.h:
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
(WebCore::RenderRubyRun::canBreakBefore):
* rendering/RenderRubyRun.h:
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore):
* rendering/RenderRubyText.h:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::canBreakAtThisPosition):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):

LayoutTests:

* fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
* fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
* fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
* fast/ruby/ruby-punctuation-avoid-breaking.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (179365 => 179366)


--- trunk/LayoutTests/ChangeLog	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/LayoutTests/ChangeLog	2015-01-29 22:03:40 UTC (rev 179366)
@@ -1,3 +1,18 @@
+2015-01-20  David Hyatt  <[email protected]>
+
+        Japanese line breaking rules need to be respected before and after Ruby.
+        https://bugs.webkit.org/show_bug.cgi?id=91588
+        <rdar://problem/17306535>
+
+        Reviewed by Dean Jackson.
+
+        * fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt:
+        * fast/ruby/ruby-block-style-not-updated-with-before-after-content.html:
+        * fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt:
+        * fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html:
+        * fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added.
+        * fast/ruby/ruby-punctuation-avoid-breaking.html: Added.
+
 2015-01-29  Alexey Proskuryakov  <[email protected]>
 
         Mark more tests as slow in debug.

Modified: trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt (179365 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt	2015-01-29 22:03:40 UTC (rev 179366)
@@ -4,9 +4,9 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderRuby (block) {RUBY} at (0,0) size 784x384 [color=#0000FF]
-        RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]
-          RenderText at (0,0) size 512x128
-            text run at (0,0) width 512: "1234"
+        RenderInline (generated) at (0,0) size 640x128 [color=#FFA500]
+          RenderText at (0,0) size 640x128
+            text run at (0,0) width 640: "1234 "
         RenderRubyRun (anonymous) at (0,128) size 512x128
           RenderRubyBase (anonymous) at (0,0) size 512x128
             RenderText {#text} at (0,0) size 512x128

Modified: trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html (179365 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html	2015-01-29 22:03:40 UTC (rev 179366)
@@ -4,12 +4,12 @@
 <style>
 #test::before
 {
-    content: "1234";
+    content: "1234 ";
     color: orange;
 }
 #test::after
 {
-    content: "4578";
+    content: " 4578";
     color: yellow;
 }
 </style>

Modified: trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt (179365 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt	2015-01-29 22:03:40 UTC (rev 179366)
@@ -4,10 +4,10 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderBlock (anonymous) at (0,0) size 784x384
-        RenderRuby (inline) {RUBY} at (0,0) size 512x384 [color=#0000FF]
-          RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]
-            RenderText at (0,0) size 512x128
-              text run at (0,0) width 512: "1234"
+        RenderRuby (inline) {RUBY} at (0,0) size 640x384 [color=#0000FF]
+          RenderInline (generated) at (0,0) size 640x128 [color=#FFA500]
+            RenderText at (0,0) size 640x128
+              text run at (0,0) width 640: "1234 "
           RenderRubyRun (anonymous) at (0,128) size 512x128
             RenderRubyBase (anonymous) at (0,0) size 512x128
               RenderText {#text} at (0,0) size 512x128

Modified: trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html (179365 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html	2015-01-29 22:03:40 UTC (rev 179366)
@@ -4,12 +4,12 @@
 <style>
 #test::before
 {
-    content: "1234";
+    content: "1234 ";
     color: orange;
 }
 #test::after
 {
-    content: "4578";
+    content: " 4578";
     color: yellow;
 }
 </style>

Added: trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html (0 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html	2015-01-29 22:03:40 UTC (rev 179366)
@@ -0,0 +1,17 @@
+<html lang="ja">
+<head>
+<meta http-equiv ="content-type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<div>
+<p>Japanese Line breaking rule "Kinsoku" Test Case. We should not break before or after the Ruby.
+<div style="position: absolute; top: 50px; left: 3%; width: 100px;">
+「<ruby>直帰<rt>ちょっき</rt></ruby>」
+</div>
+<div>
+<div style="position: absolute; top: 50px; left: 200px;-webkit-writing-mode: vertical-rl; height: 100px;">
+「<ruby>直帰<rt>ちょっき</rt></ruby>」
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html (0 => 179366)


--- trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html	2015-01-29 22:03:40 UTC (rev 179366)
@@ -0,0 +1,17 @@
+<html lang="ja">
+<head>
+<meta http-equiv ="content-type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<div>
+<p>Japanese Line breaking rule "Kinsoku" Test Case. We should not break before or after the Ruby.
+<div style="position: absolute; top: 50px; left: 3%; width: 40px;">
+「<ruby>直帰<rt>ちょっき</rt></ruby>」
+</div>
+<div>
+<div style="position: absolute; top: 50px; left: 200px;-webkit-writing-mode: vertical-rl; height: 40px;">
+「<ruby>直帰<rt>ちょっき</rt></ruby>」
+</div>
+
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (179365 => 179366)


--- trunk/Source/WebCore/ChangeLog	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/ChangeLog	2015-01-29 22:03:40 UTC (rev 179366)
@@ -1,3 +1,43 @@
+2015-01-20  David Hyatt  <[email protected]>
+
+        Japanese line breaking rules need to be respected before and after Ruby.
+        https://bugs.webkit.org/show_bug.cgi?id=91588
+        <rdar://problem/17306535>
+
+        Reviewed by Dean Jackson.
+
+        Added fast/ruby/ruby-punctuation-avoid-breaking.html.
+
+        This patch has to add support for following line breaking rules at both
+        sides of a Ruby boundary. For breaking before a Ruby, unfortunately we
+        just hard-code the rules (and apply this hard-coding only to Ruby and not
+        to other inline replaced elements).
+
+        For breaking after a Ruby we do better. The Ruby run caches its prior characters
+        and line layout is able to obtain them and use them when deciding whether or not
+        to break. This means for the "after" side of a Ruby, we're able to behave the same
+        as if no Ruby was used.
+
+        * rendering/RenderBlockFlow.h:
+        (WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+        * rendering/RenderRubyBase.cpp:
+        (WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
+        * rendering/RenderRubyBase.h:
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::RenderRubyRun):
+        (WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator):
+        (WebCore::RenderRubyRun::canBreakBefore):
+        * rendering/RenderRubyRun.h:
+        * rendering/RenderRubyText.cpp:
+        (WebCore::RenderRubyText::canBreakBefore):
+        * rendering/RenderRubyText.h:
+        * rendering/line/BreakingContextInlineHeaders.h:
+        (WebCore::BreakingContext::handleReplaced):
+        (WebCore::BreakingContext::canBreakAtThisPosition):
+        (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
+
 2015-01-28  Beth Dakin  <[email protected]>
 
         Remove more Mountain Lion code from WebCore

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.h	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h	2015-01-29 22:03:40 UTC (rev 179366)
@@ -457,7 +457,9 @@
     
     virtual void computeColumnCountAndWidth();
     virtual bool requiresColumns(int) const;
-
+    
+    virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) {};
+    
 private:
     bool recomputeLogicalWidthAndColumnWidth();
     LayoutUnit columnGap() const;

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-01-29 22:03:40 UTC (rev 179366)
@@ -1178,6 +1178,7 @@
 
         WordMeasurements wordMeasurements;
         end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
+        cachePriorCharactersIfNeeded(renderTextInfo.m_lineBreakIterator);
         renderTextInfo.m_lineBreakIterator.resetPriorContext();
         if (resolver.position().atEnd()) {
             // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with!

Modified: trunk/Source/WebCore/rendering/RenderRubyBase.cpp (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyBase.cpp	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyBase.cpp	2015-01-29 22:03:40 UTC (rev 179366)
@@ -160,4 +160,11 @@
     logicalWidth -= inset;
 }
 
+void RenderRubyBase::cachePriorCharactersIfNeeded(const LazyLineBreakIterator& lineBreakIterator)
+{
+    auto* run = rubyRun();
+    if (run)
+        run->setCachedPriorCharacters(lineBreakIterator.lastCharacter(), lineBreakIterator.secondToLastCharacter());
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderRubyBase.h (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyBase.h	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyBase.h	2015-01-29 22:03:40 UTC (rev 179366)
@@ -56,6 +56,8 @@
         m_initialOffset = 0;
         m_isAfterExpansion = true;
     }
+    
+    virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) override;
 
 private:
     virtual bool isRubyBase() const override { return true; }

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2015-01-29 22:03:40 UTC (rev 179366)
@@ -45,6 +45,8 @@
 
 RenderRubyRun::RenderRubyRun(Document& document, Ref<RenderStyle>&& style)
     : RenderBlockFlow(document, WTF::move(style))
+    , m_lastCharacter(0)
+    , m_secondToLastCharacter(0)
 {
     setReplaced(true);
     setInline(true);
@@ -349,4 +351,17 @@
         endOverhang = std::min(endOverhang, std::min(downcast<RenderText>(*endRenderer).minLogicalWidth(), halfWidthOfFontSize));
 }
 
+void RenderRubyRun::updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator& iterator) const
+{
+    iterator.setPriorContext(m_lastCharacter, m_secondToLastCharacter);
+}
+
+bool RenderRubyRun::canBreakBefore(const LazyLineBreakIterator& iterator) const
+{
+    RenderRubyText* rubyText = this->rubyText();
+    if (!rubyText)
+        return true;
+    return rubyText->canBreakBefore(iterator);
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.h (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyRun.h	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.h	2015-01-29 22:03:40 UTC (rev 179366)
@@ -67,6 +67,14 @@
 
     static RenderRubyRun* staticCreateRubyRun(const RenderObject* parentRuby);
     
+    void updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator&) const;
+    void setCachedPriorCharacters(UChar last, UChar secondToLast)
+    {
+        m_lastCharacter = last;
+        m_secondToLastCharacter = secondToLast;
+    }
+    bool canBreakBefore(const LazyLineBreakIterator&) const;
+    
 protected:
     RenderRubyBase* createRubyBase() const;
 
@@ -75,6 +83,10 @@
     virtual const char* renderName() const override { return "RenderRubyRun (anonymous)"; }
     virtual bool createsAnonymousWrapper() const override { return true; }
     virtual void removeLeftoverAnonymousBlock(RenderBlock*) override { }
+
+private:
+    UChar m_lastCharacter;
+    UChar m_secondToLastCharacter;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderRubyText.cpp (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyText.cpp	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyText.cpp	2015-01-29 22:03:40 UTC (rev 179366)
@@ -93,4 +93,45 @@
     return true;
 }
 
+bool RenderRubyText::canBreakBefore(const LazyLineBreakIterator& iterator) const
+{
+    // FIXME: It would be nice to improve this so that it isn't just hard-coded, but lookahead in this
+    // case is particularly problematic.
+
+    if (!iterator.priorContextLength())
+        return true;
+    UChar ch = iterator.lastCharacter();
+    ULineBreak lineBreak = (ULineBreak)u_getIntPropertyValue(ch, UCHAR_LINE_BREAK);
+    // UNICODE LINE BREAKING ALGORITHM
+    // http://www.unicode.org/reports/tr14/
+    // And Requirements for Japanese Text Layout, 3.1.7 Characters Not Starting a Line
+    // http://www.w3.org/TR/2012/NOTE-jlreq-20120403/#characters_not_starting_a_line
+    switch (lineBreak) {
+    case U_LB_NONSTARTER:
+    case U_LB_CLOSE_PARENTHESIS:
+    case U_LB_CLOSE_PUNCTUATION:
+    case U_LB_EXCLAMATION:
+    case U_LB_BREAK_SYMBOLS:
+    case U_LB_INFIX_NUMERIC:
+    case U_LB_ZWSPACE:
+    case U_LB_WORD_JOINER:
+        return false;
+    default:
+        break;
+    }
+    // Special care for Requirements for Japanese Text Layout
+    switch (ch) {
+    case 0x2019: // RIGHT SINGLE QUOTATION MARK
+    case 0x201D: // RIGHT DOUBLE QUOTATION MARK
+    case 0x00BB: // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+    case 0x2010: // HYPHEN
+    case 0x2013: // EN DASH
+    case 0x300C: // LEFT CORNER BRACKET
+        return false;
+    default:
+        break;
+    }
+    return true;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderRubyText.h (179365 => 179366)


--- trunk/Source/WebCore/rendering/RenderRubyText.h	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/RenderRubyText.h	2015-01-29 22:03:40 UTC (rev 179366)
@@ -45,7 +45,9 @@
     virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override;
     
     RenderRubyRun* rubyRun() const;
-
+    
+    bool canBreakBefore(const LazyLineBreakIterator&) const;
+   
 private:
     virtual const char* renderName() const override { return "RenderRubyText"; }
     virtual bool isRubyText() const override { return true; }

Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (179365 => 179366)


--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h	2015-01-29 21:58:19 UTC (rev 179365)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h	2015-01-29 22:03:40 UTC (rev 179366)
@@ -422,7 +422,8 @@
         m_width.updateAvailableWidth(replacedBox.logicalHeight());
 
     // Break on replaced elements if either has normal white-space.
-    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)) {
+    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)
+        && (!m_current.renderer()->isRubyRun() || downcast<RenderRubyRun>(m_current.renderer())->canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) {
         m_width.commit();
         m_lineBreak.moveToStartOf(m_current.renderer());
     }
@@ -451,10 +452,13 @@
             m_width.addUncommittedWidth(replacedLogicalWidth);
     } else
         m_width.addUncommittedWidth(replacedLogicalWidth);
-    if (is<RenderRubyRun>(*m_current.renderer()))
+    if (is<RenderRubyRun>(*m_current.renderer())) {
         m_width.applyOverhang(downcast<RenderRubyRun>(m_current.renderer()), m_lastObject, m_nextObject);
-    // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
-    m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+        downcast<RenderRubyRun>(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.m_lineBreakIterator);
+    } else {
+        // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
+        m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+    }
 }
 
 inline float firstPositiveWidth(const WordMeasurements& wordMeasurements)
@@ -959,7 +963,7 @@
     RenderText& nextRenderText = downcast<RenderText>(*m_nextObject);
     bool currentIsTextOrEmptyInline = is<RenderText>(*m_current.renderer()) || (is<RenderInline>(*m_current.renderer()) && isEmptyInline(downcast<RenderInline>(*m_current.renderer())));
     if (!currentIsTextOrEmptyInline)
-        return m_autoWrap;
+        return m_autoWrap && !m_current.renderer()->isRubyRun();
 
     bool canBreakHere = !m_currentCharacterIsSpace && textBeginsWithBreakablePosition(nextRenderText);
 
@@ -1006,7 +1010,7 @@
 
     if (!m_current.renderer()->isFloatingOrOutOfFlowPositioned()) {
         m_lastObject = m_current.renderer();
-        if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!is<RenderListMarker>(*m_lastObject) || downcast<RenderListMarker>(*m_lastObject).isInside())) {
+        if (m_lastObject->isReplaced() && m_autoWrap && !m_lastObject->isRubyRun() && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!is<RenderListMarker>(*m_lastObject) || downcast<RenderListMarker>(*m_lastObject).isInside())) {
             m_width.commit();
             m_lineBreak.moveToStartOf(m_nextObject);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to