Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 // We overhang a ruby only if the neighboring layout object is a text. | 295 // We overhang a ruby only if the neighboring layout object is a text. |
| 296 // We can overhang the ruby by no more than half the width of the neighborin g text | 296 // We can overhang the ruby by no more than half the width of the neighborin g text |
| 297 // and no more than half the font size. | 297 // and no more than half the font size. |
| 298 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; | 298 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; |
| 299 if (startOverhang) | 299 if (startOverhang) |
| 300 startOverhang = std::min<int>(startOverhang, std::min<int>(toLayoutText( startLayoutObject)->minLogicalWidth(), halfWidthOfFontSize)); | 300 startOverhang = std::min<int>(startOverhang, std::min<int>(toLayoutText( startLayoutObject)->minLogicalWidth(), halfWidthOfFontSize)); |
| 301 if (endOverhang) | 301 if (endOverhang) |
| 302 endOverhang = std::min<int>(endOverhang, std::min<int>(toLayoutText(endL ayoutObject)->minLogicalWidth(), halfWidthOfFontSize)); | 302 endOverhang = std::min<int>(endOverhang, std::min<int>(toLayoutText(endL ayoutObject)->minLogicalWidth(), halfWidthOfFontSize)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool LayoutRubyRun::canBreakBefore(const LazyLineBreakIterator& iterator) const | |
| 306 { | |
| 307 // TODO(kojii): It would be nice to improve this so that it isn't just | |
| 308 // 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.
| |
| 309 | |
| 310 if (!iterator.priorContextLength()) | |
| 311 return true; | |
| 312 UChar ch = iterator.lastCharacter(); | |
| 313 ULineBreak lineBreak = (ULineBreak)u_getIntPropertyValue(ch, UCHAR_LINE_BREA K); | |
|
eae
2015/08/21 20:47:06
static_cast
kojii
2015/08/22 03:49:34
Done.
| |
| 314 // UNICODE LINE BREAKING ALGORITHM | |
| 315 // http://www.unicode.org/reports/tr14/ | |
| 316 // And Requirements for Japanese Text Layout, 3.1.7 Characters Not Starting a Line | |
| 317 // http://www.w3.org/TR/2012/NOTE-jlreq-20120403/#characters_not_starting_a_ line | |
| 318 switch (lineBreak) { | |
| 319 case U_LB_WORD_JOINER: | |
| 320 case U_LB_GLUE: | |
| 321 case U_LB_OPEN_PUNCTUATION: | |
| 322 return false; | |
| 323 default: | |
| 324 break; | |
| 325 } | |
| 326 return true; | |
| 327 } | |
| 328 | |
| 305 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |