Title: [219084] trunk/Source/WebKit/mac
Revision
219084
Author
[email protected]
Date
2017-07-03 11:55:31 -0700 (Mon, 03 Jul 2017)

Log Message

Expose unobscuredSafeAreaInsets on WebView
https://bugs.webkit.org/show_bug.cgi?id=174075
<rdar://problem/33096997>

Reviewed by Beth Dakin.

* WebView/WebView.mm:
(-[WebView _setUnobscuredSafeAreaInsets:]):
(-[WebView _unobscuredSafeAreaInsets]):
* WebView/WebViewPrivate.h:
Expose unobscuredSafeAreaInsets as a new private property on WebView,
similar to how it is exposed in WebKit2.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (219083 => 219084)


--- trunk/Source/WebKit/mac/ChangeLog	2017-07-03 18:55:01 UTC (rev 219083)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-07-03 18:55:31 UTC (rev 219084)
@@ -1,3 +1,18 @@
+2017-07-03  Tim Horton  <[email protected]>
+
+        Expose unobscuredSafeAreaInsets on WebView
+        https://bugs.webkit.org/show_bug.cgi?id=174075
+        <rdar://problem/33096997>
+
+        Reviewed by Beth Dakin.
+
+        * WebView/WebView.mm:
+        (-[WebView _setUnobscuredSafeAreaInsets:]):
+        (-[WebView _unobscuredSafeAreaInsets]):
+        * WebView/WebViewPrivate.h:
+        Expose unobscuredSafeAreaInsets as a new private property on WebView,
+        similar to how it is exposed in WebKit2.
+
 2017-07-03  Andy Estes  <[email protected]>
 
         [Xcode] Add an experimental setting to build with ccache

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (219083 => 219084)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-07-03 18:55:01 UTC (rev 219083)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-07-03 18:55:31 UTC (rev 219084)
@@ -5160,6 +5160,27 @@
 }
 #endif // PLATFORM(IOS)
 
+- (void)_setUnobscuredSafeAreaInsets:(WebEdgeInsets)insets
+{
+    if (auto page = _private->page)
+        page->setUnobscuredSafeAreaInsets(WebCore::FloatBoxExtent(insets.top, insets.right, insets.bottom, insets.left));
+}
+
+- (WebEdgeInsets)_unobscuredSafeAreaInsets
+{
+    WebEdgeInsets insets({ 0, 0, 0, 0 });
+
+    if (auto page = _private->page) {
+        auto unobscuredSafeAreaInsets = page->unobscuredSafeAreaInsets();
+        insets.top = unobscuredSafeAreaInsets.top();
+        insets.left = unobscuredSafeAreaInsets.left();
+        insets.bottom = unobscuredSafeAreaInsets.bottom();
+        insets.right = unobscuredSafeAreaInsets.right();
+    }
+
+    return insets;
+}
+
 - (void)_setSourceApplicationAuditData:(NSData *)sourceApplicationAuditData
 {
     if (_private->sourceApplicationAuditData == sourceApplicationAuditData)

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (219083 => 219084)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2017-07-03 18:55:01 UTC (rev 219083)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2017-07-03 18:55:31 UTC (rev 219084)
@@ -917,6 +917,15 @@
 - (void)forceRequestCandidatesForTesting;
 - (BOOL)shouldRequestCandidates;
 
+typedef struct WebEdgeInsets {
+    CGFloat top;
+    CGFloat left;
+    CGFloat bottom;
+    CGFloat right;
+} WebEdgeInsets;
+
+@property (nonatomic, assign, setter=_setUnobscuredSafeAreaInsets:) WebEdgeInsets _unobscuredSafeAreaInsets;
+
 @end
 
 #if !TARGET_OS_IPHONE
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to