Diff
Modified: trunk/Source/WebCore/PAL/ChangeLog (221350 => 221351)
--- trunk/Source/WebCore/PAL/ChangeLog 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebCore/PAL/ChangeLog 2017-08-30 08:59:10 UTC (rev 221351)
@@ -1,3 +1,17 @@
+2017-08-30 Andy Estes <aes...@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 <aes...@apple.com>
[Xcode] Fix up file and group paths in PAL.xcodeproj
Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (221350 => 221351)
--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 */; };
@@ -209,6 +212,9 @@
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>"; };
@@ -281,6 +287,7 @@
0C2DA1231F3BEB4900DBC317 /* CFNSURLConnectionSPI.h */,
0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */,
0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */,
+ A10265861F56746100B4C844 /* FoundationSPI.h */,
0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */,
0C2DA1271F3BEB4900DBC317 /* IOPSLibSPI.h */,
0C2DA1281F3BEB4900DBC317 /* IOReturnSPI.h */,
@@ -331,6 +338,7 @@
children = (
0C7785701F45130F00F4EBB6 /* AVFoundationSPI.h */,
0C7785711F45130F00F4EBB6 /* DataDetectorsSPI.h */,
+ A10265881F56747A00B4C844 /* HIToolboxSPI.h */,
0C7785721F45130F00F4EBB6 /* LookupSPI.h */,
0C7785731F45130F00F4EBB6 /* MediaRemoteSPI.h */,
A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */,
@@ -353,6 +361,7 @@
0C7785841F45130F00F4EBB6 /* NSWindowSPI.h */,
0C7785851F45130F00F4EBB6 /* PIPSPI.h */,
0C7785861F45130F00F4EBB6 /* QTKitSPI.h */,
+ A102658A1F56748C00B4C844 /* QuickDrawSPI.h */,
0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */,
0C7785881F45130F00F4EBB6 /* TUCallSPI.h */,
);
@@ -499,7 +508,9 @@
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 */,
@@ -551,6 +562,7 @@
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 */,
Copied: trunk/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h (from rev 221349, trunk/Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h) (0 => 221351)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
Copied: trunk/Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h (from rev 221349, trunk/Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h) (0 => 221351)
--- trunk/Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/HIToolboxSPI.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSEventSPI.h (221350 => 221351)
--- trunk/Source/WebCore/PAL/pal/spi/mac/NSEventSPI.h 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSEventSPI.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
@@ -33,10 +33,20 @@
#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
Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h (221350 => 221351)
--- trunk/Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSWindowSPI.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
@@ -41,6 +41,10 @@
@end
+enum {
+ _NSCarbonWindowMask = 1 << 25,
+};
+
#endif
#endif // PLATFORM(MAC)
Added: trunk/Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h (0 => 221351)
--- trunk/Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/QuickDrawSPI.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
Modified: trunk/Source/WebKit/ChangeLog (221350 => 221351)
--- trunk/Source/WebKit/ChangeLog 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKit/ChangeLog 2017-08-30 08:59:10 UTC (rev 221351)
@@ -1,3 +1,16 @@
+2017-08-30 Andy Estes <aes...@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 <cgar...@igalia.com>
Unreviewed. Try to fix layout test timing out after r221344.
Modified: trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm (221350 => 221351)
--- trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKit/PluginProcess/mac/PluginProcessMac.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 CGWindowID cgWindowID(WindowRef window)
{
- return reinterpret_cast<CGWindowID>(WKGetNativeWindowFromWindowRef(window));
+ return reinterpret_cast<CGWindowID>(GetNativeWindowFromWindowRef(window));
}
#endif
Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (221350 => 221351)
--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 @@
}
#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 @@
}
#ifndef NP_NO_CARBON
case NPEventModelCarbon: {
- ScriptCode scriptCode = WKGetScriptCodeFromCurrentKeyboardInputSource();
+ ScriptCode scriptCode = scriptCodeFromCurrentKeyboardInputSource();
Vector<UInt8> keyCodes;
if (!convertStringToKeyCodes(textInput, scriptCode, keyCodes))
Modified: trunk/Source/WebKitLegacy/ChangeLog (221350 => 221351)
--- trunk/Source/WebKitLegacy/ChangeLog 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/ChangeLog 2017-08-30 08:59:10 UTC (rev 221351)
@@ -1,3 +1,12 @@
+2017-08-30 Andy Estes <aes...@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.olmst...@sony.com>
[CMake] Use find_package for zlib
Modified: trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (221350 => 221351)
--- trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2017-08-30 08:59:10 UTC (rev 221351)
@@ -149,7 +149,6 @@
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 */; };
@@ -319,7 +318,6 @@
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 */; };
@@ -680,6 +678,7 @@
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 */; };
@@ -988,7 +987,6 @@
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; };
@@ -1420,6 +1418,7 @@
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; };
@@ -1597,7 +1596,6 @@
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; };
@@ -1769,7 +1767,6 @@
children = (
A10C1D2018202FAF0036883A /* ios */,
29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */,
- 5C7706711D111B220012700F /* QuickDrawCompatibility.h */,
5241ADF30B1BC48A004012BD /* WebCache.h */,
5241ADF40B1BC48A004012BD /* WebCache.mm */,
F59EAE3E0253C7EE018635CA /* WebCoreStatistics.h */,
@@ -2672,7 +2669,7 @@
isa = PBXGroup;
children = (
F7EBEEAA03F9DBA103CA0DE6 /* HIWebView.h */,
- F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.mm */,
+ A10265821F56540300B4C844 /* HIWebView.mm */,
);
name = "C API";
sourceTree = "<group>";
@@ -2936,7 +2933,6 @@
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 */,
@@ -3513,7 +3509,7 @@
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 */,
Modified: trunk/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 @@
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 @@
NSApplicationLoad();
sPool = [[NSAutoreleasePool allocWithZone:NULL] init];
- numPools = WKGetNSAutoreleasePoolCount();
+ numPools = getNSAutoreleasePoolCount();
poolLoop = GetCurrentEventLoop ();
@@ -82,12 +91,12 @@
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 );
Modified: trunk/Source/WebKitLegacy/mac/Carbon/CarbonWindowAdapter.mm (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Carbon/CarbonWindowAdapter.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Carbon/CarbonWindowAdapter.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 @@
+ (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 @@
_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 @@
#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 @@
// 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 @@
// 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 @@
// 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);
}
Modified: trunk/Source/WebKitLegacy/mac/Carbon/HIViewAdapter.m (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Carbon/HIViewAdapter.m 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Carbon/HIViewAdapter.m 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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);
Modified: trunk/Source/WebKitLegacy/mac/Carbon/HIWebView.mm (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Carbon/HIWebView.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Carbon/HIWebView.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
@@ -32,10 +32,11 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
NSResponder* responder = [kitWindow firstResponder];
if ( responder != kitWindow )
{
- kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+ kitEvent = CreateNSEventWithCarbonEvent(inEvent);
[kitWindow sendEvent:kitEvent];
[kitEvent release];
@@ -1265,7 +1354,7 @@
case kEventClassKeyboard:
{
- NSEvent* kitEvent = WKCreateNSEventWithCarbonEvent(inEvent);
+ NSEvent* kitEvent = CreateNSEventWithCarbonEvent(inEvent);
[view->fKitWindow sendSuperEvent:kitEvent];
[kitEvent release];
result = noErr;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-08-30 08:59:10 UTC (rev 221351)
@@ -1,3 +1,44 @@
+2017-08-30 Andy Estes <aes...@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 <aes...@apple.com>
[Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
Deleted: trunk/Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Misc/QuickDrawCompatibility.h 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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
Modified: trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 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::keyDown(NSEvent *theEvent)
{
m_suspendKeyUpEvents = true;
- WKSendKeyEventToTSM(theEvent);
+ TSMProcessRawKeyEvent((EventRef)[theEvent _eventRef]);
}
void WebNetscapePluginEventHandlerCarbon::syntheticKeyDownWithCommandModifier(int keyCode, char character)
@@ -238,7 +240,7 @@
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.
Modified: trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 @@
#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
Modified: trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm (221350 => 221351)
--- trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm 2017-08-30 08:57:44 UTC (rev 221350)
+++ trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm 2017-08-30 08:59:10 UTC (rev 221351)
@@ -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 @@
CGrafPtr port = GetWindowPort(windowRef);
::Rect bounds;
GetPortBounds(port, &bounds);
- WKCallDrawingNotification(port, &bounds);
+ CallDrawingNotifications(port, &bounds, kBitsProc);
#endif /* NP_NO_QUICKDRAW */
}