| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 { | 453 { |
| 454 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te
xt-orientation is not sideways-*. | 454 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te
xt-orientation is not sideways-*. |
| 455 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines | 455 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines |
| 456 if (!isHorizontal() && getLineLayoutItem().style(isFirstLineStyle())->getFon
tDescription().isVerticalAnyUpright()) | 456 if (!isHorizontal() && getLineLayoutItem().style(isFirstLineStyle())->getFon
tDescription().isVerticalAnyUpright()) |
| 457 return IdeographicBaseline; | 457 return IdeographicBaseline; |
| 458 return AlphabeticBaseline; | 458 return AlphabeticBaseline; |
| 459 } | 459 } |
| 460 | 460 |
| 461 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i
nt maxPositionTop, int maxPositionBottom) | 461 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i
nt maxPositionTop, int maxPositionBottom) |
| 462 { | 462 { |
| 463 int originalMaxAscent = maxAscent; |
| 464 int originalMaxDescent = maxDescent; |
| 463 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 465 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 464 // The computed lineheight needs to be extended for the | 466 // The computed lineheight needs to be extended for the |
| 465 // positioned elements | 467 // positioned elements |
| 466 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) | 468 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 467 continue; // Positioned placeholders don't affect calculations. | 469 continue; // Positioned placeholders don't affect calculations. |
| 468 if (curr->verticalAlign() == VerticalAlignTop || curr->verticalAlign() =
= VerticalAlignBottom) { | 470 if (curr->verticalAlign() == VerticalAlignTop || curr->verticalAlign() =
= VerticalAlignBottom) { |
| 469 int lineHeight = curr->lineHeight(); | 471 int lineHeight = curr->lineHeight().round(); |
| 470 if (curr->verticalAlign() == VerticalAlignTop) { | 472 if (curr->verticalAlign() == VerticalAlignTop) { |
| 471 if (maxAscent + maxDescent < lineHeight) | 473 if (maxAscent + maxDescent < lineHeight) |
| 472 maxDescent = lineHeight - maxAscent; | 474 maxDescent = lineHeight - maxAscent; |
| 473 } else { | 475 } else { |
| 474 if (maxAscent + maxDescent < lineHeight) | 476 if (maxAscent + maxDescent < lineHeight) |
| 475 maxAscent = lineHeight - maxDescent; | 477 maxAscent = lineHeight - maxDescent; |
| 476 } | 478 } |
| 477 | 479 |
| 478 if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBo
ttom)) | 480 if (maxAscent + maxDescent >= std::max(maxPositionTop, maxPositionBo
ttom)) |
| 479 break; | 481 break; |
| 482 maxAscent = originalMaxAscent; |
| 483 maxDescent = originalMaxDescent; |
| 480 } | 484 } |
| 481 | 485 |
| 482 if (curr->isInlineFlowBox()) | 486 if (curr->isInlineFlowBox()) |
| 483 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce
nt, maxPositionTop, maxPositionBottom); | 487 toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDesce
nt, maxPositionTop, maxPositionBottom); |
| 484 } | 488 } |
| 485 } | 489 } |
| 486 | 490 |
| 487 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit&
maxPositionTop, LayoutUnit& maxPositionBottom, int& maxAscent, int& maxDescent,
bool& setMaxAscent, bool& setMaxDescent, bool noQuirksMode, GlyphOverflowAndFal
lbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache&
verticalPositionCache) | 491 void InlineFlowBox::computeLogicalBoxHeights(RootInlineBox* rootBox, LayoutUnit&
maxPositionTop, LayoutUnit& maxPositionBottom, int& maxAscent, int& maxDescent,
bool& setMaxAscent, bool& setMaxDescent, bool noQuirksMode, GlyphOverflowAndFal
lbackFontsMap& textBoxDataMap, FontBaseline baselineType, VerticalPositionCache&
verticalPositionCache) |
| 488 { | 492 { |
| 489 // The primary purpose of this function is to compute the maximal ascent and
descent values for | 493 // The primary purpose of this function is to compute the maximal ascent and
descent values for |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 ASSERT(child->prevOnLine() == prev); | 1317 ASSERT(child->prevOnLine() == prev); |
| 1314 prev = child; | 1318 prev = child; |
| 1315 } | 1319 } |
| 1316 ASSERT(prev == m_lastChild); | 1320 ASSERT(prev == m_lastChild); |
| 1317 #endif | 1321 #endif |
| 1318 } | 1322 } |
| 1319 | 1323 |
| 1320 #endif | 1324 #endif |
| 1321 | 1325 |
| 1322 } // namespace blink | 1326 } // namespace blink |
| OLD | NEW |