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

Unified Diff: third_party/WebKit/LayoutTests/csspaint/paint2d-gradient-shadow.html

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/LayoutTests/csspaint/paint2d-gradient-shadow.html
diff --git a/third_party/WebKit/LayoutTests/csspaint/paint2d-gradient-shadow.html b/third_party/WebKit/LayoutTests/csspaint/paint2d-gradient-shadow.html
new file mode 100644
index 0000000000000000000000000000000000000000..6c1990fdef8f74e6d4a0e16dbc4c11f2f701f134
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/csspaint/paint2d-gradient-shadow.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/run-after-layout-and-paint.js"></script>
+<style>
+ #output {
+ width: 500px;
+ height: 500px;
+ background-image: paint(shapes);
+ }
+</style>
+</head>
+<body>
+<div id="output"></div>
+
+<script id="code" type="text/worklet">
+registerPaint('shapes', class {
+ paint(ctx) {
+ var fillShape = function(x, y) {
+ ctx.beginPath();
+ ctx.arc(x, y, 100, 0, Math.PI*2, true);
+ ctx.arc(x, y, 50, 0, Math.PI*2, false);
+ ctx.fill();
+ };
+
+ var gradient = ctx.createLinearGradient(0, 0, 300, 0);
+ gradient.addColorStop(0, 'rgba(0, 0, 255, 0.5)');
+ gradient.addColorStop(1, 'rgba(0, 0, 255, 0.5)');
+
+ ctx.save();
+ ctx.fillStyle = gradient;
+ ctx.shadowColor = 'rgba(255, 0, 0, 0.5)';
+ ctx.shadowOffsetX = 250;
+
+ // Alpha shadow.
+ ctx.shadowBlur = 0;
+ fillShape(150, 150);
+
+ // Blurry shadow.
+ ctx.shadowBlur = 10;
+ fillShape(150, 400);
+
+ ctx.rotate(Math.PI/2);
+
+ ctx.restore();
+ }
+});
+</script>
+
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+}
+
+var blob = new Blob([document.getElementById('code').textContent]);
+paintWorklet.import(URL.createObjectURL(blob)).then(function() {
+ runAfterLayoutAndPaint(function() {
+ if (window.testRunner) {
+ testRunner.notifyDone();
+ }
+ });
+});
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698