mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
LibWeb: Implement CanvasRenderingContext2D.isContextLost()
Note that we don't implement the "context lost steps" yet, so this will always return the initial value (false).
This commit is contained in:
parent
2576af5db1
commit
1298c27ca9
Notes:
sideshowbarker
2024-07-17 22:07:18 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/1298c27ca99 Pull-request: https://github.com/SerenityOS/serenity/pull/11444
@ -336,6 +336,13 @@ void CanvasRenderingContext2D::reset()
|
||||
reset_to_default_state();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-iscontextlost
|
||||
bool CanvasRenderingContext2D::is_context_lost()
|
||||
{
|
||||
// The isContextLost() method steps are to return this's context lost.
|
||||
return m_context_lost;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#reset-the-rendering-context-to-its-default-state
|
||||
void CanvasRenderingContext2D::reset_to_default_state()
|
||||
{
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
void save();
|
||||
void restore();
|
||||
void reset();
|
||||
bool is_context_lost();
|
||||
|
||||
void reset_to_default_state();
|
||||
|
||||
@ -97,6 +98,9 @@ private:
|
||||
DrawingState m_drawing_state;
|
||||
Vector<DrawingState> m_drawing_state_stack;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-context-lost
|
||||
bool m_context_lost { false };
|
||||
|
||||
Gfx::Path m_path;
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,7 @@ interface CanvasRenderingContext2D {
|
||||
undefined save();
|
||||
undefined restore();
|
||||
undefined reset();
|
||||
boolean isContextLost();
|
||||
|
||||
readonly attribute HTMLCanvasElement canvas;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user