Browse Source

LibWeb: Add CanvasRenderingContext2D's origin-clean flag

Linus Groh 3 years ago
parent
commit
ed03f37ae9

+ 2 - 0
Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp

@@ -31,6 +31,7 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
 
 void CanvasRenderingContext2D::set_fill_style(String style)
 {
+    // FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
     m_drawing_state.fill_style = Gfx::Color::from_string(style).value_or(Color::Black);
 }
 
@@ -63,6 +64,7 @@ void CanvasRenderingContext2D::clear_rect(float x, float y, float width, float h
 
 void CanvasRenderingContext2D::set_stroke_style(String style)
 {
+    // FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
     m_drawing_state.stroke_style = Gfx::Color::from_string(style).value_or(Color::Black);
 }
 

+ 3 - 0
Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h

@@ -121,6 +121,9 @@ private:
     DrawingState m_drawing_state;
     Vector<DrawingState> m_drawing_state_stack;
 
+    // https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-origin-clean
+    bool m_origin_clean { true };
+
     // https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-context-lost
     bool m_context_lost { false };