Title: [246048] trunk/Source
Revision
246048
Author
[email protected]
Date
2019-06-03 14:07:06 -0700 (Mon, 03 Jun 2019)

Log Message

Implement an internal switch to turn idempotent text autosizing and viewport rules off
https://bugs.webkit.org/show_bug.cgi?id=198460
<rdar://problem/51324526>

Reviewed by Tim Horton.

Source/WebCore:

Add a new WebCore setting for viewport shrink-to-fit-content heuristics; additionally, tweak the existing
idempotent text autosizing setting to default to false (this is overridden by preferences at the WebKit layer).

* page/Settings.yaml:

Source/WebKit:

* Shared/WebPreferences.yaml:

Add new preferences to control viewport shrink-to-fit-content and idempotent text autosizing.

* Shared/WebPreferencesDefaultValues.cpp:

Add the non-iOS implementation of defaultTextAutosizingUsesIdempotentMode, and also wrap these functions in the
WebKit namespace.

(WebKit::defaultTextAutosizingUsesIdempotentMode):
(defaultPassiveTouchListenersAsDefaultOnDocument): Deleted.
(defaultCustomPasteboardDataEnabled): Deleted.
* Shared/WebPreferencesDefaultValues.h:

Move some existing default preference value helper functions into the WebKit namespace.

* Shared/ios/WebPreferencesDefaultValuesIOS.mm: Copied from Source/WebKit/Shared/WebPreferencesDefaultValues.cpp.

Add an iOS-specific file for WebPreferencesDefaultValues, so that we can check for the user interface idiom.

(WebKit::defaultTextAutosizingUsesIdempotentMode):
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::immediatelyShrinkToFitContent):

Add an early return for the case where shrink-to-fit-content is explicitly disabled via the new preference.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246047 => 246048)


--- trunk/Source/WebCore/ChangeLog	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebCore/ChangeLog	2019-06-03 21:07:06 UTC (rev 246048)
@@ -1,3 +1,16 @@
+2019-06-03  Wenson Hsieh  <[email protected]>
+
+        Implement an internal switch to turn idempotent text autosizing and viewport rules off
+        https://bugs.webkit.org/show_bug.cgi?id=198460
+        <rdar://problem/51324526>
+
+        Reviewed by Tim Horton.
+
+        Add a new WebCore setting for viewport shrink-to-fit-content heuristics; additionally, tweak the existing
+        idempotent text autosizing setting to default to false (this is overridden by preferences at the WebKit layer).
+
+        * page/Settings.yaml:
+
 2019-06-03  Rob Buis  <[email protected]>
 
         Implement imagesrcset and imagesizes attributes on link rel=preload

Modified: trunk/Source/WebCore/page/Settings.yaml (246047 => 246048)


--- trunk/Source/WebCore/page/Settings.yaml	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebCore/page/Settings.yaml	2019-06-03 21:07:06 UTC (rev 246048)
@@ -441,7 +441,7 @@
   initial: defaultMinimumZoomFontSize()
   conditional: TEXT_AUTOSIZING
 textAutosizingUsesIdempotentMode:
-  initial: defaultTextAutosizingUsesIdempotentMode()
+  initial: false
   onChange: setNeedsRecalcStyleInAllFrames
   conditional: TEXT_AUTOSIZING
 
@@ -837,6 +837,9 @@
 shouldDispatchSyntheticMouseEventsWhenModifyingSelection:
   initial: false
 
+allowViewportShrinkToFitContent:
+  initial: true
+
 # Deprecated
 
 iceCandidateFilteringEnabled:

Modified: trunk/Source/WebCore/page/SettingsBase.cpp (246047 => 246048)


--- trunk/Source/WebCore/page/SettingsBase.cpp	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebCore/page/SettingsBase.cpp	2019-06-03 21:07:06 UTC (rev 246048)
@@ -96,11 +96,6 @@
 {
     return false;
 }
-
-bool SettingsBase::defaultTextAutosizingUsesIdempotentMode()
-{
-    return false;
-}
 #endif
 
 bool SettingsBase::defaultDownloadableBinaryFontsEnabled()

Modified: trunk/Source/WebCore/page/SettingsBase.h (246047 => 246048)


--- trunk/Source/WebCore/page/SettingsBase.h	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebCore/page/SettingsBase.h	2019-06-03 21:07:06 UTC (rev 246048)
@@ -113,7 +113,6 @@
     static const SettingsBase::ForcedAccessibilityValue defaultForcedPrefersReducedMotionAccessibilityValue = ForcedAccessibilityValue::System;
 
     WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
-    static bool defaultTextAutosizingUsesIdempotentMode();
     WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
     WEBCORE_EXPORT static bool defaultDownloadableBinaryFontsEnabled();
     WEBCORE_EXPORT static bool defaultContentChangeObserverEnabled();

Modified: trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm (246047 => 246048)


--- trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm	2019-06-03 21:07:06 UTC (rev 246048)
@@ -86,11 +86,6 @@
     return true;
 }
 
-bool SettingsBase::defaultTextAutosizingUsesIdempotentMode()
-{
-    return deviceHasIPadCapability() && ![[PAL::getUIApplicationClass() sharedApplication] _isClassic];
-}
-
 #endif
 
 const String& SettingsBase::defaultMediaContentTypesRequiringHardwareSupport()

Modified: trunk/Source/WebKit/ChangeLog (246047 => 246048)


--- trunk/Source/WebKit/ChangeLog	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/ChangeLog	2019-06-03 21:07:06 UTC (rev 246048)
@@ -1,3 +1,39 @@
+2019-06-03  Wenson Hsieh  <[email protected]>
+
+        Implement an internal switch to turn idempotent text autosizing and viewport rules off
+        https://bugs.webkit.org/show_bug.cgi?id=198460
+        <rdar://problem/51324526>
+
+        Reviewed by Tim Horton.
+
+        * Shared/WebPreferences.yaml:
+
+        Add new preferences to control viewport shrink-to-fit-content and idempotent text autosizing.
+
+        * Shared/WebPreferencesDefaultValues.cpp:
+
+        Add the non-iOS implementation of defaultTextAutosizingUsesIdempotentMode, and also wrap these functions in the
+        WebKit namespace.
+
+        (WebKit::defaultTextAutosizingUsesIdempotentMode):
+        (defaultPassiveTouchListenersAsDefaultOnDocument): Deleted.
+        (defaultCustomPasteboardDataEnabled): Deleted.
+        * Shared/WebPreferencesDefaultValues.h:
+
+        Move some existing default preference value helper functions into the WebKit namespace.
+
+        * Shared/ios/WebPreferencesDefaultValuesIOS.mm: Copied from Source/WebKit/Shared/WebPreferencesDefaultValues.cpp.
+
+        Add an iOS-specific file for WebPreferencesDefaultValues, so that we can check for the user interface idiom.
+
+        (WebKit::defaultTextAutosizingUsesIdempotentMode):
+        * SourcesCocoa.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::immediatelyShrinkToFitContent):
+
+        Add an early return for the case where shrink-to-fit-content is explicitly disabled via the new preference.
+
 2019-06-03  Rob Buis  <[email protected]>
 
         Implement imagesrcset and imagesizes attributes on link rel=preload

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (246047 => 246048)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-06-03 21:07:06 UTC (rev 246048)
@@ -1640,6 +1640,22 @@
   category: internal
   condition: ENABLE(TOUCH_EVENTS)
 
+TextAutosizingUsesIdempotentMode:
+  type: bool
+  defaultValue: defaultTextAutosizingUsesIdempotentMode()
+  humanReadableName: "Idempotent Text Autosizing"
+  humanReadableDescription: "Use idempotent text autosizing mode"
+  category: internal
+  condition: ENABLE(TEXT_AUTOSIZING)
+
+AllowViewportShrinkToFitContent:
+  type: bool
+  defaultValue: true
+  humanReadableName: "Allow Viewport Shrink to Fit Content"
+  humanReadableDescription: "Allow the viewport shrink to fit content heuristic when appropriate"
+  category: internal
+  condition: PLATFORM(IOS_FAMILY)
+
 ReferrerPolicyAttributeEnabled:
   type: bool
   defaultValue: false

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (246047 => 246048)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp	2019-06-03 21:07:06 UTC (rev 246048)
@@ -35,6 +35,8 @@
 #include "VersionChecks.h"
 #endif
 
+namespace WebKit {
+
 bool defaultPassiveTouchListenersAsDefaultOnDocument()
 {
 #if PLATFORM(IOS_FAMILY)
@@ -59,3 +61,13 @@
 #endif
 }
 
+#if ENABLE(TEXT_AUTOSIZING) && !PLATFORM(IOS_FAMILY)
+
+bool defaultTextAutosizingUsesIdempotentMode()
+{
+    return false;
+}
+
+#endif // ENABLE(TEXT_AUTOSIZING) && !PLATFORM(IOS_FAMILY)
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (246047 => 246048)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2019-06-03 21:07:06 UTC (rev 246048)
@@ -236,9 +236,6 @@
 #define DEFAULT_CONIC_GRADIENT_ENABLED false
 #endif
 
-bool defaultPassiveTouchListenersAsDefaultOnDocument();
-bool defaultCustomPasteboardDataEnabled();
-
 #if PLATFORM(MAC)
 #define DEFAULT_CAPTURE_AUDIO_IN_UIPROCESS true
 #else
@@ -278,3 +275,14 @@
 #else
 #define DEFAULT_WEB_AUTHENTICATION_ENABLED false
 #endif
+
+namespace WebKit {
+
+bool defaultPassiveTouchListenersAsDefaultOnDocument();
+bool defaultCustomPasteboardDataEnabled();
+
+#if ENABLE(TEXT_AUTOSIZING)
+bool defaultTextAutosizingUsesIdempotentMode();
+#endif
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm (from rev 246046, trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp) (0 => 246048)


--- trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm	                        (rev 0)
+++ trunk/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm	2019-06-03 21:07:06 UTC (rev 246048)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#import "config.h"
+#import "WebPreferencesDefaultValues.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+#import "UIKitSPI.h"
+
+namespace WebKit {
+
+#if ENABLE(TEXT_AUTOSIZING)
+
+bool defaultTextAutosizingUsesIdempotentMode()
+{
+    return currentUserInterfaceIdiomIsPad();
+}
+
+#endif
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/SourcesCocoa.txt (246047 => 246048)


--- trunk/Source/WebKit/SourcesCocoa.txt	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2019-06-03 21:07:06 UTC (rev 246048)
@@ -176,6 +176,7 @@
 Shared/ios/WebIconUtilities.mm
 Shared/ios/WebIOSEventFactory.mm
 Shared/ios/WebPlatformTouchPointIOS.cpp
+Shared/ios/WebPreferencesDefaultValuesIOS.mm
 Shared/ios/WebTouchEventIOS.cpp
 
 Shared/mac/AttributedString.mm

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (246047 => 246048)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-06-03 21:07:06 UTC (rev 246048)
@@ -4645,6 +4645,7 @@
 		F48D2A8421583A0200C6752B /* AppKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitSPI.h; sourceTree = "<group>"; };
 		F496A42F1F58A272004C1757 /* DragDropInteractionState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DragDropInteractionState.h; path = ios/DragDropInteractionState.h; sourceTree = "<group>"; };
 		F496A4301F58A272004C1757 /* DragDropInteractionState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = DragDropInteractionState.mm; path = ios/DragDropInteractionState.mm; sourceTree = "<group>"; };
+		F4AC655E22A3140E00A05607 /* WebPreferencesDefaultValuesIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPreferencesDefaultValuesIOS.mm; path = ios/WebPreferencesDefaultValuesIOS.mm; sourceTree = "<group>"; };
 		F4B378D021DDBBAB0095A378 /* WebUndoStepID.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebUndoStepID.h; sourceTree = "<group>"; };
 		F4CB09E4225D5A0300891487 /* WebsiteMediaSourcePolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebsiteMediaSourcePolicy.h; sourceTree = "<group>"; };
 		F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTextInputListViewController.h; path = ios/forms/WKTextInputListViewController.h; sourceTree = "<group>"; };
@@ -5928,6 +5929,7 @@
 				2DA944991884E4F000ED86DB /* WebIOSEventFactory.h */,
 				2DA9449A1884E4F000ED86DB /* WebIOSEventFactory.mm */,
 				2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */,
+				F4AC655E22A3140E00A05607 /* WebPreferencesDefaultValuesIOS.mm */,
 				2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */,
 			);
 			name = ios;

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (246047 => 246048)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-06-03 21:04:07 UTC (rev 246047)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-06-03 21:07:06 UTC (rev 246048)
@@ -3307,6 +3307,9 @@
     if (m_isClosed)
         return false;
 
+    if (!m_page->settings().allowViewportShrinkToFitContent())
+        return false;
+
     if (!shouldIgnoreMetaViewport())
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to