mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Implement CanvasRenderingContext2D.restore()
This commit is contained in:
parent
7d435b5ada
commit
3e0e965f24
Notes:
sideshowbarker
2024-07-17 22:07:27 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/3e0e965f244 Pull-request: https://github.com/SerenityOS/serenity/pull/11444
3 changed files with 11 additions and 0 deletions
|
@ -320,4 +320,13 @@ void CanvasRenderingContext2D::save()
|
|||
m_drawing_state_stack.append(m_drawing_state);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-restore
|
||||
void CanvasRenderingContext2D::restore()
|
||||
{
|
||||
// The restore() method steps are to pop the top entry in the drawing state stack, and reset the drawing state it describes. If there is no saved state, then the method must do nothing.
|
||||
if (m_drawing_state_stack.is_empty())
|
||||
return;
|
||||
m_drawing_state = m_drawing_state_stack.take_last();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
void put_image_data(const ImageData&, float x, float y);
|
||||
|
||||
void save();
|
||||
void restore();
|
||||
|
||||
HTMLCanvasElement* canvas() { return m_element; }
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ interface CanvasRenderingContext2D {
|
|||
undefined putImageData(ImageData imagedata, double dx, double dy);
|
||||
|
||||
undefined save();
|
||||
undefined restore();
|
||||
|
||||
readonly attribute HTMLCanvasElement canvas;
|
||||
|
||||
|
|
Loading…
Reference in a new issue