Title: [274931] trunk/Source
Revision
274931
Author
timothy_hor...@apple.com
Date
2021-03-23 23:06:42 -0700 (Tue, 23 Mar 2021)

Log Message

Consolidate Books bundle checks
https://bugs.webkit.org/show_bug.cgi?id=223664
<rdar://problem/75754750>

Reviewed by Wenson Hsieh.

Source/WebCore:

No new tests, no change in behavior.

* Modules/geolocation/Geolocation.cpp:
(WebCore::isRequestFromIBooks):
* bindings/js/CommonVM.cpp:
(WebCore::globalConstRedeclarationShouldThrow):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::initMouseEventQuirk):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::currentRunLoop):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::CocoaApplication::isIBooks):
(WebCore::MacApplication::isIBooks): Deleted.
(WebCore::IOSApplication::isIBooks): Deleted.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::synchronousWillSendRequestEnabled):
* rendering/RenderBox.cpp:
(WebCore::allowMinMaxPercentagesInAutoHeightBlocksQuirk):
Transition to a single bundle check for Books, since the quirks are generally
about book content, not about the app's behavior. Long-term, we should
get rid of these entirely (some are no longer necessary, and the rest
should turn into switches that Books can toggle).

Source/WebKitLegacy/mac:

* WebView/WebViewData.mm:
(currentRunLoop):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274930 => 274931)


--- trunk/Source/WebCore/ChangeLog	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/ChangeLog	2021-03-24 06:06:42 UTC (rev 274931)
@@ -1,3 +1,37 @@
+2021-03-23  Tim Horton  <timothy_hor...@apple.com>
+
+        Consolidate Books bundle checks
+        https://bugs.webkit.org/show_bug.cgi?id=223664
+        <rdar://problem/75754750>
+
+        Reviewed by Wenson Hsieh.
+
+        No new tests, no change in behavior.
+
+        * Modules/geolocation/Geolocation.cpp:
+        (WebCore::isRequestFromIBooks):
+        * bindings/js/CommonVM.cpp:
+        (WebCore::globalConstRedeclarationShouldThrow):
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::initMouseEventQuirk):
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::currentRunLoop):
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::CocoaApplication::isIBooks):
+        (WebCore::MacApplication::isIBooks): Deleted.
+        (WebCore::IOSApplication::isIBooks): Deleted.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::synchronousWillSendRequestEnabled):
+        * rendering/RenderBox.cpp:
+        (WebCore::allowMinMaxPercentagesInAutoHeightBlocksQuirk):
+        Transition to a single bundle check for Books, since the quirks are generally
+        about book content, not about the app's behavior. Long-term, we should
+        get rid of these entirely (some are no longer necessary, and the rest
+        should turn into switches that Books can toggle).
+
 2021-03-23  Simon Fraser  <simon.fra...@apple.com>
 
         Add DisplayRefreshMonitorFactory.

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (274930 => 274931)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -343,10 +343,8 @@
 // FIXME: remove this function when rdar://problem/32137821 is fixed.
 static bool isRequestFromIBooks()
 {
-#if PLATFORM(MAC)
-    return MacApplication::isIBooks();
-#elif PLATFORM(IOS_FAMILY)
-    return IOSApplication::isIBooks();
+#if PLATFORM(COCOA)
+    return CocoaApplication::isIBooks();
 #endif
     return false;
 }

Modified: trunk/Source/WebCore/bindings/js/CommonVM.cpp (274930 => 274931)


--- trunk/Source/WebCore/bindings/js/CommonVM.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/bindings/js/CommonVM.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -47,10 +47,8 @@
 // FIXME: <rdar://problem/25965028> This should be removed or replaced with a Setting that iBooks can use if it is still needed.
 static bool globalConstRedeclarationShouldThrow()
 {
-#if PLATFORM(MAC)
-    return !MacApplication::isIBooks();
-#elif PLATFORM(IOS_FAMILY)
-    return !IOSApplication::isIBooks();
+#if PLATFORM(COCOA)
+    return !CocoaApplication::isIBooks();
 #else
     return true;
 #endif

Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (274930 => 274931)


--- trunk/Source/WebCore/dom/MouseEvent.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -148,7 +148,7 @@
     EventTarget* relatedTarget = nullptr;
 #if PLATFORM(MAC)
     // Impacts iBooks too because of widgets generated by iAd Producer (rdar://problem/30797958).
-    if (MacApplication::isIAdProducer() || MacApplication::isIBooks()) {
+    if (MacApplication::isIAdProducer() || CocoaApplication::isIBooks()) {
         // jsEventTargetCast() does not throw and will silently convert bad input to nullptr.
         auto jsRelatedTarget = jsEventTargetCast(state.vm(), relatedTargetValue);
         if (!jsRelatedTarget && !relatedTargetValue.isUndefinedOrNull())

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (274930 => 274931)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -777,7 +777,7 @@
         return false;
 
 #if PLATFORM(IOS_FAMILY)
-    if (IOSApplication::isIBooks())
+    if (CocoaApplication::isIBooks())
         return !m_element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr) && !m_element.hasAttributeWithoutSynchronization(HTMLNames::playsinlineAttr);
     if (applicationSDKVersion() < DYLD_IOS_VERSION_10_0)
         return !m_element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr);

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (274930 => 274931)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -80,7 +80,7 @@
     // we still allow this, see <rdar://problem/7403328>. Since the race condition and subsequent
     // crash are especially troublesome for iBooks, we never allow the observer to be added to the
     // main run loop in iBooks.
-    if (IOSApplication::isIBooks())
+    if (CocoaApplication::isIBooks())
         return WebThreadRunLoop();
 #endif
     return CFRunLoopGetCurrent();

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (274930 => 274931)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2021-03-24 06:06:42 UTC (rev 274931)
@@ -59,6 +59,16 @@
 WEBCORE_EXPORT String applicationBundleIdentifier();
 WEBCORE_EXPORT void clearApplicationBundleIdentifierTestingOverride();
 
+#if PLATFORM(COCOA)
+
+namespace CocoaApplication {
+
+WEBCORE_EXPORT bool isIBooks();
+
+}
+
+#endif // PLATFORM(COCOA)
+
 #if PLATFORM(MAC)
 
 namespace MacApplication {
@@ -67,7 +77,6 @@
 WEBCORE_EXPORT bool isAdobeInstaller();
 WEBCORE_EXPORT bool isAperture();
 WEBCORE_EXPORT bool isAppleMail();
-WEBCORE_EXPORT bool isIBooks();
 WEBCORE_EXPORT bool isITunes();
 WEBCORE_EXPORT bool isMicrosoftMessenger();
 WEBCORE_EXPORT bool isMicrosoftMyDay();
@@ -100,7 +109,6 @@
 bool isMobileStore();
 bool isSpringBoard();
 WEBCORE_EXPORT bool isWebProcess();
-WEBCORE_EXPORT bool isIBooks();
 bool isIBooksStorytime();
 WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
 WEBCORE_EXPORT bool isCardiogram();

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (274930 => 274931)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2021-03-24 06:06:42 UTC (rev 274931)
@@ -95,6 +95,12 @@
     return applicationBundleIdentifier() == bundleIdentifierString;
 }
 
+bool CocoaApplication::isIBooks()
+{
+    static bool isIBooks = applicationBundleIsEqualTo("com.apple.iBooksX"_s) || applicationBundleIsEqualTo("com.apple.iBooks"_s);
+    return isIBooks;
+}
+
 #if PLATFORM(MAC)
 
 bool MacApplication::isSafari()
@@ -111,12 +117,6 @@
     return isAppleMail;
 }
 
-bool MacApplication::isIBooks()
-{
-    static bool isIBooks = applicationBundleIsEqualTo("com.apple.iBooksX"_s);
-    return isIBooks;
-}
-
 bool MacApplication::isITunes()
 {
     static bool isITunes = applicationBundleIsEqualTo("com.apple.iTunes"_s);
@@ -272,12 +272,6 @@
     return isInWebProcess();
 }
 
-bool IOSApplication::isIBooks()
-{
-    static bool isIBooks = applicationBundleIsEqualTo("com.apple.iBooks"_s);
-    return isIBooks;
-}
-
 bool IOSApplication::isIBooksStorytime()
 {
     static bool isIBooksStorytime = applicationBundleIsEqualTo("com.apple.TVBooks"_s);

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (274930 => 274931)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2021-03-24 06:06:42 UTC (rev 274931)
@@ -99,7 +99,7 @@
 
 static bool synchronousWillSendRequestEnabled()
 {
-    static bool disabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisableSynchronousWillSendRequestPreferenceKey"] || IOSApplication::isIBooks();
+    static bool disabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisableSynchronousWillSendRequestPreferenceKey"] || CocoaApplication::isIBooks();
     return !disabled;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (274930 => 274931)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-24 06:06:42 UTC (rev 274931)
@@ -3223,12 +3223,11 @@
 
 static bool allowMinMaxPercentagesInAutoHeightBlocksQuirk()
 {
-#if PLATFORM(MAC)
-    return MacApplication::isIBooks();
-#elif PLATFORM(IOS_FAMILY)
-    return IOSApplication::isIBooks();
+#if PLATFORM(COCOA)
+    return CocoaApplication::isIBooks();
+#else
+    return false;
 #endif
-    return false;
 }
 
 void RenderBox::computePreferredLogicalWidths(const Length& minWidth, const Length& maxWidth, LayoutUnit borderAndPadding)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (274930 => 274931)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-03-24 06:06:42 UTC (rev 274931)
@@ -1,3 +1,14 @@
+2021-03-23  Tim Horton  <timothy_hor...@apple.com>
+
+        Consolidate Books bundle checks
+        https://bugs.webkit.org/show_bug.cgi?id=223664
+        <rdar://problem/75754750>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebView/WebViewData.mm:
+        (currentRunLoop):
+
 2021-03-22  Jean-Yves Avenard  <j...@apple.com>
 
         Move management of RemoteCommandListener from MediaSessionManagerCocoa into NowPlayingManager

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm (274930 => 274931)


--- trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm	2021-03-24 05:19:45 UTC (rev 274930)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebViewData.mm	2021-03-24 06:06:42 UTC (rev 274931)
@@ -72,7 +72,7 @@
     // we still allow this, see <rdar://problem/7403328>. Since the race condition and subsequent
     // crash are especially troublesome for iBooks, we never allow the observer to be added to the
     // main run loop in iBooks.
-    if (WebCore::IOSApplication::isIBooks())
+    if (WebCore::CocoaApplication::isIBooks())
         return WebThreadRunLoop();
 #endif
     return CFRunLoopGetCurrent();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to