[Mac] Upstream Carbon-related WebKitSystemInterface functions
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 08:59:10 +0000 (08:59 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 08:59:10 +0000 (08:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176087

Reviewed by Alex Christensen.

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj:
* pal/spi/cocoa/FoundationSPI.h: Copied from Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h.
* pal/spi/mac/HIToolboxSPI.h: Copied from Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h.
* pal/spi/mac/NSEventSPI.h:
* pal/spi/mac/NSWindowSPI.h:
* pal/spi/mac/QuickDrawSPI.h: Added.

Source/WebKit:

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::cgWindowID):
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::scriptCodeFromCurrentKeyboardInputSource):
(WebKit::NetscapePlugin::sendComplexTextInput):

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj:

Source/WebKitLegacy/mac:

* Carbon/CarbonUtils.m:
(getNSAutoreleasePoolCount):
(WebInitForCarbon):
(PoolCleaner):
* Carbon/CarbonWindowAdapter.mm:
(+[CarbonWindowAdapter frameViewClassForStyleMask:]):
(-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
(-[CarbonWindowAdapter _oldPlaceWindow:]):
(-[CarbonWindowAdapter _windowMovedToRect:]):
* Carbon/HIViewAdapter.m:
* Carbon/HIWebView.mm:
(Draw):
(CreateNSEventAdoptingCGEvent):
(CopyEventCGEvent):
(CreateNSEventWithCarbonClickEvent):
(Click):
(CreateNSEventWithCarbonEvent):
(MouseUp):
(CreateNSEventWithCarbonMouseMoveEvent):
(MouseMoved):
(MouseDragged):
(MouseWheelMoved):
(WindowHandler):
(HIWebViewEventHandler):
* Misc/QuickDrawCompatibility.h: Removed.
* Plugins/WebNetscapePluginEventHandlerCarbon.mm:
(getCarbonEvent):
(WebNetscapePluginEventHandlerCarbon::keyDown):
(WebNetscapePluginEventHandlerCarbon::keyUp):
* Plugins/WebNetscapePluginEventHandlerCocoa.mm:
(WebNetscapePluginEventHandlerCocoa::keyDown):
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView tellQuickTimeToChill]):

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

21 files changed:
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h [new file with mode: 0644]
Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h [new file with mode: 0644]
Source/WebCore/PAL/pal/spi/mac/NSEventSPI.h
Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h
Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/PluginProcess/mac/PluginProcessMac.mm
Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
Source/WebKitLegacy/mac/Carbon/CarbonUtils.m
Source/WebKitLegacy/mac/Carbon/CarbonWindowAdapter.mm
Source/WebKitLegacy/mac/Carbon/HIViewAdapter.m
Source/WebKitLegacy/mac/Carbon/HIWebView.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h [deleted file]
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm

index 014a19eae4fcaa03c96460bdc29b461b6ab50a16..3423245c2b88dc8529bfd859e194b1c839e8ede6 100644 (file)
@@ -1,3 +1,17 @@
+2017-08-30  Andy Estes  <aestes@apple.com>
+
+        [Mac] Upstream Carbon-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176087
+
+        Reviewed by Alex Christensen.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/spi/cocoa/FoundationSPI.h: Copied from Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h.
+        * pal/spi/mac/HIToolboxSPI.h: Copied from Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h.
+        * pal/spi/mac/NSEventSPI.h:
+        * pal/spi/mac/NSWindowSPI.h:
+        * pal/spi/mac/QuickDrawSPI.h: Added.
+
 2017-08-29  Andy Estes  <aestes@apple.com>
 
         [Xcode] Fix up file and group paths in PAL.xcodeproj
index efde70baf0587433f470a33eff8aeff8aaf535e6..fd3ebc6c1aec46233b2279aa83eb33b876da2103 100644 (file)
@@ -97,6 +97,9 @@
                1C09D0531E31C44100725F18 /* CryptoDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0521E31C44100725F18 /* CryptoDigest.h */; };
                1C09D0561E31C46500725F18 /* CryptoDigestCommonCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C09D0551E31C46500725F18 /* CryptoDigestCommonCrypto.cpp */; };
                1C09D0581E31C57E00725F18 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0571E31C57E00725F18 /* config.h */; };
+               A10265871F56746100B4C844 /* FoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265861F56746100B4C844 /* FoundationSPI.h */; };
+               A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; };
+               A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658A1F56748C00B4C844 /* QuickDrawSPI.h */; };
                A1F55DCF1F5528EC00EDB75F /* MetadataSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */; };
                A30D41211F0DD0EA00B71954 /* KillRing.h in Headers */ = {isa = PBXBuildFile; fileRef = A30D411E1F0DD0EA00B71954 /* KillRing.h */; };
                A30D41221F0DD0EA00B71954 /* KillRingNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A30D411F1F0DD0EA00B71954 /* KillRingNone.cpp */; };
                1C09D0631E31EC3100725F18 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
                1C67CEA11E32EDA800F80F2E /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
                1C67CEA21E32EE2600F80F2E /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
+               A10265861F56746100B4C844 /* FoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; };
+               A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; };
+               A102658A1F56748C00B4C844 /* QuickDrawSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickDrawSPI.h; sourceTree = "<group>"; };
                A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MetadataSPI.h; sourceTree = "<group>"; };
                A30D411E1F0DD0EA00B71954 /* KillRing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KillRing.h; sourceTree = "<group>"; };
                A30D411F1F0DD0EA00B71954 /* KillRingNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KillRingNone.cpp; sourceTree = "<group>"; };
                                0C2DA1231F3BEB4900DBC317 /* CFNSURLConnectionSPI.h */,
                                0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */,
                                0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */,
+                               A10265861F56746100B4C844 /* FoundationSPI.h */,
                                0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */,
                                0C2DA1271F3BEB4900DBC317 /* IOPSLibSPI.h */,
                                0C2DA1281F3BEB4900DBC317 /* IOReturnSPI.h */,
                        children = (
                                0C7785701F45130F00F4EBB6 /* AVFoundationSPI.h */,
                                0C7785711F45130F00F4EBB6 /* DataDetectorsSPI.h */,
+                               A10265881F56747A00B4C844 /* HIToolboxSPI.h */,
                                0C7785721F45130F00F4EBB6 /* LookupSPI.h */,
                                0C7785731F45130F00F4EBB6 /* MediaRemoteSPI.h */,
                                A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */,
                                0C7785841F45130F00F4EBB6 /* NSWindowSPI.h */,
                                0C7785851F45130F00F4EBB6 /* PIPSPI.h */,
                                0C7785861F45130F00F4EBB6 /* QTKitSPI.h */,
+                               A102658A1F56748C00B4C844 /* QuickDrawSPI.h */,
                                0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
                                0C7785881F45130F00F4EBB6 /* TUCallSPI.h */,
                        );
                                0C77858A1F45130F00F4EBB6 /* DataDetectorsSPI.h in Headers */,
                                0C5AF91A1F43A4C7002EAC02 /* DataDetectorsUISPI.h in Headers */,
                                0C2D9E731EEF5AF600DBC317 /* ExportMacros.h in Headers */,
+                               A10265871F56746100B4C844 /* FoundationSPI.h in Headers */,
                                0C5AF91B1F43A4C7002EAC02 /* GraphicsServicesSPI.h in Headers */,
+                               A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */,
                                0C2DA11F1F3BE9E000DBC317 /* ImageIOSPI.h in Headers */,
                                0C2DA1421F3BEB4900DBC317 /* IOPMLibSPI.h in Headers */,
                                0C2DA1431F3BEB4900DBC317 /* IOPSLibSPI.h in Headers */,
                                0C2DA1561F3BEB4900DBC317 /* pthreadSPI.h in Headers */,
                                0C77859F1F45130F00F4EBB6 /* QTKitSPI.h in Headers */,
                                0C2DA1571F3BEB4900DBC317 /* QuartzCoreSPI.h in Headers */,
+                               A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */,
                                0C7785A01F45130F00F4EBB6 /* QuickLookMacSPI.h in Headers */,
                                0C5AF9201F43A4C7002EAC02 /* QuickLookSPI.h in Headers */,
                                0C2DA1581F3BEB4900DBC317 /* ServersSPI.h in Headers */,
diff --git a/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h
new file mode 100644 (file)
index 0000000..684175d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <Foundation/NSPrivateDecls.h>
+
+#endif
+
+typedef void* NSAutoreleasePoolMark;
+
+WTF_EXTERN_C_BEGIN
+
+NSAutoreleasePoolMark NSPushAutoreleasePool(NSUInteger capacity);
+void NSPopAutoreleasePool(NSAutoreleasePoolMark);
+
+WTF_EXTERN_C_END
diff --git a/Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h b/Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h
new file mode 100644 (file)
index 0000000..0034877
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <HIToolbox/HIToolboxPriv.h>
+
+#else
+
+#define kTSMInputSourcePropertyScriptCode CFSTR("TSMInputSourcePropertyScriptCode")
+
+#endif
+
+typedef struct __TSMInputSource* TSMInputSourceRef;
+typedef CFStringRef TSMInputSourcePropertyTag;
+
+WTF_EXTERN_C_BEGIN
+
+OSStatus _SyncWindowWithCGAfterMove(WindowRef);
+CGWindowID GetNativeWindowFromWindowRef(WindowRef);
+OSStatus TSMProcessRawKeyEvent(EventRef);
+EventRef GetCurrentEvent();
+CFTypeRef TSMGetInputSourceProperty(TSMInputSourceRef, TSMInputSourcePropertyTag);
+
+WTF_EXTERN_C_END
index 8577ce583ea1c228d44cbf24855f70fcdcf2f118..791784d5179cae7883726b2127ffbfe9026069f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc.  All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #else
 
+NS_ASSUME_NONNULL_BEGIN
+
 enum {
     NSEventSwipeTrackingConsumeMouseEvents = 0x1 << 2
 };
 
+@interface NSEvent ()
+- (nullable NSEvent *)_initWithCGEvent:(nullable CGEventRef)cgEvent eventRef:(nullable void*)eventRef;
+- (nullable void*)_eventRef NS_RETURNS_INNER_POINTER;
+- (NSEvent *)_eventRelativeToWindow:(NSWindow *)window;
+@end
+
+NS_ASSUME_NONNULL_END
+
 #endif
 
 #endif
index 02c33f713557eadc5d06127d992907a6664c266d..bab8400f049d94b92defea9ae953162ff2158943 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 @end
 
+enum {
+    _NSCarbonWindowMask = 1 << 25,
+};
+
 #endif
 
 #endif // PLATFORM(MAC)
diff --git a/Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h b/Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h
new file mode 100644 (file)
index 0000000..6ed2dcc
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2010-2017 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#ifndef __LP64__
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <QD/QuickdrawPriv.h>
+
+#else
+
+#define MacSetRect SetRect
+#define MacSetRectRgn SetRectRgn
+#define MacUnionRgn UnionRgn
+
+enum {
+    blackColor = 33,
+    whiteColor = 30,
+    greenColor = 341,
+};
+
+enum {
+    kBitsProc = 8,
+};
+
+#endif
+
+typedef long QDDrawingType;
+
+WTF_EXTERN_C_BEGIN
+
+Boolean EmptyRgn(RgnHandle);
+OSStatus CreateCGContextForPort(CGrafPtr, CGContextRef*);
+OSStatus SyncCGContextOriginWithPort(CGContextRef, CGrafPtr);
+PixMapHandle GetPortPixMap(CGrafPtr);
+QDErr NewGWorldFromPtr(GWorldPtr*, UInt32, const Rect*, CTabHandle, GDHandle, GWorldFlags, Ptr, SInt32);
+Rect* GetPortBounds(CGrafPtr, Rect*);
+Rect* GetRegionBounds(RgnHandle, Rect*);
+RgnHandle GetPortClipRegion(CGrafPtr, RgnHandle);
+RgnHandle GetPortVisibleRegion(CGrafPtr, RgnHandle);
+RgnHandle NewRgn();
+void BackColor(long);
+void CallDrawingNotifications(CGrafPtr, const Rect*, QDDrawingType);
+void DisposeGWorld(GWorldPtr);
+void DisposeRgn(RgnHandle);
+void ForeColor(long);
+void GetGWorld(CGrafPtr*, GDHandle*);
+void GetPort(GrafPtr*);
+void GlobalToLocal(Point*);
+void MacSetRect(Rect*, short, short, short, short);
+void MacSetRectRgn(RgnHandle, short, short, short, short);
+void MacUnionRgn(RgnHandle, RgnHandle, RgnHandle);
+void MovePortTo(short, short);
+void OffsetRect(Rect*, short, short);
+void OffsetRgn(RgnHandle, short, short);
+void PaintRect(const Rect*);
+void PenNormal();
+void PortSize(short, short);
+void RectRgn(RgnHandle, const Rect*);
+void SectRgn(RgnHandle, RgnHandle, RgnHandle);
+void SetGWorld(CGrafPtr, GDHandle);
+void SetOrigin(short, short);
+void SetPort(GrafPtr);
+void SetPortClipRegion(CGrafPtr, RgnHandle);
+void SetPortVisibleRegion(CGrafPtr, RgnHandle);
+
+WTF_EXTERN_C_END
+
+#endif
index b4f35e74a82c5f6e489e1cc2eb845b66e254fddb..cb9200b823493fa09bac08d3212f5ec953927349 100644 (file)
@@ -1,3 +1,16 @@
+2017-08-30  Andy Estes  <aestes@apple.com>
+
+        [Mac] Upstream Carbon-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176087
+
+        Reviewed by Alex Christensen.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::cgWindowID):
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::scriptCodeFromCurrentKeyboardInputSource):
+        (WebKit::NetscapePlugin::sendComplexTextInput):
+
 2017-08-30  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Try to fix layout test timing out after r221344.
index 529c4b5339a1c884d25e0e2b4e0b5092ea29d418..dd53370247f0a6b74a01bfcc8aa96fa6fff34418 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@
 #import <mach/mach_vm.h>
 #import <mach/vm_statistics.h>
 #import <objc/runtime.h>
+#import <pal/spi/mac/HIToolboxSPI.h>
 #import <sysexits.h>
 #import <wtf/HashSet.h>
 #import <wtf/NeverDestroyed.h>
@@ -96,7 +97,7 @@ static bool windowCoversAnyScreen(WindowRef window)
 
 static CGWindowID cgWindowID(WindowRef window)
 {
-    return reinterpret_cast<CGWindowID>(WKGetNativeWindowFromWindowRef(window));
+    return reinterpret_cast<CGWindowID>(GetNativeWindowFromWindowRef(window));
 }
 
 #endif
index 201b3dcd8399486b8e4e2d90c759f2a951ed4329..a3120e625383beb2af7070270f47f8589930c206 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
 #import <WebCore/NotImplemented.h>
 #import <WebKitSystemInterface.h>
 #import <objc/runtime.h>
+#import <pal/spi/mac/HIToolboxSPI.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/text/StringView.h>
 
@@ -988,6 +989,21 @@ static bool convertStringToKeyCodes(StringView string, ScriptCode scriptCode, Ve
 }
 #endif
 
+#ifndef NP_NO_CARBON
+static ScriptCode scriptCodeFromCurrentKeyboardInputSource()
+{
+    ScriptCode scriptCode = smRoman;
+    auto inputSource = adoptCF(TISCopyCurrentKeyboardInputSource());
+
+    CFTypeRef scriptCodeNumber = TSMGetInputSourceProperty((TSMInputSourceRef)inputSource.get(), kTSMInputSourcePropertyScriptCode);
+    ASSERT(CFGetTypeID(scriptCodeNumber) == CFNumberGetTypeID());
+    if (scriptCodeNumber)
+        CFNumberGetValue((CFNumberRef)scriptCodeNumber, kCFNumberSInt16Type, &scriptCode);
+
+    return scriptCode;
+}
+#endif
+
 void NetscapePlugin::sendComplexTextInput(const String& textInput)
 {
     if (!m_pluginWantsLegacyCocoaTextInput) {
@@ -1011,7 +1027,7 @@ void NetscapePlugin::sendComplexTextInput(const String& textInput)
     }
 #ifndef NP_NO_CARBON
     case NPEventModelCarbon: {
-        ScriptCode scriptCode = WKGetScriptCodeFromCurrentKeyboardInputSource();
+        ScriptCode scriptCode = scriptCodeFromCurrentKeyboardInputSource();
         Vector<UInt8> keyCodes;
 
         if (!convertStringToKeyCodes(textInput, scriptCode, keyCodes))
index 50b69292273680009b6af7d263f2cdeba7520f0a..6dbe3dcc414d52e06e11c5fb0af70b7cf2da3585 100644 (file)
@@ -1,3 +1,12 @@
+2017-08-30  Andy Estes  <aestes@apple.com>
+
+        [Mac] Upstream Carbon-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176087
+
+        Reviewed by Alex Christensen.
+
+        * WebKitLegacy.xcodeproj/project.pbxproj:
+
 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Use find_package for zlib
index d4beeeadef1a788a4924a4b609194c72437d0dec..c22430596d6592333ccdc35e609849616bd70e42 100644 (file)
                598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */; };
                598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */; };
                598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               5C7706721D111B220012700F /* QuickDrawCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7706711D111B220012700F /* QuickDrawCompatibility.h */; };
                5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; };
                5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; };
                939810FF0824BF01008DF038 /* CarbonWindowFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEE9503F9DBA103CA0DE6 /* CarbonWindowFrame.m */; };
                939811000824BF01008DF038 /* HIViewAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEE9B03F9DBA103CA0DE6 /* HIViewAdapter.m */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                939811010824BF01008DF038 /* CarbonUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F79B974904019934036909D2 /* CarbonUtils.m */; };
-               939811020824BF01008DF038 /* HIWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.mm */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
                939811030824BF01008DF038 /* WebKitErrors.m in Sources */ = {isa = PBXBuildFile; fileRef = 83730F9803FB1E660004736E /* WebKitErrors.m */; };
                939811060824BF01008DF038 /* WebFrameView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A8B52F04282B5900CA2D3A /* WebFrameView.mm */; };
                939811070824BF01008DF038 /* WebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A8B57A042834F700CA2D3A /* WebView.mm */; };
                93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */; };
                93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; };
                93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; };
+               A10265831F56540300B4C844 /* HIWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10265821F56540300B4C844 /* HIWebView.mm */; };
                A10C1D1818202F9C0036883A /* WebDefaultFormDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D1018202F9C0036883A /* WebDefaultFormDelegate.h */; };
                A10C1D1918202F9C0036883A /* WebDefaultFormDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D1118202F9C0036883A /* WebDefaultFormDelegate.m */; };
                A10C1D1A18202F9C0036883A /* WebDefaultFrameLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D1218202F9C0036883A /* WebDefaultFrameLoadDelegate.h */; };
                598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationProviderMock.mm; sourceTree = "<group>"; };
                598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMockInternal.h; sourceTree = "<group>"; };
                598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProvider.h; sourceTree = "<group>"; };
-               5C7706711D111B220012700F /* QuickDrawCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickDrawCompatibility.h; sourceTree = "<group>"; };
                5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; };
                5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; };
                5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; };
                93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryInternal.h; sourceTree = "<group>"; };
                9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                9CF0E249021361B00ECA16EA /* WebFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               A10265821F56540300B4C844 /* HIWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HIWebView.mm; sourceTree = "<group>"; };
                A10C1D1018202F9C0036883A /* WebDefaultFormDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebDefaultFormDelegate.h; path = ios/DefaultDelegates/WebDefaultFormDelegate.h; sourceTree = SOURCE_ROOT; };
                A10C1D1118202F9C0036883A /* WebDefaultFormDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebDefaultFormDelegate.m; path = ios/DefaultDelegates/WebDefaultFormDelegate.m; sourceTree = SOURCE_ROOT; };
                A10C1D1218202F9C0036883A /* WebDefaultFrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebDefaultFrameLoadDelegate.h; path = ios/DefaultDelegates/WebDefaultFrameLoadDelegate.h; sourceTree = SOURCE_ROOT; };
                F7EBEE9A03F9DBA103CA0DE6 /* HIViewAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HIViewAdapter.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F7EBEE9B03F9DBA103CA0DE6 /* HIViewAdapter.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = HIViewAdapter.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F7EBEEAA03F9DBA103CA0DE6 /* HIWebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HIWebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = HIWebView.mm; sourceTree = "<group>"; usesTabs = 0; };
                F834AAD50E64B1C700E2737C /* WebTextIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTextIterator.h; sourceTree = "<group>"; };
                F834AAD60E64B1C700E2737C /* WebTextIterator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextIterator.mm; sourceTree = "<group>"; };
                F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        children = (
                                A10C1D2018202FAF0036883A /* ios */,
                                29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */,
-                               5C7706711D111B220012700F /* QuickDrawCompatibility.h */,
                                5241ADF30B1BC48A004012BD /* WebCache.h */,
                                5241ADF40B1BC48A004012BD /* WebCache.mm */,
                                F59EAE3E0253C7EE018635CA /* WebCoreStatistics.h */,
                        isa = PBXGroup;
                        children = (
                                F7EBEEAA03F9DBA103CA0DE6 /* HIWebView.h */,
-                               F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.mm */,
+                               A10265821F56540300B4C844 /* HIWebView.mm */,
                        );
                        name = "C API";
                        sourceTree = "<group>";
                                7C01CB85173435C900C5D807 /* PopupMenuMac.h in Headers */,
                                1A2DBE9F0F251E3A0036F8A6 /* ProxyInstance.h in Headers */,
                                E169836211346D1B00894115 /* ProxyRuntimeObject.h in Headers */,
-                               5C7706721D111B220012700F /* QuickDrawCompatibility.h in Headers */,
                                A10C1D621820300E0036883A /* SearchPopupMenuIOS.h in Headers */,
                                7C01CB87173435C900C5D807 /* SearchPopupMenuMac.h in Headers */,
                                1A6B31321A51F3A900422975 /* StorageAreaImpl.h in Headers */,
                                93D4379A1D57ABEF00AB85EA /* ExceptionHandlers.mm in Sources */,
                                1A60519317502A5D00BC62F5 /* HistoryPropertyList.mm in Sources */,
                                939811000824BF01008DF038 /* HIViewAdapter.m in Sources */,
-                               939811020824BF01008DF038 /* HIWebView.mm in Sources */,
+                               A10265831F56540300B4C844 /* HIWebView.mm in Sources */,
                                1A8DED510EE88B8A00F25022 /* HostedNetscapePluginStream.mm in Sources */,
                                A10C1D3318202FC50036883A /* MemoryMeasure.mm in Sources */,
                                1AAF5CEB0EDDE1FE008D883D /* NetscapePluginHostManager.mm in Sources */,
index c58623d4071deb8478f209ecb887db3e2eec6851..fad2f60fed7db4183144b3f29973994e32ce0ae8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Inc.  All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,6 +30,7 @@
 
 #include "CarbonUtils.h"
 #import <WebKitSystemInterface.h>
+#import <pal/spi/cocoa/FoundationSPI.h>
 
 extern CGImageRef _NSCreateImageRef( unsigned char *const bitmapData[5], int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, CGColorSpaceRef customColorSpace, id sourceObj);
 
@@ -41,6 +42,14 @@ static EventLoopRef poolLoop;
 
 void                    HIWebViewRegisterClass( void );
 
+static unsigned getNSAutoreleasePoolCount(void)
+{
+    void* v = NSPushAutoreleasePool(0);
+    uintptr_t numPools = (uintptr_t)v;
+    NSPopAutoreleasePool(v);
+    return numPools;
+}
+
 void
 WebInitForCarbon()
 {
@@ -56,7 +65,7 @@ WebInitForCarbon()
         NSApplicationLoad();
                 
         sPool = [[NSAutoreleasePool allocWithZone:NULL] init];
-        numPools = WKGetNSAutoreleasePoolCount();
+        numPools = getNSAutoreleasePoolCount();
         
         poolLoop = GetCurrentEventLoop ();
 
@@ -82,12 +91,12 @@ PoolCleaner( EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void
         CFStringRef mode = CFRunLoopCopyCurrentMode( (CFRunLoopRef)GetCFRunLoopFromEventLoop( GetCurrentEventLoop() ));
         EventLoopRef thisLoop = GetCurrentEventLoop ();
         if ( CFEqual( mode, kCFRunLoopDefaultMode ) && thisLoop == poolLoop) {
-            unsigned currentNumPools = WKGetNSAutoreleasePoolCount()-1;            
+            unsigned currentNumPools = getNSAutoreleasePoolCount()-1;            
             if (currentNumPools == numPools){
                 [sPool drain];
                 
                 sPool = [[NSAutoreleasePool allocWithZone:NULL] init];
-                numPools = WKGetNSAutoreleasePoolCount();
+                numPools = getNSAutoreleasePoolCount();
             }
         }
         CFRelease( mode );
index 6009dfcd870734e302b94851909aca6c99a8ee3f..1bd53e8907d7f70934482a0f50d787fedb437400 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Inc.  All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -73,6 +73,8 @@
 #import <assert.h>
 
 #import <WebCore/WebCoreObjCExtras.h>
+#import <pal/spi/mac/HIToolboxSPI.h>
+#import <pal/spi/mac/NSWindowSPI.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/MainThread.h>
 #import <wtf/RunLoop.h>
@@ -81,6 +83,9 @@
 #import "WebNSObjectExtras.h"
 #import "WebTypesInternal.h"
 
+extern const OSType NSAppKitPropertyCreator;
+extern const OSType NSCarbonWindowPropertyTag;
+
 @interface NSWindow(HIWebFrameView)
 - (id)_initContent:(const NSRect *)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag contentView:aView;
 - (void)_oldPlaceWindow:(NSRect)frameRect;
@@ -111,7 +116,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
 + (Class)frameViewClassForStyleMask:(unsigned int)style {
 
     // There's only one appropriate window style, and only one appropriate window frame class.
-    assert(style & WKCarbonWindowMask());
+    assert(style & _NSCarbonWindowMask);
     return [CarbonWindowFrame class];
 
 }
@@ -156,7 +161,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
        _carbon = inCarbon;
 
     // Find out the window's CoreGraphics window reference.
-    nativeWindow = WKGetNativeWindowFromWindowRef(inWindowRef);
+    nativeWindow = (void*)GetNativeWindowFromWindowRef(inWindowRef);
 
     // Find out the window's Carbon window attributes.
     GetWindowAttributes(inWindowRef, &windowAttributes);
@@ -175,7 +180,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
 #pragma clang diagnostic pop
 
     // Figure out the window's style mask.
-    styleMask = WKCarbonWindowMask();
+    styleMask = _NSCarbonWindowMask;
     if (windowAttributes & kWindowCloseBoxAttribute)
         styleMask |= NSWindowStyleMaskClosable;
     if (windowAttributes & kWindowResizableAttribute)
@@ -242,7 +247,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
     // Put a pointer to this Cocoa NSWindow in a Carbon window property tag.
     // Right now, this is just used by NSViewCarbonControl.  M.P. Notice - 10/9/00
     windowAsProperty = self;
-    osStatus = SetWindowProperty(_windowRef, WKCarbonWindowPropertyCreator(), WKCarbonWindowPropertyTag(), sizeof(NSWindow *), &windowAsProperty);
+    osStatus = SetWindowProperty(_windowRef, NSAppKitPropertyCreator, NSCarbonWindowPropertyTag, sizeof(NSWindow *), &windowAsProperty);
     if (osStatus!=noErr) {
         [self release];
         return nil;
@@ -554,7 +559,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
 
     // Tell Carbon to update its various regions.
     // Despite its name, this function should be called early and often, even if the window isn't visible yet.  2702648.  M.P. Notice - 7/24/01
-    osStatus = WKSyncWindowWithCGAfterMove(_windowRef);
+    osStatus = _SyncWindowWithCGAfterMove(_windowRef);
     if (osStatus!=noErr) NSLog(@"A Carbon window's bounds couldn't be synchronized (%i).", (int)osStatus);
 
 }
@@ -614,7 +619,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall
 
     // Let Carbon know that the window has been moved, unless this method is being called "early."
     if (_wFlags.visible) {
-        osStatus = WKSyncWindowWithCGAfterMove(_windowRef);
+        osStatus = _SyncWindowWithCGAfterMove(_windowRef);
         if (osStatus!=noErr) NSLog(@"A Carbon window's bounds couldn't be synchronized (%i).", (int)osStatus);
     }
 
index cd208f790c05ad914450a6f8b61fe161ec9af894..355370752dea06795b358e9db8178fba1cd9703a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,8 +30,8 @@
 
 #import "HIViewAdapter.h"
 
-#import "QuickDrawCompatibility.h"
 #import "WebNSObjectExtras.h"
+#import <pal/spi/mac/QuickDrawSPI.h>
 #import <wtf/Assertions.h>
 
 static void SetViewNeedsDisplay(HIViewRef inView, RgnHandle inRegion, Boolean inNeedsDisplay);
index 0ae014702fd391cce5826a4a01a08fff2c04be6c..34585c252c3b18cacd6e07ad5e9448779d8be457 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Inc.  All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #import "CarbonWindowAdapter.h"
 #import "HIViewAdapter.h"
-#import "QuickDrawCompatibility.h"
 #import "WebHTMLViewInternal.h"
 #import "WebKit.h"
 #import <WebKitSystemInterface.h>
+#import <pal/spi/mac/NSEventSPI.h>
+#import <pal/spi/mac/QuickDrawSPI.h>
 #import <wtf/ObjcRuntimeExtras.h>
 
 @interface NSWindow (AppKitSecretsHIWebViewKnows)
@@ -306,9 +307,12 @@ Draw( HIWebView* inView, RgnHandle limitRgn, CGContextRef inContext )
         GrafPtr port;
         Rect portRect;
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
         GetPort( &port );
         GetPortBounds( port, &portRect );
         CreateCGContextForPort( port, &inContext );
+#pragma clang diagnostic push
         SyncCGContextOriginWithPort( inContext, port );
         CGContextTranslateCTM( inContext, 0, (portRect.bottom - portRect.top) );
         CGContextScaleCTM( inContext, 1, -1 );
@@ -436,6 +440,64 @@ GetWindowRef( HIWebView* inView )
        return GetControlOwner( inView->fViewRef );
 }
 
+static NSEvent *
+CreateNSEventAdoptingCGEvent( CGEventRef cgEvent, EventRef eventRef )
+{
+    NSEvent *result = [[NSEvent alloc] _initWithCGEvent:cgEvent eventRef:eventRef];
+    CFRelease(cgEvent);
+    return result;
+}
+
+static Boolean
+CopyEventCGEvent( EventRef event, CGEventRef* cgEvent )
+{
+    if ((*cgEvent = CopyEventCGEvent(event)))
+        return true;
+    
+    // This event might not have been created directly from a CGS event, and might not
+    // have a CGEventRef associated with it. In that case, try using the event most
+    // recently dispatched by the event dispatcher, which is likely to be the original
+    // user-input event containing a CGEventRef.
+    event = GetCurrentEvent();
+    if (event && (*cgEvent = CopyEventCGEvent(event)))
+        return true;
+    return false;
+}
+
+static NSEvent *
+CreateNSEventWithCarbonClickEvent( EventRef inEvent, WindowRef windowRef )
+{
+    EventRef newEvent;
+    Point where;
+    OSStatus err;
+    UInt32 modifiers;
+    Rect windRect;
+    
+    CGEventRef cgEvent = NULL;
+    if (!CopyEventCGEvent(inEvent, &cgEvent))
+        return nil;
+    
+    // We need to make the event be a kEventMouseDown event, or the webkit might trip up when
+    // we click on a Netscape plugin. It calls ConvertEventRefToEventRecord, assuming
+    // that mouseDown was passed an event with a real mouse down eventRef. We just need a
+    // minimal one here.
+    
+    err = CreateEvent(NULL, kEventClassMouse, kEventMouseDown, GetEventTime(inEvent), 0, &newEvent);
+    if (err != noErr)
+        return nil;
+    
+    GetEventParameter(inEvent, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &where);
+    GetWindowBounds(windowRef, kWindowStructureRgn, &windRect);
+    where.h += windRect.left;
+    where.v += windRect.top;
+    
+    GetEventParameter(inEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    SetEventParameter(newEvent, kEventParamMouseLocation, typeQDPoint, sizeof(Point), &where);
+    SetEventParameter(newEvent, kEventParamKeyModifiers, typeUInt32, sizeof(UInt32), &modifiers);
+    
+    return CreateNSEventAdoptingCGEvent(cgEvent, newEvent);
+}
+
 //----------------------------------------------------------------------------------
 // Click
 //----------------------------------------------------------------------------------
@@ -443,7 +505,7 @@ GetWindowRef( HIWebView* inView )
 static OSStatus
 Click(HIWebView* inView, EventRef inEvent)
 {
-    NSEvent *kitEvent = WKCreateNSEventWithCarbonClickEvent(inEvent, GetWindowRef(inView));
+    NSEvent *kitEvent = CreateNSEventWithCarbonClickEvent(inEvent, GetWindowRef(inView));
 
     if (!inView->fIsComposited)
         StartUpdateObserver(inView);
@@ -458,6 +520,16 @@ Click(HIWebView* inView, EventRef inEvent)
     return noErr;
 }
 
+static NSEvent *
+CreateNSEventWithCarbonEvent( EventRef inEvent )
+{
+    NSEvent *event = [NSEvent eventWithEventRef:inEvent];
+    if (!event)
+        event = [NSEvent eventWithEventRef:GetCurrentEvent()];
+
+    return [event retain];
+}
+
 //----------------------------------------------------------------------------------
 // MouseUp
 //----------------------------------------------------------------------------------
@@ -465,15 +537,32 @@ Click(HIWebView* inView, EventRef inEvent)
 static OSStatus
 MouseUp( HIWebView* inView, EventRef inEvent )
 {
-       NSEvent* kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+    NSEvent* kitEvent = CreateNSEventWithCarbonEvent(inEvent);
 
     [inView->fKitWindow sendEvent:kitEvent];
-       
+
     [kitEvent release];
-    
+
        return noErr;
 }
 
+static NSEvent *
+CreateNSEventWithCarbonMouseMoveEvent( EventRef inEvent, NSWindow *window )
+{
+    NSEvent* kitEvent = [NSEvent eventWithEventRef:inEvent];
+
+    // FIXME: Works around bug 3585644. Can remove it once that bug is fixed.
+    // We preflight here and don't do any work when the window is already correct
+    // because _eventRelativeToWindow will malfunction if the event's window method
+    // has been hijacked by the bug workaround used by Contribute. It's fine to just
+    // leave the event alone if the window is already correct.
+
+    if ([kitEvent window] != window)
+        kitEvent = [kitEvent _eventRelativeToWindow:window];
+
+    return [kitEvent retain];
+}
+
 //----------------------------------------------------------------------------------
 // MouseMoved
 //----------------------------------------------------------------------------------
@@ -481,7 +570,7 @@ MouseUp( HIWebView* inView, EventRef inEvent )
 static OSStatus
 MouseMoved( HIWebView* inView, EventRef inEvent )
 {
-    NSEvent *kitEvent = WKCreateNSEventWithCarbonMouseMoveEvent(inEvent, inView->fKitWindow);
+    NSEvent *kitEvent = CreateNSEventWithCarbonMouseMoveEvent(inEvent, inView->fKitWindow);
     [inView->fKitWindow sendEvent:kitEvent];
        [kitEvent release];
 
@@ -495,12 +584,12 @@ MouseMoved( HIWebView* inView, EventRef inEvent )
 static OSStatus
 MouseDragged( HIWebView* inView, EventRef inEvent )
 {
-       NSEvent* kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+    NSEvent* kitEvent = CreateNSEventWithCarbonEvent(inEvent);
 
     [inView->fKitWindow sendEvent:kitEvent];
 
-       [kitEvent release];
-       
+    [kitEvent release];
+
        return noErr;
 }
 
@@ -511,12 +600,12 @@ MouseDragged( HIWebView* inView, EventRef inEvent )
 static OSStatus
 MouseWheelMoved( HIWebView* inView, EventRef inEvent )
 {
-       NSEvent* kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+    NSEvent* kitEvent = CreateNSEventWithCarbonEvent(inEvent);
 
     [inView->fKitWindow sendEvent:kitEvent];
 
-       [kitEvent release];
-       
+    [kitEvent release];
+
        return noErr;
 }
 
@@ -684,7 +773,7 @@ WindowHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData
                                        NSResponder* responder = [kitWindow firstResponder];
                                        if ( responder != kitWindow )
                                        {
-                        kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+                        kitEvent = CreateNSEventWithCarbonEvent(inEvent);
                                                
                                                [kitWindow sendEvent:kitEvent];
                                                [kitEvent release];
@@ -1265,7 +1354,7 @@ HIWebViewEventHandler(
 
                case kEventClassKeyboard:
                        {
-                               NSEvent* kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+                NSEvent* kitEvent = CreateNSEventWithCarbonEvent(inEvent);
                                [view->fKitWindow sendSuperEvent:kitEvent];
                                [kitEvent release];
                                result = noErr;
index 4a309173c9690eec7a6144fb534a24f8b99842cf..ffd228c6091228d9b8faa02be4c9c515dc2990f9 100644 (file)
@@ -1,3 +1,44 @@
+2017-08-30  Andy Estes  <aestes@apple.com>
+
+        [Mac] Upstream Carbon-related WebKitSystemInterface functions
+        https://bugs.webkit.org/show_bug.cgi?id=176087
+
+        Reviewed by Alex Christensen.
+
+        * Carbon/CarbonUtils.m:
+        (getNSAutoreleasePoolCount):
+        (WebInitForCarbon):
+        (PoolCleaner):
+        * Carbon/CarbonWindowAdapter.mm:
+        (+[CarbonWindowAdapter frameViewClassForStyleMask:]):
+        (-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
+        (-[CarbonWindowAdapter _oldPlaceWindow:]):
+        (-[CarbonWindowAdapter _windowMovedToRect:]):
+        * Carbon/HIViewAdapter.m:
+        * Carbon/HIWebView.mm:
+        (Draw):
+        (CreateNSEventAdoptingCGEvent):
+        (CopyEventCGEvent):
+        (CreateNSEventWithCarbonClickEvent):
+        (Click):
+        (CreateNSEventWithCarbonEvent):
+        (MouseUp):
+        (CreateNSEventWithCarbonMouseMoveEvent):
+        (MouseMoved):
+        (MouseDragged):
+        (MouseWheelMoved):
+        (WindowHandler):
+        (HIWebViewEventHandler):
+        * Misc/QuickDrawCompatibility.h: Removed.
+        * Plugins/WebNetscapePluginEventHandlerCarbon.mm:
+        (getCarbonEvent):
+        (WebNetscapePluginEventHandlerCarbon::keyDown):
+        (WebNetscapePluginEventHandlerCarbon::keyUp):
+        * Plugins/WebNetscapePluginEventHandlerCocoa.mm:
+        (WebNetscapePluginEventHandlerCocoa::keyDown):
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView tellQuickTimeToChill]):
+
 2017-08-29  Andy Estes  <aestes@apple.com>
 
         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
diff --git a/Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h b/Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h
deleted file mode 100644 (file)
index cff553f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 QuickDrawCompatibility_h
-#define QuickDrawCompatibility_h
-
-#ifndef __LP64__
-
-#import <Carbon/Carbon.h>
-
-#if defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MacSetRect SetRect
-#define MacSetRectRgn SetRectRgn
-#define MacUnionRgn UnionRgn
-
-extern Boolean EmptyRgn(RgnHandle);
-extern OSStatus CreateCGContextForPort(CGrafPtr, CGContextRef*);
-extern OSStatus SyncCGContextOriginWithPort(CGContextRef, CGrafPtr);
-extern PixMapHandle GetPortPixMap(CGrafPtr);
-extern QDErr NewGWorldFromPtr(GWorldPtr*, UInt32, const Rect*, CTabHandle, GDHandle, GWorldFlags, Ptr, SInt32);
-extern Rect* GetPortBounds(CGrafPtr, Rect*);
-extern Rect* GetRegionBounds(RgnHandle, Rect*);
-extern RgnHandle GetPortClipRegion(CGrafPtr, RgnHandle);
-extern RgnHandle GetPortVisibleRegion(CGrafPtr, RgnHandle);
-extern RgnHandle NewRgn();
-extern void BackColor(long);
-extern void DisposeGWorld(GWorldPtr);
-extern void DisposeRgn(RgnHandle);
-extern void ForeColor(long);
-extern void GetGWorld(CGrafPtr*, GDHandle*);
-extern void GetPort(GrafPtr*);
-extern void GlobalToLocal(Point*);
-extern void MacSetRect(Rect*, short, short, short, short);
-extern void MacSetRectRgn(RgnHandle, short, short, short, short);
-extern void MacUnionRgn(RgnHandle, RgnHandle, RgnHandle);
-extern void MovePortTo(short, short);
-extern void OffsetRect(Rect*, short, short);
-extern void OffsetRgn(RgnHandle, short, short);
-extern void PaintRect(const Rect*);
-extern void PenNormal();
-extern void PortSize(short, short);
-extern void RectRgn(RgnHandle, const Rect*);
-extern void SectRgn(RgnHandle, RgnHandle, RgnHandle);
-extern void SetGWorld(CGrafPtr, GDHandle);
-extern void SetOrigin(short, short);
-extern void SetPort(GrafPtr);
-extern void SetPortClipRegion(CGrafPtr, RgnHandle);
-extern void SetPortVisibleRegion(CGrafPtr, RgnHandle);
-
-enum {
-    blackColor = 33,
-    whiteColor = 30,
-    greenColor = 341,
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
-
-#endif // __LP64__
-
-#endif // QuickDrawCompatibility_h
index 68567b3394dd81ae9f5197418994dbd28f3eb27b..3fcb467fd7878431a14fe79978477c25895fad2f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,6 +30,8 @@
 #import "WebNetscapePluginView.h"
 #import "WebKitLogging.h"
 #import "WebKitSystemInterface.h"
+#import <pal/spi/mac/HIToolboxSPI.h>
+#import <pal/spi/mac/NSEventSPI.h>
 
 // Send null events 50 times a second when active, so plug-ins like Flash get high frame rates.
 #define NullEventIntervalActive         0.02
@@ -85,7 +87,7 @@ static EventModifiers modifiersForEvent(NSEvent *event)
 
 static void getCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent)
 {
-    if (WKConvertNSEventToCarbonEvent(carbonEvent, cocoaEvent))
+    if ([cocoaEvent _eventRef] && ConvertEventRefToEventRecord((EventRef)[cocoaEvent _eventRef], carbonEvent))
         return;
     
     NSPoint where = [[cocoaEvent window] convertBaseToScreen:[cocoaEvent locationInWindow]];
@@ -210,7 +212,7 @@ void WebNetscapePluginEventHandlerCarbon::mouseMoved(NSEvent* theEvent)
 void WebNetscapePluginEventHandlerCarbon::keyDown(NSEvent *theEvent)
 {
     m_suspendKeyUpEvents = true;
-    WKSendKeyEventToTSM(theEvent);
+    TSMProcessRawKeyEvent((EventRef)[theEvent _eventRef]);
 }
 
 void WebNetscapePluginEventHandlerCarbon::syntheticKeyDownWithCommandModifier(int keyCode, char character)
@@ -238,7 +240,7 @@ static UInt32 keyMessageForEvent(NSEvent *event)
     
 void WebNetscapePluginEventHandlerCarbon::keyUp(NSEvent* theEvent)
 {
-    WKSendKeyEventToTSM(theEvent);
+    TSMProcessRawKeyEvent((EventRef)[theEvent _eventRef]);
     
     // TSM won't send keyUp events so we have to send them ourselves.
     // Only send keyUp events after we receive the TSM callback because this is what plug-in expect from OS 9.
index de20189a37dc0928782e861b2a69a03c7608e178..f80034f1ed73697b6110fbfaeae97f0239d4091e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,8 @@
 
 #import "WebKitSystemInterface.h"
 #import "WebNetscapePluginView.h"
+#import <pal/spi/mac/HIToolboxSPI.h>
+#import <pal/spi/mac/NSEventSPI.h>
 #import <wtf/Vector.h>
 
 WebNetscapePluginEventHandlerCocoa::WebNetscapePluginEventHandlerCocoa(WebNetscapePluginView* pluginView)
@@ -128,7 +130,7 @@ void WebNetscapePluginEventHandlerCocoa::keyDown(NSEvent *event)
 #ifndef __LP64__
     // If the plug-in did not handle the event, pass it on to the Input Manager.
     if (retval)
-        WKSendKeyEventToTSM(event);
+        TSMProcessRawKeyEvent((EventRef)[event _eventRef]);
 #else
     UNUSED_PARAM(retval);
 #endif
index f961efe1e28c48bb654c51f36ca073283cc457a1..c680ff7ee31c93b8fb492297e4e7ad9141a4dde4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,7 +30,6 @@
 
 #import "WebNetscapePluginView.h"
 
-#import "QuickDrawCompatibility.h"
 #import "WebDataSourceInternal.h"
 #import "WebDefaultUIDelegate.h"
 #import "WebFrameInternal.h"
@@ -75,6 +74,7 @@
 #import <WebKitLegacy/DOMPrivate.h>
 #import <WebKitLegacy/WebUIDelegate.h>
 #import <objc/runtime.h>
+#import <pal/spi/mac/QuickDrawSPI.h>
 #import <runtime/InitializeThreading.h>
 #import <runtime/JSLock.h>
 #import <wtf/Assertions.h>
@@ -915,7 +915,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     CGrafPtr port = GetWindowPort(windowRef);
     ::Rect bounds;
     GetPortBounds(port, &bounds);
-    WKCallDrawingNotification(port, &bounds);
+    CallDrawingNotifications(port, &bounds, kBitsProc);
 #endif /* NP_NO_QUICKDRAW */
 }