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

Unified Diff: Source/core/style/ComputedStyle.cpp

Issue 950623002: Store resolved color in AppliedTextDecoration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed inherited_flags.m_textunderline Created 5 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 side-by-side diff with in-line comments
Download patch
« Source/core/style/ComputedStyle.h ('K') | « Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/ComputedStyle.cpp
diff --git a/Source/core/style/ComputedStyle.cpp b/Source/core/style/ComputedStyle.cpp
index 55e5e184c452ef04b7ac13ab6e637b610973677d..4b832b2a04e086c728679a9832452c909f2f2007 100644
--- a/Source/core/style/ComputedStyle.cpp
+++ b/Source/core/style/ComputedStyle.cpp
@@ -737,7 +737,6 @@ void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other
if (!diff.needsPaintInvalidation()) {
if (inherited->color != other.inherited->color
|| inherited->visitedLinkColor != other.inherited->visitedLinkColor
- || inherited_flags.m_textUnderline != other.inherited_flags.m_textUnderline
|| visual->textDecoration != other.visual->textDecoration) {
diff.setTextOrColorChanged();
} else if (rareNonInheritedData.get() != other.rareNonInheritedData.get()
@@ -1214,11 +1213,11 @@ TextDecoration ComputedStyle::textDecorationsInEffect() const
const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() const
{
- if (!inherited_flags.m_textUnderline && !rareInheritedData->appliedTextDecorations) {
+ if (!isSimpleUnderlineDecoration() && !rareInheritedData->appliedTextDecorations) {
DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ());
return empty;
}
- if (inherited_flags.m_textUnderline) {
+ if (isSimpleUnderlineDecoration()) {
DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, AppliedTextDecoration(TextDecorationUnderline)));
return underline;
}
@@ -1322,44 +1321,49 @@ void ComputedStyle::addAppliedTextDecoration(const AppliedTextDecoration& decora
else if (!list->hasOneRef())
list = list->copy();
- if (inherited_flags.m_textUnderline) {
- inherited_flags.m_textUnderline = false;
+ if (isSimpleUnderlineDecoration()) {
list->append(AppliedTextDecoration(TextDecorationUnderline));
}
list->append(decoration);
}
-void ComputedStyle::applyTextDecorations()
+void ComputedStyle::applyTextDecorations(const ComputedStyle& parentStyle)
{
- if (textDecoration() == TextDecorationNone)
+ if (textDecoration() == TextDecorationNone) {
+ if (hasOutOfFlowPosition() || isFloating()) {
samahto 2015/05/17 17:12:40 [spec says]: "text decorations are not propagated
wkorman 2015/07/01 15:16:14 Add layout tests to validate this works as expecte
+ clearAppliedTextDecorations();
+ return;
+ }
+ if ((parentStyle.isSimpleUnderlineDecoration())) {
+ TextDecorationStyle style = parentStyle.textDecorationStyle();
+ Color color = parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor);
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationUnderline, style, color));
+ }
return;
+ }
TextDecorationStyle style = textDecorationStyle();
StyleColor styleColor = decorationColorIncludingFallback(insideLink() == InsideVisitedLink);
+ Color resolvedColor = styleColor.resolve(color());
int decorations = textDecoration();
if (decorations & TextDecorationUnderline) {
// To save memory, we don't use AppliedTextDecoration objects in the
// common case of a single simple underline.
- AppliedTextDecoration underline(TextDecorationUnderline, style, styleColor);
-
- if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnderline())
- inherited_flags.m_textUnderline = true;
- else
+ AppliedTextDecoration underline(TextDecorationUnderline, style, resolvedColor);
+ if (rareInheritedData->appliedTextDecorations || !styleColor.isCurrentColor())
addAppliedTextDecoration(underline);
}
if (decorations & TextDecorationOverline)
- addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, style, styleColor));
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, style, resolvedColor));
if (decorations & TextDecorationLineThrough)
- addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough, style, styleColor));
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough, style, resolvedColor));
}
void ComputedStyle::clearAppliedTextDecorations()
{
- inherited_flags.m_textUnderline = false;
-
if (rareInheritedData->appliedTextDecorations)
rareInheritedData.access()->appliedTextDecorations = nullptr;
}
@@ -1699,7 +1703,6 @@ bool ComputedStyle::borderObscuresBackground() const
BorderEdge edges[4];
getBorderEdgeInfo(edges);
-
for (int i = BSTop; i <= BSLeft; ++i) {
const BorderEdge& currEdge = edges[i];
if (!currEdge.obscuresBackground())
« Source/core/style/ComputedStyle.h ('K') | « Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698