diff --git a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 2037d8df7eb..305cdab815f 100644 --- a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -634,8 +634,10 @@ void CanvasRenderingContext2D::reset_to_default_state() // 4. Reset everything that drawing state consists of to their initial values. reset_drawing_state(); - if (surface) + if (surface) { + painter()->reset(); did_draw(surface->rect().to_type()); + } } // https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-measuretext diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/canvas/element/reset/2d.reset.state.clip-expected.html b/Tests/LibWeb/Ref/expected/wpt-import/html/canvas/element/reset/2d.reset.state.clip-expected.html new file mode 100644 index 00000000000..6b42984aebb --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/html/canvas/element/reset/2d.reset.state.clip-expected.html @@ -0,0 +1,15 @@ + + + +Canvas test: 2d.reset.state.clip +

2d.reset.state.clip

+

check that the clip is reset

+ +

FAIL (fallback content)

+
+ diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/canvas/element/reset/2d.reset.state.clip.html b/Tests/LibWeb/Ref/input/wpt-import/html/canvas/element/reset/2d.reset.state.clip.html new file mode 100644 index 00000000000..95b2a4dd257 --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/html/canvas/element/reset/2d.reset.state.clip.html @@ -0,0 +1,24 @@ + + + + +Canvas test: 2d.reset.state.clip +

2d.reset.state.clip

+

check that the clip is reset

+ +

FAIL (fallback content)

+
+ diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.txt new file mode 100644 index 00000000000..b243f04feeb --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Resetting the canvas state resets the current clip region \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.txt new file mode 100644 index 00000000000..ec2260de9b0 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Resetting the canvas state resets the current transformation matrix \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.html new file mode 100644 index 00000000000..7bf15018844 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.clip.html @@ -0,0 +1,33 @@ + + + +Canvas test: 2d.canvas.host.initial.reset.clip + + + + + + +

2d.canvas.host.initial.reset.clip

+

Resetting the canvas state resets the current clip region

+ + +

Actual output:

+

FAIL (fallback content)

+ + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.html new file mode 100644 index 00000000000..6996ef9749a --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/canvas-host/2d.canvas.host.initial.reset.transform.html @@ -0,0 +1,32 @@ + + + +Canvas test: 2d.canvas.host.initial.reset.transform + + + + + + +

2d.canvas.host.initial.reset.transform

+

Resetting the canvas state resets the current transformation matrix

+ + +

Actual output:

+

FAIL (fallback content)

+ + + +