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

Unified Diff: third_party/WebKit/Source/core/css/CSSPaintValue.cpp

Issue 1782833008: Add paint() function as valid CSS <image> type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: name->customCSSText Created 4 years, 9 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 | « third_party/WebKit/Source/core/css/CSSPaintValue.h ('k') | third_party/WebKit/Source/core/css/CSSValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSPaintValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..68e13dfd42017a8dfff3addb16c8dfb61128219d
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
@@ -0,0 +1,54 @@
+// Copyright 2016 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.
+
+#include "core/css/CSSPaintValue.h"
+
+#include "core/css/CSSCustomIdentValue.h"
+#include "platform/graphics/Image.h"
+#include "wtf/text/StringBuilder.h"
+
+namespace blink {
+
+CSSPaintValue::CSSPaintValue(PassRefPtrWillBeRawPtr<CSSCustomIdentValue> name)
+ : CSSImageGeneratorValue(PaintClass)
+ , m_name(name)
+{
+}
+
+CSSPaintValue::~CSSPaintValue()
+{
+}
+
+String CSSPaintValue::customCSSText() const
+{
+ StringBuilder result;
+ result.appendLiteral("paint(");
+ result.append(m_name->customCSSText());
+ result.append(')');
+ return result.toString();
+}
+
+String CSSPaintValue::name() const
+{
+ return m_name->value();
+}
+
+PassRefPtr<Image> CSSPaintValue::image(const LayoutObject*, const IntSize&)
+{
+ // TODO(ikilpatrick): implement.
+ return nullptr;
+}
+
+bool CSSPaintValue::equals(const CSSPaintValue& other) const
+{
+ return name() == other.name();
+}
+
+DEFINE_TRACE_AFTER_DISPATCH(CSSPaintValue)
+{
+ visitor->trace(m_name);
+ CSSImageGeneratorValue::traceAfterDispatch(visitor);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPaintValue.h ('k') | third_party/WebKit/Source/core/css/CSSValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698