[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

reni at webkit.org reni at webkit.org
Wed Dec 22 18:24:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a1db5cff241b3929520ccd631e7c67884b394d55
Author: reni at webkit.org <reni at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 15:36:50 2010 +0000

    GraphicsContext: Merge m_common and m_data
    https://bugs.webkit.org/show_bug.cgi?id=49914
    
    Patch by Renata Hodovan <reni at webkit.org> on 2010-12-10
    Reviewed by Andreas Kling.
    
    Move data members from GraphicsContextPrivate into GraphicsContext. So GraphicsContextPlatform.h
    and m_common became unnecessary. They are removed.
    Add two methods to GraphicsContext: platformInit() and platformDestroy(), which
    make the constructor of GraphicsContext clearer.
    Besides add a getter to the private GraphicsContext::m_state member, because some inline
    functions in cairo need it.
    
    No new test is needed, because this is a refactoring.
    
    * WebCore.xcodeproj/project.pbxproj:
    * platform/graphics/GraphicsContext.cpp:
    (WebCore::GraphicsContext::GraphicsContext):
    (WebCore::GraphicsContext::~GraphicsContext):
    (WebCore::GraphicsContext::save):
    (WebCore::GraphicsContext::restore):
    (WebCore::GraphicsContext::setStrokeThickness):
    (WebCore::GraphicsContext::setStrokeStyle):
    (WebCore::GraphicsContext::setStrokeColor):
    (WebCore::GraphicsContext::setShadow):
    (WebCore::GraphicsContext::clearShadow):
    (WebCore::GraphicsContext::getShadow):
    (WebCore::GraphicsContext::strokeThickness):
    (WebCore::GraphicsContext::strokeStyle):
    (WebCore::GraphicsContext::strokeColor):
    (WebCore::GraphicsContext::strokeColorSpace):
    (WebCore::GraphicsContext::fillRule):
    (WebCore::GraphicsContext::setFillRule):
    (WebCore::GraphicsContext::setFillColor):
    (WebCore::GraphicsContext::fillColor):
    (WebCore::GraphicsContext::fillColorSpace):
    (WebCore::GraphicsContext::setShouldAntialias):
    (WebCore::GraphicsContext::shouldAntialias):
    (WebCore::GraphicsContext::state):
    (WebCore::GraphicsContext::setStrokePattern):
    (WebCore::GraphicsContext::setFillPattern):
    (WebCore::GraphicsContext::setStrokeGradient):
    (WebCore::GraphicsContext::setFillGradient):
    (WebCore::GraphicsContext::fillGradient):
    (WebCore::GraphicsContext::strokeGradient):
    (WebCore::GraphicsContext::fillPattern):
    (WebCore::GraphicsContext::strokePattern):
    (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
    (WebCore::GraphicsContext::updatingControlTints):
    (WebCore::GraphicsContext::setUpdatingControlTints):
    (WebCore::GraphicsContext::setPaintingDisabled):
    (WebCore::GraphicsContext::paintingDisabled):
    (WebCore::GraphicsContext::textDrawingMode):
    (WebCore::GraphicsContext::setTextDrawingMode):
    * platform/graphics/GraphicsContext.h:
    (WebCore::GraphicsContextState::GraphicsContextState):
    * platform/graphics/GraphicsContextPrivate.h: Removed.
    * platform/graphics/cairo/GraphicsContextCairo.cpp:
    (WebCore::setPlatformFill):
    (WebCore::setPlatformStroke):
    (WebCore::drawPathShadow):
    (WebCore::fillCurrentCairoPath):
    (WebCore::strokeCurrentCairoPath):
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::strokePath):
    (WebCore::GraphicsContext::fillRect):
    (WebCore::GraphicsContext::setPlatformShadow):
    (WebCore::GraphicsContext::strokeRect):
    (WebCore::GraphicsContext::setAlpha):
    (WebCore::GraphicsContext::getAlpha):
    * platform/graphics/cg/GraphicsContextCG.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::applyStrokePattern):
    (WebCore::GraphicsContext::applyFillPattern):
    (WebCore::GraphicsContext::drawPath):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::strokePath):
    (WebCore::GraphicsContext::fillRect):
    (WebCore::GraphicsContext::setPlatformShadow):
    (WebCore::GraphicsContext::strokeRect):
    * platform/graphics/haiku/GraphicsContextHaiku.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::strokePath):
    (WebCore::GraphicsContext::clip):
    (WebCore::GraphicsContext::clipOut):
    (WebCore::GraphicsContext::addInnerRoundedRectClip):
    * platform/graphics/qt/GraphicsContextQt.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::strokePath):
    (WebCore::GraphicsContext::fillRect):
    (WebCore::GraphicsContext::setPlatformShadow):
    * platform/graphics/skia/GraphicsContextSkia.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::setPlatformShadow):
    * platform/graphics/win/GraphicsContextCGWin.cpp:
    (WebCore::GraphicsContext::GraphicsContext):
    (WebCore::GraphicsContext::platformInit):
    * platform/graphics/win/GraphicsContextCairoWin.cpp:
    (WebCore::GraphicsContext::GraphicsContext):
    (WebCore::GraphicsContext::platformInit):
    * platform/graphics/wince/GraphicsContextWinCE.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    (WebCore::GraphicsContext::fillPath):
    (WebCore::GraphicsContext::fillRect):
    * platform/graphics/wx/GraphicsContextWx.cpp:
    (WebCore::GraphicsContext::platformInit):
    (WebCore::GraphicsContext::platformDestroy):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f2b688b..73d21ee 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,125 @@
+2010-12-10  Renata Hodovan  <reni at webkit.org>
+
+        Reviewed by Andreas Kling.
+
+        GraphicsContext: Merge m_common and m_data
+        https://bugs.webkit.org/show_bug.cgi?id=49914
+
+        Move data members from GraphicsContextPrivate into GraphicsContext. So GraphicsContextPlatform.h
+        and m_common became unnecessary. They are removed.
+        Add two methods to GraphicsContext: platformInit() and platformDestroy(), which
+        make the constructor of GraphicsContext clearer.
+        Besides add a getter to the private GraphicsContext::m_state member, because some inline
+        functions in cairo need it.
+
+        No new test is needed, because this is a refactoring.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::~GraphicsContext):
+        (WebCore::GraphicsContext::save):
+        (WebCore::GraphicsContext::restore):
+        (WebCore::GraphicsContext::setStrokeThickness):
+        (WebCore::GraphicsContext::setStrokeStyle):
+        (WebCore::GraphicsContext::setStrokeColor):
+        (WebCore::GraphicsContext::setShadow):
+        (WebCore::GraphicsContext::clearShadow):
+        (WebCore::GraphicsContext::getShadow):
+        (WebCore::GraphicsContext::strokeThickness):
+        (WebCore::GraphicsContext::strokeStyle):
+        (WebCore::GraphicsContext::strokeColor):
+        (WebCore::GraphicsContext::strokeColorSpace):
+        (WebCore::GraphicsContext::fillRule):
+        (WebCore::GraphicsContext::setFillRule):
+        (WebCore::GraphicsContext::setFillColor):
+        (WebCore::GraphicsContext::fillColor):
+        (WebCore::GraphicsContext::fillColorSpace):
+        (WebCore::GraphicsContext::setShouldAntialias):
+        (WebCore::GraphicsContext::shouldAntialias):
+        (WebCore::GraphicsContext::state):
+        (WebCore::GraphicsContext::setStrokePattern):
+        (WebCore::GraphicsContext::setFillPattern):
+        (WebCore::GraphicsContext::setStrokeGradient):
+        (WebCore::GraphicsContext::setFillGradient):
+        (WebCore::GraphicsContext::fillGradient):
+        (WebCore::GraphicsContext::strokeGradient):
+        (WebCore::GraphicsContext::fillPattern):
+        (WebCore::GraphicsContext::strokePattern):
+        (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
+        (WebCore::GraphicsContext::updatingControlTints):
+        (WebCore::GraphicsContext::setUpdatingControlTints):
+        (WebCore::GraphicsContext::setPaintingDisabled):
+        (WebCore::GraphicsContext::paintingDisabled):
+        (WebCore::GraphicsContext::textDrawingMode):
+        (WebCore::GraphicsContext::setTextDrawingMode):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContextState::GraphicsContextState):
+        * platform/graphics/GraphicsContextPrivate.h: Removed.
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::setPlatformFill):
+        (WebCore::setPlatformStroke):
+        (WebCore::drawPathShadow):
+        (WebCore::fillCurrentCairoPath):
+        (WebCore::strokeCurrentCairoPath):
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::setAlpha):
+        (WebCore::GraphicsContext::getAlpha):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::applyStrokePattern):
+        (WebCore::GraphicsContext::applyFillPattern):
+        (WebCore::GraphicsContext::drawPath):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        (WebCore::GraphicsContext::strokeRect):
+        * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::clipOut):
+        (WebCore::GraphicsContext::addInnerRoundedRectClip):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::platformInit):
+        * platform/graphics/win/GraphicsContextCairoWin.cpp:
+        (WebCore::GraphicsContext::GraphicsContext):
+        (WebCore::GraphicsContext::platformInit):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::fillRect):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        (WebCore::GraphicsContext::platformDestroy):
+
 2010-12-10  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index f36a2a6..17807ed 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3928,7 +3928,7 @@
 		A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F4FB950C169E85002AFED5 /* SVGRenderSupport.cpp */; };
 		A8F5C0B80F9285AC0098E06B /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */; };
 		A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */; };
-		A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; };
+		A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */; };
 		A9C6E4E30D745E05006442E9 /* DOMMimeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */; };
 		A9C6E4E40D745E05006442E9 /* DOMMimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E4E20D745E05006442E9 /* DOMMimeType.h */; };
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index 2edcc6d..5ee8bf8 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -29,7 +29,6 @@
 #include "BidiResolver.h"
 #include "Font.h"
 #include "Generator.h"
-#include "GraphicsContextPrivate.h"
 #include "ImageBuffer.h"
 
 using namespace std;
@@ -74,14 +73,15 @@ private:
     int m_offset;
 };
 
-GraphicsContextPrivate* GraphicsContext::createGraphicsContextPrivate()
+GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext)
+    : m_updatingControlTints(false)
 {
-    return new GraphicsContextPrivate;
+    platformInit(platformGraphicsContext);
 }
 
-void GraphicsContext::destroyGraphicsContextPrivate(GraphicsContextPrivate* deleteMe)
+GraphicsContext::~GraphicsContext()
 {
-    delete deleteMe;
+    platformDestroy();
 }
 
 void GraphicsContext::save()
@@ -89,7 +89,7 @@ void GraphicsContext::save()
     if (paintingDisabled())
         return;
 
-    m_common->stack.append(m_common->state);
+    m_stack.append(m_state);
 
     savePlatformState();
 }
@@ -99,120 +99,125 @@ void GraphicsContext::restore()
     if (paintingDisabled())
         return;
 
-    if (m_common->stack.isEmpty()) {
+    if (m_stack.isEmpty()) {
         LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty");
         return;
     }
-    m_common->state = m_common->stack.last();
-    m_common->stack.removeLast();
+    m_state = m_stack.last();
+    m_stack.removeLast();
 
     restorePlatformState();
 }
 
 void GraphicsContext::setStrokeThickness(float thickness)
 {
-    m_common->state.strokeThickness = thickness;
+    m_state.strokeThickness = thickness;
     setPlatformStrokeThickness(thickness);
 }
 
 void GraphicsContext::setStrokeStyle(const StrokeStyle& style)
 {
-    m_common->state.strokeStyle = style;
+    m_state.strokeStyle = style;
     setPlatformStrokeStyle(style);
 }
 
 void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
 {
-    m_common->state.strokeColor = color;
-    m_common->state.strokeColorSpace = colorSpace;
-    m_common->state.strokeGradient.clear();
-    m_common->state.strokePattern.clear();
+    m_state.strokeColor = color;
+    m_state.strokeColorSpace = colorSpace;
+    m_state.strokeGradient.clear();
+    m_state.strokePattern.clear();
     setPlatformStrokeColor(color, colorSpace);
 }
 
 void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
 {
-    m_common->state.shadowOffset = offset;
-    m_common->state.shadowBlur = blur;
-    m_common->state.shadowColor = color;
+    m_state.shadowOffset = offset;
+    m_state.shadowBlur = blur;
+    m_state.shadowColor = color;
     setPlatformShadow(offset, blur, color, colorSpace);
 }
 
 void GraphicsContext::clearShadow()
 {
-    m_common->state.shadowOffset = FloatSize();
-    m_common->state.shadowBlur = 0;
-    m_common->state.shadowColor = Color();
+    m_state.shadowOffset = FloatSize();
+    m_state.shadowBlur = 0;
+    m_state.shadowColor = Color();
     clearPlatformShadow();
 }
 
 bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color) const
 {
-    offset = m_common->state.shadowOffset;
-    blur = m_common->state.shadowBlur;
-    color = m_common->state.shadowColor;
+    offset = m_state.shadowOffset;
+    blur = m_state.shadowBlur;
+    color = m_state.shadowColor;
 
     return color.isValid() && color.alpha() && (blur || offset.width() || offset.height());
 }
 
 float GraphicsContext::strokeThickness() const
 {
-    return m_common->state.strokeThickness;
+    return m_state.strokeThickness;
 }
 
 StrokeStyle GraphicsContext::strokeStyle() const
 {
-    return m_common->state.strokeStyle;
+    return m_state.strokeStyle;
 }
 
 Color GraphicsContext::strokeColor() const
 {
-    return m_common->state.strokeColor;
+    return m_state.strokeColor;
 }
 
 ColorSpace GraphicsContext::strokeColorSpace() const
 {
-    return m_common->state.strokeColorSpace;
+    return m_state.strokeColorSpace;
 }
 
 WindRule GraphicsContext::fillRule() const
 {
-    return m_common->state.fillRule;
+    return m_state.fillRule;
 }
 
 void GraphicsContext::setFillRule(WindRule fillRule)
 {
-    m_common->state.fillRule = fillRule;
+    m_state.fillRule = fillRule;
 }
 
 void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
 {
-    m_common->state.fillColor = color;
-    m_common->state.fillColorSpace = colorSpace;
-    m_common->state.fillGradient.clear();
-    m_common->state.fillPattern.clear();
+    m_state.fillColor = color;
+    m_state.fillColorSpace = colorSpace;
+    m_state.fillGradient.clear();
+    m_state.fillPattern.clear();
     setPlatformFillColor(color, colorSpace);
 }
 
 Color GraphicsContext::fillColor() const
 {
-    return m_common->state.fillColor;
+    return m_state.fillColor;
 }
 
 ColorSpace GraphicsContext::fillColorSpace() const
 {
-    return m_common->state.fillColorSpace;
+    return m_state.fillColorSpace;
 }
 
 void GraphicsContext::setShouldAntialias(bool b)
 {
-    m_common->state.shouldAntialias = b;
+    m_state.shouldAntialias = b;
     setPlatformShouldAntialias(b);
 }
 
 bool GraphicsContext::shouldAntialias() const
 {
-    return m_common->state.shouldAntialias;
+    return m_state.shouldAntialias;
+}
+
+const GraphicsContextState& GraphicsContext::state() const
+{
+    return m_state;
 }
 
 void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
@@ -222,9 +227,9 @@ void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern)
         setStrokeColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_common->state.strokeGradient.clear();
-    m_common->state.strokePattern = pattern;
-    setPlatformStrokePattern(m_common->state.strokePattern.get());
+    m_state.strokeGradient.clear();
+    m_state.strokePattern = pattern;
+    setPlatformStrokePattern(m_state.strokePattern.get());
 }
 
 void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
@@ -234,9 +239,9 @@ void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern)
         setFillColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_common->state.fillGradient.clear();
-    m_common->state.fillPattern = pattern;
-    setPlatformFillPattern(m_common->state.fillPattern.get());
+    m_state.fillGradient.clear();
+    m_state.fillPattern = pattern;
+    setPlatformFillPattern(m_state.fillPattern.get());
 }
 
 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
@@ -246,9 +251,9 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient)
         setStrokeColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_common->state.strokeGradient = gradient;
-    m_common->state.strokePattern.clear();
-    setPlatformStrokeGradient(m_common->state.strokeGradient.get());
+    m_state.strokeGradient = gradient;
+    m_state.strokePattern.clear();
+    setPlatformStrokeGradient(m_state.strokeGradient.get());
 }
 
 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
@@ -258,55 +263,55 @@ void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient)
         setFillColor(Color::black, ColorSpaceDeviceRGB);
         return;
     }
-    m_common->state.fillGradient = gradient;
-    m_common->state.fillPattern.clear();
-    setPlatformFillGradient(m_common->state.fillGradient.get());
+    m_state.fillGradient = gradient;
+    m_state.fillPattern.clear();
+    setPlatformFillGradient(m_state.fillGradient.get());
 }
 
 Gradient* GraphicsContext::fillGradient() const
 {
-    return m_common->state.fillGradient.get();
+    return m_state.fillGradient.get();
 }
 
 Gradient* GraphicsContext::strokeGradient() const
 {
-    return m_common->state.strokeGradient.get();
+    return m_state.strokeGradient.get();
 }
 
 Pattern* GraphicsContext::fillPattern() const
 {
-    return m_common->state.fillPattern.get();
+    return m_state.fillPattern.get();
 }
 
 Pattern* GraphicsContext::strokePattern() const
 {
-    return m_common->state.strokePattern.get();
+    return m_state.strokePattern.get();
 }
 
 void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
 {
-    m_common->state.shadowsIgnoreTransforms = ignoreTransforms;
+    m_state.shadowsIgnoreTransforms = ignoreTransforms;
 }
 
 bool GraphicsContext::updatingControlTints() const
 {
-    return m_common->m_updatingControlTints;
+    return m_updatingControlTints;
 }
 
 void GraphicsContext::setUpdatingControlTints(bool b)
 {
     setPaintingDisabled(b);
-    m_common->m_updatingControlTints = b;
+    m_updatingControlTints = b;
 }
 
 void GraphicsContext::setPaintingDisabled(bool f)
 {
-    m_common->state.paintingDisabled = f;
+    m_state.paintingDisabled = f;
 }
 
 bool GraphicsContext::paintingDisabled() const
 {
-    return m_common->state.paintingDisabled;
+    return m_state.paintingDisabled;
 }
 
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
@@ -528,12 +533,12 @@ void GraphicsContext::clipToImageBuffer(ImageBuffer* buffer, const FloatRect& re
 
 TextDrawingModeFlags GraphicsContext::textDrawingMode() const
 {
-    return m_common->state.textDrawingMode;
+    return m_state.textDrawingMode;
 }
 
 void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
 {
-    m_common->state.textDrawingMode = mode;
+    m_state.textDrawingMode = mode;
     if (paintingDisabled())
         return;
     setPlatformTextDrawingMode(mode);
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 3bda553..eee8b94 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -30,9 +30,11 @@
 #include "ColorSpace.h"
 #include "DashArray.h"
 #include "FloatRect.h"
+#include "Gradient.h"
 #include "Image.h"
 #include "IntRect.h"
 #include "Path.h"
+#include "Pattern.h"
 #include "TextDirection.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
@@ -117,12 +119,9 @@ namespace WebCore {
     class DrawingBuffer;
     class Font;
     class Generator;
-    class Gradient;
     class GraphicsContextPlatformPrivate;
-    class GraphicsContextPrivate;
     class ImageBuffer;
     class KURL;
-    class Pattern;
     class SharedGraphicsContext3D;
     class TextRun;
 
@@ -149,6 +148,57 @@ namespace WebCore {
         InterpolationHigh
     };
 
+    struct GraphicsContextState {
+        GraphicsContextState()
+            : strokeThickness(0)
+            , shadowBlur(0)
+#if PLATFORM(CAIRO)
+            , globalAlpha(1)
+#endif
+            , textDrawingMode(TextModeFill)
+            , strokeColor(Color::black)
+            , fillColor(Color::black)
+            , strokeStyle(SolidStroke)
+            , fillRule(RULE_NONZERO)
+            , strokeColorSpace(ColorSpaceDeviceRGB)
+            , fillColorSpace(ColorSpaceDeviceRGB)
+            , shouldAntialias(true)
+            , paintingDisabled(false)
+            , shadowsIgnoreTransforms(false)
+        {
+        }
+
+        RefPtr<Gradient> strokeGradient;
+        RefPtr<Pattern> strokePattern;
+        
+        RefPtr<Gradient> fillGradient;
+        RefPtr<Pattern> fillPattern;
+
+        FloatSize shadowOffset;
+
+        float strokeThickness;
+        float shadowBlur;
+
+#if PLATFORM(CAIRO)
+        float globalAlpha;
+#endif
+        TextDrawingModeFlags textDrawingMode;
+
+        Color strokeColor;
+        Color fillColor;
+        Color shadowColor;
+
+        StrokeStyle strokeStyle;
+        WindRule fillRule;
+
+        ColorSpace strokeColorSpace;
+        ColorSpace fillColorSpace;
+
+        bool shouldAntialias;
+        bool paintingDisabled;
+        bool shadowsIgnoreTransforms;
+    };
+
     class GraphicsContext : public Noncopyable {
     public:
         GraphicsContext(PlatformGraphicsContext*);
@@ -189,6 +239,8 @@ namespace WebCore {
         void setShouldAntialias(bool);
         bool shouldAntialias() const;
 
+        const GraphicsContextState& state() const;
+
 #if PLATFORM(CG)
         void applyStrokePattern();
         void applyFillPattern();
@@ -418,6 +470,13 @@ namespace WebCore {
         void markDirtyRect(const IntRect&); // Hints that a portion of the backing store is dirty.
 
     private:
+        void platformInit(PlatformGraphicsContext*);
+        void platformDestroy();
+
+#if PLATFORM(WIN)
+        void platformInit(HDC, bool hasAlpha = false);
+#endif
+
         void savePlatformState();
         void restorePlatformState();
 
@@ -441,11 +500,11 @@ namespace WebCore {
 
         static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
 
-        static GraphicsContextPrivate* createGraphicsContextPrivate();
-        static void destroyGraphicsContextPrivate(GraphicsContextPrivate*);
+        GraphicsContextPlatformPrivate* m_data;
 
-        GraphicsContextPrivate* m_common;
-        GraphicsContextPlatformPrivate* m_data; // Deprecated; m_commmon can just be downcasted. To be removed.
+        GraphicsContextState m_state;
+        Vector<GraphicsContextState> m_stack;
+        bool m_updatingControlTints;
     };
 
 } // namespace WebCore
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
deleted file mode 100644
index 9288df4..0000000
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GraphicsContextPrivate_h
-#define GraphicsContextPrivate_h
-
-#include "Gradient.h"
-#include "GraphicsContext.h"
-#include "Pattern.h"
-
-namespace WebCore {
-
-    struct GraphicsContextState {
-        GraphicsContextState()
-            : strokeThickness(0)
-            , shadowBlur(0)
-#if PLATFORM(CAIRO)
-            , globalAlpha(1)
-#endif
-            , textDrawingMode(TextModeFill)
-            , strokeColor(Color::black)
-            , fillColor(Color::black)
-            , strokeStyle(SolidStroke)
-            , fillRule(RULE_NONZERO)
-            , strokeColorSpace(ColorSpaceDeviceRGB)
-            , fillColorSpace(ColorSpaceDeviceRGB)
-            , shouldAntialias(true)
-            , paintingDisabled(false)
-            , shadowsIgnoreTransforms(false)
-        {
-        }
-
-        RefPtr<Gradient> strokeGradient;
-        RefPtr<Pattern> strokePattern;
-        
-        RefPtr<Gradient> fillGradient;
-        RefPtr<Pattern> fillPattern;
-
-        FloatSize shadowOffset;
-
-        float strokeThickness;
-        float shadowBlur;
-
-#if PLATFORM(CAIRO)
-        float globalAlpha;
-#endif
-        TextDrawingModeFlags textDrawingMode;
-
-        Color strokeColor;
-        Color fillColor;
-        Color shadowColor;
-
-        StrokeStyle strokeStyle;
-        WindRule fillRule;
-
-        ColorSpace strokeColorSpace;
-        ColorSpace fillColorSpace;
-
-        bool shouldAntialias;
-        bool paintingDisabled;
-        bool shadowsIgnoreTransforms;
-    };
-
-    class GraphicsContextPrivate : public Noncopyable {
-    public:
-        GraphicsContextPrivate()
-            : m_updatingControlTints(false)
-        {
-        }
-
-        GraphicsContextState state;
-        Vector<GraphicsContextState> stack;
-        bool m_updatingControlTints;
-    };
-
-} // namespace WebCore
-
-#endif // GraphicsContextPrivate_h
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 2548c5e..6c1c0df 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -41,7 +41,6 @@
 #include "FloatRect.h"
 #include "Font.h"
 #include "GraphicsContextPlatformPrivateCairo.h"
-#include "GraphicsContextPrivate.h"
 #include "OwnPtrCairo.h"
 #include "IntRect.h"
 #include "NotImplemented.h"
@@ -69,42 +68,46 @@ using namespace std;
 
 namespace WebCore {
 
-static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
+static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr)
 {
     cairo_pattern_t* pattern = 0;
     cairo_save(cr);
-    if (gcp->state.fillPattern) {
+    
+    const GraphicsContextState& state = context->state();
+    if (state.fillPattern) {
         AffineTransform affine;
-        pattern = gcp->state.fillPattern->createPlatformPattern(affine);
+        pattern = state.fillPattern->createPlatformPattern(affine);
         cairo_set_source(cr, pattern);
-    } else if (gcp->state.fillGradient)
-        cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
+    } else if (state.fillGradient)
+        cairo_set_source(cr, state.fillGradient->platformGradient());
     else
         setSourceRGBAFromColor(cr, context->fillColor());
     cairo_clip_preserve(cr);
-    cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
+    cairo_paint_with_alpha(cr, state.globalAlpha);
     cairo_restore(cr);
     if (pattern)
         cairo_pattern_destroy(pattern);
 }
 
-static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
+static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr)
 {
     cairo_pattern_t* pattern = 0;
     cairo_save(cr);
-    if (gcp->state.strokePattern) {
+    
+    const GraphicsContextState& state = context->state();
+    if (state.strokePattern) {
         AffineTransform affine;
-        pattern = gcp->state.strokePattern->createPlatformPattern(affine);
+        pattern = state.strokePattern->createPlatformPattern(affine);
         cairo_set_source(cr, pattern);
-    } else if (gcp->state.strokeGradient)
-        cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
+    } else if (state.strokeGradient)
+        cairo_set_source(cr, state.strokeGradient->platformGradient());
     else  {
-        Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
+        Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * state.globalAlpha);
         setSourceRGBAFromColor(cr, strokeColor);
     }
-    if (gcp->state.globalAlpha < 1.0f && (gcp->state.strokePattern || gcp->state.strokeGradient)) {
+    if (state.globalAlpha < 1.0f && (state.strokePattern || state.strokeGradient)) {
         cairo_push_group(cr);
-        cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
+        cairo_paint_with_alpha(cr, state.globalAlpha);
         cairo_pop_group_to_source(cr);
     }
     cairo_stroke_preserve(cr);
@@ -136,7 +139,7 @@ enum PathDrawingStyle {
     FillAndStroke = Fill + Stroke
 };
 
-static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPrivate* contextPrivate, PathDrawingStyle drawingStyle)
+static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle drawingStyle)
 {
     ContextShadow* shadow = context->contextShadow();
     ASSERT(shadow);
@@ -172,41 +175,39 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva
     cairo_append_path(shadowContext, path.get());
 
     if (drawingStyle & Fill)
-        setPlatformFill(context, shadowContext, contextPrivate);
+        setPlatformFill(context, shadowContext);
     if (drawingStyle & Stroke)
-        setPlatformStroke(context, shadowContext, contextPrivate);
+        setPlatformStroke(context, shadowContext);
 
     shadow->endShadowLayer(cairoContext);
 }
 
-static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
+static void fillCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
 {
     cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
-    drawPathShadow(context, gcp, Fill);
+    drawPathShadow(context, Fill);
 
-    setPlatformFill(context, cairoContext, gcp);
+    setPlatformFill(context, cairoContext);
     cairo_new_path(cairoContext);
 }
 
-static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
+static void strokeCurrentCairoPath(GraphicsContext* context,  cairo_t* cairoContext)
 {
-    drawPathShadow(context, gcp, Stroke);
-    setPlatformStroke(context, cairoContext, gcp);
+    drawPathShadow(context, Stroke);
+    setPlatformStroke(context, cairoContext);
     cairo_new_path(cairoContext);
 }
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate)
+void GraphicsContext::platformInit(PlatformGraphicsContext* cr)
 {
+    m_data = new GraphicsContextPlatformPrivate;
     m_data->cr = cairo_reference(cr);
     m_data->syncContext(cr);
     setPaintingDisabled(!cr);
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
@@ -532,7 +533,7 @@ void GraphicsContext::fillPath(const Path& path)
 
     cairo_t* cr = m_data->cr;
     setPathOnCairoContext(cr, path.platformPath()->context());
-    fillCurrentCairoPath(this, m_common, cr);
+    fillCurrentCairoPath(this, cr);
 }
 
 void GraphicsContext::strokePath(const Path& path)
@@ -542,7 +543,7 @@ void GraphicsContext::strokePath(const Path& path)
 
     cairo_t* cr = m_data->cr;
     setPathOnCairoContext(cr, path.platformPath()->context());
-    strokeCurrentCairoPath(this, m_common, cr);
+    strokeCurrentCairoPath(this, cr);
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect)
@@ -553,7 +554,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     cairo_t* cr = m_data->cr;
     cairo_save(cr);
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
-    fillCurrentCairoPath(this, m_common, cr);
+    fillCurrentCairoPath(this, cr);
     cairo_restore(cr);
 }
 
@@ -863,10 +864,10 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
 void GraphicsContext::setPlatformShadow(FloatSize const& size, float blur, Color const& color, ColorSpace)
 {
     // Cairo doesn't support shadows natively, they are drawn manually in the draw* functions
-    if (m_common->state.shadowsIgnoreTransforms) {
+    if (m_state.shadowsIgnoreTransforms) {
         // Meaning that this graphics context is associated with a CanvasRenderingContext
         // We flip the height since CG and HTML5 Canvas have opposite Y axis
-        m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
+        m_state.shadowOffset = FloatSize(size.width(), -size.height());
         m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
     } else
         m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), size.height()));
@@ -929,7 +930,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
     cairo_save(cr);
     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
     cairo_set_line_width(cr, width);
-    strokeCurrentCairoPath(this, m_common, cr);
+    strokeCurrentCairoPath(this, cr);
     cairo_restore(cr);
 }
 
@@ -988,12 +989,12 @@ void GraphicsContext::setMiterLimit(float miter)
 
 void GraphicsContext::setAlpha(float alpha)
 {
-    m_common->state.globalAlpha = alpha;
+    m_state.globalAlpha = alpha;
 }
 
 float GraphicsContext::getAlpha()
 {
-    return m_common->state.globalAlpha;
+    return m_state.globalAlpha;
 }
 
 void GraphicsContext::setCompositeOperation(CompositeOperator op)
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 01773bb..0562b03 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -31,7 +31,6 @@
 #include "AffineTransform.h"
 #include "FloatConversion.h"
 #include "GraphicsContextPlatformPrivateCG.h"
-#include "GraphicsContextPrivate.h"
 #include "ImageBuffer.h"
 #include "KURL.h"
 #include "Path.h"
@@ -108,10 +107,9 @@ CGColorSpaceRef linearRGBColorSpaceRef()
 #endif
 }
 
-GraphicsContext::GraphicsContext(CGContextRef cgContext)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(cgContext))
+void GraphicsContext::platformInit(CGContextRef cgContext)
 {
+    m_data = new GraphicsContextPlatformPrivate(cgContext);
     setPaintingDisabled(!cgContext);
     if (cgContext) {
         // Make sure the context starts in sync with our state.
@@ -120,9 +118,8 @@ GraphicsContext::GraphicsContext(CGContextRef cgContext)
     }
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
@@ -453,7 +450,7 @@ void GraphicsContext::applyStrokePattern()
 {
     CGContextRef cgContext = platformContext();
 
-    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.strokePattern->createPlatformPattern(getCTM()));
+    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(getCTM()));
     if (!platformPattern)
         return;
 
@@ -468,7 +465,7 @@ void GraphicsContext::applyFillPattern()
 {
     CGContextRef cgContext = platformContext();
 
-    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.fillPattern->createPlatformPattern(getCTM()));
+    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(getCTM()));
     if (!platformPattern)
         return;
 
@@ -512,7 +509,7 @@ void GraphicsContext::drawPath(const Path& path)
         return;
 
     CGContextRef context = platformContext();
-    const GraphicsContextState& state = m_common->state;
+    const GraphicsContextState& state = m_state;
 
     if (state.fillGradient || state.strokeGradient) {
         // We don't have any optimized way to fill & stroke a path using gradients
@@ -553,19 +550,19 @@ void GraphicsContext::fillPath(const Path& path)
     CGContextBeginPath(context);
     CGContextAddPath(context, path.platformPath());
 
-    if (m_common->state.fillGradient) {
+    if (m_state.fillGradient) {
         CGContextSaveGState(context);
         if (fillRule() == RULE_EVENODD)
             CGContextEOClip(context);
         else
             CGContextClip(context);
-        CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
-        m_common->state.fillGradient->paint(this);
+        CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
+        m_state.fillGradient->paint(this);
         CGContextRestoreGState(context);
         return;
     }
 
-    if (m_common->state.fillPattern)
+    if (m_state.fillPattern)
         applyFillPattern();
     fillPathWithFillRule(context, fillRule());
 }
@@ -580,17 +577,17 @@ void GraphicsContext::strokePath(const Path& path)
     CGContextBeginPath(context);
     CGContextAddPath(context, path.platformPath());
 
-    if (m_common->state.strokeGradient) {
+    if (m_state.strokeGradient) {
         CGContextSaveGState(context);
         CGContextReplacePathWithStrokedPath(context);
         CGContextClip(context);
-        CGContextConcatCTM(context, m_common->state.strokeGradient->gradientSpaceTransform());
-        m_common->state.strokeGradient->paint(this);
+        CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform());
+        m_state.strokeGradient->paint(this);
         CGContextRestoreGState(context);
         return;
     }
 
-    if (m_common->state.strokePattern)
+    if (m_state.strokePattern)
         applyStrokePattern();
     CGContextStrokePath(context);
 }
@@ -602,16 +599,16 @@ void GraphicsContext::fillRect(const FloatRect& rect)
 
     CGContextRef context = platformContext();
 
-    if (m_common->state.fillGradient) {
+    if (m_state.fillGradient) {
         CGContextSaveGState(context);
         CGContextClipToRect(context, rect);
-        CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
-        m_common->state.fillGradient->paint(this);
+        CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
+        m_state.fillGradient->paint(this);
         CGContextRestoreGState(context);
         return;
     }
 
-    if (m_common->state.fillPattern)
+    if (m_state.fillPattern)
         applyFillPattern();
     CGContextFillRect(context, rect);
 }
@@ -741,7 +738,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con
     CGFloat blurRadius = blur;
     CGContextRef context = platformContext();
 
-    if (!m_common->state.shadowsIgnoreTransforms) {
+    if (!m_state.shadowsIgnoreTransforms) {
         CGAffineTransform userToBaseCTM = wkGetUserToBaseCTM(context);
 
         CGFloat A = userToBaseCTM.a * userToBaseCTM.a + userToBaseCTM.b * userToBaseCTM.b;
@@ -816,18 +813,18 @@ void GraphicsContext::strokeRect(const FloatRect& r, float lineWidth)
 
     CGContextRef context = platformContext();
 
-    if (m_common->state.strokeGradient) {
+    if (m_state.strokeGradient) {
         CGContextSaveGState(context);
         setStrokeThickness(lineWidth);
         CGContextAddRect(context, r);
         CGContextReplacePathWithStrokedPath(context);
         CGContextClip(context);
-        m_common->state.strokeGradient->paint(this);
+        m_state.strokeGradient->paint(this);
         CGContextRestoreGState(context);
         return;
     }
 
-    if (m_common->state.strokePattern)
+    if (m_state.strokePattern)
         applyStrokePattern();
     CGContextStrokeRectWithWidth(context, r, lineWidth);
 }
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 7dda245..f634a98 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -62,16 +62,14 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
 {
 }
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(context))
+void GraphicsContext::platformInit(PlatformGraphicsContext* context)
 {
+    m_data = new GraphicsContextPlatformPrivate(context);
     setPaintingDisabled(!context);
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 5b1eb1d..a0a62fb 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -21,7 +21,6 @@
 #include "GraphicsContext.h"
 
 #include "AffineTransform.h"
-#include "GraphicsContextPrivate.h"
 #include "KURL.h"
 #include "NotImplemented.h"
 #include "PainterOpenVG.h"
@@ -49,16 +48,14 @@ public:
     }
 };
 
-GraphicsContext::GraphicsContext(SurfaceOpenVG* surface)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(surface ? new GraphicsContextPlatformPrivate(surface) : 0)
+void GraphicsContext::platformInit(SurfaceOpenVG* surface)
 {
+    m_data = surface ? new GraphicsContextPlatformPrivate(surface) : 0;
     setPaintingDisabled(!surface);
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
@@ -144,7 +141,7 @@ void GraphicsContext::fillPath(const Path& path)
     if (paintingDisabled())
         return;
 
-    m_data->drawPath(path, VG_FILL_PATH, m_common->state.fillRule);
+    m_data->drawPath(path, VG_FILL_PATH, m_state.fillRule);
 }
 
 void GraphicsContext::strokePath(const Path& path)
@@ -152,7 +149,7 @@ void GraphicsContext::strokePath(const Path& path)
     if (paintingDisabled())
         return;
 
-    m_data->drawPath(path, VG_STROKE_PATH, m_common->state.fillRule);
+    m_data->drawPath(path, VG_STROKE_PATH, m_state.fillRule);
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect)
@@ -380,7 +377,7 @@ void GraphicsContext::clip(const Path& path)
     if (paintingDisabled())
         return;
 
-    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
+    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
 }
 
 void GraphicsContext::canvasClip(const Path& path)
@@ -393,7 +390,7 @@ void GraphicsContext::clipOut(const Path& path)
     if (paintingDisabled())
         return;
 
-    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
+    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
 }
 
 void GraphicsContext::scale(const FloatSize& scaleFactors)
@@ -427,7 +424,7 @@ void GraphicsContext::clipOut(const IntRect& rect)
 
     Path path;
     path.addRect(rect);
-    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
+    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
 }
 
 void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer* imageBuffer)
@@ -450,7 +447,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
     path.addEllipse(FloatRect(rect.x() + thickness, rect.y() + thickness,
         rect.width() - (thickness * 2), rect.height() - (thickness * 2)));
 
-    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
+    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
 }
 
 void GraphicsContext::concatCTM(const AffineTransform& transformation)
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 727fbf1..812b753 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -46,7 +46,6 @@
 #include "ContextShadow.h"
 #include "FloatConversion.h"
 #include "Font.h"
-#include "GraphicsContextPrivate.h"
 #include "ImageBuffer.h"
 #include "NotImplemented.h"
 #include "Path.h"
@@ -224,7 +223,6 @@ private:
     bool platformContextIsOwned;
 };
 
-
 GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, const QColor& initialSolidColor)
     : antiAliasingForRectsAndLines(false)
     , layerCount(0)
@@ -253,10 +251,10 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
     delete device;
 }
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(painter, fillColor()))
+void GraphicsContext::platformInit(PlatformGraphicsContext* painter)
 {
+    m_data = new GraphicsContextPlatformPrivate(painter, fillColor());
+
     setPaintingDisabled(!painter);
 
     if (!painter)
@@ -271,12 +269,11 @@ GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
     painter->setPen(pen);
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
     while (!m_data->layers.isEmpty())
         endTransparencyLayer();
 
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
@@ -510,7 +507,7 @@ void GraphicsContext::fillPath(const Path& path)
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
         if (shadow->m_type != ContextShadow::BlurShadow
-            && !m_common->state.fillPattern && !m_common->state.fillGradient)
+            && !m_state.fillPattern && !m_state.fillGradient)
         {
             QPointF offset = shadow->offset();
             const QTransform& transform = p->transform();
@@ -537,12 +534,12 @@ void GraphicsContext::fillPath(const Path& path)
         }
 
     }
-    if (m_common->state.fillPattern) {
+    if (m_state.fillPattern) {
         AffineTransform affine;
-        p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
-    } else if (m_common->state.fillGradient) {
-        QBrush brush(*m_common->state.fillGradient->platformGradient());
-        brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
+        p->fillPath(platformPath, QBrush(m_state.fillPattern->createPlatformPattern(affine)));
+    } else if (m_state.fillGradient) {
+        QBrush brush(*m_state.fillGradient->platformGradient());
+        brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
         p->fillPath(platformPath, brush);
     } else
         p->fillPath(platformPath, p->brush());
@@ -562,7 +559,7 @@ void GraphicsContext::strokePath(const Path& path)
         ContextShadow* shadow = contextShadow();
 
         if (shadow->m_type != ContextShadow::BlurShadow
-            && !m_common->state.strokePattern && !m_common->state.strokeGradient)
+            && !m_state.strokePattern && !m_state.strokeGradient)
         {
             QPen shadowPen(pen);
             shadowPen.setColor(m_data->shadow.m_color);
@@ -593,14 +590,14 @@ void GraphicsContext::strokePath(const Path& path)
         }
     }
 
-    if (m_common->state.strokePattern) {
+    if (m_state.strokePattern) {
         AffineTransform affine;
-        pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
+        pen.setBrush(QBrush(m_state.strokePattern->createPlatformPattern(affine)));
         p->setPen(pen);
         p->strokePath(platformPath, pen);
-    } else if (m_common->state.strokeGradient) {
-        QBrush brush(*m_common->state.strokeGradient->platformGradient());
-        brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
+    } else if (m_state.strokeGradient) {
+        QBrush brush(*m_state.strokeGradient->platformGradient());
+        brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
         pen.setBrush(brush);
         p->setPen(pen);
         p->strokePath(platformPath, pen);
@@ -684,21 +681,21 @@ void GraphicsContext::fillRect(const FloatRect& rect)
     QRectF normalizedRect = rect.normalized();
     ContextShadow* shadow = contextShadow();
 
-    if (m_common->state.fillPattern) {
+    if (m_state.fillPattern) {
         AffineTransform affine;
-        QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine));
-        QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame();
+        QBrush brush(m_state.fillPattern->createPlatformPattern(affine));
+        QPixmap* image = m_state.fillPattern->tileImage()->nativeImageForCurrentFrame();
         QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
         if (shadowPainter) {
-            drawRepeatPattern(shadowPainter, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
+            drawRepeatPattern(shadowPainter, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
             shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
             shadowPainter->fillRect(normalizedRect, shadow->m_color);
             shadow->endShadowLayer(p);
         }
-        drawRepeatPattern(p, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
-    } else if (m_common->state.fillGradient) {
-        QBrush brush(*m_common->state.fillGradient->platformGradient());
-        brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
+        drawRepeatPattern(p, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
+    } else if (m_state.fillGradient) {
+        QBrush brush(*m_state.fillGradient->platformGradient());
+        brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
         QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
         if (shadowPainter) {
             shadowPainter->fillRect(normalizedRect, brush);
@@ -969,10 +966,10 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const
     // Qt doesn't support shadows natively, they are drawn manually in the draw*
     // functions
 
-    if (m_common->state.shadowsIgnoreTransforms) {
+    if (m_state.shadowsIgnoreTransforms) {
         // Meaning that this graphics context is associated with a CanvasRenderingContext
         // We flip the height since CG and HTML5 Canvas have opposite Y axis
-        m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
+        m_state.shadowOffset = FloatSize(size.width(), -size.height());
         m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
     } else {
         m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), size.height()));
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 84b42ff..717664f 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -37,7 +37,6 @@
 #include "GLES2Canvas.h"
 #include "Gradient.h"
 #include "GraphicsContextPlatformPrivate.h"
-#include "GraphicsContextPrivate.h"
 #include "ImageBuffer.h"
 #include "IntRect.h"
 #include "NativeImageSkia.h"
@@ -219,17 +218,15 @@ void addCornerArc(SkPath* path, const SkRect& rect, const IntSize& size, int sta
 
 // This may be called with a NULL pointer to create a graphics context that has
 // no painting.
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* gc)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(gc))
+void GraphicsContext::platformInit(PlatformGraphicsContext* gc)
 {
+    m_data = new GraphicsContextPlatformPrivate(gc);
     setPaintingDisabled(!gc || !platformContext()->canvas());
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
     delete m_data;
-    this->destroyGraphicsContextPrivate(m_common);
 }
 
 PlatformGraphicsContext* GraphicsContext::platformContext() const
@@ -742,7 +739,7 @@ void GraphicsContext::fillPath(const Path& pathToFill)
 
     platformContext()->prepareForSoftwareDraw();
 
-    const GraphicsContextState& state = m_common->state;
+    const GraphicsContextState& state = m_state;
     path.setFillType(state.fillRule == RULE_EVENODD ?
         SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
 
@@ -1071,7 +1068,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size,
 
     // TODO(tc): This still does not address the issue that shadows
     // within canvas elements should ignore transforms.
-    if (m_common->state.shadowsIgnoreTransforms)  {
+    if (m_state.shadowsIgnoreTransforms)  {
         // Currently only the GraphicsContext associated with the
         // CanvasRenderingContext for HTMLCanvasElement have shadows ignore
         // Transforms. So with this flag set, we know this state is associated
diff --git a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
index 1ad6bc1..b42e51c 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
@@ -62,9 +62,14 @@ static CGContextRef CGContextWithHDC(HDC hdc, bool hasAlpha)
 }
 
 GraphicsContext::GraphicsContext(HDC hdc, bool hasAlpha)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha)))
+    : m_updatingControlTints(false)
 {
+    platformInit(hdc, hasAlpha);
+}
+
+void GraphicsContext::platformInit(HDC hdc, bool hasAlpha)
+{
+    m_data = new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha));
     CGContextRelease(m_data->m_cgContext.get());
     m_data->m_hdc = hdc;
     setPaintingDisabled(!m_data->m_cgContext);
diff --git a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
index a989c24..b2c702f 100644
--- a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
+++ b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
@@ -65,9 +65,15 @@ static cairo_t* createCairoContextWithHDC(HDC hdc, bool hasAlpha)
 }
 
 GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate)
+    : m_updatingControlTints(false)
 {
+    platformInit(dc, hasAlpha);
+}
+
+void GraphicsContext::platformInit(HDC dc, bool hasAlpha)
+{
+    m_data = new GraphicsContextPlatformPrivate;
+
     if (dc) {
         m_data->cr = createCairoContextWithHDC(dc, hasAlpha);
         m_data->m_hdc = dc;
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index a52658f..0328330 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -28,7 +28,6 @@
 #include "GDIExtras.h"
 #include "GlyphBuffer.h"
 #include "Gradient.h"
-#include "GraphicsContextPrivate.h"
 #include "NotImplemented.h"
 #include "Path.h"
 #include "PlatformPathWinCE.h"
@@ -580,15 +579,13 @@ private:
 };
 
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* dc)
-: m_common(createGraphicsContextPrivate())
-, m_data(new GraphicsContextPlatformPrivate(dc))
+void GraphicsContext::platformInit(PlatformGraphicsContext* dc)
 {
+    m_data = new GraphicsContextPlatformPrivate(dc);
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 
@@ -1316,8 +1313,8 @@ Color gradientAverageColor(const Gradient* gradient)
 
 void GraphicsContext::fillPath(const Path& path)
 {
-    Color c = m_common->state.fillGradient
-        ? gradientAverageColor(m_common->state.fillGradient.get())
+    Color c = m_state.fillGradient
+        ? gradientAverageColor(m_state.fillGradient.get())
         : fillColor();
 
     if (!c.alpha() || !m_data->m_opacity)
@@ -1487,8 +1484,8 @@ void GraphicsContext::fillRect(const FloatRect& rect)
 {
     savePlatformState();
 
-    if (m_common->state.fillGradient)
-        fillRect(rect, m_common->state.fillGradient.get());
+    if (m_state.fillGradient)
+        fillRect(rect, m_state.fillGradient.get());
     else
         fillRect(rect, fillColor(), ColorSpaceDeviceRGB);
 
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 3428969..755b138 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -112,11 +112,11 @@ GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
 }
 
 
-GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
-    : m_common(createGraphicsContextPrivate())
-    , m_data(new GraphicsContextPlatformPrivate)
-{    
+void GraphicsContext::platformInit(PlatformGraphicsContext* context)
+{
+    m_data = new GraphicsContextPlatformPrivate;
     setPaintingDisabled(!context);
+
     if (context) {
         // Make sure the context starts in sync with our state.
         setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB);
@@ -129,9 +129,8 @@ GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
 #endif
 }
 
-GraphicsContext::~GraphicsContext()
+void GraphicsContext::platformDestroy()
 {
-    destroyGraphicsContextPrivate(m_common);
     delete m_data;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list