| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 continue; // Positioned placeholders don't affect calculations. | 530 continue; // Positioned placeholders don't affect calculations. |
| 531 | 531 |
| 532 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; | 532 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 533 | 533 |
| 534 bool affectsAscent = false; | 534 bool affectsAscent = false; |
| 535 bool affectsDescent = false; | 535 bool affectsDescent = false; |
| 536 | 536 |
| 537 // The verticalPositionForBox function returns the distance between the
child box's baseline | 537 // The verticalPositionForBox function returns the distance between the
child box's baseline |
| 538 // and the root box's baseline. The value is negative if the child box'
s baseline is above the | 538 // and the root box's baseline. The value is negative if the child box'
s baseline is above the |
| 539 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. | 539 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. |
| 540 curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositi
onCache).toFloat()); | 540 curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositi
onCache)); |
| 541 | 541 |
| 542 int ascent = 0; | 542 int ascent = 0; |
| 543 int descent = 0; | 543 int descent = 0; |
| 544 rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, a
ffectsAscent, affectsDescent); | 544 rootBox->ascentAndDescentForBox(curr, textBoxDataMap, ascent, descent, a
ffectsAscent, affectsDescent); |
| 545 | 545 |
| 546 LayoutUnit boxHeight = ascent + descent; | 546 LayoutUnit boxHeight = ascent + descent; |
| 547 if (curr->verticalAlign() == TOP) { | 547 if (curr->verticalAlign() == TOP) { |
| 548 if (maxPositionTop < boxHeight) | 548 if (maxPositionTop < boxHeight) |
| 549 maxPositionTop = boxHeight; | 549 maxPositionTop = boxHeight; |
| 550 } else if (curr->verticalAlign() == BOTTOM) { | 550 } else if (curr->verticalAlign() == BOTTOM) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); | 590 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); |
| 591 if (parent()) | 591 if (parent()) |
| 592 adjustmentForChildrenWithSameLineHeightAndBaseline += (boxModelObjec
t()->borderBefore() + boxModelObject()->paddingBefore()); | 592 adjustmentForChildrenWithSameLineHeightAndBaseline += (boxModelObjec
t()->borderBefore() + boxModelObject()->paddingBefore()); |
| 593 } | 593 } |
| 594 | 594 |
| 595 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 595 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 596 if (curr->layoutObject().isOutOfFlowPositioned()) | 596 if (curr->layoutObject().isOutOfFlowPositioned()) |
| 597 continue; // Positioned placeholders don't affect calculations. | 597 continue; // Positioned placeholders don't affect calculations. |
| 598 | 598 |
| 599 if (descendantsHaveSameLineHeightAndBaseline()) { | 599 if (descendantsHaveSameLineHeightAndBaseline()) { |
| 600 curr->moveInBlockDirection(adjustmentForChildrenWithSameLineHeightAn
dBaseline.toFloat()); | 600 curr->moveInBlockDirection(adjustmentForChildrenWithSameLineHeightAn
dBaseline); |
| 601 continue; | 601 continue; |
| 602 } | 602 } |
| 603 | 603 |
| 604 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; | 604 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 605 bool childAffectsTopBottomPos = true; | 605 bool childAffectsTopBottomPos = true; |
| 606 if (curr->verticalAlign() == TOP) { | 606 if (curr->verticalAlign() == TOP) { |
| 607 curr->setLogicalTop(top.toFloat()); | 607 curr->setLogicalTop(top); |
| 608 } else if (curr->verticalAlign() == BOTTOM) { | 608 } else if (curr->verticalAlign() == BOTTOM) { |
| 609 curr->setLogicalTop((top + maxHeight - curr->lineHeight()).toFloat()
); | 609 curr->setLogicalTop((top + maxHeight - curr->lineHeight())); |
| 610 } else { | 610 } else { |
| 611 if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren(
) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() | 611 if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren(
) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() |
| 612 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) | 612 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) |
| 613 childAffectsTopBottomPos = false; | 613 childAffectsTopBottomPos = false; |
| 614 LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineTy
pe); | 614 LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineTy
pe); |
| 615 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); | 615 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); |
| 616 } | 616 } |
| 617 | 617 |
| 618 LayoutUnit newLogicalTop = curr->logicalTop(); | 618 LayoutUnit newLogicalTop = curr->logicalTop(); |
| 619 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; | 619 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 632 newLogicalTopIncludingMargins = newLogicalTop; | 632 newLogicalTopIncludingMargins = newLogicalTop; |
| 633 } else if (!curr->layoutObject().isBR()) { | 633 } else if (!curr->layoutObject().isBR()) { |
| 634 LayoutBox& box = toLayoutBox(curr->layoutObject()); | 634 LayoutBox& box = toLayoutBox(curr->layoutObject()); |
| 635 newLogicalTopIncludingMargins = newLogicalTop; | 635 newLogicalTopIncludingMargins = newLogicalTop; |
| 636 LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() :
box.marginRight(); | 636 LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() :
box.marginRight(); |
| 637 LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom
() : box.marginLeft(); | 637 LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom
() : box.marginLeft(); |
| 638 newLogicalTop += overSideMargin; | 638 newLogicalTop += overSideMargin; |
| 639 boxHeightIncludingMargins += overSideMargin + underSideMargin; | 639 boxHeightIncludingMargins += overSideMargin + underSideMargin; |
| 640 } | 640 } |
| 641 | 641 |
| 642 curr->setLogicalTop(newLogicalTop.toFloat()); | 642 curr->setLogicalTop(newLogicalTop); |
| 643 | 643 |
| 644 if (childAffectsTopBottomPos) { | 644 if (childAffectsTopBottomPos) { |
| 645 if (curr->layoutObject().isRubyRun()) { | 645 if (curr->layoutObject().isRubyRun()) { |
| 646 // Treat the leading on the first and last lines of ruby runs as
not being part of the overall lineTop/lineBottom. | 646 // Treat the leading on the first and last lines of ruby runs as
not being part of the overall lineTop/lineBottom. |
| 647 // Really this is a workaround hack for the fact that ruby shoul
d have been done as line layout and not done using | 647 // Really this is a workaround hack for the fact that ruby shoul
d have been done as line layout and not done using |
| 648 // inline-block. | 648 // inline-block. |
| 649 if (layoutObject().style()->isFlippedLinesWritingMode() == (curr
->layoutObject().style()->rubyPosition() == RubyPositionAfter)) | 649 if (layoutObject().style()->isFlippedLinesWritingMode() == (curr
->layoutObject().style()->rubyPosition() == RubyPositionAfter)) |
| 650 hasAnnotationsBefore = true; | 650 hasAnnotationsBefore = true; |
| 651 else | 651 else |
| 652 hasAnnotationsAfter = true; | 652 hasAnnotationsAfter = true; |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 ASSERT(child->prevOnLine() == prev); | 1309 ASSERT(child->prevOnLine() == prev); |
| 1310 prev = child; | 1310 prev = child; |
| 1311 } | 1311 } |
| 1312 ASSERT(prev == m_lastChild); | 1312 ASSERT(prev == m_lastChild); |
| 1313 #endif | 1313 #endif |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 #endif | 1316 #endif |
| 1317 | 1317 |
| 1318 } // namespace blink | 1318 } // namespace blink |
| OLD | NEW |