Title: [294888] trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Revision
294888
Author
drou...@apple.com
Date
2022-05-26 12:50:46 -0700 (Thu, 26 May 2022)

Log Message

spurious `RELEASE_LOG` when creating a `WKWebView` with an empty `frame`
https://bugs.webkit.org/show_bug.cgi?id=240959

Reviewed by Tim Horton.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _recalculateViewportSizesWithMinimumViewportInset:maximumViewportInset:throwOnInvalidInput:]):
Don't `RELEASE_LOG` (or `throw`) unless a `minimumViewportInset`/`maximumViewportInset` has been specified.

Canonical link: https://commits.webkit.org/251015@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (294887 => 294888)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-05-26 19:30:38 UTC (rev 294887)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2022-05-26 19:50:46 UTC (rev 294888)
@@ -1602,25 +1602,33 @@
 {
     auto frame = WebCore::FloatSize(self.frame.size);
 
-    auto minimumUnobscuredSize = frame - WebCore::FloatSize(maximumViewportInset.left + maximumViewportInset.right, maximumViewportInset.top + maximumViewportInset.bottom);
+    auto maximumViewportInsetSize = WebCore::FloatSize(maximumViewportInset.left + maximumViewportInset.right, maximumViewportInset.top + maximumViewportInset.bottom);
+    auto minimumUnobscuredSize = frame - maximumViewportInsetSize;
     if (minimumUnobscuredSize.isEmpty()) {
-        if (throwOnInvalidInput) {
-            [NSException raise:NSInvalidArgumentException format:@"maximumViewportInset cannot be larger than frame"];
-            return;
+        if (!maximumViewportInsetSize.isEmpty()) {
+            if (throwOnInvalidInput) {
+                [NSException raise:NSInvalidArgumentException format:@"maximumViewportInset cannot be larger than frame"];
+                return;
+            }
+
+            RELEASE_LOG_ERROR(ViewportSizing, "maximumViewportInset cannot be larger than frame");
         }
 
-        RELEASE_LOG_ERROR(ViewportSizing, "maximumViewportInset cannot be larger than frame");
         minimumUnobscuredSize = frame;
     }
 
-    auto maximumUnobscuredSize = frame - WebCore::FloatSize(minimumViewportInset.left + minimumViewportInset.right, minimumViewportInset.top + minimumViewportInset.bottom);
+    auto minimumViewportInsetSize = WebCore::FloatSize(minimumViewportInset.left + minimumViewportInset.right, minimumViewportInset.top + minimumViewportInset.bottom);
+    auto maximumUnobscuredSize = frame - minimumViewportInsetSize;
     if (maximumUnobscuredSize.isEmpty()) {
-        if (throwOnInvalidInput) {
-            [NSException raise:NSInvalidArgumentException format:@"minimumViewportInset cannot be larger than frame"];
-            return;
+        if (!minimumViewportInsetSize.isEmpty()) {
+            if (throwOnInvalidInput) {
+                [NSException raise:NSInvalidArgumentException format:@"minimumViewportInset cannot be larger than frame"];
+                return;
+            }
+
+            RELEASE_LOG_ERROR(ViewportSizing, "minimumViewportInset cannot be larger than frame");
         }
 
-        RELEASE_LOG_ERROR(ViewportSizing, "minimumViewportInset cannot be larger than frame");
         maximumUnobscuredSize = frame;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to