Title: [219057] trunk/Source/WebKit
Revision
219057
Author
timothy_hor...@apple.com
Date
2017-07-01 23:48:02 -0700 (Sat, 01 Jul 2017)

Log Message

Expose viewport-fit value to UIKit via viewport arguments dictionary
https://bugs.webkit.org/show_bug.cgi?id=174071
<rdar://problem/33096620>

Reviewed by Wenson Hsieh.

Source/WebKit/ios:

* WebCoreSupport/WebChromeClientIOS.mm:
(nameForViewportFitValue):
(dictionaryForViewportArguments):
Make use of the named constants we already have for these; the code
that reads this dictionary uses them, so we might as well!

Add viewport-fit -> { auto, contain, cover } to the dictionary.

* WebKit.iOS.exp:

Source/WebKit/mac:

* History/WebHistoryItem.mm:
* History/WebHistoryItemPrivate.h:
Add another dictionary key and three values.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ios/ChangeLog (219056 => 219057)


--- trunk/Source/WebKit/ios/ChangeLog	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/ios/ChangeLog	2017-07-02 06:48:02 UTC (rev 219057)
@@ -1,3 +1,21 @@
+2017-07-01  Tim Horton  <timothy_hor...@apple.com>
+
+        Expose viewport-fit value to UIKit via viewport arguments dictionary
+        https://bugs.webkit.org/show_bug.cgi?id=174071
+        <rdar://problem/33096620>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (nameForViewportFitValue):
+        (dictionaryForViewportArguments):
+        Make use of the named constants we already have for these; the code
+        that reads this dictionary uses them, so we might as well!
+
+        Add viewport-fit -> { auto, contain, cover } to the dictionary.
+
+        * WebKit.iOS.exp:
+
 2017-06-30  Daniel Bates  <daba...@apple.com>
 
         API::FrameInfo should know the web page that contains the frame; add API property webView to WKFrameInfo

Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm (219056 => 219057)


--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm	2017-07-02 06:48:02 UTC (rev 219057)
@@ -36,6 +36,7 @@
 #import "WebFormDelegate.h"
 #import "WebFrameIOS.h"
 #import "WebFrameInternal.h"
+#import "WebHistoryItemInternal.h"
 #import "WebKitSystemInterface.h"
 #import "WebOpenPanelResultListener.h"
 #import "WebUIDelegate.h"
@@ -190,15 +191,29 @@
     }
 }
 
+static inline NSString *nameForViewportFitValue(ViewportFit value)
+{
+    switch (value) {
+    case ViewportFit::Auto:
+        return WebViewportFitAutoValue;
+    case ViewportFit::Contain:
+        return WebViewportFitContainValue;
+    case ViewportFit::Cover:
+        return WebViewportFitCoverValue;
+    }
+    return WebViewportFitAutoValue;
+}
+
 static inline NSDictionary *dictionaryForViewportArguments(const WebCore::ViewportArguments& arguments)
 {
-    return @{ @"initial-scale":@(arguments.zoom),
-              @"minimum-scale":@(arguments.minZoom),
-              @"maximum-scale":@(arguments.maxZoom),
-              @"user-scalable":@(arguments.userZoom),
-              @"shrink-to-fit":@(0),
-              @"width":@(arguments.width),
-              @"height":@(arguments.height) };
+    return @{ WebViewportInitialScaleKey: @(arguments.zoom),
+              WebViewportMinimumScaleKey: @(arguments.minZoom),
+              WebViewportMaximumScaleKey: @(arguments.maxZoom),
+              WebViewportUserScalableKey: @(arguments.userZoom),
+              WebViewportShrinkToFitKey: @(0),
+              WebViewportFitKey: nameForViewportFitValue(arguments.viewportFit),
+              WebViewportWidthKey: @(arguments.width),
+              WebViewportHeightKey: @(arguments.height) };
 }
 
 FloatSize WebChromeClientIOS::screenSize() const

Modified: trunk/Source/WebKit/ios/WebKit.iOS.exp (219056 => 219057)


--- trunk/Source/WebKit/ios/WebKit.iOS.exp	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/ios/WebKit.iOS.exp	2017-07-02 06:48:02 UTC (rev 219057)
@@ -24,6 +24,10 @@
 _WebOpenPanelConfigurationMediaCaptureTypeKey
 _WebQuickLookFileNameKey
 _WebQuickLookUTIKey
+_WebViewportFitKey
+_WebViewportFitAutoValue
+_WebViewportFitContainValue
+_WebViewportFitCoverValue
 _WebViewportHeightKey
 _WebViewportInitialScaleKey
 _WebViewportMaximumScaleKey

Modified: trunk/Source/WebKit/mac/ChangeLog (219056 => 219057)


--- trunk/Source/WebKit/mac/ChangeLog	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-07-02 06:48:02 UTC (rev 219057)
@@ -1,3 +1,15 @@
+2017-07-01  Tim Horton  <timothy_hor...@apple.com>
+
+        Expose viewport-fit value to UIKit via viewport arguments dictionary
+        https://bugs.webkit.org/show_bug.cgi?id=174071
+        <rdar://problem/33096620>
+
+        Reviewed by Wenson Hsieh.
+
+        * History/WebHistoryItem.mm:
+        * History/WebHistoryItemPrivate.h:
+        Add another dictionary key and three values.
+
 2017-07-01  Dan Bernstein  <m...@apple.com>
 
         [iOS] Remove code only needed when building for iOS 9.x

Modified: trunk/Source/WebKit/mac/History/WebHistoryItem.mm (219056 => 219057)


--- trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/mac/History/WebHistoryItem.mm	2017-07-02 06:48:02 UTC (rev 219057)
@@ -64,9 +64,14 @@
 NSString *WebViewportMaximumScaleKey = @"maximum-scale";
 NSString *WebViewportUserScalableKey = @"user-scalable";
 NSString *WebViewportShrinkToFitKey  = @"shrink-to-fit";
+NSString *WebViewportFitKey          = @"viewport-fit";
 NSString *WebViewportWidthKey        = @"width";
 NSString *WebViewportHeightKey       = @"height";
 
+NSString *WebViewportFitAutoValue    = @"auto";
+NSString *WebViewportFitContainValue = @"contain";
+NSString *WebViewportFitCoverValue   = @"cover";
+
 static NSString *scaleKey = @"scale";
 static NSString *scaleIsInitialKey = @"scaleIsInitial";
 static NSString *scrollPointXKey = @"scrollPointX";

Modified: trunk/Source/WebKit/mac/History/WebHistoryItemPrivate.h (219056 => 219057)


--- trunk/Source/WebKit/mac/History/WebHistoryItemPrivate.h	2017-07-02 04:40:34 UTC (rev 219056)
+++ trunk/Source/WebKit/mac/History/WebHistoryItemPrivate.h	2017-07-02 06:48:02 UTC (rev 219057)
@@ -34,8 +34,13 @@
 extern NSString *WebViewportMaximumScaleKey;
 extern NSString *WebViewportUserScalableKey;
 extern NSString *WebViewportShrinkToFitKey;
+extern NSString *WebViewportFitKey;
 extern NSString *WebViewportWidthKey;
 extern NSString *WebViewportHeightKey;
+
+extern NSString *WebViewportFitAutoValue;
+extern NSString *WebViewportFitContainValue;
+extern NSString *WebViewportFitCoverValue;
 #endif
 
 @interface WebHistoryItem (WebPrivate)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to