Skip to content

Commit

Permalink
Don't forward delegated ink metadata if the diameter is <= 0
Browse files Browse the repository at this point in the history
If the diameter is 0 or below, then nothing will be rendered to the
screen. Therefore, we can just bail early to save some precious cycles
and avoid any unexpected behaviour if a negative diameter is provided.

Bug: 1093159
Change-Id: I1de4bfd4788a823201c468cd1089b0f44dd6bf98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2239290
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Libby <dlibby@microsoft.com>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#777114}
  • Loading branch information
mabian-ms authored and chromium-wpt-export-bot committed Jun 10, 2020
1 parent 555a1b3 commit be320ed
Showing 1 changed file with 31 additions and 0 deletions.
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<canvas id="canvas"></canvas>
<script>
function RunTest(d, move) {
promise_test(async (t) => {
const presenter = await navigator.ink.requestPresenter('delegated-ink-trail', canvas);
const style = { color: "green", diameter: d };

canvas.addEventListener("pointermove", evt => {
assert_equals(d, style.diameter);
assert_throws_dom("NotSupportedError", function() {
presenter.updateInkTrailStartPoint(evt, style);
}, "Expected a NotSupportedError to be thrown due to diameter set to "+d+".");
});

const actions_promise = new test_driver.Actions().pointerMove(move, move).send();
t.add_cleanup(() => actions_promise);
});
}

RunTest(0, 10);
RunTest(-0.000001, 11);
RunTest(-1, 10);
RunTest(-100, 11);
</script>

0 comments on commit be320ed

Please sign in to comment.