Bug 227009 - GraphicsContext restores need to do nothing if the state stack is empty
Summary: GraphicsContext restores need to do nothing if the state stack is empty
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-14 20:20 PDT by Myles C. Maxfield
Modified: 2021-06-30 06:20 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.35 KB, patch)
2021-06-14 20:23 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (4.46 KB, patch)
2021-06-14 22:06 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (5.15 KB, patch)
2021-06-14 23:28 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (4.47 KB, patch)
2021-06-15 00:14 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2021-06-14 20:20:41 PDT
GraphicsContext restores need to do nothing if the state stack is empty
Comment 1 Myles C. Maxfield 2021-06-14 20:23:27 PDT
Created attachment 431397 [details]
Patch
Comment 2 Tim Horton 2021-06-14 20:43:59 PDT
Comment on attachment 431397 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431397&action=review

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:222
> +    if (!stackSize())
> +        return;

I think you'll want this in all of the subclasses?
Comment 3 Simon Fraser (smfr) 2021-06-14 20:49:59 PDT
Comment on attachment 431397 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431397&action=review

> Source/WebCore/ChangeLog:10
> +        According to the HTML spec (https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-restore-dev),
> +        "If there is no saved state, then the method must do nothing."

That's true, and the CanvasRenderingContext protects against it, but you're changing GraphicsContext.

We have thus far assumed that mismatched push/pop in GraphicsContext is a programming error.
Comment 4 Myles C. Maxfield 2021-06-14 22:06:53 PDT
Created attachment 431400 [details]
Patch
Comment 5 Myles C. Maxfield 2021-06-14 23:28:53 PDT
Created attachment 431407 [details]
Patch
Comment 6 Myles C. Maxfield 2021-06-15 00:14:45 PDT
Created attachment 431408 [details]
Patch
Comment 7 EWS 2021-06-15 11:16:03 PDT
Committed r278884 (238826@main): <https://commits.webkit.org/238826@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431408 [details].
Comment 8 Radar WebKit Bug Importer 2021-06-15 11:17:22 PDT
<rdar://problem/79352121>