| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int logicalLeftOverhang = std::numeric_limits<int>::max(); | 284 int logicalLeftOverhang = std::numeric_limits<int>::max(); |
| 285 int logicalRightOverhang = std::numeric_limits<int>::max(); | 285 int logicalRightOverhang = std::numeric_limits<int>::max(); |
| 286 for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox;
rootInlineBox = rootInlineBox->nextRootBox()) { | 286 for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox;
rootInlineBox = rootInlineBox->nextRootBox()) { |
| 287 logicalLeftOverhang = std::min<int>(logicalLeftOverhang, rootInlineBox->
logicalLeft()); | 287 logicalLeftOverhang = std::min<int>(logicalLeftOverhang, rootInlineBox->
logicalLeft()); |
| 288 logicalRightOverhang = std::min<int>(logicalRightOverhang, logicalWidth
- rootInlineBox->logicalRight()); | 288 logicalRightOverhang = std::min<int>(logicalRightOverhang, logicalWidth
- rootInlineBox->logicalRight()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : lo
gicalRightOverhang; | 291 startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : lo
gicalRightOverhang; |
| 292 endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : log
icalLeftOverhang; | 292 endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : log
icalLeftOverhang; |
| 293 | 293 |
| 294 if (!startRenderer || !startRenderer->isText() || startRenderer->style(first
Line)->fontSize() > rubyBase->style(firstLine)->fontSize()) | 294 if (!startRenderer || !startRenderer->isText() || startRenderer->styleOrFirs
tLineStyle(firstLine)->fontSize() > rubyBase->styleOrFirstLineStyle(firstLine)->
fontSize()) |
| 295 startOverhang = 0; | 295 startOverhang = 0; |
| 296 | 296 |
| 297 if (!endRenderer || !endRenderer->isText() || endRenderer->style(firstLine)-
>fontSize() > rubyBase->style(firstLine)->fontSize()) | 297 if (!endRenderer || !endRenderer->isText() || endRenderer->styleOrFirstLineS
tyle(firstLine)->fontSize() > rubyBase->styleOrFirstLineStyle(firstLine)->fontSi
ze()) |
| 298 endOverhang = 0; | 298 endOverhang = 0; |
| 299 | 299 |
| 300 // We overhang a ruby only if the neighboring render object is a text. | 300 // We overhang a ruby only if the neighboring render object is a text. |
| 301 // We can overhang the ruby by no more than half the width of the neighborin
g text | 301 // We can overhang the ruby by no more than half the width of the neighborin
g text |
| 302 // and no more than half the font size. | 302 // and no more than half the font size. |
| 303 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; | 303 int halfWidthOfFontSize = rubyText->styleOrFirstLineStyle(firstLine)->fontSi
ze() / 2; |
| 304 if (startOverhang) | 304 if (startOverhang) |
| 305 startOverhang = std::min<int>(startOverhang, std::min<int>(toRenderText(
startRenderer)->minLogicalWidth(), halfWidthOfFontSize)); | 305 startOverhang = std::min<int>(startOverhang, std::min<int>(toRenderText(
startRenderer)->minLogicalWidth(), halfWidthOfFontSize)); |
| 306 if (endOverhang) | 306 if (endOverhang) |
| 307 endOverhang = std::min<int>(endOverhang, std::min<int>(toRenderText(endR
enderer)->minLogicalWidth(), halfWidthOfFontSize)); | 307 endOverhang = std::min<int>(endOverhang, std::min<int>(toRenderText(endR
enderer)->minLogicalWidth(), halfWidthOfFontSize)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace WebCore | 310 } // namespace WebCore |
| OLD | NEW |