Skip to content

Commit

Permalink
Revert of [DevTools] Consolidate overlay-related functionality in Ove…
Browse files Browse the repository at this point in the history
…rlay domain (patchset #7 id:120001 of https://codereview.chromium.org/2819183002/ )

Reason for revert:
This seems to be breaking the devtools closure compiler, i.e., closure is reporting an error:

https://luci-milo.appspot.com/buildbot/chromium.linux/Linux%20Tests/55326
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.linux%2FLinux_Tests%2F55326%2F%2B%2Frecipes%2Fsteps%2Fdevtools_closure_compile%2F0%2Fstdout

Command: /usr/bin/python ../../testing/scripts/run_devtools_check.py ../../third_party/WebKit/Source/devtools/scripts/compile_frontend.py --isolated-script-test-output=/b/s/w/ioH2ERuI/output.json --isolated-script-test-chartjson-output=/b/s/w/ioH2ERuI/chartjson-output.json

Java executable: /usr/bin/java
Compiling frontend...
Compiling devtools_compatibility.js...
Verifying JSDoc comments...
devtools_compatibility.js compilation output:
0 error(s), 0 warning(s), 95.2% typed

devtools frontend compilation output:
/b/s/w/itFkGMoq/tmp_x1qK7/front_end/emulation/DeviceModeModel.js:640: WARNING - Property renderingAgent never defined on SDK.Target
    this._target.renderingAgent().setShowViewportSizeOnResize(false);
                 ^^^^^^^^^^^^^^

0 error(s), 1 warning(s), 94.3% typed

ERRORS DETECTED
Running ['/usr/bin/python', '../../third_party/WebKit/Source/devtools/scripts/compile_frontend.py'] in None (env: None)
Command ['/usr/bin/python', '../../third_party/WebKit/Source/devtools/scripts/compile_frontend.py'] returned exit code 1

Original issue's description:
> [DevTools] Consolidate overlay-related functionality in Overlay domain
>
> This turns InspectorOverlay into InspectorOverlayAgent with respective
> lifetime and domain:
> - rendering domain merges into overlay;
> - Page.configureOverlay moves to overlay;
> - highlighting and inspect mode move from DOM to overlay.
>
> BUG=none
> [email protected]
>
> Review-Url: https://codereview.chromium.org/2819183002
> Cr-Original-Original-Commit-Position: refs/heads/master@{#465422}
> Committed: https://chromium.googlesource.com/chromium/src/+/8982f602a8e1f521949d8dd8dae58cff1c787bec
> Review-Url: https://codereview.chromium.org/2819183002
> Cr-Original-Commit-Position: refs/heads/master@{#465812}
> Committed: https://chromium.googlesource.com/chromium/src/+/7afbb9a64fbd30254a2dab9a689648621fa29f14
> Review-Url: https://codereview.chromium.org/2819183002
> Cr-Commit-Position: refs/heads/master@{#466489}
> Committed: https://chromium.googlesource.com/chromium/src/+/c8abe8c3b07d77195777e07180a4122f4d50246a

[email protected],[email protected],[email protected]
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=none

Review-Url: https://codereview.chromium.org/2835843002
Cr-Commit-Position: refs/heads/master@{#466557}
  • Loading branch information
dpranke authored and Commit bot committed Apr 23, 2017
1 parent 411c879 commit 24f4950
Show file tree
Hide file tree
Showing 28 changed files with 422 additions and 462 deletions.
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ all_devtools_files = [
"front_end/main/GCActionDelegate.js",
"front_end/main/Main.js",
"front_end/main/module.json",
"front_end/main/OverlayController.js",
"front_end/main/remoteDebuggingTerminatedScreen.css",
"front_end/main/renderingOptions.css",
"front_end/main/RenderingOptions.js",
Expand Down Expand Up @@ -476,7 +477,6 @@ all_devtools_files = [
"front_end/sdk/module.json",
"front_end/sdk/NetworkManager.js",
"front_end/sdk/NetworkRequest.js",
"front_end/sdk/OverlayModel.js",
"front_end/sdk/PaintProfiler.js",
"front_end/sdk/ProfileTreeModel.js",
"front_end/sdk/RemoteObject.js",
Expand Down
2 changes: 1 addition & 1 deletion front_end/accessibility/AXTreePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Accessibility.AXTreePane = class extends Accessibility.AccessibilitySubPane {
if (!this.node())
return;
// Highlight and scroll into view the currently inspected node.
this.node().domModel().overlayModel().nodeHighlightRequested(this.node().id);
this.node().domModel().nodeHighlightRequested(this.node().id);
}
}

Expand Down
2 changes: 1 addition & 1 deletion front_end/accessibility/AccessibilityModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Accessibility.AccessibilityNode = class {
this.deferredDOMNode().resolvePromise().then(node => {
if (!node)
return;
node.domModel().overlayModel().nodeHighlightRequested(node.id);
node.domModel().nodeHighlightRequested(node.id);
});
}

Expand Down
2 changes: 1 addition & 1 deletion front_end/components/DOMPresentationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Components.DOMPresentationUtils.linkifyNodeReference = function(node, idref) {

link.addEventListener('click', Common.Revealer.reveal.bind(Common.Revealer, node, undefined), false);
link.addEventListener('mouseover', node.highlight.bind(node, undefined, undefined), false);
link.addEventListener('mouseleave', () => SDK.OverlayModel.hideDOMNodeHighlight(), false);
link.addEventListener('mouseleave', SDK.DOMModel.hideDOMNodeHighlight.bind(SDK.DOMModel), false);

return root;
};
Expand Down
2 changes: 1 addition & 1 deletion front_end/elements/ElementsBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Elements.ElementsBreadcrumbs = class extends UI.HBox {

_mouseMovedOutOfCrumbs(event) {
if (this._currentDOMNode)
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
}


Expand Down
2 changes: 1 addition & 1 deletion front_end/elements/ElementsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Elements.ElementsPanel = class extends UI.Panel {
willHide() {
UI.context.setFlavor(Elements.ElementsPanel, null);

SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
for (var i = 0; i < this._treeOutlines.length; ++i) {
var treeOutline = this._treeOutlines[i];
treeOutline.setVisible(false);
Expand Down
5 changes: 2 additions & 3 deletions front_end/elements/ElementsTreeElementHighlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ Elements.ElementsTreeElementHighlighter = class {
this._treeOutline.addEventListener(UI.TreeOutline.Events.ElementCollapsed, this._clearState, this);
this._treeOutline.addEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._clearState, this);
SDK.targetManager.addModelListener(
SDK.OverlayModel, SDK.OverlayModel.Events.HighlightNodeRequested, this._highlightNode, this);
this._treeOutline.domModel().overlayModel().addEventListener(
SDK.OverlayModel.Events.InspectModeWillBeToggled, this._clearState, this);
SDK.DOMModel, SDK.DOMModel.Events.NodeHighlightedInOverlay, this._highlightNode, this);
this._treeOutline.domModel().addEventListener(SDK.DOMModel.Events.InspectModeWillBeToggled, this._clearState, this);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions front_end/elements/ElementsTreeOutline.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,20 +620,20 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline {
this.setHoverEffect(element);

if (element instanceof Elements.ElementsTreeElement) {
this._domModel.overlayModel().highlightDOMNodeWithConfig(
this._domModel.highlightDOMNodeWithConfig(
element.node().id, {mode: 'all', showInfo: !UI.KeyboardShortcut.eventHasCtrlOrMeta(event)});
return;
}

if (element instanceof Elements.ElementsTreeOutline.ShortcutTreeElement) {
this._domModel.overlayModel().highlightDOMNodeWithConfig(
this._domModel.highlightDOMNodeWithConfig(
undefined, {mode: 'all', showInfo: !UI.KeyboardShortcut.eventHasCtrlOrMeta(event)}, element.backendNodeId());
}
}

_onmouseleave(event) {
this.setHoverEffect(null);
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
}

_ondragstart(event) {
Expand All @@ -653,7 +653,7 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline {
event.dataTransfer.effectAllowed = 'copyMove';
this._treeElementBeingDragged = treeElement;

SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();

return true;
}
Expand Down Expand Up @@ -971,7 +971,7 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline {
this.selectDOMNode(null, false);
this._popoverHelper.hidePopover();
delete this._clipboardNodeData;
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
this._updateRecords.clear();
}

Expand Down
38 changes: 19 additions & 19 deletions front_end/elements/InspectElementModeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,46 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @implements {SDK.SDKModelObserver<!SDK.OverlayModel>}
* @implements {SDK.SDKModelObserver<!SDK.DOMModel>}
* @unrestricted
*/
Elements.InspectElementModeController = class {
constructor() {
this._toggleSearchAction = UI.actionRegistry.action('elements.toggle-element-search');
this._mode = Protocol.Overlay.InspectMode.None;
this._mode = Protocol.DOM.InspectMode.None;
SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChanged, this._suspendStateChanged, this);
SDK.targetManager.observeModels(SDK.OverlayModel, this);
SDK.targetManager.observeModels(SDK.DOMModel, this);
}

/**
* @override
* @param {!SDK.OverlayModel} overlayModel
* @param {!SDK.DOMModel} domModel
*/
modelAdded(overlayModel) {
modelAdded(domModel) {
// When DevTools are opening in the inspect element mode, the first target comes in
// much later than the InspectorFrontendAPI.enterInspectElementMode event.
if (this._mode === Protocol.Overlay.InspectMode.None)
if (this._mode === Protocol.DOM.InspectMode.None)
return;
overlayModel.setInspectMode(this._mode);
domModel.setInspectMode(this._mode);
}

/**
* @override
* @param {!SDK.OverlayModel} overlayModel
* @param {!SDK.DOMModel} domModel
*/
modelRemoved(overlayModel) {
modelRemoved(domModel) {
}

/**
* @return {boolean}
*/
isInInspectElementMode() {
return this._mode === Protocol.Overlay.InspectMode.SearchForNode ||
this._mode === Protocol.Overlay.InspectMode.SearchForUAShadowDOM;
return this._mode === Protocol.DOM.InspectMode.SearchForNode ||
this._mode === Protocol.DOM.InspectMode.SearchForUAShadowDOM;
}

stopInspection() {
if (this._mode && this._mode !== Protocol.Overlay.InspectMode.None)
if (this._mode && this._mode !== Protocol.DOM.InspectMode.None)
this._toggleInspectMode();
}

Expand All @@ -75,30 +75,30 @@ Elements.InspectElementModeController = class {

var mode;
if (this.isInInspectElementMode()) {
mode = Protocol.Overlay.InspectMode.None;
mode = Protocol.DOM.InspectMode.None;
} else {
mode = Common.moduleSetting('showUAShadowDOM').get() ? Protocol.Overlay.InspectMode.SearchForUAShadowDOM :
Protocol.Overlay.InspectMode.SearchForNode;
mode = Common.moduleSetting('showUAShadowDOM').get() ? Protocol.DOM.InspectMode.SearchForUAShadowDOM :
Protocol.DOM.InspectMode.SearchForNode;
}

this._setMode(mode);
}

/**
* @param {!Protocol.Overlay.InspectMode} mode
* @param {!Protocol.DOM.InspectMode} mode
*/
_setMode(mode) {
this._mode = mode;
for (var overlayModel of SDK.targetManager.models(SDK.OverlayModel))
overlayModel.setInspectMode(mode);
for (var domModel of SDK.targetManager.models(SDK.DOMModel))
domModel.setInspectMode(mode);
this._toggleSearchAction.setToggled(this.isInInspectElementMode());
}

_suspendStateChanged() {
if (!SDK.targetManager.allTargetsSuspended())
return;

this._mode = Protocol.Overlay.InspectMode.None;
this._mode = Protocol.DOM.InspectMode.None;
this._toggleSearchAction.setToggled(false);
}
};
Expand Down
2 changes: 1 addition & 1 deletion front_end/elements/MetricsSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Elements.MetricsSidebarPane = class extends Elements.ElementsSidebarPane {
this.node().highlight(mode);
} else {
delete this._highlightMode;
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
}

for (var i = 0; this._boxElements && i < this._boxElements.length; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions front_end/elements/StylesSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ Elements.StylePropertiesSection = class {
_onMouseOutSelector() {
if (this._hoverTimer)
clearTimeout(this._hoverTimer);
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
}

_onMouseEnterSelector() {
Expand All @@ -846,11 +846,11 @@ Elements.StylePropertiesSection = class {
}

_highlight() {
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
var node = this._parentPane.node();
var domModel = node.domModel();
var selectors = this._style.parentRule ? this._style.parentRule.selectorText() : undefined;
node.domModel().overlayModel().highlightDOMNodeWithConfig(
node.id, {mode: 'all', showInfo: undefined, selectors: selectors});
domModel.highlightDOMNodeWithConfig(node.id, {mode: 'all', showInfo: undefined, selectors: selectors});
}

/**
Expand Down
5 changes: 2 additions & 3 deletions front_end/emulation/DeviceModeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,8 @@ Emulation.DeviceModeModel = class {
this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile,
this._uaSetting.get() === Emulation.DeviceModeModel.UA.Mobile);
}
var overlayModel = this._target ? this._target.model(SDK.OverlayModel) : null;
if (overlayModel)
overlayModel.setShowViewportSizeOnResize(this._type === Emulation.DeviceModeModel.Type.None);
if (this._target)
this._target.renderingAgent().setShowViewportSizeOnResize(this._type === Emulation.DeviceModeModel.Type.None);
this._updateCallback.call(null);
}

Expand Down
8 changes: 4 additions & 4 deletions front_end/emulation/DeviceModeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ Emulation.DeviceModeView = class extends UI.VBox {
* @return {!Promise}
*/
async captureScreenshot() {
SDK.OverlayModel.muteHighlight();
SDK.DOMModel.muteHighlight();
var screenshot = await this._model.captureScreenshot(false);
SDK.OverlayModel.unmuteHighlight();
SDK.DOMModel.unmuteHighlight();
if (screenshot === null)
return;

Expand Down Expand Up @@ -410,9 +410,9 @@ Emulation.DeviceModeView = class extends UI.VBox {
* @return {!Promise}
*/
async captureFullSizeScreenshot() {
SDK.OverlayModel.muteHighlight();
SDK.DOMModel.muteHighlight();
var screenshot = await this._model.captureScreenshot(true);
SDK.OverlayModel.unmuteHighlight();
SDK.DOMModel.unmuteHighlight();
if (screenshot === null)
return;

Expand Down
22 changes: 10 additions & 12 deletions front_end/emulation/TouchModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Emulation.MultitargetTouchModel = class {
if (this._customTouchEnabled)
current = {enabled: true, configuration: 'mobile'};

var overlayModel = target.model(SDK.OverlayModel);
var inspectModeEnabled = overlayModel ? overlayModel.inspectModeEnabled() : false;
var domModel = target.model(SDK.DOMModel);
var inspectModeEnabled = domModel ? domModel.inspectModeEnabled() : false;
if (inspectModeEnabled)
current = {enabled: false, configuration: 'mobile'};

Expand Down Expand Up @@ -107,18 +107,18 @@ Emulation.MultitargetTouchModel = class {
* @param {!Common.Event} event
*/
_inspectModeToggled(event) {
var overlayModel = /** @type {!SDK.OverlayModel} */ (event.data);
this._applyToTarget(overlayModel.target());
var domModel = /** @type {!SDK.DOMModel} */ (event.data);
this._applyToTarget(domModel.target());
}

/**
* @override
* @param {!SDK.Target} target
*/
targetAdded(target) {
var overlayModel = target.model(SDK.OverlayModel);
if (overlayModel)
overlayModel.addEventListener(SDK.OverlayModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this);
var domModel = target.model(SDK.DOMModel);
if (domModel)
domModel.addEventListener(SDK.DOMModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this);
this._applyToTarget(target);
}

Expand All @@ -127,11 +127,9 @@ Emulation.MultitargetTouchModel = class {
* @param {!SDK.Target} target
*/
targetRemoved(target) {
var overlayModel = target.model(SDK.OverlayModel);
if (overlayModel) {
overlayModel.removeEventListener(
SDK.OverlayModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this);
}
var domModel = target.model(SDK.DOMModel);
if (domModel)
domModel.removeEventListener(SDK.DOMModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this);
}
};

Expand Down
2 changes: 1 addition & 1 deletion front_end/layer_viewer/LayerViewHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,6 @@ LayerViewer.LayerViewHost = class {
node.highlightForTwoSeconds();
return;
}
SDK.OverlayModel.hideDOMNodeHighlight();
SDK.DOMModel.hideDOMNodeHighlight();
}
};
5 changes: 3 additions & 2 deletions front_end/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Main.Main = class {
Persistence.persistence =
new Persistence.Persistence(Workspace.workspace, Bindings.breakpointManager, Workspace.fileSystemMapping);

new Main.OverlayController();
new Main.ExecutionContextSelector(SDK.targetManager, UI.context);
Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWorkspaceBinding);

Expand Down Expand Up @@ -796,8 +797,7 @@ Main.Main.PauseListener = class {
*/
Main.Main.InspectedNodeRevealer = class {
constructor() {
SDK.targetManager.addModelListener(
SDK.OverlayModel, SDK.OverlayModel.Events.InspectNodeRequested, this._inspectNode, this);
SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.NodeInspected, this._inspectNode, this);
}

/**
Expand Down Expand Up @@ -933,6 +933,7 @@ Main.BackendSettingsSync = class {
*/
targetAdded(target) {
this._updateTarget(target);
target.renderingAgent().setShowViewportSizeOnResize(true);
}

/**
Expand Down
Loading

0 comments on commit 24f4950

Please sign in to comment.