Changeset 121672 in webkit
- Timestamp:
- Jul 2, 2012 5:13:19 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121671 r121672 1 2012-06-26 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: StyleSource should set content using CSSStyleModelResourceBinding directly. 4 https://bugs.webkit.org/show_bug.cgi?id=89891 5 6 Reviewed by Pavel Feldman. 7 8 StyleSource now calls CSS resource binding directly. 9 CSS resource binding now adds resource revision only after setStyleSheetText call returns from backend. 10 Resource.revertAndClearHistory is now clearing history asynchronously 11 since Resource.setContent adds revision that should be removed as well. 12 13 * inspector/front-end/CSSStyleModel.js: 14 (WebInspector.CSSStyleModel.prototype.getViaInspectorResourceForRule): 15 (WebInspector.CSSStyleModel.prototype.resourceBinding): 16 (WebInspector.CSSStyleModelResourceBinding.prototype.setStyleContent.innerCallback): 17 (WebInspector.CSSStyleModelResourceBinding.prototype.setStyleContent): 18 (WebInspector.CSSStyleModelResourceBinding.prototype.setContent): 19 * inspector/front-end/Resource.js: 20 (WebInspector.Resource.prototype.revertAndClearHistory): 21 (WebInspector.Resource.prototype.revertAndClearHistory.clearHistory): 22 * inspector/front-end/RevisionHistoryView.js: 23 (WebInspector.RevisionHistoryView.prototype._createResourceItem): 24 * inspector/front-end/StylesPanel.js: 25 (WebInspector.StyleSource.prototype.workingCopyCommitted): 26 (WebInspector.StyleSource.prototype.workingCopyChanged): 27 1 28 2012-07-02 Taiju Tsuiki <tzik@chromium.org> 2 29 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r118367 r121672 336 336 } 337 337 this._resourceBinding._requestViaInspectorResource(rule.id.styleSheetId, callback); 338 }, 339 340 /** 341 * @return {WebInspector.CSSStyleModelResourceBinding} 342 */ 343 resourceBinding: function() 344 { 345 return this._resourceBinding; 338 346 } 339 347 } … … 941 949 WebInspector.CSSStyleModelResourceBinding.prototype = { 942 950 /** 951 * @param {WebInspector.StyleSource} styleSource 952 * @param {string} content 953 * @param {boolean} majorChange 954 * @param {function(?string)} userCallback 955 */ 956 setStyleContent: function(styleSource, content, majorChange, userCallback) 957 { 958 var resource = styleSource.resource(); 959 if (this._styleSheetIdForResource(resource)) { 960 this._innerSetContent(resource, content, majorChange, innerCallback, null); 961 return; 962 } 963 this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, innerCallback)); 964 965 function innerCallback(error) 966 { 967 if (error) { 968 userCallback(error); 969 return; 970 } 971 972 if (majorChange) 973 resource.addRevision(content); 974 975 userCallback(null); 976 } 977 }, 978 979 /** 943 980 * @param {WebInspector.Resource} resource 944 981 * @param {string} content … … 948 985 setContent: function(resource, content, majorChange, userCallback) 949 986 { 950 if (majorChange && resource.type === WebInspector.resourceTypes.Stylesheet) 951 resource.addRevision(content); 952 953 if (this._styleSheetIdForResource(resource)) { 954 this._innerSetContent(resource, content, majorChange, userCallback, null); 987 var styleSource = /** @type {WebInspector.StyleSource} */ resource.uiSourceCode(); 988 if (!styleSource) { 989 userCallback("Resource is not editable"); 955 990 return; 956 991 } 957 this. _loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, userCallback));992 this.setStyleContent(styleSource, content, majorChange, userCallback); 958 993 }, 959 994 -
trunk/Source/WebCore/inspector/front-end/Resource.js
r121537 r121672 501 501 }, 502 502 503 revertAndClearHistory: function( )503 revertAndClearHistory: function(callback) 504 504 { 505 505 function revert(content) 506 506 { 507 this.setContent(content, true, function() {}); 507 this.setContent(content, true, clearHistory.bind(this)); 508 } 509 510 function clearHistory() 511 { 508 512 WebInspector.Resource._clearResourceHistory(this); 509 513 this.history = []; 510 } 514 callback(); 515 } 516 511 517 this.requestContent(revert.bind(this)); 512 518 }, -
trunk/Source/WebCore/inspector/front-end/RevisionHistoryView.js
r120184 r121672 113 113 revertToOriginal.addEventListener("click", resource.revertToOriginal.bind(resource)); 114 114 115 function clearHistory() 115 var clearHistoryElement = resourceItem.listItemElement.createChild("span", "revision-history-link"); 116 clearHistoryElement.textContent = WebInspector.UIString("revert"); 117 clearHistoryElement.addEventListener("click", this._clearHistory.bind(this, resource)); 118 return resourceItem; 119 }, 120 121 /** 122 * @param {WebInspector.Resource} resource 123 */ 124 _clearHistory: function(resource) 125 { 126 resource.revertAndClearHistory(historyCleared.bind(this)); 127 128 function historyCleared() 116 129 { 117 resource.revertAndClearHistory();130 var resourceItem = this._resourceItems.get(resource); 118 131 this._treeOutline.removeChild(resourceItem); 119 132 this._resourceItems.remove(resource); 120 133 } 121 134 122 var clearHistoryElement = resourceItem.listItemElement.createChild("span", "revision-history-link");123 clearHistoryElement.textContent = WebInspector.UIString("revert");124 clearHistoryElement.addEventListener("click", clearHistory.bind(this));125 return resourceItem;126 135 }, 127 136 -
trunk/Source/WebCore/inspector/front-end/StylesPanel.js
r120182 r121672 104 104 workingCopyCommitted: function(callback) 105 105 { 106 this._resource.setContent(this.workingCopy(), true, callback);106 WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), true, callback); 107 107 }, 108 108 … … 111 111 function commitIncrementalEdit() 112 112 { 113 this._resource.setContent(this.workingCopy(), false, function() {});113 WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), false, function() {}); 114 114 } 115 115 const updateTimeout = 200;
Note: See TracChangeset
for help on using the changeset viewer.