Closed Bug 1830346 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 39710 - Optimize 2D Canvas style setters

Categories

(Core :: Graphics: Canvas2D, task, P4)

task

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 39710 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/39710
Details from upstream follow.

Justin Novosad <junov@chromium.org> wrote:

Optimize 2D Canvas style setters

This CL eliminates unnecessary conditional branches, switch statements
and function call overhead when setting the fillStyle and strokeStyle
attributes of CanvasRenderingContext2D.

This change also updates the 2d.gradient.object.update.html tests to
make them more robust. Before this change, blink was not spec
compliant and the existing test did not catch it. The problem
was that because blink was deferring the evaluation of the
CanvasGradient until the time of first draw, it was catching changes
to the CanvasGradient that were made after setting fillStyle. So the
test was not robust enough to truly verify that the CanvasGradient
object is live. The test now modifies the CanvasGradient between
consecutive draws, which is the test that the old implementation would
have failed because the gradient would have been baked-in after the
first draw.

This change improves MotionMark Canvas Lines by 0.4% on M1 MacOS

Bug: 1430274
Change-Id: Iaaad63df54eeb62c3ae91f621922976c5a82d0b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4407944
Reviewed-by: Jean-Philippe Gravel \<jpgravel@chromium.org>
Reviewed-by: Aaron Krajeski \<aaronhk@chromium.org>
Code-Coverage: Findit \<findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Justin Novosad \<junov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1136002}

Component: web-platform-tests → Graphics: Canvas2D
Product: Testing → Core
Try push failed: decision task JDCJpAFlSy-DVvshmWsuHg returned error
Try push failed: decision task Jx8BoYz-RQaseZs5b6TUrQ returned error
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f2cdc5bc535d [wpt PR 39710] - Optimize 2D Canvas style setters, a=testonly
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.