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

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

Issue 2880573002: Store border-*-style on SurroundData in ComputedStyle (Closed)
Patch Set: Store border-*-style on SurroundData in ComputedStyle not BorderStyle 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (IsDisplayTableType(Display())) { 767 if (IsDisplayTableType(Display())) {
768 if (BorderCollapse() != other.BorderCollapse() || 768 if (BorderCollapse() != other.BorderCollapse() ||
769 EmptyCells() != other.EmptyCells() || 769 EmptyCells() != other.EmptyCells() ||
770 CaptionSide() != other.CaptionSide() || 770 CaptionSide() != other.CaptionSide() ||
771 TableLayout() != other.TableLayout()) 771 TableLayout() != other.TableLayout())
772 return true; 772 return true;
773 773
774 // In the collapsing border model, 'hidden' suppresses other borders, while 774 // In the collapsing border model, 'hidden' suppresses other borders, while
775 // 'none' does not, so these style differences can be width differences. 775 // 'none' does not, so these style differences can be width differences.
776 if ((BorderCollapse() == EBorderCollapse::kCollapse) && 776 if ((BorderCollapse() == EBorderCollapse::kCollapse) &&
777 ((BorderTopStyle() == kBorderStyleHidden && 777 ((BorderTopStyle() == EBorderStyle::kHidden &&
778 other.BorderTopStyle() == kBorderStyleNone) || 778 other.BorderTopStyle() == EBorderStyle::kNone) ||
779 (BorderTopStyle() == kBorderStyleNone && 779 (BorderTopStyle() == EBorderStyle::kNone &&
780 other.BorderTopStyle() == kBorderStyleHidden) || 780 other.BorderTopStyle() == EBorderStyle::kHidden) ||
781 (BorderBottomStyle() == kBorderStyleHidden && 781 (BorderBottomStyle() == EBorderStyle::kHidden &&
782 other.BorderBottomStyle() == kBorderStyleNone) || 782 other.BorderBottomStyle() == EBorderStyle::kNone) ||
783 (BorderBottomStyle() == kBorderStyleNone && 783 (BorderBottomStyle() == EBorderStyle::kNone &&
784 other.BorderBottomStyle() == kBorderStyleHidden) || 784 other.BorderBottomStyle() == EBorderStyle::kHidden) ||
785 (BorderLeftStyle() == kBorderStyleHidden && 785 (BorderLeftStyle() == EBorderStyle::kHidden &&
786 other.BorderLeftStyle() == kBorderStyleNone) || 786 other.BorderLeftStyle() == EBorderStyle::kNone) ||
787 (BorderLeftStyle() == kBorderStyleNone && 787 (BorderLeftStyle() == EBorderStyle::kNone &&
788 other.BorderLeftStyle() == kBorderStyleHidden) || 788 other.BorderLeftStyle() == EBorderStyle::kHidden) ||
789 (BorderRightStyle() == kBorderStyleHidden && 789 (BorderRightStyle() == EBorderStyle::kHidden &&
790 other.BorderRightStyle() == kBorderStyleNone) || 790 other.BorderRightStyle() == EBorderStyle::kNone) ||
791 (BorderRightStyle() == kBorderStyleNone && 791 (BorderRightStyle() == EBorderStyle::kNone &&
792 other.BorderRightStyle() == kBorderStyleHidden))) 792 other.BorderRightStyle() == EBorderStyle::kHidden)))
793 return true; 793 return true;
794 } else if (Display() == EDisplay::kListItem) { 794 } else if (Display() == EDisplay::kListItem) {
795 if (ListStyleType() != other.ListStyleType() || 795 if (ListStyleType() != other.ListStyleType() ||
796 ListStylePosition() != other.ListStylePosition()) 796 ListStylePosition() != other.ListStylePosition())
797 return true; 797 return true;
798 } 798 }
799 799
800 if ((Visibility() == EVisibility::kCollapse) != 800 if ((Visibility() == EVisibility::kCollapse) !=
801 (other.Visibility() == EVisibility::kCollapse)) 801 (other.Visibility() == EVisibility::kCollapse))
802 return true; 802 return true;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 return true; 862 return true;
863 } 863 }
864 864
865 return false; 865 return false;
866 } 866 }
867 867
868 bool ComputedStyle::DiffNeedsPaintInvalidationObject( 868 bool ComputedStyle::DiffNeedsPaintInvalidationObject(
869 const ComputedStyle& other) const { 869 const ComputedStyle& other) const {
870 if (Visibility() != other.Visibility() || 870 if (Visibility() != other.Visibility() ||
871 PrintColorAdjust() != other.PrintColorAdjust() || 871 PrintColorAdjust() != other.PrintColorAdjust() ||
872 InsideLink() != other.InsideLink() || 872 InsideLink() != other.InsideLink() || !BorderVisuallyEqual(other) ||
873 !Border().VisuallyEqual(other.Border()) || !RadiiEqual(other) || 873 !RadiiEqual(other) || *background_data_ != *other.background_data_)
874 !BorderColorVisuallyEquals(other) || !BorderSizeEquals(other) ||
875 *background_data_ != *other.background_data_)
876 return true; 874 return true;
877 875
878 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) { 876 if (rare_inherited_data_.Get() != other.rare_inherited_data_.Get()) {
879 if (rare_inherited_data_->user_modify_ != 877 if (rare_inherited_data_->user_modify_ !=
880 other.rare_inherited_data_->user_modify_ || 878 other.rare_inherited_data_->user_modify_ ||
881 rare_inherited_data_->user_select_ != 879 rare_inherited_data_->user_select_ !=
882 other.rare_inherited_data_->user_select_ || 880 other.rare_inherited_data_->user_select_ ||
883 rare_inherited_data_->image_rendering_ != 881 rare_inherited_data_->image_rendering_ !=
884 other.rare_inherited_data_->image_rendering_) 882 other.rare_inherited_data_->image_rendering_)
885 return true; 883 return true;
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 text_stroke_style_color.GetColor().Alpha()) 2091 text_stroke_style_color.GetColor().Alpha())
2094 return text_stroke_style_color; 2092 return text_stroke_style_color;
2095 } 2093 }
2096 2094
2097 return visited_link ? VisitedLinkTextFillColor() : TextFillColor(); 2095 return visited_link ? VisitedLinkTextFillColor() : TextFillColor();
2098 } 2096 }
2099 2097
2100 Color ComputedStyle::ColorIncludingFallback(int color_property, 2098 Color ComputedStyle::ColorIncludingFallback(int color_property,
2101 bool visited_link) const { 2099 bool visited_link) const {
2102 StyleColor result(StyleColor::CurrentColor()); 2100 StyleColor result(StyleColor::CurrentColor());
2103 EBorderStyle border_style = kBorderStyleNone; 2101 EBorderStyle border_style = EBorderStyle::kNone;
2104 switch (color_property) { 2102 switch (color_property) {
2105 case CSSPropertyBackgroundColor: 2103 case CSSPropertyBackgroundColor:
2106 result = visited_link ? VisitedLinkBackgroundColor() : BackgroundColor(); 2104 result = visited_link ? VisitedLinkBackgroundColor() : BackgroundColor();
2107 break; 2105 break;
2108 case CSSPropertyBorderLeftColor: 2106 case CSSPropertyBorderLeftColor:
2109 result = visited_link ? VisitedLinkBorderLeftColor() : BorderLeftColor(); 2107 result = visited_link ? VisitedLinkBorderLeftColor() : BorderLeftColor();
2110 border_style = BorderLeftStyle(); 2108 border_style = BorderLeftStyle();
2111 break; 2109 break;
2112 case CSSPropertyBorderRightColor: 2110 case CSSPropertyBorderRightColor:
2113 result = 2111 result =
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 default: 2167 default:
2170 NOTREACHED(); 2168 NOTREACHED();
2171 break; 2169 break;
2172 } 2170 }
2173 2171
2174 if (!result.IsCurrentColor()) 2172 if (!result.IsCurrentColor())
2175 return result.GetColor(); 2173 return result.GetColor();
2176 2174
2177 // FIXME: Treating styled borders with initial color differently causes 2175 // FIXME: Treating styled borders with initial color differently causes
2178 // problems, see crbug.com/316559, crbug.com/276231 2176 // problems, see crbug.com/316559, crbug.com/276231
2179 if (!visited_link && 2177 if (!visited_link && (border_style == EBorderStyle::kInset ||
2180 (border_style == kBorderStyleInset || 2178 border_style == EBorderStyle::kOutset ||
2181 border_style == kBorderStyleOutset || 2179 border_style == EBorderStyle::kRidge ||
2182 border_style == kBorderStyleRidge || border_style == kBorderStyleGroove)) 2180 border_style == EBorderStyle::kGroove))
2183 return Color(238, 238, 238); 2181 return Color(238, 238, 238);
2184 return visited_link ? VisitedLinkColor() : GetColor(); 2182 return visited_link ? VisitedLinkColor() : GetColor();
2185 } 2183 }
2186 2184
2187 Color ComputedStyle::VisitedDependentColor(int color_property) const { 2185 Color ComputedStyle::VisitedDependentColor(int color_property) const {
2188 Color unvisited_color = ColorIncludingFallback(color_property, false); 2186 Color unvisited_color = ColorIncludingFallback(color_property, false);
2189 if (InsideLink() != EInsideLink::kInsideVisitedLink) 2187 if (InsideLink() != EInsideLink::kInsideVisitedLink)
2190 return unvisited_color; 2188 return unvisited_color;
2191 2189
2192 Color visited_color = ColorIncludingFallback(color_property, true); 2190 Color visited_color = ColorIncludingFallback(color_property, true);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 if (value < 0) 2503 if (value < 0)
2506 fvalue -= 0.5f; 2504 fvalue -= 0.5f;
2507 else 2505 else
2508 fvalue += 0.5f; 2506 fvalue += 0.5f;
2509 } 2507 }
2510 2508
2511 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2509 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2512 } 2510 }
2513 2511
2514 } // namespace blink 2512 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698