Bug 167649 - [Cocoa] Assertion failure in contentZoomScale(WKWebView *) (scale == [webView->_scrollView zoomScale]) in iOS Mail
Summary: [Cocoa] Assertion failure in contentZoomScale(WKWebView *) (scale == [webView...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-01-31 09:52 PST by mitz
Modified: 2017-01-31 11:21 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2017-01-31 09:52:08 PST
Running the iOS Mail app with a Debug build of WebKit, some of its web views used for message display are constantly failing the ASSERT(scale == [webView->_scrollView zoomScale]) in WKWebView.mm’s contentZoomScale(WKWebView *). In a typical example, one sees

(lldb) p scale
(CGFloat) $0 = 0.25
(lldb) p [(UIScrollView*)webView->_scrollView.m_ptr zoomScale]
(CGFloat) $1 = 1
Comment 1 mitz 2017-01-31 09:56:33 PST
<rdar://problem/30287825>
Comment 2 mitz 2017-01-31 11:21:08 PST
More information from Simon:

(lldb) po [self recursiveDescription]
<: 0x7f91b3728f10; frame = (0 0; 363 276); gestureRecognizers = <NSArray: 0x620000052240>; layer = <CALayer: 0x6180002226c0>>
   | <UIView: 0x7f91b3730a80; frame = (0 0; 0 0); layer = <CALayer: 0x6180002237c0>>
   | <WKWebView: 0x7f91b481fc00; frame = (0 0; 363 276); autoresize = W+H; layer = <CALayer: 0x6180002219c0>>
   |    | <WKScrollView: 0x7f91b683e800; baseClass = UIScrollView; frame = (0 0; 363 276); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000056650>; layer = <CALayer: 0x600000221420>; contentOffset: {0, 0}; contentSize: {0, 0}>
   |    |    | <WKContentView: 0x7f91b6813800; frame = (0 0; 0 0); transform = [0.25, 0, 0, 0.25, 0, 0]; gestureRecognizers = <NSArray: 0x64000004b040>; layer = <CALayer: 0x6000002213e0>>
   |    |    |    | <UIView: 0x7f91b5c0f8f0; frame = (0 0; 0 0); clipsToBounds = YES; layer = <CALayer: 0x64000003b060>>
   |    |    |    |    | <UIView: 0x7f91b5c0f750; frame = (0 0; 0 0); autoresize = W+H; layer = <CALayer: 0x64000003aea0>>
   |    |    |    |    |    | <WKCompositingView: 0x7f91b5b250e0; frame = (0 0; 0 0); layer = <CALayer: 0x62800023e540>> layerID = 1 "<WKCompositingView: 0x7f91b5b250e0>"
   |    |    | <UIView: 0x7f91b5c0fa90; frame = (0 0; 0 0); opaque = NO; layer = <CALayer: 0x64000003b020>>
   |    |    |    | <UITextSelectionView: 0x7f91b5b253f0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x62800023e560>>
   |    |    | <: 0x7f91b37428a0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x618000222b00>>
   | <: 0x7f91b3741a10; baseClass = UIStackView; frame = (0 0; 0 0); layer = <CATransformLayer: 0x618000222a40>>


The layer transform is being set via -[UIScrollView setZoomScale:] being called from:
    frame #13: WebKit`::-[WKWebView _didCommitLayerTree:](self=0x00007fb8b00aea00, _cmd="_didCommitLayerTree:", layerTreeTransaction=0x00007fff55f11a00) at WKWebView.mm:1271
    frame #14: WebKit`::-[WKContentView _didCommitLayerTree:](self=0x00007fb8b00b5400, _cmd="_didCommitLayerTree:", layerTreeTransaction=0x00007fff55f11a00) at WKContentView.mm:562
    frame #15: WebKit`WebKit::PageClientImpl::didCommitLayerTree(this=0x0000600000422dc0, layerTreeTransaction=0x00007fff55f11a00) at PageClientImplIOS.mm:506
    frame #16: WebKit`WebKit::WebPageProxy::didCommitLayerTree(this=0x00007fb8b000c018, layerTreeTransaction=0x00007fff55f11a00) at WebPageProxyIOS.mm:407
    frame #17: WebKit`WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree(this=0x00007fb8b41020d0, layerTreeTransaction=0x00007fff55f11a00, scrollingTreeTransaction=0x00007fff55f11b08) at RemoteLayerTreeDrawingAreaProxy.mm:200

but this seems to happen for an offscreen WKWebView (I see this before viewing any message on iPhone). Then the assertion hits when the WKWebView is being resized.

My guess is that the 0.25x scale is some WKWebView content autosizing minimum scale, and the assertion hits when the WKWebView is being prepared for display.