Skip to content

Commit

Permalink
Update navigator.ink.requestPresenter() to use a dictionary param
Browse files Browse the repository at this point in the history
requestPresenter took in two params, a String |type| and an Element
|presentationArea|. The goal of the |type| param was to enable
requestPresenter() to be easily extensible in the future for other types
of presenters.

However, in its current state, it is a no-op param. For this reason,
after some discussion ([1], [2], [3]) it has been decided that the API
should be updated to instead just use a dictionary param. This will
still be easily extensible in the future, but won't require a string
param until then.

[1]: WICG/ink-enhancement#20
[2]: w3ctag/design-reviews#473 (comment)
[3]: https://groups.google.com/a/chromium.org/g/blink-dev/c/ZtqwKR_HIAE

Bug: 1052145
Change-Id: I9ef18a04ab150fff8c8f173bfa209e10d90781f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3027884
Reviewed-by: Daniel Libby <dlibby@microsoft.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#902434}
  • Loading branch information
mabian-ms authored and chromium-wpt-export-bot committed Jul 16, 2021
1 parent 4331522 commit 94a6599
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion delegated-ink/exception-thrown-bad-color.tentative.html
Expand Up @@ -8,7 +8,7 @@
<canvas id="canvas"></canvas>
<script>
promise_test(async (t) => {
const presenter = await navigator.ink.requestPresenter('delegated-ink-trail', canvas);
const presenter = await navigator.ink.requestPresenter({presentationArea: canvas});
const style = { color: "bad-color", diameter: 6 };

canvas.addEventListener("pointermove", evt => {
Expand Down
Expand Up @@ -9,7 +9,7 @@
<script>
function RunTest(d, move) {
promise_test(async (t) => {
const presenter = await navigator.ink.requestPresenter('delegated-ink-trail', canvas);
const presenter = await navigator.ink.requestPresenter({presentationArea: canvas});
const style = { color: "green", diameter: d };

canvas.addEventListener("pointermove", evt => {
Expand Down
@@ -1,4 +1,4 @@
let presenter = navigator.ink.requestPresenter('delegated-ink-trail');
let presenter = navigator.ink.requestPresenter();
let style = { color: "red", diameter: 3 };
let evt = new PointerEvent("pointerdown", {clientX: 10, clientY: 10});
presenter.then( function(p) {
Expand Down
Expand Up @@ -3,9 +3,21 @@ test(() => {
}, "navigator needs to support ink to run this test.");

promise_test(t => {
return promise_rejects_js(t, TypeError, navigator.ink.requestPresenter('bad-type'));
}, "Receive rejected promise for a bad type.");
return promise_rejects_js(t, TypeError, navigator.ink.requestPresenter('invalid-param'));
}, "Receive rejected promise for an invalid param.");

promise_test(() => {
return navigator.ink.requestPresenter('delegated-ink-trail');
}, "Received fulfilled promise for a good type.");
return navigator.ink.requestPresenter();
}, "Received fulfilled promise for no param");

promise_test(() => {
return navigator.ink.requestPresenter(null);
}, "Received fulfilled promise for null param");

promise_test(() => {
return navigator.ink.requestPresenter({});
}, "Received fulfilled promise for empty dictionary param");

promise_test(() => {
return navigator.ink.requestPresenter({presentationArea: null});
}, "Received fulfilled promise for dictionary param with valid element.");

0 comments on commit 94a6599

Please sign in to comment.