| Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_00004b
|
| diff --git a/Source/devtools/front_end/CSSStyleModel.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_00004b
|
| similarity index 91%
|
| copy from Source/devtools/front_end/CSSStyleModel.js
|
| copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_00004b
|
| index f393e5d680570b71a4b9fc96130ccd12efb1c014..42fdeb9c2684703a5a249d23b2a270e77f14a8cf 100644
|
| --- a/Source/devtools/front_end/CSSStyleModel.js
|
| +++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_00004b
|
| @@ -42,8 +42,8 @@ WebInspector.CSSStyleModel = function(target)
|
| this._styleLoader = new WebInspector.CSSStyleModel.ComputedStyleLoader(this);
|
| this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoRequested, this._undoRedoRequested, this);
|
| this._domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
|
| - target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this);
|
| - target.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
|
| + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this);
|
| + InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
|
| this._agent.enable(this._wasEnabled.bind(this));
|
| this._resetStyleSheets();
|
| }
|
| @@ -245,13 +245,13 @@ WebInspector.CSSStyleModel.prototype = {
|
| },
|
|
|
| /**
|
| - * @param {!CSSAgent.CSSRule} rule
|
| + * @param {!CSSAgent.CSSRuleId} ruleId
|
| * @param {!DOMAgent.NodeId} nodeId
|
| * @param {string} newSelector
|
| * @param {function(!WebInspector.CSSRule)} successCallback
|
| * @param {function()} failureCallback
|
| */
|
| - setRuleSelector: function(rule, nodeId, newSelector, successCallback, failureCallback)
|
| + setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
|
| {
|
| /**
|
| * @param {!DOMAgent.NodeId} nodeId
|
| @@ -273,10 +273,9 @@ WebInspector.CSSStyleModel.prototype = {
|
| this._computeMatchingSelectors(rulePayload, nodeId, successCallback, failureCallback);
|
| }
|
|
|
| - if (!rule.styleSheetId)
|
| - throw "No rule stylesheet id";
|
| +
|
| this._pendingCommandsMajorState.push(true);
|
| - this._agent.setRuleSelector(rule.styleSheetId, rule.selectorRange, newSelector, callback.bind(this, nodeId, successCallback, failureCallback, newSelector));
|
| + this._agent.setRuleSelector(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback, newSelector));
|
| },
|
|
|
| /**
|
| @@ -356,7 +355,7 @@ WebInspector.CSSStyleModel.prototype = {
|
| */
|
| requestViaInspectorStylesheet: function(node, callback)
|
| {
|
| - var frameId = node.frameId() || this.target().resourceTreeModel.mainFrame.id;
|
| + var frameId = node.frameId() || WebInspector.resourceTreeModel.mainFrame.id;
|
| for (var styleSheetId in this._styleSheetIdToHeader) {
|
| var styleSheetHeader = this._styleSheetIdToHeader[styleSheetId];
|
| if (styleSheetHeader.frameId === frameId && styleSheetHeader.isViaInspector()) {
|
| @@ -671,7 +670,7 @@ WebInspector.CSSStyleModel.LiveLocation.prototype = {
|
| var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(cssLocation.url);
|
| if (!uiSourceCode)
|
| return null;
|
| - return uiSourceCode.uiLocation(cssLocation.lineNumber, cssLocation.columnNumber);
|
| + return new WebInspector.UILocation(uiSourceCode, cssLocation.lineNumber, cssLocation.columnNumber);
|
| },
|
|
|
| dispose: function()
|
| @@ -730,10 +729,10 @@ WebInspector.CSSLocation.prototype = {
|
| WebInspector.CSSStyleDeclaration = function(cssModel, payload)
|
| {
|
| this._cssModel = cssModel;
|
| - this.styleSheetId = payload.styleSheetId;
|
| + this.id = payload.styleId;
|
| this.width = payload.width;
|
| this.height = payload.height;
|
| - this.range = payload.range ? WebInspector.TextRange.fromObject(payload.range) : null;
|
| + this.range = payload.range;
|
| this._shorthandValues = WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries);
|
| this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
|
| this._allProperties = []; // ALL properties: [ CSSProperty ]
|
| @@ -802,21 +801,6 @@ WebInspector.CSSStyleDeclaration.parseComputedStylePayload = function(cssModel,
|
| }
|
|
|
| WebInspector.CSSStyleDeclaration.prototype = {
|
| - /**
|
| - * @param {string} styleSheetId
|
| - * @param {!WebInspector.TextRange} oldRange
|
| - * @param {!WebInspector.TextRange} newRange
|
| - */
|
| - sourceStyleSheetEdited: function(styleSheetId, oldRange, newRange)
|
| - {
|
| - if (this.styleSheetId !== styleSheetId)
|
| - return;
|
| - if (this.range)
|
| - this.range = this.range.rebaseAfterTextEdit(oldRange, newRange);
|
| - for (var i = 0; i < this._allProperties.length; ++i)
|
| - this._allProperties[i].sourceStyleSheetEdited(styleSheetId, oldRange, newRange);
|
| - },
|
| -
|
| _computeActiveProperties: function()
|
| {
|
| var activeProperties = {};
|
| @@ -919,23 +903,13 @@ WebInspector.CSSStyleDeclaration.prototype = {
|
| },
|
|
|
| /**
|
| - * @param {number} index
|
| - * @return {!WebInspector.TextRange}
|
| - */
|
| - _insertionRange: function(index)
|
| - {
|
| - var property = this.propertyAt(index);
|
| - return property && property.range ? property.range.collapseToStart() : this.range.collapseToEnd();
|
| - },
|
| -
|
| - /**
|
| * @param {number=} index
|
| * @return {!WebInspector.CSSProperty}
|
| */
|
| newBlankProperty: function(index)
|
| {
|
| index = (typeof index === "undefined") ? this.pastLastSourcePropertyIndex() : index;
|
| - var property = new WebInspector.CSSProperty(this, index, "", "", false, false, true, false, "", this._insertionRange(index));
|
| + var property = new WebInspector.CSSProperty(this, index, "", "", false, false, true, false, "");
|
| property._setActive(true);
|
| return property;
|
| },
|
| @@ -966,11 +940,11 @@ WebInspector.CSSStyleDeclaration.prototype = {
|
| userCallback(WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel, payload));
|
| }
|
|
|
| - if (!this.styleSheetId)
|
| - throw "No stylesheet id";
|
| + if (!this.id)
|
| + throw "No style id";
|
|
|
| this._cssModel._pendingCommandsMajorState.push(true);
|
| - this._cssModel._agent.setPropertyText(this.styleSheetId, this._insertionRange(index), name + ": " + value + ";", callback.bind(this));
|
| + this._cssModel._agent.setPropertyText(this.id, index, name + ": " + value + ";", false, callback.bind(this));
|
| },
|
|
|
| /**
|
| @@ -993,15 +967,10 @@ WebInspector.CSSStyleDeclaration.prototype = {
|
| WebInspector.CSSRule = function(cssModel, payload, matchingSelectors)
|
| {
|
| this._cssModel = cssModel;
|
| - this.styleSheetId = payload.styleSheetId;
|
| + this.id = payload.ruleId;
|
| if (matchingSelectors)
|
| this.matchingSelectors = matchingSelectors;
|
| this.selectors = payload.selectorList.selectors;
|
| - for (var i = 0; i < this.selectors.length; ++i) {
|
| - var selector = this.selectors[i];
|
| - if (selector.range)
|
| - selector.range = WebInspector.TextRange.fromObject(selector.range);
|
| - }
|
| this.selectorText = this.selectors.select("value").join(", ");
|
|
|
| var firstRange = this.selectors[0].range;
|
| @@ -1009,10 +978,7 @@ WebInspector.CSSRule = function(cssModel, payload, matchingSelectors)
|
| var lastRange = this.selectors.peekLast().range;
|
| this.selectorRange = new WebInspector.TextRange(firstRange.startLine, firstRange.startColumn, lastRange.endLine, lastRange.endColumn);
|
| }
|
| - if (this.styleSheetId) {
|
| - var styleSheetHeader = cssModel.styleSheetHeaderForId(this.styleSheetId);
|
| - this.sourceURL = styleSheetHeader.sourceURL;
|
| - }
|
| + this.sourceURL = payload.sourceURL;
|
| this.origin = payload.origin;
|
| this.style = WebInspector.CSSStyleDeclaration.parsePayload(this._cssModel, payload.style);
|
| this.style.parentRule = this;
|
| @@ -1033,34 +999,11 @@ WebInspector.CSSRule.parsePayload = function(cssModel, payload, matchingIndices)
|
| }
|
|
|
| WebInspector.CSSRule.prototype = {
|
| - /**
|
| - * @param {string} styleSheetId
|
| - * @param {!WebInspector.TextRange} oldRange
|
| - * @param {!WebInspector.TextRange} newRange
|
| - */
|
| - sourceStyleSheetEdited: function(styleSheetId, oldRange, newRange)
|
| - {
|
| - if (this.styleSheetId === styleSheetId) {
|
| - if (this.selectorRange)
|
| - this.selectorRange = this.selectorRange.rebaseAfterTextEdit(oldRange, newRange);
|
| - for (var i = 0; i < this.selectors.length; ++i) {
|
| - var selector = this.selectors[i];
|
| - if (selector.range)
|
| - selector.range = selector.range.rebaseAfterTextEdit(oldRange, newRange);
|
| - }
|
| - }
|
| - if (this.media) {
|
| - for (var i = 0; i < this.media.length; ++i)
|
| - this.media[i].sourceStyleSheetEdited(styleSheetId, oldRange, newRange);
|
| - }
|
| - this.style.sourceStyleSheetEdited(styleSheetId, oldRange, newRange);
|
| - },
|
| -
|
| _setRawLocationAndFrameId: function()
|
| {
|
| - if (!this.styleSheetId)
|
| + if (!this.id)
|
| return;
|
| - var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSheetId);
|
| + var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.id.styleSheetId);
|
| this.frameId = styleSheetHeader.frameId;
|
| var url = styleSheetHeader.resourceURL();
|
| if (!url)
|
| @@ -1073,9 +1016,9 @@ WebInspector.CSSRule.prototype = {
|
| */
|
| resourceURL: function()
|
| {
|
| - if (!this.styleSheetId)
|
| + if (!this.id)
|
| return "";
|
| - var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSheetId);
|
| + var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.id.styleSheetId);
|
| return styleSheetHeader.resourceURL();
|
| },
|
|
|
| @@ -1086,9 +1029,9 @@ WebInspector.CSSRule.prototype = {
|
| lineNumberInSource: function(selectorIndex)
|
| {
|
| var selector = this.selectors[selectorIndex];
|
| - if (!selector || !selector.range || !this.styleSheetId)
|
| + if (!selector || !selector.range)
|
| return 0;
|
| - var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSheetId);
|
| + var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.id.styleSheetId);
|
| return styleSheetHeader.lineNumberInSource(selector.range.startLine);
|
| },
|
|
|
| @@ -1099,9 +1042,9 @@ WebInspector.CSSRule.prototype = {
|
| columnNumberInSource: function(selectorIndex)
|
| {
|
| var selector = this.selectors[selectorIndex];
|
| - if (!selector || !selector.range || !this.styleSheetId)
|
| + if (!selector || !selector.range)
|
| return undefined;
|
| - var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.styleSheetId);
|
| + var styleSheetHeader = this._cssModel.styleSheetHeaderForId(this.id.styleSheetId);
|
| console.assert(styleSheetHeader);
|
| return styleSheetHeader.columnNumberInSource(selector.range.startLine, selector.range.startColumn);
|
| },
|
| @@ -1151,7 +1094,7 @@ WebInspector.CSSProperty = function(ownerStyle, index, name, value, important, d
|
| this.parsedOk = parsedOk;
|
| this.implicit = implicit;
|
| this.text = text;
|
| - this.range = range ? WebInspector.TextRange.fromObject(range) : null;
|
| + this.range = range;
|
| }
|
|
|
| /**
|
| @@ -1174,19 +1117,6 @@ WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
|
|
|
| WebInspector.CSSProperty.prototype = {
|
| /**
|
| - * @param {string} styleSheetId
|
| - * @param {!WebInspector.TextRange} oldRange
|
| - * @param {!WebInspector.TextRange} newRange
|
| - */
|
| - sourceStyleSheetEdited: function(styleSheetId, oldRange, newRange)
|
| - {
|
| - if (this.ownerStyle.styleSheetId !== styleSheetId)
|
| - return;
|
| - if (this.range)
|
| - this.range = this.range.rebaseAfterTextEdit(oldRange, newRange);
|
| - },
|
| -
|
| - /**
|
| * @param {boolean} active
|
| */
|
| _setActive: function(active)
|
| @@ -1270,14 +1200,13 @@ WebInspector.CSSProperty.prototype = {
|
| if (!this.ownerStyle)
|
| throw "No ownerStyle for property";
|
|
|
| - if (!this.ownerStyle.styleSheetId)
|
| + if (!this.ownerStyle.id)
|
| throw "No owner style id";
|
|
|
| // An index past all the properties adds a new property to the style.
|
| var cssModel = this.ownerStyle._cssModel;
|
| cssModel._pendingCommandsMajorState.push(majorChange);
|
| - var range = /** @type {!WebInspector.TextRange} */ (this.range);
|
| - cssModel._agent.setPropertyText(this.ownerStyle.styleSheetId, overwrite ? range : range.collapseToStart(), propertyText, callback.bind(this));
|
| + cssModel._agent.setPropertyText(this.ownerStyle.id, this.index, propertyText, overwrite, callback.bind(this));
|
| },
|
|
|
| /**
|
| @@ -1380,19 +1309,6 @@ WebInspector.CSSMedia.parseMediaArrayPayload = function(cssModel, payload)
|
|
|
| WebInspector.CSSMedia.prototype = {
|
| /**
|
| - * @param {string} styleSheetId
|
| - * @param {!WebInspector.TextRange} oldRange
|
| - * @param {!WebInspector.TextRange} newRange
|
| - */
|
| - sourceStyleSheetEdited: function(styleSheetId, oldRange, newRange)
|
| - {
|
| - if (this.parentStyleSheetId !== styleSheetId)
|
| - return;
|
| - if (this.range)
|
| - this.range = this.range.rebaseAfterTextEdit(oldRange, newRange);
|
| - },
|
| -
|
| - /**
|
| * @return {number|undefined}
|
| */
|
| lineNumberInSource: function()
|
| @@ -1514,7 +1430,7 @@ WebInspector.CSSStyleSheetHeader.prototype = {
|
| */
|
| _viaInspectorResourceURL: function()
|
| {
|
| - var frame = this._cssModel.target().resourceTreeModel.frameForId(this.frameId);
|
| + var frame = WebInspector.resourceTreeModel.frameForId(this.frameId);
|
| console.assert(frame);
|
| var parsedURL = new WebInspector.ParsedURL(frame.url);
|
| var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComponents;
|
|
|