Bug 141037 - Convert WebInspectorProxy to use WKWebView API for the inspector view
Summary: Convert WebInspectorProxy to use WKWebView API for the inspector view
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brian Burg
URL:
Keywords:
Depends on: 141190
Blocks: 141135
  Show dependency treegraph
 
Reported: 2015-01-29 09:16 PST by Brian Burg
Modified: 2015-02-03 15:21 PST (History)
9 users (show)

See Also:


Attachments
WIP (18.04 KB, patch)
2015-01-29 15:06 PST, Brian Burg
no flags Details | Formatted Diff | Diff
WIP (18.04 KB, patch)
2015-01-29 15:10 PST, Brian Burg
no flags Details | Formatted Diff | Diff
Patch (19.05 KB, patch)
2015-01-31 21:09 PST, Brian Burg
no flags Details | Formatted Diff | Diff
Patch for EWS (19.10 KB, patch)
2015-02-01 11:17 PST, Brian Burg
no flags Details | Formatted Diff | Diff
Patch (31.45 KB, patch)
2015-02-03 13:40 PST, Brian Burg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Burg 2015-01-29 09:16:10 PST
.
Comment 1 Brian Burg 2015-01-29 15:06:09 PST
Created attachment 245656 [details]
WIP
Comment 2 Brian Burg 2015-01-29 15:10:17 PST
Created attachment 245657 [details]
WIP
Comment 3 Brian Burg 2015-01-29 16:22:51 PST
The attached patch mostly works, except for dock to bottom. In that case, the initial draw seems to be correct, but subsequent draws paint the inspector over the entire inspected page superview, with web content on top.

Our initial assessment is that Safari or some other component is resizing the view behind our backs. Not sure I can diagnose further from OpenSource only, so benching this patch for now.

There is also some clean up to do with the PageGroup stuff. Unless I'm missing some important detail, the whole "level" system can be significantly simplified now that multi-process guarantees concurrent execution between different inspector levels (no stalling during debugger pauses).
Comment 4 Sam Weinig 2015-01-29 17:25:51 PST
(In reply to comment #3)
> The attached patch mostly works, except for dock to bottom. In that case,
> the initial draw seems to be correct, but subsequent draws paint the
> inspector over the entire inspected page superview, with web content on top.
> 
> Our initial assessment is that Safari or some other component is resizing
> the view behind our backs. Not sure I can diagnose further from OpenSource
> only, so benching this patch for now.

Do you see the same behavior in MiniBrowser? If so, I would recommend debugging from there.

> 
> There is also some clean up to do with the PageGroup stuff. Unless I'm
> missing some important detail, the whole "level" system can be significantly
> simplified now that multi-process guarantees concurrent execution between
> different inspector levels (no stalling during debugger pauses).

I am generally confused by the layering of this code.  It seems like the inspector code in WebKit2 lives both at the WebPageProxy/C++ layer, yet knows about things like WKWebView.  Is there something cleaner we can do here?
Comment 5 Brian Burg 2015-01-29 22:02:16 PST
> > There is also some clean up to do with the PageGroup stuff. Unless I'm
> > missing some important detail, the whole "level" system can be significantly
> > simplified now that multi-process guarantees concurrent execution between
> > different inspector levels (no stalling during debugger pauses).
> 
> I am generally confused by the layering of this code.  It seems like the
> inspector code in WebKit2 lives both at the WebPageProxy/C++ layer, yet
> knows about things like WKWebView.  Is there something cleaner we can do
> here?

Most of inspector WK2 code is cross-platform and in the C++ layer, except port-specific WebInspectorProxy functions. The platform-specific parts are to manage frame sizes and windows while attached and detached. This isn't cross-platform because every port does windowing differently.

I think it is pretty well segregated as-is; this patch does not affect ports other than Mac. Other code in WebInspectorProxy and WebKit2 doesn't care whether WKView or WKWebView API is used to set up the underlying WebPageProxy.
Comment 6 Timothy Hatcher 2015-01-30 17:23:38 PST
Disabling automaticallyAdjustsContentInsets fixes this.

Add this after creating the WKWebView in m_inspectorView:

#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    [m_inspectorView _setAutomaticallyAdjustsContentInsets:NO];
#endif
Comment 7 Brian Burg 2015-01-31 21:09:39 PST
Created attachment 245817 [details]
Patch
Comment 8 Timothy Hatcher 2015-02-01 07:07:20 PST
Comment on attachment 245817 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=245817&action=review

> Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm:498
>      [m_inspectorView setDrawsBackground:NO];

This needs to be _setDrawsTransparentBackground:YES to fix the 10.9 build.
Comment 9 Brian Burg 2015-02-01 11:17:07 PST
Created attachment 245836 [details]
Patch for EWS
Comment 10 Timothy Hatcher 2015-02-02 13:43:45 PST
Comment on attachment 245836 [details]
Patch for EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=245836&action=review

> Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm:497
> -#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
> -    [m_inspectorView setDrawsBackground:NO];
> +    [m_inspectorView _setDrawsTransparentBackground:YES];

On Yosemite we don't need to be transparent. We draw everything. So the __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 check needs to stay.
Comment 11 Timothy Hatcher 2015-02-02 13:45:49 PST
Comment on attachment 245836 [details]
Patch for EWS

Just add that #ifdef around _setDrawsTransparentBackground:YES back and this looks good to me.
Comment 12 Brian Burg 2015-02-02 21:28:44 PST
Committed r179540: <http://trac.webkit.org/changeset/179540>
Comment 14 WebKit Commit Bot 2015-02-02 22:10:45 PST
Re-opened since this is blocked by bug 141190
Comment 15 Brian Burg 2015-02-03 13:40:12 PST
Created attachment 245961 [details]
Patch
Comment 16 WebKit Commit Bot 2015-02-03 15:21:52 PST
Comment on attachment 245961 [details]
Patch

Clearing flags on attachment: 245961

Committed r179573: <http://trac.webkit.org/changeset/179573>
Comment 17 WebKit Commit Bot 2015-02-03 15:21:56 PST
All reviewed patches have been landed.  Closing bug.