[iOS] Fix the open source iOS 12 build after r236445
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 18:59:38 +0000 (18:59 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 18:59:38 +0000 (18:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189953

Reviewed by Alex Christensen.

Source/WebCore:

Remove soft-linking macros from several sources in WebCore, and instead import UIKitSoftLink from PAL. This
allows different WebCore sources to soft-link UIKit (and its classes and symbols) without reimplementing
WebCore::UIKitLibrary.

* editing/cocoa/FontAttributesCocoa.mm:
* editing/cocoa/FontShadowCocoa.mm:
(WebCore::FontShadow::createShadow const):
* platform/graphics/cocoa/ColorCocoa.mm:
(WebCore::platformColor):
* platform/ios/PlatformScreenIOS.mm:
(WebCore::screenIsMonochrome):
(WebCore::screenHasInvertedColors):
(WebCore::screenSize):
(WebCore::availableScreenSize):
(WebCore::screenScaleFactor):

Source/WebCore/PAL:

Introduce a single UIKit soft-linking header in PAL.

* PAL.xcodeproj/project.pbxproj:
* pal/ios/UIKitSoftLink.h: Copied from Source/WebCore/platform/graphics/cocoa/ColorCocoa.mm.
* pal/ios/UIKitSoftLink.mm: Copied from Source/WebCore/platform/graphics/cocoa/ColorCocoa.mm.

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

Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/ios/UIKitSoftLink.h [new file with mode: 0644]
Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm [new file with mode: 0644]
Source/WebCore/editing/cocoa/FontAttributesCocoa.mm
Source/WebCore/editing/cocoa/FontShadowCocoa.mm
Source/WebCore/platform/graphics/cocoa/ColorCocoa.mm
Source/WebCore/platform/ios/PlatformScreenIOS.mm

index df6f78e..7026bba 100644 (file)
@@ -1,3 +1,26 @@
+2018-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Fix the open source iOS 12 build after r236445
+        https://bugs.webkit.org/show_bug.cgi?id=189953
+
+        Reviewed by Alex Christensen.
+
+        Remove soft-linking macros from several sources in WebCore, and instead import UIKitSoftLink from PAL. This
+        allows different WebCore sources to soft-link UIKit (and its classes and symbols) without reimplementing
+        WebCore::UIKitLibrary.
+
+        * editing/cocoa/FontAttributesCocoa.mm:
+        * editing/cocoa/FontShadowCocoa.mm:
+        (WebCore::FontShadow::createShadow const):
+        * platform/graphics/cocoa/ColorCocoa.mm:
+        (WebCore::platformColor):
+        * platform/ios/PlatformScreenIOS.mm:
+        (WebCore::screenIsMonochrome):
+        (WebCore::screenHasInvertedColors):
+        (WebCore::screenSize):
+        (WebCore::availableScreenSize):
+        (WebCore::screenScaleFactor):
+
 2018-09-25  Thibault Saunier  <tsaunier@igalia.com>
 
         [WPE][GTK][WebRTC] Fixup VP8 encoding support
index 5a45546..23f82d2 100644 (file)
@@ -1,3 +1,16 @@
+2018-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Fix the open source iOS 12 build after r236445
+        https://bugs.webkit.org/show_bug.cgi?id=189953
+
+        Reviewed by Alex Christensen.
+
+        Introduce a single UIKit soft-linking header in PAL.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/ios/UIKitSoftLink.h: Copied from Source/WebCore/platform/graphics/cocoa/ColorCocoa.mm.
+        * pal/ios/UIKitSoftLink.mm: Copied from Source/WebCore/platform/graphics/cocoa/ColorCocoa.mm.
+
 2018-09-24  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Refactor Editor::fontAttributesForSelectionStart to be platform-agnostic
index e0ecb3c..c3253df 100644 (file)
                1CCEE4F520D871930047B097 /* CoreUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCEE4F420D871930047B097 /* CoreUISPI.h */; };
                1CCEE4F720D8743F0047B097 /* NSAppearanceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */; };
                2D02E93C2056FAA700A13797 /* AudioToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */; };
+               2E1342CC215AA10A007199D2 /* UIKitSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E1342CA215AA10A007199D2 /* UIKitSoftLink.h */; };
+               2E1342CD215AA10A007199D2 /* UIKitSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */; };
                31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31308B1320A21705003FB929 /* SystemPreviewSPI.h */; };
                570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; };
                570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */; };
                1CCEE4F420D871930047B097 /* CoreUISPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreUISPI.h; sourceTree = "<group>"; };
                1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppearanceSPI.h; sourceTree = "<group>"; };
                2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioToolboxSPI.h; sourceTree = "<group>"; };
+               2E1342CA215AA10A007199D2 /* UIKitSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIKitSoftLink.h; path = ios/UIKitSoftLink.h; sourceTree = "<group>"; };
+               2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UIKitSoftLink.mm; path = ios/UIKitSoftLink.mm; sourceTree = "<group>"; };
                31308B1320A21705003FB929 /* SystemPreviewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemPreviewSPI.h; sourceTree = "<group>"; };
                37119A7820CCB5FF002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
                570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxySPI.h; sourceTree = "<group>"; };
                                0CF99CA51F73841C007EE793 /* cf */,
                                1C4876DE1F8D831300CCEEBD /* cocoa */,
                                1C09D0511E31C41200725F18 /* crypto */,
+                               2E87C06E215A993100D6CD32 /* ios */,
                                0C2DA0651F33CA3300DBC317 /* spi */,
                                A3788E9F1F05B7CE00679425 /* system */,
                                A30D411D1F0DD0AC00B71954 /* text */,
                        path = cocoa;
                        sourceTree = "<group>";
                };
+               2E87C06E215A993100D6CD32 /* ios */ = {
+                       isa = PBXGroup;
+                       children = (
+                               2E1342CA215AA10A007199D2 /* UIKitSoftLink.h */,
+                               2E1342CB215AA10A007199D2 /* UIKitSoftLink.mm */,
+                       );
+                       name = ios;
+                       sourceTree = "<group>";
+               };
                A30D411D1F0DD0AC00B71954 /* text */ = {
                        isa = PBXGroup;
                        children = (
                                A3AB6E581F3D1DDB009C14B1 /* SystemSleepListener.h in Headers */,
                                A3AB6E641F3D217F009C14B1 /* SystemSleepListenerMac.h in Headers */,
                                0C7785A11F45130F00F4EBB6 /* TUCallSPI.h in Headers */,
+                               2E1342CC215AA10A007199D2 /* UIKitSoftLink.h in Headers */,
                                0C5AF9221F43A4C7002EAC02 /* UIKitSPI.h in Headers */,
                                0C2DA1471F3BEB4900DBC317 /* URLFormattingSPI.h in Headers */,
                                0C2DA1591F3BEB4900DBC317 /* WebFilterEvaluatorSPI.h in Headers */,
                                A3788E9E1F05B78E00679425 /* SoundMac.mm in Sources */,
                                A3AB6E571F3D1DDB009C14B1 /* SystemSleepListener.cpp in Sources */,
                                A3AB6E651F3D217F009C14B1 /* SystemSleepListenerMac.mm in Sources */,
+                               2E1342CD215AA10A007199D2 /* UIKitSoftLink.mm in Sources */,
                                A10826FA1F576292004772AC /* WebPanel.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
diff --git a/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h b/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h
new file mode 100644 (file)
index 0000000..913d72e
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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 PLATFORM(IOS)
+
+#import <pal/spi/ios/UIKitSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, UIKit)
+
+SOFT_LINK_CLASS_FOR_HEADER(PAL, UIKit, NSShadow)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, UIKit, UIApplication)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, UIKit, UIScreen)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, UIKit, UIColor)
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityIsGrayscaleEnabled, BOOL, (void), ())
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityIsInvertColorsEnabled, BOOL, (void), ())
+
+#endif
diff --git a/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm b/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm
new file mode 100644 (file)
index 0000000..c0b4579
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#include "config.h"
+
+#if PLATFORM(IOS)
+
+#import <pal/spi/ios/UIKitSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_SOURCE(PAL, UIKit)
+
+SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, NSShadow)
+SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIApplication)
+SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIScreen)
+SOFT_LINK_CLASS_FOR_SOURCE(PAL, UIKit, UIColor)
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIAccessibilityIsGrayscaleEnabled, BOOL, (void), ())
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIAccessibilityIsInvertColorsEnabled, BOOL, (void), ())
+
+#endif
index 5122abb..470e292 100644 (file)
@@ -27,7 +27,6 @@
 #import "FontAttributes.h"
 
 #import "ColorCocoa.h"
-#import <wtf/SoftLinking.h>
 
 namespace WebCore {
 
index b54afc9..05e0a46 100644 (file)
@@ -30,8 +30,7 @@
 #import "ColorMac.h"
 
 #if PLATFORM(IOS)
-SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, UIKit)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, UIKit, NSShadow)
+#import <pal/ios/UIKitSoftLink.h>
 #endif
 
 namespace WebCore {
@@ -41,7 +40,7 @@ RetainPtr<NSShadow> FontShadow::createShadow() const
 #if USE(APPKIT)
     auto shadow = adoptNS([NSShadow new]);
 #elif PLATFORM(IOS)
-    auto shadow = adoptNS([get_UIKit_NSShadowClass() new]);
+    auto shadow = adoptNS([PAL::get_UIKit_NSShadowClass() new]);
 #endif
     [shadow setShadowColor:platformColor(color)];
     [shadow setShadowOffset:offset];
index ab61479..2f739b8 100644 (file)
 #import "ColorCocoa.h"
 
 #import "ColorMac.h"
-#import <wtf/SoftLinking.h>
 
 #if PLATFORM(IOS)
+#import <pal/ios/UIKitSoftLink.h>
 #import <pal/spi/ios/UIKitSPI.h>
-
-SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, UIKit)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, UIKit, UIColor)
 #endif
 
 namespace WebCore {
@@ -51,7 +48,7 @@ NSColor *platformColor(const Color& color)
 
 UIColor *platformColor(const Color& color)
 {
-    return [get_UIKit_UIColorClass() _disambiguated_due_to_CIImage_colorWithCGColor:cachedCGColor(color)];
+    return [PAL::get_UIKit_UIColorClass() _disambiguated_due_to_CIImage_colorWithCGColor:cachedCGColor(color)];
 }
 
 #endif
index 05b6ce3..c52707d 100644 (file)
 #import "IntRect.h"
 #import "WAKWindow.h"
 #import "Widget.h"
+#import <pal/ios/UIKitSoftLink.h>
 #import <pal/spi/ios/MobileGestaltSPI.h>
 #import <pal/spi/ios/UIKitSPI.h>
-#import <wtf/SoftLinking.h>
-
-SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, UIKit)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, UIKit, UIApplication)
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, UIKit, UIScreen)
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, UIKit, UIAccessibilityIsGrayscaleEnabled, BOOL, (void), ())
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, UIKit, UIAccessibilityIsInvertColorsEnabled, BOOL, (void), ())
 
 namespace WebCore {
 
@@ -64,12 +58,12 @@ int screenDepthPerComponent(Widget*)
 
 bool screenIsMonochrome(Widget*)
 {
-    return softLinkUIKitUIAccessibilityIsGrayscaleEnabled();
+    return PAL::softLinkUIKitUIAccessibilityIsGrayscaleEnabled();
 }
 
 bool screenHasInvertedColors()
 {
-    return softLinkUIKitUIAccessibilityIsInvertColorsEnabled();
+    return PAL::softLinkUIKitUIAccessibilityIsInvertColorsEnabled();
 }
 
 bool screenSupportsExtendedColor(Widget*)
@@ -135,16 +129,16 @@ float screenPPIFactor()
 
 FloatSize screenSize()
 {
-    if (deviceHasIPadCapability() && [[get_UIKit_UIApplicationClass() sharedApplication] _isClassic])
+    if (deviceHasIPadCapability() && [[PAL::get_UIKit_UIApplicationClass() sharedApplication] _isClassic])
         return { 320, 480 };
-    return FloatSize([[get_UIKit_UIScreenClass() mainScreen] _referenceBounds].size);
+    return FloatSize([[PAL::get_UIKit_UIScreenClass() mainScreen] _referenceBounds].size);
 }
 
 FloatSize availableScreenSize()
 {
-    if (deviceHasIPadCapability() && [[get_UIKit_UIApplicationClass() sharedApplication] _isClassic])
+    if (deviceHasIPadCapability() && [[PAL::get_UIKit_UIApplicationClass() sharedApplication] _isClassic])
         return { 320, 480 };
-    return FloatSize([get_UIKit_UIScreenClass() mainScreen].bounds.size);
+    return FloatSize([PAL::get_UIKit_UIScreenClass() mainScreen].bounds.size);
 }
 
 #if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PlatformScreenIOS.mm>)
@@ -159,7 +153,7 @@ FloatSize overrideScreenSize()
 float screenScaleFactor(UIScreen *screen)
 {
     if (!screen)
-        screen = [get_UIKit_UIScreenClass() mainScreen];
+        screen = [PAL::get_UIKit_UIScreenClass() mainScreen];
 
     return screen.scale;
 }