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

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

Issue 2845773002: Make TextDecoration an enum class. (Closed)
Patch Set: Address comments Created 3 years, 7 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 900
901 LayoutUnit InlineFlowBox::MaxLogicalBottomForUnderline( 901 LayoutUnit InlineFlowBox::MaxLogicalBottomForUnderline(
902 LineLayoutItem decoration_object, 902 LineLayoutItem decoration_object,
903 LayoutUnit max_logical_bottom) const { 903 LayoutUnit max_logical_bottom) const {
904 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { 904 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) {
905 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) 905 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned())
906 continue; // Positioned placeholders don't affect calculations. 906 continue; // Positioned placeholders don't affect calculations.
907 907
908 // If the text decoration isn't in effect on the child, it must be outside 908 // If the text decoration isn't in effect on the child, it must be outside
909 // of |decorationObject|. 909 // of |decorationObject|.
910 if (!(curr->LineStyleRef().TextDecorationsInEffect() & 910 if (!EnumHasFlags(curr->LineStyleRef().TextDecorationsInEffect(),
911 kTextDecorationUnderline)) 911 TextDecoration::kUnderline))
912 continue; 912 continue;
913 913
914 if (decoration_object && decoration_object.IsLayoutInline() && 914 if (decoration_object && decoration_object.IsLayoutInline() &&
915 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem())) 915 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem()))
916 continue; 916 continue;
917 917
918 if (curr->IsInlineFlowBox()) { 918 if (curr->IsInlineFlowBox()) {
919 max_logical_bottom = ToInlineFlowBox(curr)->MaxLogicalBottomForUnderline( 919 max_logical_bottom = ToInlineFlowBox(curr)->MaxLogicalBottomForUnderline(
920 decoration_object, max_logical_bottom); 920 decoration_object, max_logical_bottom);
921 } else if (curr->IsInlineTextBox()) { 921 } else if (curr->IsInlineTextBox()) {
922 max_logical_bottom = std::max(max_logical_bottom, curr->LogicalBottom()); 922 max_logical_bottom = std::max(max_logical_bottom, curr->LogicalBottom());
923 } 923 }
924 } 924 }
925 return max_logical_bottom; 925 return max_logical_bottom;
926 } 926 }
927 927
928 LayoutUnit InlineFlowBox::MinLogicalTopForUnderline( 928 LayoutUnit InlineFlowBox::MinLogicalTopForUnderline(
929 LineLayoutItem decoration_object, 929 LineLayoutItem decoration_object,
930 LayoutUnit min_logical_top) const { 930 LayoutUnit min_logical_top) const {
931 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) { 931 for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) {
932 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned()) 932 if (curr->GetLineLayoutItem().IsOutOfFlowPositioned())
933 continue; // Positioned placeholders don't affect calculations. 933 continue; // Positioned placeholders don't affect calculations.
934 934
935 // If the text decoration isn't in effect on the child, it must be outside 935 // If the text decoration isn't in effect on the child, it must be outside
936 // of |decorationObject|. 936 // of |decorationObject|.
937 if (!(curr->LineStyleRef().TextDecorationsInEffect() & 937 if (!EnumHasFlags(curr->LineStyleRef().TextDecorationsInEffect(),
938 kTextDecorationUnderline)) 938 TextDecoration::kUnderline))
939 continue; 939 continue;
940 940
941 if (decoration_object && decoration_object.IsLayoutInline() && 941 if (decoration_object && decoration_object.IsLayoutInline() &&
942 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem())) 942 !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem()))
943 continue; 943 continue;
944 944
945 if (curr->IsInlineFlowBox()) { 945 if (curr->IsInlineFlowBox()) {
946 min_logical_top = ToInlineFlowBox(curr)->MinLogicalTopForUnderline( 946 min_logical_top = ToInlineFlowBox(curr)->MinLogicalTopForUnderline(
947 decoration_object, min_logical_top); 947 decoration_object, min_logical_top);
948 } else if (curr->IsInlineTextBox()) { 948 } else if (curr->IsInlineTextBox()) {
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 DCHECK_EQ(child->prevOnLine(), prev); 1753 DCHECK_EQ(child->prevOnLine(), prev);
1754 prev = child; 1754 prev = child;
1755 } 1755 }
1756 DCHECK_EQ(prev, m_lastChild); 1756 DCHECK_EQ(prev, m_lastChild);
1757 #endif 1757 #endif
1758 } 1758 }
1759 1759
1760 #endif 1760 #endif
1761 1761
1762 } // namespace blink 1762 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698