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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 bool should_clear_descendants_have_same_line_height_and_baseline = false; | 126 bool should_clear_descendants_have_same_line_height_and_baseline = false; |
127 if (child->GetLineLayoutItem().IsAtomicInlineLevel()) { | 127 if (child->GetLineLayoutItem().IsAtomicInlineLevel()) { |
128 should_clear_descendants_have_same_line_height_and_baseline = true; | 128 should_clear_descendants_have_same_line_height_and_baseline = true; |
129 } else if (child->IsText()) { | 129 } else if (child->IsText()) { |
130 if (child->GetLineLayoutItem().IsBR() || | 130 if (child->GetLineLayoutItem().IsBR() || |
131 (child->GetLineLayoutItem().Parent() != GetLineLayoutItem())) { | 131 (child->GetLineLayoutItem().Parent() != GetLineLayoutItem())) { |
132 if (!HasIdenticalLineHeightProperties(parent_style, child_style, root)) | 132 if (!HasIdenticalLineHeightProperties(parent_style, child_style, root)) |
133 should_clear_descendants_have_same_line_height_and_baseline = true; | 133 should_clear_descendants_have_same_line_height_and_baseline = true; |
134 } | 134 } |
135 if (child_style.HasTextCombine() || | 135 if (child_style.HasTextCombine() || |
136 child_style.GetTextEmphasisMark() != kTextEmphasisMarkNone) | 136 child_style.GetTextEmphasisMark() != TextEmphasisMark::kNone) |
137 should_clear_descendants_have_same_line_height_and_baseline = true; | 137 should_clear_descendants_have_same_line_height_and_baseline = true; |
138 } else { | 138 } else { |
139 if (child->GetLineLayoutItem().IsBR()) { | 139 if (child->GetLineLayoutItem().IsBR()) { |
140 // FIXME: This is dumb. We only turn off because current layout test | 140 // FIXME: This is dumb. We only turn off because current layout test |
141 // results expect the <br> to be 0-height on the baseline. | 141 // results expect the <br> to be 0-height on the baseline. |
142 // Other than making a zillion tests have to regenerate results, there's | 142 // Other than making a zillion tests have to regenerate results, there's |
143 // no reason to ditch the optimization here. | 143 // no reason to ditch the optimization here. |
144 should_clear_descendants_have_same_line_height_and_baseline = true; | 144 should_clear_descendants_have_same_line_height_and_baseline = true; |
145 } else { | 145 } else { |
146 DCHECK(IsInlineFlowBox()); | 146 DCHECK(IsInlineFlowBox()); |
(...skipping 12 matching lines...) Expand all Loading... |
159 | 159 |
160 if (should_clear_descendants_have_same_line_height_and_baseline) | 160 if (should_clear_descendants_have_same_line_height_and_baseline) |
161 ClearDescendantsHaveSameLineHeightAndBaseline(); | 161 ClearDescendantsHaveSameLineHeightAndBaseline(); |
162 } | 162 } |
163 | 163 |
164 if (!child->GetLineLayoutItem().IsOutOfFlowPositioned()) { | 164 if (!child->GetLineLayoutItem().IsOutOfFlowPositioned()) { |
165 if (child->IsText()) { | 165 if (child->IsText()) { |
166 const ComputedStyle& child_style = | 166 const ComputedStyle& child_style = |
167 child->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); | 167 child->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); |
168 if (child_style.LetterSpacing() < 0 || child_style.TextShadow() || | 168 if (child_style.LetterSpacing() < 0 || child_style.TextShadow() || |
169 child_style.GetTextEmphasisMark() != kTextEmphasisMarkNone || | 169 child_style.GetTextEmphasisMark() != TextEmphasisMark::kNone || |
170 child_style.TextStrokeWidth()) | 170 child_style.TextStrokeWidth()) |
171 child->ClearKnownToHaveNoOverflow(); | 171 child->ClearKnownToHaveNoOverflow(); |
172 } else if (child->GetLineLayoutItem().IsAtomicInlineLevel()) { | 172 } else if (child->GetLineLayoutItem().IsAtomicInlineLevel()) { |
173 LineLayoutBox box = LineLayoutBox(child->GetLineLayoutItem()); | 173 LineLayoutBox box = LineLayoutBox(child->GetLineLayoutItem()); |
174 if (box.HasOverflowModel() || box.HasSelfPaintingLayer()) | 174 if (box.HasOverflowModel() || box.HasSelfPaintingLayer()) |
175 child->ClearKnownToHaveNoOverflow(); | 175 child->ClearKnownToHaveNoOverflow(); |
176 } else if (!child->GetLineLayoutItem().IsBR() && | 176 } else if (!child->GetLineLayoutItem().IsBR() && |
177 (child->GetLineLayoutItem() | 177 (child->GetLineLayoutItem() |
178 .Style(IsFirstLineStyle()) | 178 .Style(IsFirstLineStyle()) |
179 ->BoxShadow() || | 179 ->BoxShadow() || |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 float left_glyph_edge = glyph_overflow ? glyph_overflow->left : 0; | 1040 float left_glyph_edge = glyph_overflow ? glyph_overflow->left : 0; |
1041 float right_glyph_edge = glyph_overflow ? glyph_overflow->right : 0; | 1041 float right_glyph_edge = glyph_overflow ? glyph_overflow->right : 0; |
1042 | 1042 |
1043 float stroke_overflow = style.TextStrokeWidth() / 2.0f; | 1043 float stroke_overflow = style.TextStrokeWidth() / 2.0f; |
1044 float top_glyph_overflow = -stroke_overflow - top_glyph_edge; | 1044 float top_glyph_overflow = -stroke_overflow - top_glyph_edge; |
1045 float bottom_glyph_overflow = stroke_overflow + bottom_glyph_edge; | 1045 float bottom_glyph_overflow = stroke_overflow + bottom_glyph_edge; |
1046 float left_glyph_overflow = -stroke_overflow - left_glyph_edge; | 1046 float left_glyph_overflow = -stroke_overflow - left_glyph_edge; |
1047 float right_glyph_overflow = stroke_overflow + right_glyph_edge; | 1047 float right_glyph_overflow = stroke_overflow + right_glyph_edge; |
1048 | 1048 |
1049 TextEmphasisPosition emphasis_mark_position; | 1049 TextEmphasisPosition emphasis_mark_position; |
1050 if (style.GetTextEmphasisMark() != kTextEmphasisMarkNone && | 1050 if (style.GetTextEmphasisMark() != TextEmphasisMark::kNone && |
1051 text_box->GetEmphasisMarkPosition(style, emphasis_mark_position)) { | 1051 text_box->GetEmphasisMarkPosition(style, emphasis_mark_position)) { |
1052 float emphasis_mark_height = | 1052 float emphasis_mark_height = |
1053 style.GetFont().EmphasisMarkHeight(style.TextEmphasisMarkString()); | 1053 style.GetFont().EmphasisMarkHeight(style.TextEmphasisMarkString()); |
1054 if ((emphasis_mark_position == TextEmphasisPosition::kOver) == | 1054 if ((emphasis_mark_position == TextEmphasisPosition::kOver) == |
1055 (!style.IsFlippedLinesWritingMode())) | 1055 (!style.IsFlippedLinesWritingMode())) |
1056 top_glyph_overflow = std::min(top_glyph_overflow, -emphasis_mark_height); | 1056 top_glyph_overflow = std::min(top_glyph_overflow, -emphasis_mark_height); |
1057 else | 1057 else |
1058 bottom_glyph_overflow = | 1058 bottom_glyph_overflow = |
1059 std::max(bottom_glyph_overflow, emphasis_mark_height); | 1059 std::max(bottom_glyph_overflow, emphasis_mark_height); |
1060 } | 1060 } |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 bottom_of_last_ruby_text_line += curr->LogicalTop(); | 1539 bottom_of_last_ruby_text_line += curr->LogicalTop(); |
1540 result = | 1540 result = |
1541 std::max(result, bottom_of_last_ruby_text_line - allowed_position); | 1541 std::max(result, bottom_of_last_ruby_text_line - allowed_position); |
1542 } | 1542 } |
1543 } | 1543 } |
1544 | 1544 |
1545 if (curr->IsInlineTextBox()) { | 1545 if (curr->IsInlineTextBox()) { |
1546 const ComputedStyle& style = | 1546 const ComputedStyle& style = |
1547 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); | 1547 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); |
1548 TextEmphasisPosition emphasis_mark_position; | 1548 TextEmphasisPosition emphasis_mark_position; |
1549 if (style.GetTextEmphasisMark() != kTextEmphasisMarkNone && | 1549 if (style.GetTextEmphasisMark() != TextEmphasisMark::kNone && |
1550 ToInlineTextBox(curr)->GetEmphasisMarkPosition( | 1550 ToInlineTextBox(curr)->GetEmphasisMarkPosition( |
1551 style, emphasis_mark_position) && | 1551 style, emphasis_mark_position) && |
1552 emphasis_mark_position == TextEmphasisPosition::kOver) { | 1552 emphasis_mark_position == TextEmphasisPosition::kOver) { |
1553 if (!style.IsFlippedLinesWritingMode()) { | 1553 if (!style.IsFlippedLinesWritingMode()) { |
1554 int top_of_emphasis_mark = | 1554 int top_of_emphasis_mark = |
1555 (curr->LogicalTop() - style.GetFont().EmphasisMarkHeight( | 1555 (curr->LogicalTop() - style.GetFont().EmphasisMarkHeight( |
1556 style.TextEmphasisMarkString())) | 1556 style.TextEmphasisMarkString())) |
1557 .ToInt(); | 1557 .ToInt(); |
1558 result = std::max(result, allowed_position - top_of_emphasis_mark); | 1558 result = std::max(result, allowed_position - top_of_emphasis_mark); |
1559 } else { | 1559 } else { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 continue; | 1609 continue; |
1610 bottom_of_last_ruby_text_line += curr->LogicalTop(); | 1610 bottom_of_last_ruby_text_line += curr->LogicalTop(); |
1611 result = | 1611 result = |
1612 std::max(result, bottom_of_last_ruby_text_line - allowed_position); | 1612 std::max(result, bottom_of_last_ruby_text_line - allowed_position); |
1613 } | 1613 } |
1614 } | 1614 } |
1615 | 1615 |
1616 if (curr->IsInlineTextBox()) { | 1616 if (curr->IsInlineTextBox()) { |
1617 const ComputedStyle& style = | 1617 const ComputedStyle& style = |
1618 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); | 1618 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); |
1619 if (style.GetTextEmphasisMark() != kTextEmphasisMarkNone && | 1619 if (style.GetTextEmphasisMark() != TextEmphasisMark::kNone && |
1620 style.GetTextEmphasisPosition() == TextEmphasisPosition::kUnder) { | 1620 style.GetTextEmphasisPosition() == TextEmphasisPosition::kUnder) { |
1621 if (!style.IsFlippedLinesWritingMode()) { | 1621 if (!style.IsFlippedLinesWritingMode()) { |
1622 LayoutUnit bottom_of_emphasis_mark = | 1622 LayoutUnit bottom_of_emphasis_mark = |
1623 curr->LogicalBottom() + style.GetFont().EmphasisMarkHeight( | 1623 curr->LogicalBottom() + style.GetFont().EmphasisMarkHeight( |
1624 style.TextEmphasisMarkString()); | 1624 style.TextEmphasisMarkString()); |
1625 result = std::max(result, bottom_of_emphasis_mark - allowed_position); | 1625 result = std::max(result, bottom_of_emphasis_mark - allowed_position); |
1626 } else { | 1626 } else { |
1627 LayoutUnit top_of_emphasis_mark = | 1627 LayoutUnit top_of_emphasis_mark = |
1628 curr->LogicalTop() - style.GetFont().EmphasisMarkHeight( | 1628 curr->LogicalTop() - style.GetFont().EmphasisMarkHeight( |
1629 style.TextEmphasisMarkString()); | 1629 style.TextEmphasisMarkString()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 InlineBox::ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, | 1707 InlineBox::ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, |
1708 marked_label2, obj, depth); | 1708 marked_label2, obj, depth); |
1709 for (const InlineBox* box = FirstChild(); box; box = box->NextOnLine()) | 1709 for (const InlineBox* box = FirstChild(); box; box = box->NextOnLine()) |
1710 box->ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, | 1710 box->ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, |
1711 marked_label2, obj, depth + 1); | 1711 marked_label2, obj, depth + 1); |
1712 } | 1712 } |
1713 | 1713 |
1714 #endif | 1714 #endif |
1715 | 1715 |
1716 } // namespace blink | 1716 } // namespace blink |
OLD | NEW |