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

Side by Side Diff: Source/core/layout/style/LayoutStyle.cpp

Issue 950623002: Store resolved color in AppliedTextDecoration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated patch with underline optimization handling Created 5 years, 9 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 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 list = list->copy(); 1313 list = list->copy();
1314 1314
1315 if (inherited_flags.m_textUnderline) { 1315 if (inherited_flags.m_textUnderline) {
1316 inherited_flags.m_textUnderline = false; 1316 inherited_flags.m_textUnderline = false;
1317 list->append(AppliedTextDecoration(TextDecorationUnderline)); 1317 list->append(AppliedTextDecoration(TextDecorationUnderline));
1318 } 1318 }
1319 1319
1320 list->append(decoration); 1320 list->append(decoration);
1321 } 1321 }
1322 1322
1323 bool LayoutStyle::hasSimpleUnderlineTextDecoration()
1324 {
1325 int decorations = textDecoration();
Timothy Loh 2015/03/25 00:26:23 Don't think we should have to check this. If you l
1326 return inherited_flags.m_textUnderline && (decorations & TextDecorationUnder line);
1327 }
1328
1329 void LayoutStyle::adjustTextDecorationDifference()
1330 {
1331 Color color = visitedDependentColor(CSSPropertyTextDecorationColor);
1332 TextDecorationStyle style = textDecorationStyle();
Timothy Loh 2015/03/25 00:26:23 Is this always TextDecorationUnderline when we get
1333
1334 AppliedTextDecoration underline(TextDecorationUnderline, style, color);
1335 addAppliedTextDecoration(underline);
1336 }
1337
1323 void LayoutStyle::applyTextDecorations() 1338 void LayoutStyle::applyTextDecorations()
1324 { 1339 {
1325 if (textDecoration() == TextDecorationNone) 1340 if (textDecoration() == TextDecorationNone)
1326 return; 1341 return;
1327 1342
1328 TextDecorationStyle style = textDecorationStyle(); 1343 TextDecorationStyle style = textDecorationStyle();
1329 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins ideVisitedLink); 1344 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins ideVisitedLink);
1345 Color resolvedColor = styleColor.resolve(color());
1330 1346
1331 int decorations = textDecoration(); 1347 int decorations = textDecoration();
1332 1348
1333 if (decorations & TextDecorationUnderline) { 1349 if (decorations & TextDecorationUnderline) {
1334 // To save memory, we don't use AppliedTextDecoration objects in the 1350 // To save memory, we don't use AppliedTextDecoration objects in the
1335 // common case of a single simple underline. 1351 // common case of a single simple underline.
1336 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or); 1352 AppliedTextDecoration underline(TextDecorationUnderline, style, resolved Color);
1337 1353
1338 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline()) 1354 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde rline(styleColor.isCurrentColor()))
Timothy Loh 2015/03/25 00:26:23 I think this is just if (!rareInheritedData->appli
1339 inherited_flags.m_textUnderline = true; 1355 inherited_flags.m_textUnderline = true;
1340 else 1356 else
1341 addAppliedTextDecoration(underline); 1357 addAppliedTextDecoration(underline);
1342 } 1358 }
1343 if (decorations & TextDecorationOverline) 1359 if (decorations & TextDecorationOverline)
1344 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s tyle, styleColor)); 1360 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s tyle, resolvedColor));
1345 if (decorations & TextDecorationLineThrough) 1361 if (decorations & TextDecorationLineThrough)
1346 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough , style, styleColor)); 1362 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough , style, resolvedColor));
1347 } 1363 }
1348 1364
1349 void LayoutStyle::clearAppliedTextDecorations() 1365 void LayoutStyle::clearAppliedTextDecorations()
1350 { 1366 {
1351 inherited_flags.m_textUnderline = false; 1367 inherited_flags.m_textUnderline = false;
1352 1368
1353 if (rareInheritedData->appliedTextDecorations) 1369 if (rareInheritedData->appliedTextDecorations)
1354 rareInheritedData.access()->appliedTextDecorations = nullptr; 1370 rareInheritedData.access()->appliedTextDecorations = nullptr;
1355 } 1371 }
1356 1372
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 horizontal || includeLogicalRightEdge); 1738 horizontal || includeLogicalRightEdge);
1723 1739
1724 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1740 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1725 visitedDependentColor(CSSPropertyBorderLeftColor), 1741 visitedDependentColor(CSSPropertyBorderLeftColor),
1726 borderLeftStyle(), 1742 borderLeftStyle(),
1727 borderLeftIsTransparent(), 1743 borderLeftIsTransparent(),
1728 !horizontal || includeLogicalLeftEdge); 1744 !horizontal || includeLogicalLeftEdge);
1729 } 1745 }
1730 1746
1731 } // namespace blink 1747 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698