Index: third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h |
diff --git a/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h b/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h |
index 47fe8c79bf19301951cecf5a1d4496c732713f5e..bcec998b41b4f0f83a422c46bb995a1b0bf8c753 100644 |
--- a/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h |
+++ b/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h |
@@ -12,11 +12,35 @@ namespace blink { |
class ComputedStyle; |
+struct OptionalStyleColor { |
+ public: |
+ OptionalStyleColor(std::nullptr_t) : m_isNull(true) {} |
+ OptionalStyleColor(const StyleColor& styleColor) |
+ : m_isNull(false), m_styleColor(styleColor) {} |
+ OptionalStyleColor(const Color& color) |
+ : m_isNull(false), m_styleColor(color) {} |
+ |
+ bool isNull() const { return m_isNull; } |
+ const StyleColor& access() const { |
+ DCHECK(!m_isNull); |
+ return m_styleColor; |
+ } |
+ bool operator==(const OptionalStyleColor& other) const { |
+ return m_isNull == other.m_isNull && m_styleColor == other.m_styleColor; |
+ } |
+ |
+ private: |
+ bool m_isNull; |
+ StyleColor m_styleColor; |
+}; |
+ |
class ColorPropertyFunctions { |
public: |
- static bool getInitialColor(CSSPropertyID, StyleColor& initialColor); |
- static StyleColor getUnvisitedColor(CSSPropertyID, const ComputedStyle&); |
- static StyleColor getVisitedColor(CSSPropertyID, const ComputedStyle&); |
+ static OptionalStyleColor getInitialColor(CSSPropertyID); |
+ static OptionalStyleColor getUnvisitedColor(CSSPropertyID, |
+ const ComputedStyle&); |
+ static OptionalStyleColor getVisitedColor(CSSPropertyID, |
+ const ComputedStyle&); |
static void setUnvisitedColor(CSSPropertyID, ComputedStyle&, const Color&); |
static void setVisitedColor(CSSPropertyID, ComputedStyle&, const Color&); |
}; |