Closed Bug 323453 Opened 19 years ago Closed 18 years ago

Canvas save/restore ignores fillStyle and strokeStyle

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: eae, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

According to the whatwg canvas specification [1] the canvas state (which is stored/restored using save/restore) includes, among other things, the following attributes: strokeStyle, fillStyle, globalAlpha, lineWidth, lineCap, lineJoin, miterLimit, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, globalCompositeOperation.

However, in the mozilla implementation neither strokeStyle nor fillStyle is restored when the restore method is called.

The demonstration provided illustrates this, the box should contain two squares, a green one with a black border in the top left and red one with a blue border in the bottom right.

Thats the way it's rendered in Safari [2]. In mozilla (firefox 1.5 and trunk) however, the second square is blue with a red border, as the restore method failed to restore the strokeStyle and fillStyle attributes.

[1] http://www.whatwg.org/specs/web-apps/current-work/#the-canvas
[2] http://eae.net/canvas_state_safari.png

Reproducible: Always

Steps to Reproduce:
Demonstrated here: http://eae.net/canvas_state.html

Actual Results:  
The lower right square is blue with a red border

Expected Results:  
The lower right square should be red with a blue border
Keywords: testcase
This is very similar to bug 313372 which was fixed; not sure why this is occurring.  I'll take a look.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Fixed with 333177.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: