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

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

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 7731a94081e5247a31f901a9363d3a31f3367495..1a05201050b83f7692e3aeaadeb078ba4f8b811b 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1662,18 +1662,16 @@ bool RenderObject::isSelectable() const
Color RenderObject::selectionBackgroundColor() const
{
- Color backgroundColor= Color::transparent;
+ Color backgroundColor;
if (isSelectable()) {
RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
- if (pseudoStyle) {
- StyleColor styleColor = resolveCurrentColor(pseudoStyle.get(), CSSPropertyBackgroundColor);
- if (styleColor.isValid())
- return styleColor.color().blendWithWhite();
+ if (pseudoStyle && resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).isValid()) {
+ backgroundColor = resolveColor(pseudoStyle.get(), CSSPropertyBackgroundColor).blendWithWhite();
+ } else {
+ backgroundColor = frame()->selection().isFocusedAndActive() ?
+ RenderTheme::theme().activeSelectionBackgroundColor() :
+ RenderTheme::theme().inactiveSelectionBackgroundColor();
}
-
- backgroundColor = frame()->selection().isFocusedAndActive() ?
- RenderTheme::theme().activeSelectionBackgroundColor() :
- RenderTheme::theme().inactiveSelectionBackgroundColor();
}
return backgroundColor;
@@ -1688,13 +1686,14 @@ Color RenderObject::selectionColor(int colorProperty) const
Color color;
if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(PseudoStyleRequest(SELECTION))) {
- StyleColor styleColor = resolveCurrentColor(pseudoStyle.get(), colorProperty);
- color = styleColor.isValid() ? styleColor.color() : resolveColor(pseudoStyle.get(), CSSPropertyColor);
+ Color selectionColor = resolveColor(pseudoStyle.get(), colorProperty);
+ color = selectionColor.isValid() ? selectionColor : resolveColor(pseudoStyle.get(), CSSPropertyColor);
} else {
color = frame()->selection().isFocusedAndActive() ?
RenderTheme::theme().activeSelectionForegroundColor() :
RenderTheme::theme().inactiveSelectionForegroundColor();
}
+
return color;
}
@@ -2910,20 +2909,20 @@ bool RenderObject::hasBlendMode() const
static Color decorationColor(const RenderObject* object, RenderStyle* style)
{
- StyleColor result;
+ Color result;
// Check for text decoration color first.
- result = object->resolveStyleColor(style, CSSPropertyTextDecorationColor);
+ result = object->resolveColor(style, CSSPropertyTextDecorationColor);
if (result.isValid())
- return result.color();
+ return result;
if (style->textStrokeWidth() > 0) {
// Prefer stroke color if possible but not if it's fully transparent.
result = object->resolveColor(style, CSSPropertyWebkitTextStrokeColor);
if (result.alpha())
- return result.color();
+ return result;
}
result = object->resolveColor(style, CSSPropertyWebkitTextFillColor);
- return result.color();
+ return result;
}
void RenderObject::getTextDecorationColors(int decorations, Color& underline, Color& overline,

Powered by Google App Engine
This is Rietveld 408576698