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

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

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.h
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 16264201d1ada3c0f0700e92de4cf91429c8f572..2906b02348df8eefd39dc4440e74259c1b16ee7f 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -530,13 +530,7 @@ public:
bool backgroundIsKnownToBeObscured();
bool borderImageIsLoadedAndCanBeRendered() const;
bool mustRepaintBackgroundOrBorder() const;
- bool hasBackground() const
- {
- StyleColor color = resolveColor(CSSPropertyBackgroundColor);
- if (color.isValid() && color.alpha())
- return true;
- return style()->hasBackgroundImage();
- }
+ bool hasBackground() const { return style()->hasBackground(); }
bool hasEntirelyFixedBackground() const;
bool needsLayout() const
@@ -760,41 +754,23 @@ public:
inline Color resolveColor(const RenderStyle* styleToUse, int colorProperty) const
{
- StyleColor styleColor = resolveCurrentColor(styleToUse, colorProperty);
- return styleColor.color();
+ return styleToUse->visitedDependentColor(colorProperty);
}
inline Color resolveColor(int colorProperty) const
{
- StyleColor styleColor = resolveCurrentColor(style(), colorProperty);
- return styleColor.color();
- }
-
- inline Color resolveColor(int colorProperty, Color fallbackIfInvalid) const
- {
- StyleColor styleColor = resolveCurrentColor(style(), colorProperty);
- return styleColor.isValid() ? styleColor.color() : fallbackIfInvalid;
+ return style()->visitedDependentColor(colorProperty);
}
- inline Color resolveColor(StyleColor color) const
+ inline Color resolveColor(int colorProperty, Color fallback) const
{
- return resolveCurrentColor(color).color();
+ Color color = resolveColor(colorProperty);
+ return color.isValid() ? color : fallback;
}
- inline Color resolveColor(StyleColor color, Color fallbackIfInvalid) const
+ inline Color resolveColor(Color color) const
{
- StyleColor styleColor = resolveCurrentColor(color);
- return styleColor.isValid() ? styleColor.color() : fallbackIfInvalid;
- }
-
- inline StyleColor resolveStyleColor(int colorProperty) const
- {
- return resolveCurrentColor(style(), colorProperty);
- }
-
- inline StyleColor resolveStyleColor(const RenderStyle* styleToUse, int colorProperty) const
- {
- return resolveCurrentColor(styleToUse, colorProperty);
+ return color;
}
// Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a
@@ -1044,28 +1020,6 @@ private:
Color selectionColor(int colorProperty) const;
- inline StyleColor resolveCurrentColor(const RenderStyle* styleToUse, int colorProperty) const
- {
- StyleColor styleColor = styleToUse->visitedDependentColor(colorProperty);
- if (UNLIKELY(styleColor.isCurrentColor()))
- styleColor = styleToUse->visitedDependentColor(CSSPropertyColor);
-
- // In the unlikely case that CSSPropertyColor is also 'currentColor'
- // the color of the nearest ancestor with a valid color is used.
- for (const RenderObject* object = this; UNLIKELY(styleColor.isCurrentColor()) && object && object->style(); object = object->parent())
- styleColor = object->style()->visitedDependentColor(CSSPropertyColor);
-
- return styleColor;
- }
-
- inline StyleColor resolveCurrentColor(StyleColor color) const
- {
- StyleColor styleColor = color;
- for (const RenderObject* object = this; UNLIKELY(styleColor.isCurrentColor()) && object && object->style(); object = object->parent())
- styleColor = object->style()->visitedDependentColor(CSSPropertyColor);
- return styleColor;
- }
-
void removeShapeImageClient(ShapeValue*);
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698