Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: third_party/WebKit/Source/devtools/front_end/elements/SharedSidebarModel.js

Issue 2144923002: DevTools: remove the ComputedStyles -> Styles pane dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/elements/SharedSidebarModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/SharedSidebarModel.js b/third_party/WebKit/Source/devtools/front_end/elements/SharedSidebarModel.js
deleted file mode 100644
index 1eb7e828b57ca539d3e3922f4a202fbc53ab1e68..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/devtools/front_end/elements/SharedSidebarModel.js
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @extends {WebInspector.Object}
- * @constructor
- */
-WebInspector.SharedSidebarModel = function()
-{
- WebInspector.Object.call(this);
- this._node = WebInspector.context.flavor(WebInspector.DOMNode);
- WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._onNodeChanged, this);
-}
-
-WebInspector.SharedSidebarModel.Events = {
- ComputedStyleChanged: "ComputedStyleChanged"
-}
-
-WebInspector.SharedSidebarModel.prototype = {
- /**
- * @return {?WebInspector.DOMNode}
- */
- node: function()
- {
- return this._node;
- },
-
- /**
- * @return {?WebInspector.CSSModel}
- */
- cssModel: function()
- {
- return this._cssModel;
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
- _onNodeChanged: function(event)
- {
- this._node = /** @type {?WebInspector.DOMNode} */(event.data);
- this._updateTarget(this._node ? this._node.target() : null);
- this._onComputedStyleChanged();
- },
-
- /**
- * @param {?WebInspector.Target} target
- */
- _updateTarget: function(target)
- {
- if (this._target === target)
- return;
- if (this._targetEvents) {
- WebInspector.EventTarget.removeEventListeners(this._targetEvents);
- this._targetEvents = null;
- }
- this._target = target;
- var domModel = null;
- if (target) {
- this._cssModel = WebInspector.CSSModel.fromTarget(target);
- domModel = WebInspector.DOMModel.fromTarget(target);
- }
-
- if (domModel && this._cssModel) {
- this._targetEvents = [
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetAdded, this._onComputedStyleChanged, this),
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetRemoved, this._onComputedStyleChanged, this),
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._onComputedStyleChanged, this),
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.MediaQueryResultChanged, this._onComputedStyleChanged, this),
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.PseudoStateForced, this._onComputedStyleChanged, this),
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.ModelWasEnabled, this._onComputedStyleChanged, this),
- domModel.addEventListener(WebInspector.DOMModel.Events.DOMMutated, this._onComputedStyleChanged, this)
- ];
- }
- },
-
- /**
- * @return {?WebInspector.DOMNode}
- */
- _elementNode: function()
- {
- return this.node() ? this.node().enclosingElementOrSelf() : null;
- },
-
- /**
- * @return {!Promise.<?WebInspector.SharedSidebarModel.ComputedStyle>}
- */
- fetchComputedStyle: function()
- {
- var elementNode = this._elementNode();
- var cssModel = this.cssModel();
- if (!elementNode || !cssModel)
- return Promise.resolve(/** @type {?WebInspector.SharedSidebarModel.ComputedStyle} */(null));
-
- if (!this._computedStylePromise)
- this._computedStylePromise = cssModel.computedStylePromise(elementNode.id).then(verifyOutdated.bind(this, elementNode));
-
- return this._computedStylePromise;
-
- /**
- * @param {!WebInspector.DOMNode} elementNode
- * @param {?Map.<string, string>} style
- * @return {?WebInspector.SharedSidebarModel.ComputedStyle}
- * @this {WebInspector.SharedSidebarModel}
- */
- function verifyOutdated(elementNode, style)
- {
- return elementNode === this._elementNode() && style ? new WebInspector.SharedSidebarModel.ComputedStyle(elementNode, style) : /** @type {?WebInspector.SharedSidebarModel.ComputedStyle} */(null);
- }
- },
-
- _onComputedStyleChanged: function()
- {
- delete this._computedStylePromise;
- this.dispatchEventToListeners(WebInspector.SharedSidebarModel.Events.ComputedStyleChanged);
- },
-
- __proto__: WebInspector.Object.prototype
-}
-
-/**
- * @constructor
- * @param {!WebInspector.DOMNode} node
- * @param {!Map.<string, string>} computedStyle
- */
-WebInspector.SharedSidebarModel.ComputedStyle = function(node, computedStyle)
-{
- this.node = node;
- this.computedStyle = computedStyle;
-}

Powered by Google App Engine
This is Rietveld 408576698