testing/web-platform/tests/css/css-paint-api/parse-input-arguments-016.https.html
author Yuki Shiino <yukishiino@chromium.org>
Wed, 06 Mar 2019 12:36:18 +0000
changeset 522287 fe1a2cb779e0e27eeaccc778b945b047ad87244c
parent 459852 4498cd0e6fdf80a3af7a66b491601961c3cb5062
child 522313 66b1aba3fb4372ec47986e728b1da9b32dd3d368
permissions -rw-r--r--
Bug 1530852 [wpt PR 15497] - v8binding: Make PaintWorkletGlobalScope use IDL callback function, a=testonly Automatic update from web-platform-tests v8binding: Make PaintWorkletGlobalScope use IDL callback function Converts PaintWorkletGlobalScope.registerPaint's second argument |paintCtor| into IDL callback function type. Also, makes Paint Worklet use |PaintCallback| of callback function type. Change-Id: I6706499705a116c85f5c092a46309854db88708c Reviewed-on: https://chromium-review.googlesource.com/c/1478850 Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Hitoshi Yoshida <peria@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#634582} -- wpt-commits: 270d9bf4444b52a2d66dd10ade64cdfa455f2300 wpt-pr: 15497

<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="parse-input-arguments-ref.html">
<style>
.container {
  width: 100px;
  height: 100px;
}

#canvas-geometry {
  background-image: paint(geometry);
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<div id="canvas-geometry" class="container"></div>

<script id="code" type="text/worklet">
var testsPassed = false;
try {
    registerPaint('foo12', class {
        static get contextOptions() {
            return 42;
        }
    });
} catch(ex) {
    // 'contextOptions' property is 42, not a dictionary.
    if (ex.name == 'TypeError')
        testsPassed = true;
}

registerPaint('geometry', class {
    paint(ctx, geom) {
        if (testsPassed)
            ctx.strokeStyle = 'green';
        else
            ctx.strokeStyle = 'red';
        ctx.lineWidth = 4;
        ctx.strokeRect(0, 0, geom.width, geom.height);
    }
});
</script>

<script>
    importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
</script>
</body>
</html>