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

Unified Diff: Source/WebCore/inspector/front-end/StylesSidebarPane.js

Issue 8380009: Merge 98243 - Web Inspector: [Styles] Adding a new style rule breaks things (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « LayoutTests/inspector/styles/styles-add-new-rule-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/front-end/StylesSidebarPane.js
===================================================================
--- Source/WebCore/inspector/front-end/StylesSidebarPane.js (revision 98247)
+++ Source/WebCore/inspector/front-end/StylesSidebarPane.js (working copy)
@@ -375,7 +375,7 @@
var styleRules = [];
for (var i = 0; sections && i < sections.length; ++i) {
var section = sections[i];
- if (section instanceof WebInspector.BlankStylePropertiesSection)
+ if (section.isBlank)
continue;
if (section.computedStyle)
section.styleRule.style = nodeComputedStyle;
@@ -1307,7 +1307,7 @@
{
for (var i = 0; i < sections.length; ++i) {
var section = sections[i];
- if (section.computedStyle || section instanceof WebInspector.BlankStylePropertiesSection)
+ if (section.computedStyle || section.isBlank)
continue;
for (var j = 0; j < section.uniqueProperties.length; ++j) {
@@ -1355,13 +1355,24 @@
}
WebInspector.BlankStylePropertiesSection.prototype = {
+ get isBlank()
+ {
+ return !this._normal;
+ },
+
expand: function()
{
- // Do nothing, blank sections are not expandable.
+ if (!this.isBlank)
+ WebInspector.StylePropertiesSection.prototype.expand.call(this);
},
- editingSelectorCommitted: function(element, newContent, oldContent, context)
+ editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection)
{
+ if (!this.isBlank) {
+ WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.call(this, element, newContent, oldContent, context, moveDirection);
+ return;
+ }
+
function successCallback(newRule, doesSelectorAffectSelectedNode)
{
var styleRule = { section: this, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
@@ -1374,8 +1385,8 @@
this.subtitleElement.textContent = WebInspector.UIString("via inspector");
this.expand();
- if (this.element.parentElement) // Might have been detached already.
- this.addNewBlankProperty().startEditing();
+ if (this.element.parentElement) // Might have been detached already.
+ this._moveEditorFromSelector(moveDirection);
}
WebInspector.cssModel.addRule(this.pane.node.id, newContent, successCallback.bind(this), this.editingSelectorCancelled.bind(this));
@@ -1383,6 +1394,11 @@
editingSelectorCancelled: function()
{
+ if (!this.isBlank) {
+ WebInspector.StylePropertiesSection.prototype.editingSelectorCancelled.call(this);
+ return;
+ }
+
this.pane.removeSection(this);
},
@@ -1392,6 +1408,9 @@
this.styleRule = styleRule;
this.rule = styleRule.rule;
this.identifier = styleRule.selectorText + ":via inspector";
+
+ // FIXME: replace this instance by a normal WebInspector.StylePropertiesSection.
+ this._normal = true;
}
}
« no previous file with comments | « LayoutTests/inspector/styles/styles-add-new-rule-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698