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

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

Issue 2077413005: Add "alpha" option to PaintWorklet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set alpha to be true by default Created 4 years, 5 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/modules/csspaint/PaintRenderingContext2DTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
index 5dab990e1113261179b9b3013fde42ffe75888a7..89c43e4900bfad2e02e42772085695c1c7d909c6 100644
--- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
@@ -84,6 +84,16 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, const ScriptValu
}
}
+ // Parse 'alpha' AKA hasAlpha property.
+ v8::Local<v8::Value> alphaValue;
+ if (!v8Call(constructor->Get(context, v8String(isolate, "alpha")), alphaValue))
+ return;
+ if (!isUndefinedOrNull(alphaValue) && !alphaValue->IsBoolean()) {
+ exceptionState.throwTypeError("The 'alpha' property on the class is not a boolean.");
+ return;
+ }
+ bool hasAlpha = alphaValue->IsBoolean() ? v8::Local<v8::Boolean>::Cast(alphaValue)->Value() : true;
+
v8::Local<v8::Value> prototypeValue;
if (!v8Call(constructor->Get(context, v8String(isolate, "prototype")), prototypeValue))
return;
@@ -116,7 +126,7 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, const ScriptValu
v8::Local<v8::Function> paint = v8::Local<v8::Function>::Cast(paintValue);
- CSSPaintDefinition* definition = CSSPaintDefinition::create(scriptController()->getScriptState(), constructor, paint, nativeInvalidationProperties, customInvalidationProperties);
+ CSSPaintDefinition* definition = CSSPaintDefinition::create(scriptController()->getScriptState(), constructor, paint, nativeInvalidationProperties, customInvalidationProperties, hasAlpha);
m_paintDefinitions.set(name, definition);
// Set the definition on any pending generators.
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2DTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698