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

Side by Side Diff: sky/engine/core/rendering/style/RenderStyle.cpp

Issue 667003003: Remove most of visited link support. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 766 }
767 767
768 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list StyleImage.get(); } 768 StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->list StyleImage.get(); }
769 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v) 769 void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v)
770 { 770 {
771 if (rareInheritedData->listStyleImage != v) 771 if (rareInheritedData->listStyleImage != v)
772 rareInheritedData.access()->listStyleImage = v; 772 rareInheritedData.access()->listStyleImage = v;
773 } 773 }
774 774
775 Color RenderStyle::color() const { return inherited->color; } 775 Color RenderStyle::color() const { return inherited->color; }
776 Color RenderStyle::visitedLinkColor() const { return inherited->visitedLinkColor ; }
777 void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); } 776 void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); }
778 void RenderStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visit edLinkColor, v); }
779 777
780 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta l_border_spacing; } 778 short RenderStyle::horizontalBorderSpacing() const { return inherited->horizonta l_border_spacing; }
781 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo rder_spacing; } 779 short RenderStyle::verticalBorderSpacing() const { return inherited->vertical_bo rder_spacing; }
782 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz ontal_border_spacing, v); } 780 void RenderStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horiz ontal_border_spacing, v); }
783 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica l_border_spacing, v); } 781 void RenderStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertica l_border_spacing, v); }
784 782
785 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const 783 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
786 { 784 {
787 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); 785 IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
788 RoundedRect roundedRect(snappedBorderRect); 786 RoundedRect roundedRect(snappedBorderRect);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1056
1059 list->append(decoration); 1057 list->append(decoration);
1060 } 1058 }
1061 1059
1062 void RenderStyle::applyTextDecorations() 1060 void RenderStyle::applyTextDecorations()
1063 { 1061 {
1064 if (textDecoration() == TextDecorationNone) 1062 if (textDecoration() == TextDecorationNone)
1065 return; 1063 return;
1066 1064
1067 TextDecorationStyle style = textDecorationStyle(); 1065 TextDecorationStyle style = textDecorationStyle();
1068 StyleColor styleColor = visitedDependentDecorationStyleColor(); 1066 StyleColor styleColor = decorationStyleColor();
1069 1067
1070 int decorations = textDecoration(); 1068 int decorations = textDecoration();
1071 1069
1072 if (decorations & TextDecorationUnderline) { 1070 if (decorations & TextDecorationUnderline) {
1073 // To save memory, we don't use AppliedTextDecoration objects in the 1071 // To save memory, we don't use AppliedTextDecoration objects in the
1074 // common case of a single simple underline. 1072 // common case of a single simple underline.
1075 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or); 1073 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or);
1076 1074
1077 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline()) 1075 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline())
1078 inherited_flags.m_textUnderline = true; 1076 inherited_flags.m_textUnderline = true;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 const ShadowData& shadow = shadowList->shadows()[i]; 1170 const ShadowData& shadow = shadowList->shadows()[i];
1173 if (shadow.style() == Inset) 1171 if (shadow.style() == Inset)
1174 continue; 1172 continue;
1175 float blurAndSpread = shadow.blur() + shadow.spread(); 1173 float blurAndSpread = shadow.blur() + shadow.spread();
1176 1174
1177 top = std::min<LayoutUnit>(top, shadow.y() - blurAndSpread); 1175 top = std::min<LayoutUnit>(top, shadow.y() - blurAndSpread);
1178 bottom = std::max<LayoutUnit>(bottom, shadow.y() + blurAndSpread); 1176 bottom = std::max<LayoutUnit>(bottom, shadow.y() + blurAndSpread);
1179 } 1177 }
1180 } 1178 }
1181 1179
1182 StyleColor RenderStyle::visitedDependentDecorationStyleColor() const 1180 StyleColor RenderStyle::decorationStyleColor() const
1183 { 1181 {
1184 bool isVisited = false; 1182 StyleColor styleColor = textDecorationColor();
1185
1186 StyleColor styleColor = isVisited ? visitedLinkTextDecorationColor() : textD ecorationColor();
1187 1183
1188 if (!styleColor.isCurrentColor()) 1184 if (!styleColor.isCurrentColor())
1189 return styleColor; 1185 return styleColor;
1190 1186
1191 if (textStrokeWidth()) { 1187 if (textStrokeWidth()) {
1192 // Prefer stroke color if possible, but not if it's fully transparent. 1188 // Prefer stroke color if possible, but not if it's fully transparent.
1193 StyleColor textStrokeStyleColor = isVisited ? visitedLinkTextStrokeColor () : textStrokeColor(); 1189 StyleColor textStrokeStyleColor = textStrokeColor();
1194 if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color ().alpha()) 1190 if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color ().alpha())
1195 return textStrokeStyleColor; 1191 return textStrokeStyleColor;
1196 } 1192 }
1197 1193
1198 return isVisited ? visitedLinkTextFillColor() : textFillColor(); 1194 return textFillColor();
1199 } 1195 }
1200 1196
1201 Color RenderStyle::visitedDependentDecorationColor() const 1197 Color RenderStyle::decorationColor() const
1202 { 1198 {
1203 bool isVisited = false; 1199 return decorationStyleColor().resolve(color());
1204 return visitedDependentDecorationStyleColor().resolve(isVisited ? visitedLin kColor() : color());
1205 } 1200 }
1206 1201
1207 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c onst 1202 Color RenderStyle::colorIncludingFallback(int colorProperty) const
1208 { 1203 {
1209 StyleColor result(StyleColor::currentColor()); 1204 StyleColor result(StyleColor::currentColor());
1210 EBorderStyle borderStyle = BNONE; 1205 EBorderStyle borderStyle = BNONE;
1211 switch (colorProperty) { 1206 switch (colorProperty) {
1212 case CSSPropertyBackgroundColor: 1207 case CSSPropertyBackgroundColor:
1213 result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); 1208 result = backgroundColor();
1214 break; 1209 break;
1215 case CSSPropertyBorderLeftColor: 1210 case CSSPropertyBorderLeftColor:
1216 result = visitedLink ? visitedLinkBorderLeftColor() : borderLeftColor(); 1211 result = borderLeftColor();
1217 borderStyle = borderLeftStyle(); 1212 borderStyle = borderLeftStyle();
1218 break; 1213 break;
1219 case CSSPropertyBorderRightColor: 1214 case CSSPropertyBorderRightColor:
1220 result = visitedLink ? visitedLinkBorderRightColor() : borderRightColor( ); 1215 result = borderRightColor();
1221 borderStyle = borderRightStyle(); 1216 borderStyle = borderRightStyle();
1222 break; 1217 break;
1223 case CSSPropertyBorderTopColor: 1218 case CSSPropertyBorderTopColor:
1224 result = visitedLink ? visitedLinkBorderTopColor() : borderTopColor(); 1219 result = borderTopColor();
1225 borderStyle = borderTopStyle(); 1220 borderStyle = borderTopStyle();
1226 break; 1221 break;
1227 case CSSPropertyBorderBottomColor: 1222 case CSSPropertyBorderBottomColor:
1228 result = visitedLink ? visitedLinkBorderBottomColor() : borderBottomColo r(); 1223 result = borderBottomColor();
1229 borderStyle = borderBottomStyle(); 1224 borderStyle = borderBottomStyle();
1230 break; 1225 break;
1231 case CSSPropertyColor: 1226 case CSSPropertyColor:
1232 result = visitedLink ? visitedLinkColor() : color(); 1227 result = color();
1233 break; 1228 break;
1234 case CSSPropertyOutlineColor: 1229 case CSSPropertyOutlineColor:
1235 result = visitedLink ? visitedLinkOutlineColor() : outlineColor(); 1230 result = outlineColor();
1236 break; 1231 break;
1237 case CSSPropertyWebkitTextEmphasisColor: 1232 case CSSPropertyWebkitTextEmphasisColor:
1238 result = visitedLink ? visitedLinkTextEmphasisColor() : textEmphasisColo r(); 1233 result = textEmphasisColor();
1239 break; 1234 break;
1240 case CSSPropertyWebkitTextFillColor: 1235 case CSSPropertyWebkitTextFillColor:
1241 result = visitedLink ? visitedLinkTextFillColor() : textFillColor(); 1236 result = textFillColor();
1242 break; 1237 break;
1243 case CSSPropertyWebkitTextStrokeColor: 1238 case CSSPropertyWebkitTextStrokeColor:
1244 result = visitedLink ? visitedLinkTextStrokeColor() : textStrokeColor(); 1239 result = textStrokeColor();
1245 break; 1240 break;
1246 case CSSPropertyWebkitTapHighlightColor: 1241 case CSSPropertyWebkitTapHighlightColor:
1247 result = tapHighlightColor(); 1242 result = tapHighlightColor();
1248 break; 1243 break;
1249 default: 1244 default:
1250 ASSERT_NOT_REACHED(); 1245 ASSERT_NOT_REACHED();
1251 break; 1246 break;
1252 } 1247 }
1253 1248
1254 if (!result.isCurrentColor()) 1249 if (!result.isCurrentColor())
1255 return result.color(); 1250 return result.color();
1256 1251
1257 // FIXME: Treating styled borders with initial color differently causes prob lems 1252 // FIXME: Treating styled borders with initial color differently causes prob lems
1258 // See crbug.com/316559, crbug.com/276231 1253 // See crbug.com/316559, crbug.com/276231
1259 if (!visitedLink && (borderStyle == INSET || borderStyle == OUTSET || border Style == RIDGE || borderStyle == GROOVE)) 1254 if ((borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE | | borderStyle == GROOVE))
1260 return Color(238, 238, 238); 1255 return Color(238, 238, 238);
1261 return visitedLink ? visitedLinkColor() : color(); 1256 return color();
1262 }
1263
1264 Color RenderStyle::visitedDependentColor(int colorProperty) const
1265 {
1266 // FIXME(sky): Remove visited colors.
1267 return colorIncludingFallback(colorProperty, false);
1268 } 1257 }
1269 1258
1270 const BorderValue& RenderStyle::borderBefore() const 1259 const BorderValue& RenderStyle::borderBefore() const
1271 { 1260 {
1272 switch (writingMode()) { 1261 switch (writingMode()) {
1273 case TopToBottomWritingMode: 1262 case TopToBottomWritingMode:
1274 return borderTop(); 1263 return borderTop();
1275 case BottomToTopWritingMode: 1264 case BottomToTopWritingMode:
1276 return borderBottom(); 1265 return borderBottom();
1277 case LeftToRightWritingMode: 1266 case LeftToRightWritingMode:
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 // right 1457 // right
1469 radiiSum = radii.topRight().height() + radii.bottomRight().height(); 1458 radiiSum = radii.topRight().height() + radii.bottomRight().height();
1470 if (radiiSum > rect.height()) 1459 if (radiiSum > rect.height())
1471 factor = std::min(rect.height() / radiiSum, factor); 1460 factor = std::min(rect.height() / radiiSum, factor);
1472 1461
1473 ASSERT(factor <= 1); 1462 ASSERT(factor <= 1);
1474 return factor; 1463 return factor;
1475 } 1464 }
1476 1465
1477 } // namespace blink 1466 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/style/RenderStyle.h ('k') | sky/engine/core/rendering/style/StyleInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698