Assertion failure in CanvasRenderingContext2D::State::fontsNeedUpdate when invalidati...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 17:45:16 +0000 (17:45 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 17:45:16 +0000 (17:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=58229

Reviewed by Alexey Proskuryakov.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::State::State): Added copy constructor, to register the copy with
the font selector if needed.
(WebCore::CanvasRenderingContext2D::State::operator=): Added assignment constructor, to handle
registration with the font selector as needed.
* html/canvas/CanvasRenderingContext2D.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83451 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h

index 94fa2e99abd15d6af66da01e4dc875004a3a7dcf..11f98954c8499eae9ccc2cd0cae193c38cb97fe8 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-11  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Assertion failure in CanvasRenderingContext2D::State::fontsNeedUpdate when invalidating the font cache after opening canvas/philip/tests/initial.reset.2dstate.html (occurs on Qt debug test bot)
+        https://bugs.webkit.org/show_bug.cgi?id=58229
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::State::State): Added copy constructor, to register the copy with
+        the font selector if needed.
+        (WebCore::CanvasRenderingContext2D::State::operator=): Added assignment constructor, to handle
+        registration with the font selector as needed.
+        * html/canvas/CanvasRenderingContext2D.h:
+
 2011-04-11  Mario Sanchez Prada  <msanchez@igalia.com>
 
         Reviewed by Chris Fleizach.
index 1f09a762efd4fa57e91e13a8a0193222863d033c..fe992028360a9a489863462421041303f3875f9a 100644 (file)
@@ -213,6 +213,68 @@ CanvasRenderingContext2D::State::State()
 {
 }
 
+CanvasRenderingContext2D::State::State(const State& other)
+{
+    m_unparsedStrokeColor = other.m_unparsedStrokeColor;
+    m_unparsedFillColor = other.m_unparsedFillColor;
+    m_strokeStyle = other.m_strokeStyle;
+    m_fillStyle = other.m_fillStyle;
+    m_lineWidth = other.m_lineWidth;
+    m_lineCap = other.m_lineCap;
+    m_lineJoin = other.m_lineJoin;
+    m_miterLimit = other.m_miterLimit;
+    m_shadowOffset = other.m_shadowOffset;
+    m_shadowBlur = other.m_shadowBlur;
+    m_shadowColor = other.m_shadowColor;
+    m_globalAlpha = other.m_globalAlpha;
+    m_globalComposite = other.m_globalComposite;
+    m_transform = other.m_transform;
+    m_invertibleCTM = other.m_invertibleCTM;
+    m_textAlign = other.m_textAlign;
+    m_textBaseline = other.m_textBaseline;
+    m_unparsedFont = other.m_unparsedFont;
+    m_font = other.m_font;
+    m_realizedFont = other.m_realizedFont;
+
+    if (m_realizedFont)
+        m_font.fontSelector()->registerForInvalidationCallbacks(this);
+}
+
+CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(const State& other)
+{
+    if (this == &other)
+        return *this;
+
+    if (m_realizedFont)
+        m_font.fontSelector()->unregisterForInvalidationCallbacks(this);
+
+    m_unparsedStrokeColor = other.m_unparsedStrokeColor;
+    m_unparsedFillColor = other.m_unparsedFillColor;
+    m_strokeStyle = other.m_strokeStyle;
+    m_fillStyle = other.m_fillStyle;
+    m_lineWidth = other.m_lineWidth;
+    m_lineCap = other.m_lineCap;
+    m_lineJoin = other.m_lineJoin;
+    m_miterLimit = other.m_miterLimit;
+    m_shadowOffset = other.m_shadowOffset;
+    m_shadowBlur = other.m_shadowBlur;
+    m_shadowColor = other.m_shadowColor;
+    m_globalAlpha = other.m_globalAlpha;
+    m_globalComposite = other.m_globalComposite;
+    m_transform = other.m_transform;
+    m_invertibleCTM = other.m_invertibleCTM;
+    m_textAlign = other.m_textAlign;
+    m_textBaseline = other.m_textBaseline;
+    m_unparsedFont = other.m_unparsedFont;
+    m_font = other.m_font;
+    m_realizedFont = other.m_realizedFont;
+
+    if (m_realizedFont)
+        m_font.fontSelector()->registerForInvalidationCallbacks(this);
+
+    return *this;
+}
+
 CanvasRenderingContext2D::State::~State()
 {
     if (m_realizedFont)
index 48c4aae381442efe8ac6bbb2e1d143323e171df5..6823c80a73d3533297b0100411181dac1cdc4a2a 100644 (file)
@@ -231,6 +231,9 @@ private:
         State();
         virtual ~State();
 
+        State(const State&);
+        State& operator=(const State&);
+
         virtual void fontsNeedUpdate(FontSelector*);
 
         String m_unparsedStrokeColor;