Commit a8f945fa authored by dgozman@chromium.org's avatar dgozman@chromium.org

Revert of [DevTools] Inject element into toolbox window, do not load modules...

Revert of [DevTools] Inject element into toolbox window, do not load modules there. (patchset #2 id:150001 of https://codereview.chromium.org/653613002/)

Reason for revert:
Breaks all references to "document".

Original issue's description:
> [DevTools] Inject element into toolbox window, do not load modules there.
> 
> BUG=none
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183669

TBR=pfeldman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=none

Review URL: https://codereview.chromium.org/660503002

git-svn-id: svn://svn.chromium.org/blink/trunk@183744 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 61e613b1
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "bindings/core/v8/V8InspectorFrontendHost.h" #include "bindings/core/v8/V8InspectorFrontendHost.h"
#include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8Document.h"
#include "bindings/core/v8/V8MouseEvent.h" #include "bindings/core/v8/V8MouseEvent.h"
#include "bindings/core/v8/V8Window.h" #include "bindings/core/v8/V8Window.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
...@@ -147,17 +146,12 @@ void V8InspectorFrontendHost::showContextMenuAtPointMethodCustom(const v8::Funct ...@@ -147,17 +146,12 @@ void V8InspectorFrontendHost::showContextMenuAtPointMethodCustom(const v8::Funct
if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info.GetIsolate())) if (!populateContextMenuItems(v8::Local<v8::Array>::Cast(array), menu, info.GetIsolate()))
return; return;
LocalDOMWindow* window = nullptr; v8::Isolate* isolate = info.GetIsolate();
if (info.Length() >= 4) { v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain(isolate->GetEnteredContext()->Global(), isolate);
window = toDOMWindow(info[3], info.GetIsolate()); if (windowWrapper.IsEmpty())
} else { return;
v8::Isolate* isolate = info.GetIsolate(); LocalDOMWindow* window = V8Window::toImpl(windowWrapper);
v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain(isolate->GetEnteredContext()->Global(), isolate); if (!window->document() || !window->document()->page())
if (windowWrapper.IsEmpty())
return;
window = V8Window::toImpl(windowWrapper);
}
if (!window || !window->document() || !window->document()->page())
return; return;
InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toImpl(info.Holder()); InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toImpl(info.Holder());
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
[Custom] DOMString port(); [Custom] DOMString port();
// FIXME: showContextMenu is here only for old frontends. Remove in M43. // FIXME: showContextMenu is here only for old frontends. Remove in M43.
[Custom] void showContextMenu(MouseEvent event, any items); [Custom] void showContextMenu(MouseEvent event, any items);
[Custom] void showContextMenuAtPoint(float x, float y, any items, optional DOMWindow window); [Custom] void showContextMenuAtPoint(float x, float y, any items);
void sendMessageToBackend(DOMString message); void sendMessageToBackend(DOMString message);
void sendMessageToEmbedder(DOMString message); void sendMessageToEmbedder(DOMString message);
......
...@@ -31,10 +31,6 @@ ...@@ -31,10 +31,6 @@
/** @interface */ /** @interface */
function InspectorFrontendHostAPI() function InspectorFrontendHostAPI()
{ {
/**
* @type {!WebInspector.EventTarget}
*/
this.events;
} }
/** @typedef {{type:string, id:(number|undefined), /** @typedef {{type:string, id:(number|undefined),
...@@ -276,9 +272,8 @@ InspectorFrontendHostAPI.prototype = { ...@@ -276,9 +272,8 @@ InspectorFrontendHostAPI.prototype = {
* @param {number} x * @param {number} x
* @param {number} y * @param {number} y
* @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items * @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
* @param {!Window} window
*/ */
showContextMenuAtPoint: function(x, y, items, window) { }, showContextMenuAtPoint: function(x, y, items) { },
/** /**
* @return {boolean} * @return {boolean}
...@@ -591,9 +586,8 @@ WebInspector.InspectorFrontendHostStub.prototype = { ...@@ -591,9 +586,8 @@ WebInspector.InspectorFrontendHostStub.prototype = {
* @param {number} x * @param {number} x
* @param {number} y * @param {number} y
* @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items * @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
* @param {!Window} window
*/ */
showContextMenuAtPoint: function(x, y, items, window) showContextMenuAtPoint: function(x, y, items)
{ {
throw "Soft context menu should be used"; throw "Soft context menu should be used";
}, },
......
...@@ -88,26 +88,16 @@ WebInspector.AdvancedApp.prototype = { ...@@ -88,26 +88,16 @@ WebInspector.AdvancedApp.prototype = {
}, },
/** /**
* @param {!Element} rootElement * @param {!WebInspector.ResponsiveDesignView} responsiveDesignView
* @override * @param {!WebInspector.InspectedPagePlaceholder} placeholder
*/ */
toolboxLoaded: function(rootElement) toolboxLoaded: function(responsiveDesignView, placeholder)
{ {
var inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder(); this._toolboxResponsiveDesignView = responsiveDesignView;
inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this, true)); placeholder.addEventListener(WebInspector.InspectedPagePlaceholder.Events.Update, this._onSetInspectedPageBounds.bind(this, true));
this._toolboxResponsiveDesignView = new WebInspector.ResponsiveDesignView(inspectedPagePlaceholder);
this._toolboxResponsiveDesignView.show(rootElement);
this._updatePageResizer(); this._updatePageResizer();
}, },
/**
* @return {!InspectorFrontendHostAPI}
*/
inspectorFrontendHost: function()
{
return window.InspectorFrontendHost;
},
_updatePageResizer: function() _updatePageResizer: function()
{ {
if (this._isDocked()) if (this._isDocked())
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
"name": "ui", "name": "ui",
"type": "autostart" "type": "autostart"
}, },
{
"name": "sdk",
"type": "autostart"
},
{ {
"name": "host", "name": "host",
"type": "autostart" "type": "autostart"
...@@ -11,6 +15,18 @@ ...@@ -11,6 +15,18 @@
"name": "common", "name": "common",
"type": "autostart" "type": "autostart"
}, },
{
"name": "toolbox",
"type": "autostart"
},
{
"name": "bindings",
"type": "autostart"
},
{
"name": "workspace",
"type": "autostart"
},
{ {
"name": "toolbox_bootstrap", "name": "toolbox_bootstrap",
"type": "autostart" "type": "autostart"
......
...@@ -143,7 +143,7 @@ WebInspector.MediaQueryInspector.prototype = { ...@@ -143,7 +143,7 @@ WebInspector.MediaQueryInspector.prototype = {
} }
var contextMenuItems = uiLocations.keys().sort(); var contextMenuItems = uiLocations.keys().sort();
var contextMenu = new WebInspector.ContextMenu(event, this.element.ownerDocument.defaultView); var contextMenu = new WebInspector.ContextMenu(event);
var subMenuItem = contextMenu.appendSubMenuItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in source code" : "Reveal In Source Code")); var subMenuItem = contextMenu.appendSubMenuItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in source code" : "Reveal In Source Code"));
for (var i = 0; i < contextMenuItems.length; ++i) { for (var i = 0; i < contextMenuItems.length; ++i) {
var title = contextMenuItems[i]; var title = contextMenuItems[i];
......
...@@ -9,12 +9,8 @@ WebInspector.ToolboxDelegate = function() {} ...@@ -9,12 +9,8 @@ WebInspector.ToolboxDelegate = function() {}
WebInspector.ToolboxDelegate.prototype = { WebInspector.ToolboxDelegate.prototype = {
/** /**
* @param {!Element} rootElement * @param {!WebInspector.ResponsiveDesignView} responsiveDesignView
* @param {!WebInspector.InspectedPagePlaceholder} placeholder
*/ */
toolboxLoaded: function(rootElement) {}, toolboxLoaded: function(responsiveDesignView, placeholder) {}
/**
* @return {!InspectorFrontendHostAPI}
*/
inspectorFrontendHost: function() {}
} }
...@@ -10,14 +10,24 @@ WebInspector.Toolbox = function() ...@@ -10,14 +10,24 @@ WebInspector.Toolbox = function()
if (!window.opener) if (!window.opener)
return; return;
var delegate = /** @type {!WebInspector.ToolboxDelegate} */ (window.opener.WebInspector["app"]); WebInspector.zoomManager = new WebInspector.ZoomManager(window.opener.InspectorFrontendHost);
WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport;
WebInspector.zoomManager = new WebInspector.ZoomManager(delegate.inspectorFrontendHost()); WebInspector.settings = window.opener.WebInspector.settings;
WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSettings;
WebInspector.targetManager = window.opener.WebInspector.targetManager;
WebInspector.workspace = window.opener.WebInspector.workspace;
WebInspector.cssWorkspaceBinding = window.opener.WebInspector.cssWorkspaceBinding;
WebInspector.Revealer = window.opener.WebInspector.Revealer;
WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu;
WebInspector.installPortStyles(); WebInspector.installPortStyles();
var delegate = /** @type {!WebInspector.ToolboxDelegate} */ (window.opener.WebInspector["app"]);
var rootView = new WebInspector.RootView(); var rootView = new WebInspector.RootView();
delegate.toolboxLoaded(rootView.element); var inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder();
this._responsiveDesignView = new WebInspector.ResponsiveDesignView(inspectedPagePlaceholder);
this._responsiveDesignView.show(rootView.element);
rootView.attachToBody(); rootView.attachToBody();
delegate.toolboxLoaded(this._responsiveDesignView, inspectedPagePlaceholder);
} }
// FIXME: This stub is invoked from the backend and should be removed // FIXME: This stub is invoked from the backend and should be removed
......
{ {
"dependencies": [ "dependencies": [
"ui", "toolbox"
"host",
"common"
], ],
"scripts": [ "scripts": [
"Toolbox.js" "Toolbox.js"
......
...@@ -197,9 +197,8 @@ WebInspector.ContextSubMenuItem.prototype = { ...@@ -197,9 +197,8 @@ WebInspector.ContextSubMenuItem.prototype = {
* @constructor * @constructor
* @extends {WebInspector.ContextSubMenuItem} * @extends {WebInspector.ContextSubMenuItem}
* @param {!Event} event * @param {!Event} event
* @param {!Window=} opt_window
*/ */
WebInspector.ContextMenu = function(event, opt_window) WebInspector.ContextMenu = function(event)
{ {
WebInspector.ContextSubMenuItem.call(this, this, ""); WebInspector.ContextSubMenuItem.call(this, this, "");
/** @type {!Array.<!Promise.<!WebInspector.ContextMenu.Provider> >} */ /** @type {!Array.<!Promise.<!WebInspector.ContextMenu.Provider> >} */
...@@ -211,7 +210,6 @@ WebInspector.ContextMenu = function(event, opt_window) ...@@ -211,7 +210,6 @@ WebInspector.ContextMenu = function(event, opt_window)
this._y = event.y; this._y = event.y;
this._handlers = {}; this._handlers = {};
this._id = 0; this._id = 0;
this._window = opt_window || window;
} }
WebInspector.ContextMenu.initialize = function() WebInspector.ContextMenu.initialize = function()
...@@ -280,7 +278,7 @@ WebInspector.ContextMenu.prototype = { ...@@ -280,7 +278,7 @@ WebInspector.ContextMenu.prototype = {
var softMenu = new WebInspector.SoftContextMenu(menuObject, this._itemSelected.bind(this)); var softMenu = new WebInspector.SoftContextMenu(menuObject, this._itemSelected.bind(this));
softMenu.show(this._x, this._y); softMenu.show(this._x, this._y);
} else { } else {
InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, menuObject, this._window); InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, menuObject);
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuCleared, this._menuCleared, this); InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuCleared, this._menuCleared, this);
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuItemSelected, this._onItemSelected, this); InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ContextMenuItemSelected, this._onItemSelected, this);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment