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

Unified Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 280503003: Fix incorrect style recalculation of text-decoration properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review issues. Created 6 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
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index 7871ddcc59aadaffe943e15b9acb6e2c91ada05c..df03fc9af7441639f28075e592f134f39eb5cba9 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -1270,20 +1270,25 @@ void RenderStyle::applyTextDecorations()
if (textDecoration() == TextDecorationNone)
return;
+ TextDecorationStyle style = textDecorationStyle();
+ StyleColor styleColor = visitedDependentDecorationStyleColor();
+
int decorations = textDecoration();
if (decorations & TextDecorationUnderline) {
// To save memory, we don't use AppliedTextDecoration objects in the
- // common case of a single underline.
- if (!rareInheritedData->appliedTextDecorations)
+ // common case of a single simple underline.
+ AppliedTextDecoration underline(TextDecorationUnderline, style, styleColor);
+
+ if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnderline())
inherited_flags.m_textUnderline = true;
else
- addAppliedTextDecoration(AppliedTextDecoration(TextDecorationUnderline));
+ addAppliedTextDecoration(underline);
}
if (decorations & TextDecorationOverline)
- addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline));
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, style, styleColor));
if (decorations & TextDecorationLineThrough)
- addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough));
+ addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough, style, styleColor));
}
void RenderStyle::clearAppliedTextDecorations()
@@ -1371,10 +1376,29 @@ void RenderStyle::getShadowVerticalExtent(const ShadowList* shadowList, LayoutUn
}
}
-StyleColor RenderStyle::visitedDependentDecorationColor() const
+StyleColor RenderStyle::visitedDependentDecorationStyleColor() const
+{
+ bool isVisited = insideLink() == InsideVisitedLink;
+
+ StyleColor styleColor = isVisited ? visitedLinkTextDecorationColor() : textDecorationColor();
+
+ if (!styleColor.isCurrentColor())
+ return styleColor;
+
+ if (textStrokeWidth()) {
+ // Prefer stroke color if possible, but not if it's fully transparent.
+ StyleColor textStrokeStyleColor = isVisited ? visitedLinkTextStrokeColor() : textStrokeColor();
+ if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color().alpha())
+ return textStrokeStyleColor;
+ }
+
+ return isVisited ? visitedLinkTextFillColor() : textFillColor();
+}
+
+Color RenderStyle::visitedDependentDecorationColor() const
{
- // Text decoration color fallback is handled in RenderObject::decorationColor.
- return insideLink() == InsideVisitedLink ? visitedLinkTextDecorationColor() : textDecorationColor();
+ bool isVisited = insideLink() == InsideVisitedLink;
+ return visitedDependentDecorationStyleColor().resolve(isVisited ? visitedLinkColor() : color());
}
Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) const
« 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