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

Unified Diff: third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp

Issue 2054023002: [CSS Paint API] Add StylePropertyMap as an argument to the paint function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 years, 6 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/modules/csspaint/CSSPaintDefinition.cpp
diff --git a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp
index dc4bc2f35b06fb31dea2a4c5a4b623bfec4c0207..41059bb1ffc3f1a9ed5a8b1ff373c359b2a1a278 100644
--- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp
+++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp
@@ -8,7 +8,10 @@
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8BindingMacros.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "core/css/CSSComputedStyleDeclaration.h"
+#include "core/css/cssom/FilteredComputedStylePropertyMap.h"
#include "core/dom/ExecutionContext.h"
+#include "core/layout/LayoutObject.h"
#include "modules/csspaint/Geometry.h"
#include "modules/csspaint/PaintRenderingContext2D.h"
#include "platform/graphics/ImageBuffer.h"
@@ -35,7 +38,7 @@ CSSPaintDefinition::~CSSPaintDefinition()
{
}
-PassRefPtr<Image> CSSPaintDefinition::paint(const IntSize& size)
+PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, const IntSize& size)
{
ScriptState::Scope scope(m_scriptState.get());
@@ -49,13 +52,19 @@ PassRefPtr<Image> CSSPaintDefinition::paint(const IntSize& size)
if (isUndefinedOrNull(instance))
return nullptr;
+ DCHECK(layoutObject.node());
+
PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create(
ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size))));
Geometry* geometry = Geometry::create(size);
+ StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create(
+ CSSComputedStyleDeclaration::create(layoutObject.node()),
+ m_nativeInvalidationProperties, m_customInvalidationProperties);
v8::Local<v8::Value> argv[] = {
toV8(renderingContext, m_scriptState->context()->Global(), isolate),
- toV8(geometry, m_scriptState->context()->Global(), isolate)
+ toV8(geometry, m_scriptState->context()->Global(), isolate),
+ toV8(styleMap, m_scriptState->context()->Global(), isolate)
};
v8::Local<v8::Function> paint = m_paint.newLocal(isolate);
@@ -63,7 +72,7 @@ PassRefPtr<Image> CSSPaintDefinition::paint(const IntSize& size)
v8::TryCatch block(isolate);
block.SetVerbose(true);
- V8ScriptRunner::callFunction(paint, m_scriptState->getExecutionContext(), instance, 2, argv, isolate);
+ V8ScriptRunner::callFunction(paint, m_scriptState->getExecutionContext(), instance, 3, argv, isolate);
// The paint function may have produced an error, in which case produce an
// invalid image.

Powered by Google App Engine
This is Rietveld 408576698