| 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 lineBottomIncludingMargins = | 881 lineBottomIncludingMargins = |
| 882 std::max(lineBottom, lineBottomIncludingMargins); | 882 std::max(lineBottom, lineBottomIncludingMargins); |
| 883 } | 883 } |
| 884 | 884 |
| 885 if (getLineLayoutItem().style()->isFlippedLinesWritingMode()) | 885 if (getLineLayoutItem().style()->isFlippedLinesWritingMode()) |
| 886 flipLinesInBlockDirection(lineTopIncludingMargins, | 886 flipLinesInBlockDirection(lineTopIncludingMargins, |
| 887 lineBottomIncludingMargins); | 887 lineBottomIncludingMargins); |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 | 890 |
| 891 void InlineFlowBox::computeMaxLogicalTop(LayoutUnit& maxLogicalTop) const { | 891 LayoutUnit InlineFlowBox::maxLogicalBottomForUnderline( |
| 892 LineLayoutItem decorationObject, |
| 893 LayoutUnit maxLogicalBottom) const { |
| 892 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 894 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 893 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) | 895 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 894 continue; // Positioned placeholders don't affect calculations. | 896 continue; // Positioned placeholders don't affect calculations. |
| 895 | 897 |
| 896 if (descendantsHaveSameLineHeightAndBaseline()) | 898 // If the text decoration isn't in effect on the child, it must be outside |
| 899 // of |decorationObject|. |
| 900 if (!(curr->lineStyleRef().textDecorationsInEffect() & |
| 901 TextDecorationUnderline)) |
| 897 continue; | 902 continue; |
| 898 | 903 |
| 899 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, curr->y()); | 904 if (decorationObject && decorationObject.isLayoutInline() && |
| 900 LayoutUnit localMaxLogicalTop; | 905 !isAncestorAndWithinBlock(decorationObject, curr->getLineLayoutItem())) |
| 901 if (curr->isInlineFlowBox()) | 906 continue; |
| 902 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); | 907 |
| 903 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, localMaxLogicalTop); | 908 if (curr->isInlineFlowBox()) { |
| 909 maxLogicalBottom = toInlineFlowBox(curr)->maxLogicalBottomForUnderline( |
| 910 decorationObject, maxLogicalBottom); |
| 911 } else if (curr->isInlineTextBox()) { |
| 912 maxLogicalBottom = std::max(maxLogicalBottom, curr->logicalBottom()); |
| 913 } |
| 904 } | 914 } |
| 915 return maxLogicalBottom; |
| 916 } |
| 917 |
| 918 LayoutUnit InlineFlowBox::minLogicalTopForUnderline( |
| 919 LineLayoutItem decorationObject, |
| 920 LayoutUnit minLogicalTop) const { |
| 921 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 922 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 923 continue; // Positioned placeholders don't affect calculations. |
| 924 |
| 925 // If the text decoration isn't in effect on the child, it must be outside |
| 926 // of |decorationObject|. |
| 927 if (!(curr->lineStyleRef().textDecorationsInEffect() & |
| 928 TextDecorationUnderline)) |
| 929 continue; |
| 930 |
| 931 if (decorationObject && decorationObject.isLayoutInline() && |
| 932 !isAncestorAndWithinBlock(decorationObject, curr->getLineLayoutItem())) |
| 933 continue; |
| 934 |
| 935 if (curr->isInlineFlowBox()) { |
| 936 minLogicalTop = toInlineFlowBox(curr)->minLogicalTopForUnderline( |
| 937 decorationObject, minLogicalTop); |
| 938 } else if (curr->isInlineTextBox()) { |
| 939 minLogicalTop = std::min(minLogicalTop, curr->logicalTop()); |
| 940 } |
| 941 } |
| 942 return minLogicalTop; |
| 905 } | 943 } |
| 906 | 944 |
| 907 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, | 945 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, |
| 908 LayoutUnit lineBottom) { | 946 LayoutUnit lineBottom) { |
| 909 // Flip the box on the line such that the top is now relative to the | 947 // Flip the box on the line such that the top is now relative to the |
| 910 // lineBottom instead of the lineTop. | 948 // lineBottom instead of the lineTop. |
| 911 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); | 949 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); |
| 912 | 950 |
| 913 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 951 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 914 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) | 952 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 ASSERT(child->prevOnLine() == prev); | 1684 ASSERT(child->prevOnLine() == prev); |
| 1647 prev = child; | 1685 prev = child; |
| 1648 } | 1686 } |
| 1649 ASSERT(prev == m_lastChild); | 1687 ASSERT(prev == m_lastChild); |
| 1650 #endif | 1688 #endif |
| 1651 } | 1689 } |
| 1652 | 1690 |
| 1653 #endif | 1691 #endif |
| 1654 | 1692 |
| 1655 } // namespace blink | 1693 } // namespace blink |
| OLD | NEW |