⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 107362 in webkit


Ignore:
Timestamp:
Feb 9, 2012, 10:23:49 PM (15 years ago)
Author:
timothy@apple.com
Message:

Prevent attaching when inspecting the Web Inspector.

Source/WebCore:

https://webkit.org/b/78304

Reviewed by Brian Weinstein.

  • inspector/InspectorFrontendClientLocal.cpp:

(WebCore::InspectorFrontendClientLocal::canAttachWindow): Prevent attaching when the page is an inspector page.

Source/WebKit2:

Also adds some comments about keeping in sync with InspectorFrontendClientLocal::canAttachWindow
and why there are two implementations of the same function.

https://webkit.org/b/78304

Reviewed by Brian Weinstein.

  • UIProcess/WebInspectorProxy.cpp:

(WebKit::WebInspectorProxy::canAttach): Prevent attaching when the page is an inspector page.
Added comments about InspectorFrontendClientLocal::canAttachWindow.

  • UIProcess/WebInspectorProxy.h:

(WebInspectorProxy): Added comment about keeping in sync with InspectorFrontendClientLocal.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107360 r107362  
     12012-02-09  Timothy Hatcher  <timothy@apple.com>
     2
     3        Prevent attaching when inspecting the Web Inspector.
     4
     5        https://webkit.org/b/78304
     6
     7        Reviewed by Brian Weinstein.
     8
     9        * inspector/InspectorFrontendClientLocal.cpp:
     10        (WebCore::InspectorFrontendClientLocal::canAttachWindow): Prevent attaching when the page is an inspector page.
     11
    1122012-02-09  Dana Jansens  <danakj@chromium.org>
    213
  • trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp

    r105600 r107362  
    160160bool InspectorFrontendClientLocal::canAttachWindow()
    161161{
     162    // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
     163    // Also don't allow attaching to another inspector -- two inspectors in one window is too much!
     164    bool isInspectorPage = m_inspectorController->inspectedPage()->inspectorController()->hasInspectorFrontendClient();
    162165    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
    163 
    164     // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
    165     return minimumAttachedHeight <= inspectedPageHeight * maximumAttachedHeightRatio;
     166    unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
     167    return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
    166168}
    167169
  • trunk/Source/WebKit2/ChangeLog

    r107359 r107362  
     12012-02-09  Timothy Hatcher  <timothy@apple.com>
     2
     3        Prevent attaching when inspecting the Web Inspector.
     4
     5        Also adds some comments about keeping in sync with InspectorFrontendClientLocal::canAttachWindow
     6        and why there are two implementations of the same function.
     7
     8        https://webkit.org/b/78304
     9
     10        Reviewed by Brian Weinstein.
     11
     12        * UIProcess/WebInspectorProxy.cpp:
     13        (WebKit::WebInspectorProxy::canAttach): Prevent attaching when the page is an inspector page.
     14        Added comments about InspectorFrontendClientLocal::canAttachWindow.
     15        * UIProcess/WebInspectorProxy.h:
     16        (WebInspectorProxy): Added comment about keeping in sync with InspectorFrontendClientLocal.
     17
    1182012-02-09  Alexey Proskuryakov  <ap@apple.com>
    219
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp

    r107028 r107362  
    261261bool WebInspectorProxy::canAttach()
    262262{
    263     unsigned inspectedWindowHeight = platformInspectedWindowHeight();
    264     return inspectedWindowHeight && minimumAttachedHeight <= (inspectedWindowHeight * 3 / 4);
     263    // Keep this in sync with InspectorFrontendClientLocal::canAttachWindow. There are two implementations
     264    // to make life easier in the multi-process world we have. WebInspectorProxy uses canAttach to decide if
     265    // we can attach on open (on the UI process side). And InspectorFrontendClientLocal::canAttachWindow is
     266    // used to decide if we can attach when the attach button is pressed (on the WebProcess side).
     267
     268    // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
     269    // Also don't allow attaching to another inspector -- two inspectors in one window is too much!
     270    bool isInspectorPage = m_page->pageGroup() == inspectorPageGroup();
     271    unsigned inspectedPageHeight = platformInspectedWindowHeight();
     272    unsigned maximumAttachedHeight = inspectedPageHeight * 3 / 4;
     273    return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
    265274}
    266275
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h

    r107028 r107362  
    165165    static const unsigned initialWindowWidth = 750;
    166166    static const unsigned initialWindowHeight = 650;
     167
     168    // Keep this in sync with the value in InspectorFrontendClientLocal.
    167169    static const unsigned minimumAttachedHeight = 250;
    168170
Note: See TracChangeset for help on using the changeset viewer.