Diff
Modified: branches/safari-614.1.8-branch/Source/WebKit/ChangeLog (292016 => 292017)
--- branches/safari-614.1.8-branch/Source/WebKit/ChangeLog 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Source/WebKit/ChangeLog 2022-03-29 01:14:28 UTC (rev 292017)
@@ -1,5 +1,53 @@
2022-03-28 Russell Epstein <repst...@apple.com>
+ Cherry-pick r292007. rdar://problem/90602918
+
+ [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
+ https://bugs.webkit.org/show_bug.cgi?id=238173
+ <rdar://problem/90602918>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebKit:
+
+ See <https://webkit.org/b/237979> for information about this API. This change just also
+ enables it on macOS (the other change was iOS-only).
+
+ * UIProcess/API/Cocoa/WKWebView.h:
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ * UIProcess/API/mac/WKWebViewMac.mm:
+ (-[WKWebView setFrameSize:]):
+ Remove the `#if PLATFORM(IOS_FAMILY)` around all things related to `-[WKWebview setMinimumViewportInset:maximumViewportInset:]`.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
+ Enable tests for `-[WKWebView setMinimumViewportInset:maximumViewportInset:]` on macOS.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-28 Devin Rousso <drou...@apple.com>
+
+ [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
+ https://bugs.webkit.org/show_bug.cgi?id=238173
+ <rdar://problem/90602918>
+
+ Reviewed by Wenson Hsieh.
+
+ See <https://webkit.org/b/237979> for information about this API. This change just also
+ enables it on macOS (the other change was iOS-only).
+
+ * UIProcess/API/Cocoa/WKWebView.h:
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ * UIProcess/API/mac/WKWebViewMac.mm:
+ (-[WKWebView setFrameSize:]):
+ Remove the `#if PLATFORM(IOS_FAMILY)` around all things related to `-[WKWebview setMinimumViewportInset:maximumViewportInset:]`.
+
+2022-03-28 Russell Epstein <repst...@apple.com>
+
Cherry-pick r291980. rdar://problem/89434696
[iOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
Modified: branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (292016 => 292017)
--- branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2022-03-29 01:14:28 UTC (rev 292017)
@@ -638,6 +638,10 @@
@property (nonatomic, readonly) UIEdgeInsets minimumViewportInset WK_API_AVAILABLE(ios(WK_IOS_TBA));
@property (nonatomic, readonly) UIEdgeInsets maximumViewportInset WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)setMinimumViewportInset:(UIEdgeInsets)minimumViewportInset maximumViewportInset:(UIEdgeInsets)maximumViewportInset WK_API_AVAILABLE(ios(WK_IOS_TBA));
+#else
+@property (nonatomic, readonly) NSEdgeInsets minimumViewportInset WK_API_AVAILABLE(macos(WK_MAC_TBA));
+@property (nonatomic, readonly) NSEdgeInsets maximumViewportInset WK_API_AVAILABLE(macos(WK_MAC_TBA));
+- (void)setMinimumViewportInset:(NSEdgeInsets)minimumViewportInset maximumViewportInset:(NSEdgeInsets)maximumViewportInset WK_API_AVAILABLE(macos(WK_MAC_TBA));
#endif
@end
Modified: branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (292016 => 292017)
--- branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2022-03-29 01:14:28 UTC (rev 292017)
@@ -1865,8 +1865,6 @@
#endif
}
-#if PLATFORM(IOS_FAMILY)
-
- (void)setMinimumViewportInset:(CocoaEdgeInsets)minimumViewportInset maximumViewportInset:(CocoaEdgeInsets)maximumViewportInset
{
if (minimumViewportInset.top < 0 || minimumViewportInset.left < 0 || minimumViewportInset.bottom < 0 || minimumViewportInset.right < 0)
@@ -1884,8 +1882,6 @@
_maximumViewportInset = maximumViewportInset;
}
-#endif // PLATFORM(IOS_FAMILY)
-
@end
#pragma mark -
Modified: branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (292016 => 292017)
--- branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h 2022-03-29 01:14:28 UTC (rev 292017)
@@ -140,10 +140,8 @@
_WKRenderingProgressEvents _observedRenderingProgressEvents;
BOOL _usePlatformFindUI;
-#if PLATFORM(IOS_FAMILY)
CocoaEdgeInsets _minimumViewportInset;
CocoaEdgeInsets _maximumViewportInset;
-#endif
#if PLATFORM(MAC)
std::unique_ptr<WebKit::WebViewImpl> _impl;
Modified: branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm (292016 => 292017)
--- branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm 2022-03-29 01:14:28 UTC (rev 292017)
@@ -140,6 +140,8 @@
[_safeBrowsingWarning setFrame:self.bounds];
if (_impl)
_impl->setFrameSize(NSSizeToCGSize(size));
+
+ [self _recalculateViewportSizesWithMinimumViewportInset:_minimumViewportInset maximumViewportInset:_maximumViewportInset throwOnInvalidInput:NO];
}
- (void)setUserInterfaceLayoutDirection:(NSUserInterfaceLayoutDirection)userInterfaceLayoutDirection
Modified: branches/safari-614.1.8-branch/Tools/ChangeLog (292016 => 292017)
--- branches/safari-614.1.8-branch/Tools/ChangeLog 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Tools/ChangeLog 2022-03-29 01:14:28 UTC (rev 292017)
@@ -1,5 +1,46 @@
2022-03-28 Russell Epstein <repst...@apple.com>
+ Cherry-pick r292007. rdar://problem/90602918
+
+ [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
+ https://bugs.webkit.org/show_bug.cgi?id=238173
+ <rdar://problem/90602918>
+
+ Reviewed by Wenson Hsieh.
+
+ Source/WebKit:
+
+ See <https://webkit.org/b/237979> for information about this API. This change just also
+ enables it on macOS (the other change was iOS-only).
+
+ * UIProcess/API/Cocoa/WKWebView.h:
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ * UIProcess/API/mac/WKWebViewMac.mm:
+ (-[WKWebView setFrameSize:]):
+ Remove the `#if PLATFORM(IOS_FAMILY)` around all things related to `-[WKWebview setMinimumViewportInset:maximumViewportInset:]`.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
+ Enable tests for `-[WKWebView setMinimumViewportInset:maximumViewportInset:]` on macOS.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-28 Devin Rousso <drou...@apple.com>
+
+ [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
+ https://bugs.webkit.org/show_bug.cgi?id=238173
+ <rdar://problem/90602918>
+
+ Reviewed by Wenson Hsieh.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
+ Enable tests for `-[WKWebView setMinimumViewportInset:maximumViewportInset:]` on macOS.
+
+2022-03-28 Russell Epstein <repst...@apple.com>
+
Cherry-pick r291980. rdar://problem/89434696
[iOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units
Modified: branches/safari-614.1.8-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm (292016 => 292017)
--- branches/safari-614.1.8-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm 2022-03-29 00:40:14 UTC (rev 292016)
+++ branches/safari-614.1.8-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm 2022-03-29 01:14:28 UTC (rev 292017)
@@ -179,8 +179,6 @@
#define CocoaEdgeInsetsZero CocoaEdgeInsetsMake(0, 0, 0, 0)
-#if PLATFORM(IOS_FAMILY)
-
TEST(CSSViewportUnits, NegativeMinimumViewportInset)
{
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
@@ -682,6 +680,8 @@
}
}
+#if PLATFORM(IOS_FAMILY)
+
TEST(CSSViewportUnits, MinimumViewportInsetWithContentInset)
{
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);