Skip to content
Permalink
Browse files
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
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed May 26, 2022
1 parent cc1cdaa commit 53361d11968b3896b02e3dd638b45a8a4fa6e884
Showing 1 changed file with 18 additions and 10 deletions.
@@ -1602,25 +1602,33 @@ - (void)_recalculateViewportSizesWithMinimumViewportInset:(CocoaEdgeInsets)minim
{
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;
}

0 comments on commit 53361d1

Please sign in to comment.