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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2890733002: Make EBorderStyle an enum class. (Closed)
Patch Set: Build for Mac 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 if (IsDisplayTableType(Display())) { 750 if (IsDisplayTableType(Display())) {
751 if (BorderCollapse() != other.BorderCollapse() || 751 if (BorderCollapse() != other.BorderCollapse() ||
752 EmptyCells() != other.EmptyCells() || 752 EmptyCells() != other.EmptyCells() ||
753 CaptionSide() != other.CaptionSide() || 753 CaptionSide() != other.CaptionSide() ||
754 TableLayout() != other.TableLayout()) 754 TableLayout() != other.TableLayout())
755 return true; 755 return true;
756 756
757 // In the collapsing border model, 'hidden' suppresses other borders, while 757 // In the collapsing border model, 'hidden' suppresses other borders, while
758 // 'none' does not, so these style differences can be width differences. 758 // 'none' does not, so these style differences can be width differences.
759 if ((BorderCollapse() == EBorderCollapse::kCollapse) && 759 if ((BorderCollapse() == EBorderCollapse::kCollapse) &&
760 ((BorderTopStyle() == kBorderStyleHidden && 760 ((BorderTopStyle() == EBorderStyle::kHidden &&
761 other.BorderTopStyle() == kBorderStyleNone) || 761 other.BorderTopStyle() == EBorderStyle::kNone) ||
762 (BorderTopStyle() == kBorderStyleNone && 762 (BorderTopStyle() == EBorderStyle::kNone &&
763 other.BorderTopStyle() == kBorderStyleHidden) || 763 other.BorderTopStyle() == EBorderStyle::kHidden) ||
764 (BorderBottomStyle() == kBorderStyleHidden && 764 (BorderBottomStyle() == EBorderStyle::kHidden &&
765 other.BorderBottomStyle() == kBorderStyleNone) || 765 other.BorderBottomStyle() == EBorderStyle::kNone) ||
766 (BorderBottomStyle() == kBorderStyleNone && 766 (BorderBottomStyle() == EBorderStyle::kNone &&
767 other.BorderBottomStyle() == kBorderStyleHidden) || 767 other.BorderBottomStyle() == EBorderStyle::kHidden) ||
768 (BorderLeftStyle() == kBorderStyleHidden && 768 (BorderLeftStyle() == EBorderStyle::kHidden &&
769 other.BorderLeftStyle() == kBorderStyleNone) || 769 other.BorderLeftStyle() == EBorderStyle::kNone) ||
770 (BorderLeftStyle() == kBorderStyleNone && 770 (BorderLeftStyle() == EBorderStyle::kNone &&
771 other.BorderLeftStyle() == kBorderStyleHidden) || 771 other.BorderLeftStyle() == EBorderStyle::kHidden) ||
772 (BorderRightStyle() == kBorderStyleHidden && 772 (BorderRightStyle() == EBorderStyle::kHidden &&
773 other.BorderRightStyle() == kBorderStyleNone) || 773 other.BorderRightStyle() == EBorderStyle::kNone) ||
774 (BorderRightStyle() == kBorderStyleNone && 774 (BorderRightStyle() == EBorderStyle::kNone &&
775 other.BorderRightStyle() == kBorderStyleHidden))) 775 other.BorderRightStyle() == EBorderStyle::kHidden)))
776 return true; 776 return true;
777 } else if (Display() == EDisplay::kListItem) { 777 } else if (Display() == EDisplay::kListItem) {
778 if (ListStyleType() != other.ListStyleType() || 778 if (ListStyleType() != other.ListStyleType() ||
779 ListStylePosition() != other.ListStylePosition()) 779 ListStylePosition() != other.ListStylePosition())
780 return true; 780 return true;
781 } 781 }
782 782
783 if ((Visibility() == EVisibility::kCollapse) != 783 if ((Visibility() == EVisibility::kCollapse) !=
784 (other.Visibility() == EVisibility::kCollapse)) 784 (other.Visibility() == EVisibility::kCollapse))
785 return true; 785 return true;
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 text_stroke_style_color.GetColor().Alpha()) 2082 text_stroke_style_color.GetColor().Alpha())
2083 return text_stroke_style_color; 2083 return text_stroke_style_color;
2084 } 2084 }
2085 2085
2086 return visited_link ? VisitedLinkTextFillColor() : TextFillColor(); 2086 return visited_link ? VisitedLinkTextFillColor() : TextFillColor();
2087 } 2087 }
2088 2088
2089 Color ComputedStyle::ColorIncludingFallback(int color_property, 2089 Color ComputedStyle::ColorIncludingFallback(int color_property,
2090 bool visited_link) const { 2090 bool visited_link) const {
2091 StyleColor result(StyleColor::CurrentColor()); 2091 StyleColor result(StyleColor::CurrentColor());
2092 EBorderStyle border_style = kBorderStyleNone; 2092 EBorderStyle border_style = EBorderStyle::kNone;
2093 switch (color_property) { 2093 switch (color_property) {
2094 case CSSPropertyBackgroundColor: 2094 case CSSPropertyBackgroundColor:
2095 result = visited_link ? VisitedLinkBackgroundColor() : BackgroundColor(); 2095 result = visited_link ? VisitedLinkBackgroundColor() : BackgroundColor();
2096 break; 2096 break;
2097 case CSSPropertyBorderLeftColor: 2097 case CSSPropertyBorderLeftColor:
2098 result = visited_link ? VisitedLinkBorderLeftColor() : BorderLeftColor(); 2098 result = visited_link ? VisitedLinkBorderLeftColor() : BorderLeftColor();
2099 border_style = BorderLeftStyle(); 2099 border_style = BorderLeftStyle();
2100 break; 2100 break;
2101 case CSSPropertyBorderRightColor: 2101 case CSSPropertyBorderRightColor:
2102 result = 2102 result =
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 default: 2158 default:
2159 NOTREACHED(); 2159 NOTREACHED();
2160 break; 2160 break;
2161 } 2161 }
2162 2162
2163 if (!result.IsCurrentColor()) 2163 if (!result.IsCurrentColor())
2164 return result.GetColor(); 2164 return result.GetColor();
2165 2165
2166 // FIXME: Treating styled borders with initial color differently causes 2166 // FIXME: Treating styled borders with initial color differently causes
2167 // problems, see crbug.com/316559, crbug.com/276231 2167 // problems, see crbug.com/316559, crbug.com/276231
2168 if (!visited_link && 2168 if (!visited_link && (border_style == EBorderStyle::kInset ||
2169 (border_style == kBorderStyleInset || 2169 border_style == EBorderStyle::kOutset ||
2170 border_style == kBorderStyleOutset || 2170 border_style == EBorderStyle::kRidge ||
2171 border_style == kBorderStyleRidge || border_style == kBorderStyleGroove)) 2171 border_style == EBorderStyle::kGroove))
2172 return Color(238, 238, 238); 2172 return Color(238, 238, 238);
2173 return visited_link ? VisitedLinkColor() : GetColor(); 2173 return visited_link ? VisitedLinkColor() : GetColor();
2174 } 2174 }
2175 2175
2176 Color ComputedStyle::VisitedDependentColor(int color_property) const { 2176 Color ComputedStyle::VisitedDependentColor(int color_property) const {
2177 Color unvisited_color = ColorIncludingFallback(color_property, false); 2177 Color unvisited_color = ColorIncludingFallback(color_property, false);
2178 if (InsideLink() != EInsideLink::kInsideVisitedLink) 2178 if (InsideLink() != EInsideLink::kInsideVisitedLink)
2179 return unvisited_color; 2179 return unvisited_color;
2180 2180
2181 Color visited_color = ColorIncludingFallback(color_property, true); 2181 Color visited_color = ColorIncludingFallback(color_property, true);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 if (value < 0) 2494 if (value < 0)
2495 fvalue -= 0.5f; 2495 fvalue -= 0.5f;
2496 else 2496 else
2497 fvalue += 0.5f; 2497 fvalue += 0.5f;
2498 } 2498 }
2499 2499
2500 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2500 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2501 } 2501 }
2502 2502
2503 } // namespace blink 2503 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698