Title: [187714] trunk/Source/WebInspectorUI
- Revision
- 187714
- Author
- drou...@apple.com
- Date
- 2015-07-31 23:48:27 -0700 (Fri, 31 Jul 2015)
Log Message
Web Inspector: inherited CSS rules disappear from Styles sidebar while editing
https://bugs.webkit.org/show_bug.cgi?id=147441
Reviewed by Timothy Hatcher.
If the user edits a style declaration such that it would dissapear mid-edit, prevent
the rules panel from refreshing until that editor is blurred.
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection):
(WebInspector.CSSStyleDeclarationSection.prototype.get editorActive):
(WebInspector.CSSStyleDeclarationSection.prototype.get _hasInvalidSelector):
(WebInspector.CSSStyleDeclarationSection.prototype._editorContentChanged):
(WebInspector.CSSStyleDeclarationSection.prototype._editorBlurred):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._editorBlured):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._contentChanged):
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel):
(WebInspector.RulesStyleDetailsPanel.prototype._removeSectionWithActiveEditor):
* UserInterface/Views/StyleDetailsPanel.js:
(WebInspector.StyleDetailsPanel.prototype._refreshPreservingScrollPosition):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (187713 => 187714)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-08-01 06:47:50 UTC (rev 187713)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-08-01 06:48:27 UTC (rev 187714)
@@ -1,5 +1,30 @@
2015-07-31 Devin Rousso <drou...@apple.com>
+ Web Inspector: inherited CSS rules disappear from Styles sidebar while editing
+ https://bugs.webkit.org/show_bug.cgi?id=147441
+
+ Reviewed by Timothy Hatcher.
+
+ If the user edits a style declaration such that it would dissapear mid-edit, prevent
+ the rules panel from refreshing until that editor is blurred.
+
+ * UserInterface/Views/CSSStyleDeclarationSection.js:
+ (WebInspector.CSSStyleDeclarationSection):
+ (WebInspector.CSSStyleDeclarationSection.prototype.get editorActive):
+ (WebInspector.CSSStyleDeclarationSection.prototype.get _hasInvalidSelector):
+ (WebInspector.CSSStyleDeclarationSection.prototype._editorContentChanged):
+ (WebInspector.CSSStyleDeclarationSection.prototype._editorBlurred):
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._editorBlured):
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._contentChanged):
+ * UserInterface/Views/RulesStyleDetailsPanel.js:
+ (WebInspector.RulesStyleDetailsPanel):
+ (WebInspector.RulesStyleDetailsPanel.prototype._removeSectionWithActiveEditor):
+ * UserInterface/Views/StyleDetailsPanel.js:
+ (WebInspector.StyleDetailsPanel.prototype._refreshPreservingScrollPosition):
+
+2015-07-31 Devin Rousso <drou...@apple.com>
+
Web Inspector: Autocomplete: Undo (Cmd+Z) doesn't work as expected
https://bugs.webkit.org/show_bug.cgi?id=147316
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (187713 => 187714)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-08-01 06:47:50 UTC (rev 187713)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-08-01 06:48:27 UTC (rev 187714)
@@ -62,7 +62,10 @@
this._propertiesElement = document.createElement("div");
this._propertiesElement.className = "properties";
+ this._editorActive = false;
this._propertiesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this, style);
+ this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged, this._editorContentChanged.bind(this));
+ this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred, this._editorBlurred.bind(this));
this._propertiesElement.appendChild(this._propertiesTextEditor.element);
this._element.appendChild(this._headerElement);
@@ -386,6 +389,11 @@
return !this._style.editable;
},
+ get editorActive()
+ {
+ return this._editorActive;
+ },
+
// Private
get _currentSelectorText()
@@ -585,7 +593,22 @@
get _hasInvalidSelector()
{
return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName);
+ },
+
+ _editorContentChanged: function(event)
+ {
+ this._editorActive = true;
+ },
+
+ _editorBlurred: function(event)
+ {
+ this._editorActive = false;
+ this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationSection.Event.Blurred);
}
};
+WebInspector.CSSStyleDeclarationSection.Event = {
+ Blurred: "css-style-declaration-sections-blurred"
+};
+
WebInspector.CSSStyleDeclarationSection.prototype.__proto__ = WebInspector.StyleDetailsPanel.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (187713 => 187714)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-08-01 06:47:50 UTC (rev 187713)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-08-01 06:48:27 UTC (rev 187714)
@@ -744,6 +744,7 @@
// Reset the content on blur since we stop accepting external changes while the the editor is focused.
// This causes us to pick up any change that was suppressed while the editor was focused.
this._resetContent();
+ this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred);
}
_editorFocused(codeMirror)
@@ -779,6 +780,8 @@
if (this._commitChangesTimeout)
clearTimeout(this._commitChangesTimeout);
this._commitChangesTimeout = setTimeout(this._commitChanges.bind(this), delay);
+
+ this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged);
}
_updateTextMarkers(nonatomic)
@@ -1671,6 +1674,11 @@
}
};
+WebInspector.CSSStyleDeclarationTextEditor.Event = {
+ ContentChanged: "css-style-declaration-text-editor-content-changed",
+ Blurred: "css-style-declaration-text-editor-blurred"
+};
+
WebInspector.CSSStyleDeclarationTextEditor.StyleClassName = "css-style-text-editor";
WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName = "read-only";
WebInspector.CSSStyleDeclarationTextEditor.ColorSwatchElementStyleClassName = "color-swatch";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (187713 => 187714)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-08-01 06:47:50 UTC (rev 187713)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-08-01 06:48:27 UTC (rev 187714)
@@ -41,6 +41,8 @@
this._emptyFilterResultsMessage.classList.add("no-filter-results-message");
this._emptyFilterResultsMessage.textContent = WebInspector.UIString("No Results Found");
this._emptyFilterResultsElement.appendChild(this._emptyFilterResultsMessage);
+
+ this._boundRemoveSectionWithActiveEditor = this._removeSectionWithActiveEditor.bind(this);
}
// Public
@@ -54,6 +56,22 @@
return;
}
+ if (!this._forceSignificantChange) {
+ this._sectionWithActiveEditor = null;
+ for (var section of this._sections) {
+ if (!section.editorActive)
+ continue;
+
+ this._sectionWithActiveEditor = section;
+ break;
+ }
+
+ if (this._sectionWithActiveEditor) {
+ this._sectionWithActiveEditor.addEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
+ return;
+ }
+ }
+
var newSections = [];
var newDOMFragment = document.createDocumentFragment();
@@ -446,4 +464,10 @@
this._focusNextNewInspectorRule = true;
this.nodeStyles.addEmptyRule();
}
+
+ _removeSectionWithActiveEditor(event)
+ {
+ this._sectionWithActiveEditor.removeEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
+ this.refresh(true);
+ }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js (187713 => 187714)
--- trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-08-01 06:47:50 UTC (rev 187713)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-08-01 06:48:27 UTC (rev 187714)
@@ -141,7 +141,6 @@
_refreshPreservingScrollPosition(significantChange)
{
significantChange = this._forceSignificantChange || significantChange || false;
- delete this._forceSignificantChange;
var previousScrollTop = this._initialScrollOffset;
@@ -155,6 +154,8 @@
if (this.element.parentNode)
this.element.parentNode.scrollTop = previousScrollTop;
+
+ this._forceSignificantChange = false;
}
_nodeStylesNeedsRefreshed(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes