Reviewed by timo.
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2006 18:41:54 +0000 (18:41 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Sep 2006 18:41:54 +0000 (18:41 +0000)
        Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=10812
        Move LocalGraphicsContext out of RenderThemeMac

        * WebCore.xcodeproj/project.pbxproj:
        * platform/mac/LocalGraphicsContext.h: Added.
        * platform/mac/LocalGraphicsContext.mm: Added.
        (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
        (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext):
        * rendering/RenderThemeMac.mm:

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

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/mac/LocalGraphicsContext.h [new file with mode: 0644]
WebCore/platform/mac/LocalGraphicsContext.mm [new file with mode: 0644]
WebCore/rendering/RenderThemeMac.mm

index 17254f42003476a8a0ac209a5ce86c23e094f450..d3685b456c6281c7ca71d4c73f1738fbe3baed12 100644 (file)
@@ -1,3 +1,17 @@
+2006-09-11  Adam Roben  <aroben@apple.com>
+
+        Reviewed by timo.
+
+        Fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=10812
+        Move LocalGraphicsContext out of RenderThemeMac
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/LocalGraphicsContext.h: Added.
+        * platform/mac/LocalGraphicsContext.mm: Added.
+        (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
+        (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext):
+        * rendering/RenderThemeMac.mm:
+
 2006-09-11  Vladimir Olexa  <vladimir.olexa@gmail.com>
 
         Reviewed by Darin.
index 218519fd7991b5af20830f90a9128fb4acb21eb4..e3e2a3f19e492987904c631cd62d8637cbc2a48d 100644 (file)
@@ -21,6 +21,8 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+               06E81ED70AB5D5E900C87837 /* LocalGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 06E81ED60AB5D5E900C87837 /* LocalGraphicsContext.h */; };
+               06E81EEC0AB5DA9700C87837 /* LocalGraphicsContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06E81EEB0AB5DA9700C87837 /* LocalGraphicsContext.mm */; };
                1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; };
                1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; };
                1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */; };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               06E81ED60AB5D5E900C87837 /* LocalGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalGraphicsContext.h; sourceTree = "<group>"; };
+               06E81EEB0AB5DA9700C87837 /* LocalGraphicsContext.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalGraphicsContext.mm; sourceTree = "<group>"; };
                1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
                1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; };
                1403B99609EB13AF00797C7F /* DOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindow.cpp; sourceTree = "<group>"; };
                                6593923909AE435C002C531F /* KURLMac.mm */,
                                9352084409BD43B900F2038D /* Language.mm */,
                                F587851402DE375901EA4122 /* ListBoxMac.mm */,
+                               06E81EEB0AB5DA9700C87837 /* LocalGraphicsContext.mm */,
+                               06E81ED60AB5D5E900C87837 /* LocalGraphicsContext.h */,
                                935207BF09BD412000F2038D /* LocalizedStringsMac.mm */,
                                65F5382409B2B57500F3DC4A /* mac-encodings.txt */,
                                935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
                                85E9E0A40AB3A0C700069CD0 /* DOMXPathNSResolver.h in Headers */,
                                85E9E0A50AB3A0C700069CD0 /* DOMXPathResult.h in Headers */,
                                51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */,
+                               06E81ED70AB5D5E900C87837 /* LocalGraphicsContext.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                859128F40AB2431A00202265 /* DOMHTMLEmbedElement.mm in Sources */,
                                85E9E0A20AB3A0C700069CD0 /* DOMXPathExpression.mm in Sources */,
                                85E9E0A60AB3A0C700069CD0 /* DOMXPathResult.mm in Sources */,
+                               06E81EEC0AB5DA9700C87837 /* LocalGraphicsContext.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/platform/mac/LocalGraphicsContext.h b/WebCore/platform/mac/LocalGraphicsContext.h
new file mode 100644 (file)
index 0000000..9e2bf94
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <WTF/Noncopyable.h>
+
+class NSGraphicsContext;
+
+namespace WebCore {
+
+class GraphicsContext;
+    
+// This class automatically saves and restores the current NSGraphicsContext for
+// functions which call out into AppKit and rely on the currentContext being set
+class LocalCurrentGraphicsContext : Noncopyable {
+public:
+    LocalCurrentGraphicsContext(GraphicsContext* graphicsContext);
+    ~LocalCurrentGraphicsContext();
+
+private:
+    NSGraphicsContext* m_savedNSGraphicsContext;
+};
+
+}
diff --git a/WebCore/platform/mac/LocalGraphicsContext.mm b/WebCore/platform/mac/LocalGraphicsContext.mm
new file mode 100644 (file)
index 0000000..8c74573
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "LocalGraphicsContext.h"
+
+#include "GraphicsContext.h"
+#include <AppKit/NSGraphicsContext.h>
+
+namespace WebCore {
+
+LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(GraphicsContext* graphicsContext)
+{
+    if (graphicsContext->platformContext() == [[NSGraphicsContext currentContext] graphicsPort]) {
+        m_savedNSGraphicsContext = 0;
+        return;
+    }
+    
+    m_savedNSGraphicsContext = [[NSGraphicsContext currentContext] retain];
+    NSGraphicsContext* newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:graphicsContext->platformContext() flipped:YES];
+    [NSGraphicsContext setCurrentContext:newContext];
+}
+
+LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext()
+{
+    if (m_savedNSGraphicsContext) {
+        [NSGraphicsContext setCurrentContext:m_savedNSGraphicsContext];
+        [m_savedNSGraphicsContext release];
+    }
+}
+
+}
index 8e4c6b0eb10fc50908a49b3d4eb50a664acaece3..c8feee123ca70909d1743dd53e764be1613c4e6b 100644 (file)
 #import "config.h"
 #import "RenderThemeMac.h"
 
+#import "cssstyleselector.h"
 #import "CSSValueKeywords.h"
 #import "Document.h"
 #import "FoundationExtras.h"
 #import "FrameView.h"
 #import "GraphicsContext.h"
 #import "Image.h"
+#import "LocalGraphicsContext.h"
+#import "RenderPopupMenuMac.h"
 #import "RenderView.h"
 #import "WebCoreSystemInterface.h"
-#import "cssstyleselector.h"
-#import "RenderPopupMenuMac.h"
 
 // The methods in this file are specific to the Mac OS X platform.
 
 namespace WebCore {
 
-// This class automatically saves and restores the current NSGraphicsContext for
-// functions which call out into AppKit and rely on the currentContext being set
-class LocalCurrentGraphicsContext : Noncopyable {
-public:
-    LocalCurrentGraphicsContext(GraphicsContext* graphicsContext)
-    {
-        if (graphicsContext->platformContext() == [[NSGraphicsContext currentContext] graphicsPort]) {
-            m_savedNSGraphicsContext = 0;
-            return;
-        }
-        
-        m_savedNSGraphicsContext = [[NSGraphicsContext currentContext] retain];
-        NSGraphicsContext* newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:graphicsContext->platformContext() flipped:YES];
-        [NSGraphicsContext setCurrentContext:newContext];
-    }
-    ~LocalCurrentGraphicsContext()
-    {
-        if (m_savedNSGraphicsContext) {
-            [NSGraphicsContext setCurrentContext:m_savedNSGraphicsContext];
-            [m_savedNSGraphicsContext release];
-        }
-    }
-
-private:
-    NSGraphicsContext* m_savedNSGraphicsContext;
-};
-
 enum {
     topMargin,
     rightMargin,