Changeset 92587 in webkit


Ignore:
Timestamp:
Aug 8, 2011 1:12:36 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: implement dock/undock in WebKit2 without getting into WebCore.
https://bugs.webkit.org/show_bug.cgi?id=65763

Source/WebCore:

InspectorFrontendClient.h can't have synchronous canAttachWindow() returning value
since in the multiprocess environment, you can't immediately get back to it from the host.

r92384 introduced an unhealthy WebKit -> WebCore -> WebKit canAttach query where embedder
was asking itself a question. This loop was fixed.

Reviewed by Yury Semikhatsky.

  • WebCore.exp.in:
  • inspector/InspectorController.cpp:
  • inspector/InspectorController.h:
  • inspector/InspectorFrontendClient.h:
  • inspector/InspectorFrontendClientLocal.h:
  • inspector/front-end/inspector.js:

(windowLoaded):

Source/WebKit/chromium:

Reviewed by Yury Semikhatsky.

  • src/InspectorFrontendClientImpl.cpp:
  • src/InspectorFrontendClientImpl.h:
  • src/js/DevTools.js:

(devtools.domContentLoaded):

Source/WebKit2:

InspectorFrontendClient.h can't have synchronous canAttachWindow() returning value
since in the multiprocess environment, you can't immediately get back to it from the host.

r92384 introduced an unhealthy WebKit -> WebCore -> WebKit canAttach query where embedder
was asking itself a question. This loop was fixed.

Reviewed by Yury Semikhatsky.

  • UIProcess/WebInspectorProxy.cpp:

(WebKit::WebInspectorProxy::attach):
(WebKit::WebInspectorProxy::createInspectorPage):
(WebKit::WebInspectorProxy::didLoadInspectorPage):
(WebKit::WebInspectorProxy::shouldOpenAttached):

  • UIProcess/WebInspectorProxy.h:
  • UIProcess/WebInspectorProxy.messages.in:
  • UIProcess/efl/WebInspectorEfl.cpp:

(WebKit::WebInspectorProxy::platformInspectedWindowHeight):

  • UIProcess/gtk/WebInspectorGtk.cpp:

(WebKit::WebInspectorProxy::platformInspectedWindowHeight):

  • UIProcess/mac/WebInspectorProxyMac.mm:

(WebKit::WebInspectorProxy::platformOpen):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):

  • UIProcess/qt/WebInspectorProxyQt.cpp:

(WebKit::WebInspectorProxy::platformOpen):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):

  • UIProcess/win/WebInspectorProxyWin.cpp:

(WebKit::WebInspectorProxy::platformOpen):
(WebKit::WebInspectorProxy::platformInspectedWindowHeight):

  • WebProcess/WebPage/WebInspector.cpp:

(WebKit::WebInspector::didLoadInspectorPage):

  • WebProcess/WebPage/WebInspector.h:
  • WebProcess/WebPage/WebInspector.messages.in:
Location:
trunk/Source
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92585 r92587  
     12011-08-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: implement dock/undock in WebKit2 without getting into WebCore.
     4        https://bugs.webkit.org/show_bug.cgi?id=65763
     5
     6        InspectorFrontendClient.h can't have synchronous canAttachWindow() returning value
     7        since in the multiprocess environment, you can't immediately get back to it from the host.
     8
     9        r92384 introduced an unhealthy WebKit -> WebCore -> WebKit canAttach query where embedder
     10        was asking itself a question. This loop was fixed.
     11
     12        Reviewed by Yury Semikhatsky.
     13
     14        * WebCore.exp.in:
     15        * inspector/InspectorController.cpp:
     16        * inspector/InspectorController.h:
     17        * inspector/InspectorFrontendClient.h:
     18        * inspector/InspectorFrontendClientLocal.h:
     19        * inspector/front-end/inspector.js:
     20        (windowLoaded):
     21
    1222011-07-28  Kent Tamura  <tkent@chromium.org>
    223
  • trunk/Source/WebCore/WebCore.exp.in

    r92533 r92587  
    15831583__ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
    15841584__ZN7WebCore19InspectorController14enableProfilerEv
    1585 __ZN7WebCore19InspectorController15canAttachWindowEv
    15861585__ZN7WebCore19InspectorController15debuggerEnabledEv
    15871586__ZN7WebCore19InspectorController15disableDebuggerEv
     
    15891588__ZN7WebCore19InspectorController15profilerEnabledEv
    15901589__ZN7WebCore19InspectorController18disconnectFrontendEv
    1591 __ZN7WebCore19InspectorController19requestAttachWindowEv
    15921590__ZN7WebCore19InspectorController20stopTimelineProfilerEv
    15931591__ZN7WebCore19InspectorController21showAndEnableDebuggerEv
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r92384 r92587  
    510510}
    511511
    512 void InspectorController::requestAttachWindow()
    513 {
    514     if (!m_inspectorFrontendClient)
    515         return;
    516 
    517     m_inspectorFrontendClient->requestAttachWindow();
    518 }
    519    
    520 bool InspectorController::canAttachWindow()
    521 {
    522     if (!m_inspectorFrontendClient)
    523         return false;
    524    
    525     return m_inspectorFrontendClient->canAttachWindow();
    526 }
    527 
    528512} // namespace WebCore
    529513
  • trunk/Source/WebCore/inspector/InspectorController.h

    r92384 r92587  
    122122
    123123    void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
    124    
    125     void requestAttachWindow();
    126     bool canAttachWindow();
    127124
    128125private:
  • trunk/Source/WebCore/inspector/InspectorFrontendClient.h

    r92384 r92587  
    5959    virtual void requestDetachWindow() = 0;
    6060    virtual void changeAttachedWindowHeight(unsigned) = 0;
    61     virtual bool canAttachWindow() = 0;
    6261    virtual void saveAs(const WTF::String& fileName, const WTF::String& content) = 0;
    6362
  • trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h

    r92384 r92587  
    6565    virtual void requestDetachWindow();
    6666    virtual void changeAttachedWindowHeight(unsigned);
    67     virtual bool canAttachWindow();
    6867    virtual void saveAs(const String&, const String&) { }
    6968
     
    7271
    7372    virtual void sendMessageToBackend(const String& message);
     73
     74    bool canAttachWindow();
    7475
    7576    static unsigned constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight);
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r92284 r92587  
    592592    } else
    593593        WebInspector.loaded();
     594
     595    WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true");
    594596
    595597    window.removeEventListener("DOMContentLoaded", windowLoaded, false);
  • trunk/Source/WebKit/chromium/ChangeLog

    r92576 r92587  
     12011-08-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: implement dock/undock in WebKit2 without getting into WebCore.
     4        https://bugs.webkit.org/show_bug.cgi?id=65763
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * src/InspectorFrontendClientImpl.cpp:
     9        * src/InspectorFrontendClientImpl.h:
     10        * src/js/DevTools.js:
     11        (devtools.domContentLoaded):
     12
    1132011-08-07  James Kozianski  <koz@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp

    r92384 r92587  
    126126}
    127127
    128 bool InspectorFrontendClientImpl::canAttachWindow()
    129 {
    130     // FIXME: Implement this if it is ever called by Chromium.
    131     return false;
    132 }
    133    
    134128void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content)
    135129{
  • trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h

    r92384 r92587  
    6767    virtual void requestDetachWindow();
    6868    virtual void changeAttachedWindowHeight(unsigned);
    69     virtual bool canAttachWindow();
    7069    virtual void saveAs(const WTF::String& fileName, const WTF::String& content);
    7170
  • trunk/Source/WebKit/chromium/src/js/DevTools.js

    r92213 r92587  
    6666devtools.domContentLoaded = function()
    6767{
    68     WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true");
    6968    if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsObject.textColor)
    7069        WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColor, WebInspector.queryParamsObject.textColor);
  • trunk/Source/WebKit2/ChangeLog

    r92574 r92587  
     12011-08-05  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: implement dock/undock in WebKit2 without getting into WebCore.
     4        https://bugs.webkit.org/show_bug.cgi?id=65763
     5
     6        InspectorFrontendClient.h can't have synchronous canAttachWindow() returning value
     7        since in the multiprocess environment, you can't immediately get back to it from the host.
     8
     9        r92384 introduced an unhealthy WebKit -> WebCore -> WebKit canAttach query where embedder
     10        was asking itself a question. This loop was fixed.
     11
     12        Reviewed by Yury Semikhatsky.
     13
     14        * UIProcess/WebInspectorProxy.cpp:
     15        (WebKit::WebInspectorProxy::attach):
     16        (WebKit::WebInspectorProxy::createInspectorPage):
     17        (WebKit::WebInspectorProxy::didLoadInspectorPage):
     18        (WebKit::WebInspectorProxy::shouldOpenAttached):
     19        * UIProcess/WebInspectorProxy.h:
     20        * UIProcess/WebInspectorProxy.messages.in:
     21        * UIProcess/efl/WebInspectorEfl.cpp:
     22        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
     23        * UIProcess/gtk/WebInspectorGtk.cpp:
     24        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
     25        * UIProcess/mac/WebInspectorProxyMac.mm:
     26        (WebKit::WebInspectorProxy::platformOpen):
     27        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
     28        * UIProcess/qt/WebInspectorProxyQt.cpp:
     29        (WebKit::WebInspectorProxy::platformOpen):
     30        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
     31        * UIProcess/win/WebInspectorProxyWin.cpp:
     32        (WebKit::WebInspectorProxy::platformOpen):
     33        (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
     34        * WebProcess/WebPage/WebInspector.cpp:
     35        (WebKit::WebInspector::didLoadInspectorPage):
     36        * WebProcess/WebPage/WebInspector.h:
     37        * WebProcess/WebPage/WebInspector.messages.in:
     38
    1392011-08-07  Joseph Pecoraro  <joepeck@webkit.org>
    240
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp

    r92384 r92587  
    121121void WebInspectorProxy::attach()
    122122{
     123    if (!canAttach())
     124        return;
     125
    123126    m_isAttached = true;
    124    
     127
    125128    if (m_isVisible)
    126129        inspectorPageGroup()->preferences()->setInspectorStartsAttached(true);
     
    207210    inspectorPageParameters = inspectorPage->creationParameters();
    208211
    209     inspectorPage->loadURL(inspectorPageURL());
    210 }
    211 
    212 void WebInspectorProxy::didLoadInspectorPage(bool canStartAttached)
     212    String url = inspectorPageURL();
     213    if (shouldOpenAttached())
     214        url += "?docked=true";
     215    inspectorPage->loadURL(url);
     216}
     217
     218void WebInspectorProxy::didLoadInspectorPage()
    213219{
    214220    m_isVisible = true;
    215 
    216     bool willOpenAttached = canStartAttached && inspectorPageGroup()->preferences()->inspectorStartsAttached();
    217     platformOpen(willOpenAttached);
    218    
    219     if (willOpenAttached)
    220         m_page->process()->send(Messages::WebInspector::RequestAttachWindow(), m_page->pageID());
     221    m_isAttached = shouldOpenAttached();
     222
     223    // platformOpen is responsible for rendering attached mode depending on m_isAttached.
     224    platformOpen();
    221225}
    222226
     
    244248}
    245249
     250bool WebInspectorProxy::canAttach()
     251{
     252    unsigned inspectedWindowHeight = platformInspectedWindowHeight();
     253    return inspectedWindowHeight && minimumAttachedHeight <= (inspectedWindowHeight * 3 / 4);
     254}
     255
     256bool WebInspectorProxy::shouldOpenAttached()
     257{
     258    return inspectorPageGroup()->preferences()->inspectorStartsAttached() && canAttach();
     259}
     260
    246261} // namespace WebKit
    247262
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h

    r92384 r92587  
    115115
    116116    WebPageProxy* platformCreateInspectorPage();
    117     void platformOpen(bool willOpenAttached);
     117    void platformOpen();
    118118    void platformDidClose();
    119119    void platformBringToFront();
    120120    void platformInspectedURLChanged(const String&);
     121    unsigned platformInspectedWindowHeight();
    121122    void platformAttach();
    122123    void platformDetach();
     
    128129    // Called by WebInspectorProxy messages
    129130    void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
    130     void didLoadInspectorPage(bool canStartAttached);
     131    void didLoadInspectorPage();
    131132    void didClose();
    132133    void bringToFront();
    133134    void inspectedURLChanged(const String&);
     135
     136    bool canAttach();
     137    bool shouldOpenAttached();
    134138
    135139    static WebPageGroup* inspectorPageGroup();
     
    154158    static const unsigned initialWindowWidth = 750;
    155159    static const unsigned initialWindowHeight = 650;
     160    static const unsigned minimumAttachedHeight = 250;
    156161
    157162    WebPageProxy* m_page;
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in

    r92384 r92587  
    2525messages -> WebInspectorProxy {
    2626    CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
    27     DidLoadInspectorPage(bool canStartAttached)
     27    DidLoadInspectorPage()
    2828    DidClose()
    2929    BringToFront()
    3030    InspectedURLChanged(WTF::String urlString)
    31    
     31
    3232    Attach()
    3333    Detach()
  • trunk/Source/WebKit2/UIProcess/efl/WebInspectorEfl.cpp

    r88707 r92587  
    6666}
    6767
     68unsigned WebInspectorProxy::platformInspectedWindowHeight()
     69{
     70    notImplemented();
     71    return 0;
     72}
     73
    6874void WebInspectorProxy::platformAttach()
    6975{
  • trunk/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp

    r85457 r92587  
    6767}
    6868
     69unsigned WebInspectorProxy::platformInspectedWindowHeight()
     70{
     71    notImplemented();
     72    return 0;
     73}
     74
    6975void WebInspectorProxy::platformAttach()
    7076{
  • trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

    r92384 r92587  
    110110}
    111111
    112 void WebInspectorProxy::platformOpen(bool willOpenAttached)
     112void WebInspectorProxy::platformOpen()
    113113{
    114114    ASSERT(!m_inspectorWindow);
     
    136136    [contentView addSubview:m_inspectorView.get()];
    137137
    138     if (!willOpenAttached)
     138    m_inspectorWindow.adoptNS(window);
     139
     140    if (m_isAttached)
     141        platformAttach();
     142    else
    139143        [window makeKeyAndOrderFront:nil];
    140 
    141     m_inspectorWindow.adoptNS(window);
    142144}
    143145
     
    184186}
    185187
     188unsigned WebInspectorProxy::platformInspectedWindowHeight()
     189{
     190    WKView *inspectedView = m_page->wkView();
     191    NSRect inspectedViewRect = [inspectedView frame];
     192    return static_cast<unsigned>(inspectedViewRect.size.height);
     193}
     194
    186195void WebInspectorProxy::platformAttach()
    187196{
  • trunk/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp

    r92384 r92587  
    4040}
    4141
    42 void WebInspectorProxy::platformOpen(bool)
     42void WebInspectorProxy::platformOpen()
    4343{
    4444    notImplemented();
     
    5858{
    5959    notImplemented();
     60}
     61
     62unsigned WebInspectorProxy::platformInspectedWindowHeight()
     63{
     64    notImplemented();
     65    return 0;
    6066}
    6167
  • trunk/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp

    r92384 r92587  
    199199}
    200200
    201 void WebInspectorProxy::platformOpen(bool willOpenAttached)
     201void WebInspectorProxy::platformOpen()
    202202{
    203203    registerInspectorViewWindowClass();
     
    209209    m_inspectorView->setParentWindow(m_inspectorWindow);
    210210
    211     if (!willOpenAttached)
     211    if (m_isAttached)
     212        platformAttach();
     213    else
    212214        ::ShowWindow(m_inspectorWindow, SW_SHOW);
    213215}
     
    246248}
    247249
     250unsigned WebInspectorProxy::platformInspectedWindowHeight()
     251{
     252    HWND inspectedWindow = m_page->nativeWindow();
     253
     254    RECT inspectedWindowRect;
     255    ::GetWindowRect(inspectedWindow, &inspectedWindowRect);
     256
     257    return static_cast<unsigned>(inspectedWindowRect.bottom - inspectedWindowRect.top);
     258}
     259
    248260void WebInspectorProxy::platformAttach()
    249261{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp

    r92384 r92587  
    7979void WebInspector::didLoadInspectorPage()
    8080{
    81     WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(canAttachWindow()), m_page->pageID());
     81    WebProcess::shared().connection()->send(Messages::WebInspectorProxy::DidLoadInspectorPage(), m_page->pageID());
    8282}
    8383
     
    182182}
    183183
    184 void WebInspector::requestAttachWindow()
    185 {
    186     m_inspectorPage->corePage()->inspectorController()->requestAttachWindow();
    187 }
    188 
    189 bool WebInspector::canAttachWindow() const
    190 {
    191     return m_inspectorPage->corePage()->inspectorController()->canAttachWindow();
    192 }
    193 
    194184} // namespace WebKit
    195185
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h

    r92384 r92587  
    6060    void startPageProfiling();
    6161    void stopPageProfiling();
    62    
    63     bool canAttachWindow() const;
    64     void requestAttachWindow();
    6562
    6663private:
  • trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in

    r92384 r92587  
    3333    StartPageProfiling()
    3434    StopPageProfiling()
    35 
    36     RequestAttachWindow()
    3735}
    3836
Note: See TracChangeset for help on using the changeset viewer.