+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.
/* 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;
};
--- /dev/null
+/*
+ * 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;
+};
+
+}
--- /dev/null
+/*
+ * 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];
+ }
+}
+
+}
#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,