Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp

Issue 2895883002: Make TextEmphasisPosition an enum class. (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 : bottom_ruby_base_leading; 817 : bottom_ruby_base_leading;
818 box_height -= (top_ruby_base_leading + bottom_ruby_base_leading); 818 box_height -= (top_ruby_base_leading + bottom_ruby_base_leading);
819 } 819 }
820 } 820 }
821 if (curr->IsInlineTextBox()) { 821 if (curr->IsInlineTextBox()) {
822 TextEmphasisPosition emphasis_mark_position; 822 TextEmphasisPosition emphasis_mark_position;
823 if (ToInlineTextBox(curr)->GetEmphasisMarkPosition( 823 if (ToInlineTextBox(curr)->GetEmphasisMarkPosition(
824 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()), 824 curr->GetLineLayoutItem().StyleRef(IsFirstLineStyle()),
825 emphasis_mark_position)) { 825 emphasis_mark_position)) {
826 bool emphasis_mark_is_over = 826 bool emphasis_mark_is_over =
827 emphasis_mark_position == kTextEmphasisPositionOver; 827 emphasis_mark_position == TextEmphasisPosition::kOver;
828 if (emphasis_mark_is_over != curr->GetLineLayoutItem() 828 if (emphasis_mark_is_over != curr->GetLineLayoutItem()
829 .Style(IsFirstLineStyle()) 829 .Style(IsFirstLineStyle())
830 ->IsFlippedLinesWritingMode()) 830 ->IsFlippedLinesWritingMode())
831 has_annotations_before = true; 831 has_annotations_before = true;
832 else 832 else
833 has_annotations_after = true; 833 has_annotations_after = true;
834 } 834 }
835 } 835 }
836 836
837 if (!set_line_top) { 837 if (!set_line_top) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() != kTextEmphasisMarkNone &&
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 == kTextEmphasisPositionOver) == 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 }
1061 1061
1062 // If letter-spacing is negative, we should factor that into right layout 1062 // If letter-spacing is negative, we should factor that into right layout
1063 // overflow. Even in RTL, letter-spacing is applied to the right, so this is 1063 // overflow. Even in RTL, letter-spacing is applied to the right, so this is
1064 // not an issue with left overflow. 1064 // not an issue with left overflow.
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() != kTextEmphasisMarkNone &&
1550 ToInlineTextBox(curr)->GetEmphasisMarkPosition( 1550 ToInlineTextBox(curr)->GetEmphasisMarkPosition(
1551 style, emphasis_mark_position) && 1551 style, emphasis_mark_position) &&
1552 emphasis_mark_position == kTextEmphasisPositionOver) { 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 {
1560 int bottom_of_emphasis_mark = 1560 int bottom_of_emphasis_mark =
1561 (curr->LogicalBottom() + style.GetFont().EmphasisMarkHeight( 1561 (curr->LogicalBottom() + style.GetFont().EmphasisMarkHeight(
1562 style.TextEmphasisMarkString())) 1562 style.TextEmphasisMarkString()))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() != kTextEmphasisMarkNone &&
1620 style.GetTextEmphasisPosition() == kTextEmphasisPositionUnder) { 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());
1630 result = std::max(result, allowed_position - top_of_emphasis_mark); 1630 result = std::max(result, allowed_position - top_of_emphasis_mark);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698