| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 line_bottom_including_margins = | 891 line_bottom_including_margins = |
| 892 std::max(line_bottom, line_bottom_including_margins); | 892 std::max(line_bottom, line_bottom_including_margins); |
| 893 } | 893 } |
| 894 | 894 |
| 895 if (GetLineLayoutItem().Style()->IsFlippedLinesWritingMode()) | 895 if (GetLineLayoutItem().Style()->IsFlippedLinesWritingMode()) |
| 896 FlipLinesInBlockDirection(line_top_including_margins, | 896 FlipLinesInBlockDirection(line_top_including_margins, |
| 897 line_bottom_including_margins); | 897 line_bottom_including_margins); |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 | 900 |
| 901 LayoutUnit InlineFlowBox::MaxLogicalBottomForUnderline( | 901 LayoutUnit InlineFlowBox::FarthestPositionForUnderline( |
| 902 LineLayoutItem decoration_object, | 902 LineLayoutItem decorating_box, |
| 903 LayoutUnit max_logical_bottom) const { | 903 LineVerticalPositionType position_type, |
| 904 FontBaseline baseline_type, |
| 905 LayoutUnit farthest) const { |
| 904 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { | 906 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { |
| 905 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) | 907 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) |
| 906 continue; // Positioned placeholders don't affect calculations. | 908 continue; // Positioned placeholders don't affect calculations. |
| 907 | |
| 908 // If the text decoration isn't in effect on the child, it must be outside | |
| 909 // of |decorationObject|. | |
| 910 if (!(curr->LineStyleRef().TextDecorationsInEffect() & | |
| 911 kTextDecorationUnderline)) | |
| 912 continue; | |
| 913 | |
| 914 if (decoration_object && decoration_object.IsLayoutInline() && | |
| 915 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem())) | |
| 916 continue; | |
| 917 | |
| 918 if (curr->IsInlineFlowBox()) { | |
| 919 max_logical_bottom = ToInlineFlowBox(curr)->MaxLogicalBottomForUnderline( | |
| 920 decoration_object, max_logical_bottom); | |
| 921 } else if (curr->IsInlineTextBox()) { | |
| 922 max_logical_bottom = std::max(max_logical_bottom, curr->LogicalBottom()); | |
| 923 } | |
| 924 } | |
| 925 return max_logical_bottom; | |
| 926 } | |
| 927 | |
| 928 LayoutUnit InlineFlowBox::MinLogicalTopForUnderline( | |
| 929 LineLayoutItem decoration_object, | |
| 930 LayoutUnit min_logical_top) const { | |
| 931 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { | |
| 932 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) | |
| 933 continue; // Positioned placeholders don't affect calculations. | |
| 934 | 909 |
| 935 // If the text decoration isn't in effect on the child, it must be outside | 910 // If the text decoration isn't in effect on the child, it must be outside |
| 936 // of |decorationObject|. | 911 // of |decorationObject|. |
| 937 if (!(curr->LineStyleRef().TextDecorationsInEffect() & | 912 if (!(curr->LineStyleRef().TextDecorationsInEffect() & |
| 938 kTextDecorationUnderline)) | 913 kTextDecorationUnderline)) |
| 939 continue; | 914 continue; |
| 940 | 915 |
| 941 if (decoration_object && decoration_object.IsLayoutInline() && | 916 if (decorating_box && decorating_box.IsLayoutInline() && |
| 942 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem())) | 917 !IsAncestorAndWithinBlock(decorating_box, curr->GetLineLayoutItem())) |
| 943 continue; | 918 continue; |
| 944 | 919 |
| 945 if (curr->IsInlineFlowBox()) { | 920 if (curr->IsInlineFlowBox()) { |
| 946 min_logical_top = ToInlineFlowBox(curr)->MinLogicalTopForUnderline( | 921 farthest = ToInlineFlowBox(curr)->FarthestPositionForUnderline( |
| 947 decoration_object, min_logical_top); | 922 decorating_box, position_type, baseline_type, farthest); |
| 948 } else if (curr->IsInlineTextBox()) { | 923 } else if (curr->IsInlineTextBox()) { |
| 949 min_logical_top = std::min(min_logical_top, curr->LogicalTop()); | 924 LayoutUnit position = |
| 925 ToInlineTextBox(curr)->VerticalPosition(position_type, baseline_type); |
| 926 if (IsLineOverSide(position_type)) |
| 927 farthest = std::min(farthest, position); |
| 928 else |
| 929 farthest = std::max(farthest, position); |
| 950 } | 930 } |
| 951 } | 931 } |
| 952 return min_logical_top; | 932 return farthest; |
| 953 } | 933 } |
| 954 | 934 |
| 955 void InlineFlowBox::FlipLinesInBlockDirection(LayoutUnit line_top, | 935 void InlineFlowBox::FlipLinesInBlockDirection(LayoutUnit line_top, |
| 956 LayoutUnit line_bottom) { | 936 LayoutUnit line_bottom) { |
| 957 // Flip the box on the line such that the top is now relative to the | 937 // Flip the box on the line such that the top is now relative to the |
| 958 // lineBottom instead of the lineTop. | 938 // lineBottom instead of the lineTop. |
| 959 SetLogicalTop(line_bottom - (LogicalTop() - line_top) - LogicalHeight()); | 939 SetLogicalTop(line_bottom - (LogicalTop() - line_top) - LogicalHeight()); |
| 960 | 940 |
| 961 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { | 941 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { |
| 962 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) | 942 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 DCHECK_EQ(child->prevOnLine(), prev); | 1733 DCHECK_EQ(child->prevOnLine(), prev); |
| 1754 prev = child; | 1734 prev = child; |
| 1755 } | 1735 } |
| 1756 DCHECK_EQ(prev, m_lastChild); | 1736 DCHECK_EQ(prev, m_lastChild); |
| 1757 #endif | 1737 #endif |
| 1758 } | 1738 } |
| 1759 | 1739 |
| 1760 #endif | 1740 #endif |
| 1761 | 1741 |
| 1762 } // namespace blink | 1742 } // namespace blink |
| OLD | NEW |