Changeset 89659 in webkit


Ignore:
Timestamp:
Jun 24, 2011, 1:43:28 AM (14 years ago)
Author:
caseq@chromium.org
Message:

2011-06-24 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: extension panel iframes do not span entire panel client area
https://bugs.webkit.org/show_bug.cgi?id=63165

  • inspector/front-end/ExtensionServer.js: (WebInspector.ExtensionServer.prototype._onCreatePanel): (WebInspector.ExtensionServer.prototype.createClientIframe):
  • inspector/front-end/inspector.css: (iframe.extension): (iframe.panel.extension):

2011-06-24 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: extension panel iframes do not span entire panel client area
https://bugs.webkit.org/show_bug.cgi?id=63165

  • http/tests/inspector/extensions-test.js: (initialize_ExtensionsTest.InspectorTest.showPanel): ():
  • http/tests/inspector/inspector-test.js: ():
  • http/tests/inspector/resources/extension-main.html:
  • http/tests/inspector/resources/extension-main.js: (dumpObject): (dumpArray): (evaluateOnFrontend.callbackWrapper): (evaluateOnFrontend): ():
  • http/tests/inspector/resources/extension-panel.html:
  • inspector/extensions/extensions-events.html:
  • inspector/extensions/extensions-expected.txt:
  • inspector/extensions/extensions.html:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89656 r89659  
     12011-06-24  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: extension panel iframes do not span entire panel client area
     6        https://bugs.webkit.org/show_bug.cgi?id=63165
     7
     8        * http/tests/inspector/extensions-test.js:
     9        (initialize_ExtensionsTest.InspectorTest.showPanel):
     10        ():
     11        * http/tests/inspector/inspector-test.js:
     12        ():
     13        * http/tests/inspector/resources/extension-main.html:
     14        * http/tests/inspector/resources/extension-main.js:
     15        (dumpObject):
     16        (dumpArray):
     17        (evaluateOnFrontend.callbackWrapper):
     18        (evaluateOnFrontend):
     19        ():
     20        * http/tests/inspector/resources/extension-panel.html:
     21        * inspector/extensions/extensions-events.html:
     22        * inspector/extensions/extensions-expected.txt:
     23        * inspector/extensions/extensions.html:
     24
    1252011-06-24  Andrey Kosyakov  <caseq@chromium.org>
    226
  • trunk/LayoutTests/http/tests/inspector/extensions-test.js

    r89656 r89659  
    3434window.addEventListener("message", InspectorTest.safeWrap(onMessage), false);
    3535
     36InspectorTest.showPanel = function(panelId)
     37{
     38    if (panelId === "extension")
     39        panelId = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].name;
     40    WebInspector.showPanel(panelId);
     41}
     42
    3643InspectorTest.runExtensionTests = function()
    3744{
     
    5057}
    5158
     59function extension_showPanel(panelId, callback)
     60{
     61    evaluateOnFrontend("InspectorTest.showPanel(unescape('" + escape(panelId) + "')); reply();", callback);
     62}
     63
    5264var test = function()
    5365{
  • trunk/LayoutTests/http/tests/inspector/inspector-test.js

    r89557 r89659  
    403403        }
    404404
    405         WebInspector.showPanel("console");
     405        WebInspector.showPanel("audits");
    406406        try {
    407407            testFunction();
  • trunk/LayoutTests/http/tests/inspector/resources/extension-main.html

    r89656 r89659  
    11<html>
    22<head>
     3<script src="extension-main.js"></script>
    34<script type="text/javascript">
    4 
    5 function dumpObject(object, nondeterministicProps, prefix, firstLinePrefix)
    6 {
    7     prefix = prefix || "";
    8     firstLinePrefix = firstLinePrefix || prefix;
    9     output(firstLinePrefix + "{");
    10     for (var prop in object) {
    11         var prefixWithName = prefix + "    " + prop + " : ";
    12         var propValue = object[prop];
    13         if (nondeterministicProps && prop in nondeterministicProps)
    14             output(prefixWithName + "<" + typeof propValue + ">");
    15         else if (propValue === null)
    16             output(prefixWithName + "null");
    17         else if (typeof propValue === "object")
    18             dumpObject(propValue, nondeterministicProps, prefix + "    ", prefixWithName);
    19         else if (typeof propValue === "string")
    20             output(prefixWithName + "\"" + propValue + "\"");
    21         else if (typeof propValue === "function")
    22             output(prefixWithName + "<function>");
    23         else
    24             output(prefixWithName + propValue);
    25     }
    26     output(prefix + "}");
    27 }
    28 
    29 function dumpArray(result)
    30 {
    31     if (result instanceof Array) {
    32         for (var i = 0; i < result.length; ++i)
    33             output(result[i]);
    34     } else
    35         output(result);
    36 }
    37 
    38 function evaluateOnFrontend(expression, callback)
    39 {
    40     function callbackWrapper(event)
    41     {
    42         channel.port1.removeEventListener("message", callbackWrapper, false);
    43         callback(event.data.response);
    44     }
    45     var channel = new MessageChannel();
    46     channel.port1.start();
    47     if (callback)
    48         channel.port1.addEventListener("message", callbackWrapper, false);
    49     top.postMessage({ expression: expression }, [ channel.port2 ], "*");
    50 }
    51 
    52 function output(message)
    53 {
    54     evaluateOnFrontend("InspectorTest.addResult(unescape('" + escape(message) + "'));");
    55 }
    56 
    575output("Started extension.");
     6fetchTests();
    587</script>
    59 <script src="extension-main.js"></script>
    608</head>
    619</html>
  • trunk/LayoutTests/http/tests/inspector/resources/extension-main.js

    r89656 r89659  
     1function dumpObject(object, nondeterministicProps, prefix, firstLinePrefix)
     2{
     3    prefix = prefix || "";
     4    firstLinePrefix = firstLinePrefix || prefix;
     5    output(firstLinePrefix + "{");
     6    for (var prop in object) {
     7        var prefixWithName = prefix + "    " + prop + " : ";
     8        var propValue = object[prop];
     9        if (nondeterministicProps && prop in nondeterministicProps)
     10            output(prefixWithName + "<" + typeof propValue + ">");
     11        else if (propValue === null)
     12            output(prefixWithName + "null");
     13        else if (typeof propValue === "object")
     14            dumpObject(propValue, nondeterministicProps, prefix + "    ", prefixWithName);
     15        else if (typeof propValue === "string")
     16            output(prefixWithName + "\"" + propValue + "\"");
     17        else if (typeof propValue === "function")
     18            output(prefixWithName + "<function>");
     19        else
     20            output(prefixWithName + propValue);
     21    }
     22    output(prefix + "}");
     23}
     24
     25function dumpArray(result)
     26{
     27    if (result instanceof Array) {
     28        for (var i = 0; i < result.length; ++i)
     29            output(result[i]);
     30    } else
     31        output(result);
     32}
     33
     34function evaluateOnFrontend(expression, callback)
     35{
     36    function callbackWrapper(event)
     37    {
     38        channel.port1.removeEventListener("message", callbackWrapper, false);
     39        callback(event.data.response);
     40    }
     41    var channel = new MessageChannel();
     42    channel.port1.start();
     43    if (callback)
     44        channel.port1.addEventListener("message", callbackWrapper, false);
     45    top.postMessage({ expression: expression }, [ channel.port2 ], "*");
     46}
     47
     48function output(message)
     49{
     50    evaluateOnFrontend("InspectorTest.addResult(unescape('" + escape(message) + "'));");
     51}
     52
    153function onError(event)
    254{
     
    64116    return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); };
    65117}
    66 
    67 fetchTests();
  • trunk/LayoutTests/http/tests/inspector/resources/extension-panel.html

    r74234 r89659  
    11<html>
     2<head>
     3<script src="extension-main.js"></script>
     4<script type="text/javascript">
     5function onLoad()
     6{
     7    var width = window.innerWidth;
     8    var height = window.innerHeight;
     9    evaluateOnFrontend("if (InspectorTest.panelCallback) InspectorTest.panelCallback(" + width + "," + height +");");
     10}
     11</script>
     12</head>
     13<body onload="onLoad()">
     14</body>
    215</html>
  • trunk/LayoutTests/inspector/extensions/extensions-events.html

    r89656 r89659  
    44<script src="../../http/tests/inspector/extensions-test.js"></script>
    55<script type="text/javascript">
    6 
    7 function initialize_ExtensionEventTests()
    8 {
    9     InspectorTest.showPanel = function(panelId)
    10     {
    11         if (panelId === "extension")
    12             panelId = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].name;
    13         WebInspector.showPanel(panelId);
    14     }
    15 }
    16 
    17 function extension_showPanel(panelId, callback)
    18 {
    19     evaluateOnFrontend("InspectorTest.showPanel(unescape('" + escape(panelId) + "')); reply();", callback);
    20 }
    216
    227function extension_testOnSelectionChanged(nextTest)
  • trunk/LayoutTests/inspector/extensions/extensions-expected.txt

    r84499 r89659  
    44Running tests...
    55RUNNING TEST: extension_testCreatePanel
    6 done createPanel
    76Panel created
    87{
     
    2019    }
    2120}
     21Extension panel size correct
    2222RUNNING TEST: extension_testSidebarPage
    2323Sidebar created
  • trunk/LayoutTests/inspector/extensions/extensions.html

    r89656 r89659  
    1717        });
    1818    }
     19
     20    InspectorTest.panelCallback = function(width, height)
     21    {
     22        InspectorTest.checkPanelSize(width, height);
     23        var callback = InspectorTest._pendingPanelSizeTestCallback;
     24        if (callback) {
     25            delete InspectorTest._pendingPanelSizeTestCallback;
     26            callback();
     27        }
     28    }
     29
     30    InspectorTest.waitForPanel = function(callback)
     31    {
     32         InspectorTest._pendingPanelSizeTestCallback = callback;
     33    }
     34
     35    InspectorTest.checkPanelSize = function(width, height)
     36    {
     37        var extensionPanel = WebInspector.panelOrder[WebInspector.panelOrder.length - 1];
     38        var boundingRect = extensionPanel.element.parentElement.getBoundingClientRect();
     39        InspectorTest.assertEquals(boundingRect.width, width, "panel width mismatch");
     40        InspectorTest.assertEquals(boundingRect.height, height, "panel height mismatch");
     41        InspectorTest.addResult("Extension panel size correct");
     42    }
    1943}
    2044
    2145function extension_testCreatePanel(nextTest)
    2246{
     47    var callbackCount = 0;
     48
    2349    function onPanelCreated(panel)
    2450    {
    2551        output("Panel created");
    2652        dumpObject(panel);
     53        // This will force extension iframe to be really loaded and will cause waitForPanel() callback below.
     54        extension_showPanel("extension");
    2755    }
    28     webInspector.panels.create("Test Panel", "extension-panel.png", "extension-panel.html", callbackAndNextTest(onPanelCreated, nextTest));
    29     output("done createPanel");
     56    // The panel code is expected to report its size via InspectorTest.panelCallback()
     57    evaluateOnFrontend("InspectorTest.waitForPanel(reply);", nextTest);
     58    webInspector.panels.create("Test Panel", "extension-panel.png", "extension-panel.html", onPanelCreated);
    3059}
    3160
  • trunk/Source/WebCore/ChangeLog

    r89657 r89659  
     12011-06-24  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: extension panel iframes do not span entire panel client area
     6        https://bugs.webkit.org/show_bug.cgi?id=63165
     7
     8        * inspector/front-end/ExtensionServer.js:
     9        (WebInspector.ExtensionServer.prototype._onCreatePanel):
     10        (WebInspector.ExtensionServer.prototype.createClientIframe):
     11        * inspector/front-end/inspector.css:
     12        (iframe.extension):
     13        (iframe.panel.extension):
     14
    1152011-06-24  David Grogan  <dgrogan@chromium.org>
    216
  • trunk/Source/WebCore/inspector/front-end/ExtensionServer.js

    r87399 r89659  
    210210
    211211        var iframe = this.createClientIframe(panel.element, message.url);
    212         iframe.style.height = "100%";
     212        iframe.addStyleClass("panel");
    213213        return this._status.OK();
    214214    },
     
    234234        var iframe = document.createElement("iframe");
    235235        iframe.src = url;
    236         iframe.style.width = "100%";
     236        iframe.addStyleClass("extension");
    237237        parent.appendChild(iframe);
    238238        return iframe;
  • trunk/Source/WebCore/inspector/front-end/inspector.css

    r89558 r89659  
    930930}
    931931
     932iframe.extension {
     933    width: 100%;
     934}
     935
     936iframe.panel.extension {
     937    display: block;
     938    height: 100%;
     939}
     940
    932941.webkit-line-gutter-backdrop {
    933942    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
Note: See TracChangeset for help on using the changeset viewer.