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

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

Issue 1866623002: Hook up CSSPaintValue::image to CSS Paint API callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 c4348e10b2d63435296889d760f0049cd268812b..a1670e131e14c38936f7bc53ee9c0812a0e27b00 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(CSSCustomIdentValue* name)
: CSSImageGeneratorValue(PaintClass)
, m_name(name)
+ , m_paintImageGeneratorObserver(new Observer(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::paintImageGeneratorReady()
+{
+ m_ownerValue->paintImageGeneratorReady();
+}
+
+void CSSPaintValue::paintImageGeneratorReady()
+{
+ for (const auto& curr : clients()) {
haraken 2016/04/12 00:44:20 for (LayoutObject* client : clients().keys())
ikilpatrick 2016/04/12 03:08:09 Done.
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698