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

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

Issue 1834843002: [WIP] Plumbing for paint Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: \o/\o/ 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
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
index 11b08d9e0379b7b247b9c0e5d119ba182dbdb64e..ee6c621dae11e339879df6a1a1a074e635a22ef5 100644
--- a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp
@@ -5,6 +5,7 @@
#include "core/css/CSSPaintValue.h"
#include "core/css/CSSCustomIdentValue.h"
+#include "core/layout/LayoutObject.h"
#include "platform/graphics/Image.h"
#include "wtf/text/StringBuilder.h"
@@ -13,6 +14,7 @@ namespace blink {
CSSPaintValue::CSSPaintValue(PassRefPtrWillBeRawPtr<CSSCustomIdentValue> name)
: CSSImageGeneratorValue(PaintClass)
, m_name(name)
+ , m_paintImageGeneratorObserver(this)
{
}
@@ -34,10 +36,25 @@ String CSSPaintValue::name() const
return m_name->value();
}
-PassRefPtr<Image> CSSPaintValue::image(const LayoutObject&, const IntSize&)
+PassRefPtr<Image> CSSPaintValue::image(const LayoutObject& layoutObject, const IntSize& size)
{
- // TODO(ikilpatrick): implement.
- return nullptr;
+ if (!m_generator)
+ m_generator = CSSPaintImageGenerator::create(name(), layoutObject.document(), &m_paintImageGeneratorObserver);
+
+ return m_generator->paint(size);
+}
+
+void CSSPaintValue::Observer::ready()
+{
+ m_ownerValue->ready();
+}
+
+void CSSPaintValue::ready()
+{
+ for (const auto& curr : clients()) {
+ LayoutObject* client = const_cast<LayoutObject*>(curr.key);
+ client->imageChanged(static_cast<WrappedImagePtr>(this));
+ }
}
bool CSSPaintValue::equals(const CSSPaintValue& other) const
@@ -48,6 +65,8 @@ bool CSSPaintValue::equals(const CSSPaintValue& other) const
DEFINE_TRACE_AFTER_DISPATCH(CSSPaintValue)
{
visitor->trace(m_name);
+ visitor->trace(m_generator);
+ visitor->trace(m_paintImageGeneratorObserver);
CSSImageGeneratorValue::traceAfterDispatch(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPaintValue.h ('k') | third_party/WebKit/Source/modules/ModulesInitializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698