Skip to content
Permalink
Browse files
Web Inspector: [REGRESSION] Editor lost after committing a CSS proper…
…ty value for inline style

https://bugs.webkit.org/show_bug.cgi?id=65918

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._innerUpdate.stylesCallback):
(WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback):
(WebInspector.StylesSidebarPane.prototype._innerUpdate):
(WebInspector.StylePropertyTreeElement.prototype):
(WebInspector.StylePropertyTreeElement.prototype.event):
(WebInspector.StylePropertyTreeElement.prototype.styleText.updateInterface.majorChange.isRevert.parentPane):
(WebInspector.StylePropertyTreeElement.prototype.styleText.updateInterface.majorChange.isRevert):

LayoutTests:

* inspector/styles/styles-commit-editing.html:

Canonical link: https://commits.webkit.org/81838@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@92764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Alexander Pavlov committed Aug 10, 2011
1 parent 67df4b3 commit cc248b5f9a95e3a9e6aeec91cef8b62ee55ddb42
Showing 4 changed files with 61 additions and 17 deletions.
@@ -1,3 +1,12 @@
2011-08-10 Alexander Pavlov <apavlov@chromium.org>

Web Inspector: [REGRESSION] Editor lost after committing a CSS property value for inline style
https://bugs.webkit.org/show_bug.cgi?id=65918

Reviewed by Pavel Feldman.

* inspector/styles/styles-commit-editing.html:

2011-08-10 Kent Tamura <tkent@chromium.org>

Move <input type=datetime> tests to fast/forms/datetime/
@@ -34,6 +34,10 @@

function step2()
{
if (!WebInspector.isEditingAnyField()) {
InspectorTest.addResult("No new property editor active!");
InspectorTest.completeTest();
}
InspectorTest.selectNodeWithId("other");
InspectorTest.runAfterPendingDispatches(step3);
}
@@ -1,3 +1,19 @@
2011-08-10 Alexander Pavlov <apavlov@chromium.org>

Web Inspector: [REGRESSION] Editor lost after committing a CSS property value for inline style
https://bugs.webkit.org/show_bug.cgi?id=65918

Reviewed by Pavel Feldman.

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._innerUpdate.stylesCallback):
(WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback):
(WebInspector.StylesSidebarPane.prototype._innerUpdate):
(WebInspector.StylePropertyTreeElement.prototype):
(WebInspector.StylePropertyTreeElement.prototype.event):
(WebInspector.StylePropertyTreeElement.prototype.styleText.updateInterface.majorChange.isRevert.parentPane):
(WebInspector.StylePropertyTreeElement.prototype.styleText.updateInterface.majorChange.isRevert):

2011-08-10 Yuta Kitamura <yutak@chromium.org>

WebSocket: Add binaryType attribute
@@ -239,26 +239,32 @@ WebInspector.StylesSidebarPane.prototype = {
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;
}

function stylesCallback(styles)
{
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)
@@ -1623,16 +1629,14 @@ WebInspector.StylePropertyTreeElement.prototype = {
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)
@@ -1650,7 +1654,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
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));
@@ -2092,6 +2096,12 @@ WebInspector.StylePropertyTreeElement.prototype = {

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
@@ -2111,16 +2121,17 @@ WebInspector.StylePropertyTreeElement.prototype = {
}

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;
}

@@ -2131,15 +2142,19 @@ WebInspector.StylePropertyTreeElement.prototype = {
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));
}
}

0 comments on commit cc248b5

Please sign in to comment.