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

Unified Diff: third_party/WebKit/Source/core/css/CSSColorValue.h

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 years, 2 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: third_party/WebKit/Source/core/css/CSSColorValue.h
diff --git a/third_party/WebKit/Source/core/css/CSSColorValue.h b/third_party/WebKit/Source/core/css/CSSColorValue.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8e532f0735da52edc1c3712714ea4e6ef565912
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSColorValue.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CSSColorValue_h
+#define CSSColorValue_h
+
+#include "core/css/CSSValue.h"
+#include "platform/graphics/Color.h"
+#include "wtf/PassRefPtr.h"
+
+namespace blink {
+
+// Represents the non-keyword subset of <color>.
+class CSSColorValue : public CSSValue {
+public:
+ static PassRefPtrWillBeRawPtr<CSSColorValue> create(Color color)
+ {
+ return adoptRefWillBeNoop(new CSSColorValue(color));
+ }
+
+ String customCSSText() const
+ {
+ return m_color.serializedAsCSSComponentValue();
+ }
+
+ // TODO(sashab): Make this return a Color.
+ RGBA32 value() const { return m_color.rgb(); }
+
+ bool equals(const CSSColorValue& other) const
+ {
+ return m_color == other.m_color;
+ }
+
+ DEFINE_INLINE_TRACE_AFTER_DISPATCH()
+ {
+ CSSValue::traceAfterDispatch(visitor);
+ }
+
+private:
+ CSSColorValue(Color color)
+ : CSSValue(ColorClass)
+ , m_color(color) { }
+
+ Color m_color;
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSColorValue, isColorValue());
+
+} // namespace blink
+
+#endif // CSSColorValue_h
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCalculationValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSGradientValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698