Chromium Code Reviews| Index: Source/core/layout/LayoutRubyRun.cpp |
| diff --git a/Source/core/layout/LayoutRubyRun.cpp b/Source/core/layout/LayoutRubyRun.cpp |
| index 7f8c29ebb40be920c55315f5d75e30c339831768..c5eef9107ffa7b3bcab972459f6d5217ace9be12 100644 |
| --- a/Source/core/layout/LayoutRubyRun.cpp |
| +++ b/Source/core/layout/LayoutRubyRun.cpp |
| @@ -302,4 +302,28 @@ void LayoutRubyRun::getOverhang(bool firstLine, LayoutObject* startLayoutObject, |
| endOverhang = std::min<int>(endOverhang, std::min<int>(toLayoutText(endLayoutObject)->minLogicalWidth(), halfWidthOfFontSize)); |
| } |
| +bool LayoutRubyRun::canBreakBefore(const LazyLineBreakIterator& iterator) const |
| +{ |
| + // TODO(kojii): It would be nice to improve this so that it isn't just |
| + // hard-coded, but lookahead in this case is particularly problematic. |
|
eae
2015/08/21 20:47:06
Could you add a crbug link here?
kojii
2015/08/22 03:49:34
Done.
|
| + |
| + if (!iterator.priorContextLength()) |
| + return true; |
| + UChar ch = iterator.lastCharacter(); |
| + ULineBreak lineBreak = (ULineBreak)u_getIntPropertyValue(ch, UCHAR_LINE_BREAK); |
|
eae
2015/08/21 20:47:06
static_cast
kojii
2015/08/22 03:49:34
Done.
|
| + // 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_WORD_JOINER: |
| + case U_LB_GLUE: |
| + case U_LB_OPEN_PUNCTUATION: |
| + return false; |
| + default: |
| + break; |
| + } |
| + return true; |
| +} |
| + |
| } // namespace blink |