| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 LayoutUnit& lineBottom, | 683 LayoutUnit& lineBottom, |
| 684 LayoutUnit& selectionBottom, | 684 LayoutUnit& selectionBottom, |
| 685 bool& setLineTop, | 685 bool& setLineTop, |
| 686 LayoutUnit& lineTopIncludingMargins, | 686 LayoutUnit& lineTopIncludingMargins, |
| 687 LayoutUnit& lineBottomIncludingMargins, | 687 LayoutUnit& lineBottomIncludingMargins, |
| 688 bool& hasAnnotationsBefore, | 688 bool& hasAnnotationsBefore, |
| 689 bool& hasAnnotationsAfter, | 689 bool& hasAnnotationsAfter, |
| 690 FontBaseline baselineType) { | 690 FontBaseline baselineType) { |
| 691 bool isRootBox = isRootInlineBox(); | 691 bool isRootBox = isRootInlineBox(); |
| 692 if (isRootBox) { | 692 if (isRootBox) { |
| 693 const FontMetrics& fontMetrics = | 693 const SimpleFontData* fontData = |
| 694 getLineLayoutItem().style(isFirstLineStyle())->getFontMetrics(); | 694 getLineLayoutItem().style(isFirstLineStyle())->font().primaryFont(); |
| 695 DCHECK(fontData); |
| 696 if (!fontData) |
| 697 return; |
| 698 const FontMetrics& fontMetrics = fontData->getFontMetrics(); |
| 695 // RootInlineBoxes are always placed at pixel boundaries in their logical y | 699 // RootInlineBoxes are always placed at pixel boundaries in their logical y |
| 696 // direction. Not doing so results in incorrect layout of text decorations, | 700 // direction. Not doing so results in incorrect layout of text decorations, |
| 697 // most notably underlines. | 701 // most notably underlines. |
| 698 setLogicalTop(LayoutUnit( | 702 setLogicalTop(LayoutUnit( |
| 699 roundToInt(top + maxAscent - fontMetrics.ascent(baselineType)))); | 703 roundToInt(top + maxAscent - fontMetrics.ascent(baselineType)))); |
| 700 } | 704 } |
| 701 | 705 |
| 702 LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline; | 706 LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline; |
| 703 if (descendantsHaveSameLineHeightAndBaseline()) { | 707 if (descendantsHaveSameLineHeightAndBaseline()) { |
| 704 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); | 708 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 733 int posAdjust = maxAscent - curr->baselinePosition(baselineType); | 737 int posAdjust = maxAscent - curr->baselinePosition(baselineType); |
| 734 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); | 738 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); |
| 735 } | 739 } |
| 736 | 740 |
| 737 LayoutUnit newLogicalTop = curr->logicalTop(); | 741 LayoutUnit newLogicalTop = curr->logicalTop(); |
| 738 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; | 742 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; |
| 739 LayoutUnit boxHeight = curr->logicalHeight(); | 743 LayoutUnit boxHeight = curr->logicalHeight(); |
| 740 LayoutUnit boxHeightIncludingMargins = boxHeight; | 744 LayoutUnit boxHeightIncludingMargins = boxHeight; |
| 741 LayoutUnit borderPaddingHeight; | 745 LayoutUnit borderPaddingHeight; |
| 742 if (curr->isText() || curr->isInlineFlowBox()) { | 746 if (curr->isText() || curr->isInlineFlowBox()) { |
| 743 const FontMetrics& fontMetrics = | 747 const SimpleFontData* fontData = curr->getLineLayoutItem() |
| 744 curr->getLineLayoutItem().style(isFirstLineStyle())->getFontMetrics(); | 748 .style(isFirstLineStyle()) |
| 749 ->font() |
| 750 .primaryFont(); |
| 751 DCHECK(fontData); |
| 752 if (!fontData) |
| 753 continue; |
| 754 |
| 755 const FontMetrics& fontMetrics = fontData->getFontMetrics(); |
| 745 newLogicalTop += curr->baselinePosition(baselineType) - | 756 newLogicalTop += curr->baselinePosition(baselineType) - |
| 746 fontMetrics.ascent(baselineType); | 757 fontMetrics.ascent(baselineType); |
| 747 if (curr->isInlineFlowBox()) { | 758 if (curr->isInlineFlowBox()) { |
| 748 LineLayoutBoxModel boxObject = | 759 LineLayoutBoxModel boxObject = |
| 749 LineLayoutBoxModel(curr->getLineLayoutItem()); | 760 LineLayoutBoxModel(curr->getLineLayoutItem()); |
| 750 newLogicalTop -= boxObject.borderAndPaddingOver(); | 761 newLogicalTop -= boxObject.borderAndPaddingOver(); |
| 751 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); | 762 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); |
| 752 } | 763 } |
| 753 newLogicalTopIncludingMargins = newLogicalTop; | 764 newLogicalTopIncludingMargins = newLogicalTop; |
| 754 } else if (!curr->getLineLayoutItem().isBR()) { | 765 } else if (!curr->getLineLayoutItem().isBR()) { |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 ASSERT(child->prevOnLine() == prev); | 1642 ASSERT(child->prevOnLine() == prev); |
| 1632 prev = child; | 1643 prev = child; |
| 1633 } | 1644 } |
| 1634 ASSERT(prev == m_lastChild); | 1645 ASSERT(prev == m_lastChild); |
| 1635 #endif | 1646 #endif |
| 1636 } | 1647 } |
| 1637 | 1648 |
| 1638 #endif | 1649 #endif |
| 1639 | 1650 |
| 1640 } // namespace blink | 1651 } // namespace blink |
| OLD | NEW |