Commit 079719da authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Give CWVWebView a non-empty frame at initialization

This avoids a DCHECK on an empty frame during navigation that happens
as part of state restoration, which usually occurs before the view
hierarchy has had a chance to layout its subview for the first time.

Change-Id: I0a5684b8ce6219ea073bc93f33f79e651ea7578a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2369615
Auto-Submit: John Wu <jzw@chromium.org>
Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: Hiroshi Ichikawa <ichikawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800900}
parent f3579b32
......@@ -673,7 +673,12 @@ NSString* const kWebViewShellJavaScriptDialogTextFieldAccessibilityIdentifier =
- (CWVWebView*)createWebViewWithConfiguration:
(CWVWebViewConfiguration*)configuration {
CWVWebView* webView = [[CWVWebView alloc] initWithFrame:[_contentView bounds]
// Set a non empty CGRect to avoid DCHECKs that occur when a load happens
// after state restoration, and before the view hierarchy is laid out for the
// first time.
// https://source.chromium.org/chromium/chromium/src/+/master:ios/web/web_state/ui/crw_web_request_controller.mm;l=518;drc=df887034106ef438611326745a7cd276eedd4953
CGRect frame = CGRectMake(0, 0, 1, 1);
CWVWebView* webView = [[CWVWebView alloc] initWithFrame:frame
configuration:configuration];
[_contentView addSubview:webView];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment