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

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 19697011: Change rendering code to use RenderObject::resolveColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/RenderObject.h ('k') | Source/core/rendering/RenderTable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index e32235b88474d3c23ae76b02079eeb5c46e0066c..fe8f4503802a39d69a1ceba5fa4de8c7af7ce1f9 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1116,7 +1116,7 @@ void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Vector<IntRect> focusRingRects;
addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
if (style->outlineStyleIsAuto())
- paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
+ paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor));
else
addPDFURLRect(paintInfo.context, unionRect(focusRingRects));
}
@@ -1174,7 +1174,7 @@ void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
return;
EBorderStyle outlineStyle = styleToUse->outlineStyle();
- Color outlineColor = styleToUse->visitedDependentColor(CSSPropertyOutlineColor);
+ Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor);
GraphicsContext* graphicsContext = paintInfo.context;
bool useTransparencyLayer = outlineColor.hasAlpha();
@@ -1657,8 +1657,8 @@ Color RenderObject::selectionBackgroundColor() const
Color color;
if (shouldUseSelectionColor(*style())) {
RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
- if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
- color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite();
+ if (pseudoStyle && resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).isValid())
+ color = resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blendWithWhite();
else
color = frame()->selection()->isFocusedAndActive() ?
theme()->activeSelectionBackgroundColor() :
@@ -1678,9 +1678,8 @@ Color RenderObject::selectionColor(int colorProperty) const
return color;
if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION))) {
- color = pseudoStyle->visitedDependentColor(colorProperty);
- if (!color.isValid())
- color = pseudoStyle->visitedDependentColor(CSSPropertyColor);
+ Color selectionColor = resolveColor(pseudoStyle.get(), colorProperty);
+ color = selectionColor.isValid() ? selectionColor : resolveColor(pseudoStyle.get(), CSSPropertyColor);
} else
color = frame()->selection()->isFocusedAndActive() ?
theme()->activeSelectionForegroundColor() :
@@ -2815,21 +2814,21 @@ bool RenderObject::hasBlendMode() const
return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style()->hasBlendMode();
}
-static Color decorationColor(RenderStyle* style)
+static Color decorationColor(const RenderObject* object, RenderStyle* style)
{
Color result;
// Check for text decoration color first.
- result = style->visitedDependentColor(CSSPropertyTextDecorationColor);
+ result = object->resolveColor(style, CSSPropertyTextDecorationColor);
if (result.isValid())
return result;
if (style->textStrokeWidth() > 0) {
// Prefer stroke color if possible but not if it's fully transparent.
- result = style->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
+ result = object->resolveColor(style, CSSPropertyWebkitTextStrokeColor);
if (result.alpha())
return result;
}
- result = style->visitedDependentColor(CSSPropertyWebkitTextFillColor);
+ result = object->resolveColor(style, CSSPropertyWebkitTextFillColor);
return result;
}
@@ -2843,7 +2842,7 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co
do {
styleToUse = curr->style(firstlineStyle);
currDecs = styleToUse->textDecoration();
- resultColor = decorationColor(styleToUse);
+ resultColor = decorationColor(this, styleToUse);
// Parameter 'decorations' is cast as an int to enable the bitwise operations below.
if (currDecs) {
if (currDecs & TextDecorationUnderline) {
@@ -2869,7 +2868,7 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co
// If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
if (decorations && curr) {
styleToUse = curr->style(firstlineStyle);
- resultColor = decorationColor(styleToUse);
+ resultColor = decorationColor(this, styleToUse);
if (decorations & TextDecorationUnderline)
underline = resultColor;
if (decorations & TextDecorationOverline)
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698