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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 746173002: Respect fallback colors when interpolating text-decoration-color. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 1264
1265 list->append(decoration); 1265 list->append(decoration);
1266 } 1266 }
1267 1267
1268 void RenderStyle::applyTextDecorations() 1268 void RenderStyle::applyTextDecorations()
1269 { 1269 {
1270 if (textDecoration() == TextDecorationNone) 1270 if (textDecoration() == TextDecorationNone)
1271 return; 1271 return;
1272 1272
1273 TextDecorationStyle style = textDecorationStyle(); 1273 TextDecorationStyle style = textDecorationStyle();
1274 StyleColor styleColor = visitedDependentDecorationStyleColor(); 1274 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins ideVisitedLink);
1275 1275
1276 int decorations = textDecoration(); 1276 int decorations = textDecoration();
1277 1277
1278 if (decorations & TextDecorationUnderline) { 1278 if (decorations & TextDecorationUnderline) {
1279 // To save memory, we don't use AppliedTextDecoration objects in the 1279 // To save memory, we don't use AppliedTextDecoration objects in the
1280 // common case of a single simple underline. 1280 // common case of a single simple underline.
1281 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or); 1281 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or);
1282 1282
1283 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline()) 1283 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline())
1284 inherited_flags.m_textUnderline = true; 1284 inherited_flags.m_textUnderline = true;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 const ShadowData& shadow = shadowList->shadows()[i]; 1375 const ShadowData& shadow = shadowList->shadows()[i];
1376 if (shadow.style() == Inset) 1376 if (shadow.style() == Inset)
1377 continue; 1377 continue;
1378 float blurAndSpread = shadow.blur() + shadow.spread(); 1378 float blurAndSpread = shadow.blur() + shadow.spread();
1379 1379
1380 top = std::min<LayoutUnit>(top, shadow.y() - blurAndSpread); 1380 top = std::min<LayoutUnit>(top, shadow.y() - blurAndSpread);
1381 bottom = std::max<LayoutUnit>(bottom, shadow.y() + blurAndSpread); 1381 bottom = std::max<LayoutUnit>(bottom, shadow.y() + blurAndSpread);
1382 } 1382 }
1383 } 1383 }
1384 1384
1385 StyleColor RenderStyle::visitedDependentDecorationStyleColor() const 1385 StyleColor RenderStyle::decorationColorIncludingFallback(bool visitedLink) const
1386 { 1386 {
1387 bool isVisited = insideLink() == InsideVisitedLink; 1387 StyleColor styleColor = visitedLink ? visitedLinkTextDecorationColor() : tex tDecorationColor();
1388
1389 StyleColor styleColor = isVisited ? visitedLinkTextDecorationColor() : textD ecorationColor();
1390 1388
1391 if (!styleColor.isCurrentColor()) 1389 if (!styleColor.isCurrentColor())
1392 return styleColor; 1390 return styleColor;
1393 1391
1394 if (textStrokeWidth()) { 1392 if (textStrokeWidth()) {
1395 // Prefer stroke color if possible, but not if it's fully transparent. 1393 // Prefer stroke color if possible, but not if it's fully transparent.
1396 StyleColor textStrokeStyleColor = isVisited ? visitedLinkTextStrokeColor () : textStrokeColor(); 1394 StyleColor textStrokeStyleColor = visitedLink ? visitedLinkTextStrokeCol or() : textStrokeColor();
1397 if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color ().alpha()) 1395 if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color ().alpha())
1398 return textStrokeStyleColor; 1396 return textStrokeStyleColor;
1399 } 1397 }
1400 1398
1401 return isVisited ? visitedLinkTextFillColor() : textFillColor(); 1399 return visitedLink ? visitedLinkTextFillColor() : textFillColor();
1402 }
1403
1404 Color RenderStyle::visitedDependentDecorationColor() const
1405 {
1406 bool isVisited = insideLink() == InsideVisitedLink;
1407 return visitedDependentDecorationStyleColor().resolve(isVisited ? visitedLin kColor() : color());
1408 } 1400 }
1409 1401
1410 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c onst 1402 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c onst
1411 { 1403 {
1412 StyleColor result(StyleColor::currentColor()); 1404 StyleColor result(StyleColor::currentColor());
1413 EBorderStyle borderStyle = BNONE; 1405 EBorderStyle borderStyle = BNONE;
1414 switch (colorProperty) { 1406 switch (colorProperty) {
1415 case CSSPropertyBackgroundColor: 1407 case CSSPropertyBackgroundColor:
1416 result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); 1408 result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor();
1417 break; 1409 break;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 break; 1446 break;
1455 case CSSPropertyLightingColor: 1447 case CSSPropertyLightingColor:
1456 result = lightingColor(); 1448 result = lightingColor();
1457 break; 1449 break;
1458 case CSSPropertyStopColor: 1450 case CSSPropertyStopColor:
1459 result = stopColor(); 1451 result = stopColor();
1460 break; 1452 break;
1461 case CSSPropertyWebkitTapHighlightColor: 1453 case CSSPropertyWebkitTapHighlightColor:
1462 result = tapHighlightColor(); 1454 result = tapHighlightColor();
1463 break; 1455 break;
1456 case CSSPropertyTextDecorationColor:
1457 result = decorationColorIncludingFallback(visitedLink);
1458 break;
1464 default: 1459 default:
1465 ASSERT_NOT_REACHED(); 1460 ASSERT_NOT_REACHED();
1466 break; 1461 break;
1467 } 1462 }
1468 1463
1469 if (!result.isCurrentColor()) 1464 if (!result.isCurrentColor())
1470 return result.color(); 1465 return result.color();
1471 1466
1472 // FIXME: Treating styled borders with initial color differently causes prob lems 1467 // FIXME: Treating styled borders with initial color differently causes prob lems
1473 // See crbug.com/316559, crbug.com/276231 1468 // See crbug.com/316559, crbug.com/276231
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 horizontal || includeLogicalRightEdge); 1750 horizontal || includeLogicalRightEdge);
1756 1751
1757 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1752 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1758 visitedDependentColor(CSSPropertyBorderLeftColor), 1753 visitedDependentColor(CSSPropertyBorderLeftColor),
1759 borderLeftStyle(), 1754 borderLeftStyle(),
1760 borderLeftIsTransparent(), 1755 borderLeftIsTransparent(),
1761 !horizontal || includeLogicalLeftEdge); 1756 !horizontal || includeLogicalLeftEdge);
1762 } 1757 }
1763 1758
1764 } // namespace blink 1759 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698