Index: Source/WebCore/inspector/front-end/StylesSidebarPane.js |
=================================================================== |
--- Source/WebCore/inspector/front-end/StylesSidebarPane.js (revision 93523) |
+++ Source/WebCore/inspector/front-end/StylesSidebarPane.js (working copy) |
@@ -238,13 +238,15 @@ |
this._innerUpdate(refresh, null); |
}, |
- _innerUpdate: function(refresh, editedSection) |
+ _innerUpdate: function(refresh, editedSection, userCallback) |
{ |
var node = this.node; |
if (!node) { |
this._sectionsContainer.removeChildren(); |
this._computedStylePane.bodyElement.removeChildren(); |
this.sections = {}; |
+ if (userCallback) |
+ userCallback(); |
return; |
} |
@@ -252,12 +254,16 @@ |
{ |
if (this.node === node && styles) |
this._rebuildUpdate(node, styles); |
+ if (userCallback) |
+ userCallback(); |
} |
function computedStyleCallback(computedStyle) |
{ |
if (this.node === node && computedStyle) |
this._refreshUpdate(node, computedStyle, editedSection); |
+ if (userCallback) |
+ userCallback(); |
} |
if (refresh) |
@@ -1611,16 +1617,14 @@ |
this.tooltip = this.property.propertyText; |
}, |
- _updateAll: function() |
+ _updatePane: function(userCallback) |
{ |
- if (!this.treeOutline) |
- return; |
- if (this.treeOutline.section && this.treeOutline.section.pane) |
- this.treeOutline.section.pane._innerUpdate(true, this.treeOutline.section); |
- else if (this.treeOutline.section) |
- this.treeOutline.section.update(true); |
- else |
- this.updateTitle(); // FIXME: this will not show new properties. But we don't hit this case yet. |
+ if (this.treeOutline && this.treeOutline.section && this.treeOutline.section.pane) |
+ this.treeOutline.section.pane._innerUpdate(true, this.treeOutline.section, userCallback); |
+ else { |
+ if (userCallback) |
+ userCallback(); |
+ } |
}, |
toggleEnabled: function(event) |
@@ -1638,7 +1642,7 @@ |
if (this.treeOutline.section && this.treeOutline.section.pane) |
this.treeOutline.section.pane.dispatchEventToListeners("style property toggled"); |
- this._updateAll(); |
+ this._updatePane(); |
} |
this.property.setDisabled(disabled, callback.bind(this)); |
@@ -2080,6 +2084,12 @@ |
applyStyleText: function(styleText, updateInterface, majorChange, isRevert) |
{ |
+ function userOperationFinishedCallback(parentPane, updateInterface) |
+ { |
+ if (updateInterface) |
+ delete parentPane._userOperation; |
+ } |
+ |
// Leave a way to cancel editing after incremental changes. |
if (!isRevert && !updateInterface && !this._hasBeenModifiedIncrementally()) { |
// Remember the rule's original CSS text on [Page](Up|Down), so it can be restored |
@@ -2099,16 +2109,17 @@ |
} |
var currentNode = this._parentPane.node; |
- this._parentPane._userOperation = true; |
+ if (updateInterface) |
+ this._parentPane._userOperation = true; |
- function callback(originalPropertyText, newStyle) |
+ function callback(userCallback, originalPropertyText, newStyle) |
{ |
- delete this._parentPane._userOperation; |
if (!newStyle) { |
if (updateInterface) { |
// It did not apply, cancel editing. |
this._revertStyleUponEditingCanceled(originalPropertyText); |
} |
+ userCallback(); |
return; |
} |
@@ -2119,15 +2130,19 @@ |
if (section && section.pane) |
section.pane.dispatchEventToListeners("style edited"); |
- if (updateInterface && currentNode === section.pane.node) |
- this._updateAll(); |
+ if (updateInterface && currentNode === section.pane.node) { |
+ this._updatePane(userCallback); |
+ return; |
+ } |
+ |
+ userCallback(); |
} |
// Append a ";" if the new text does not end in ";". |
// FIXME: this does not handle trailing comments. |
if (styleText.length && !/;\s*$/.test(styleText)) |
styleText += ";"; |
- this.property.setText(styleText, majorChange, callback.bind(this, this.originalPropertyText)); |
+ this.property.setText(styleText, majorChange, callback.bind(this, userOperationFinishedCallback.bind(null, this._parentPane, updateInterface), this.originalPropertyText)); |
} |
} |