Diff
Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193045 => 193046)
--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog 2015-12-03 18:34:54 UTC (rev 193045)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog 2015-12-03 18:35:00 UTC (rev 193046)
@@ -1,5 +1,34 @@
2015-12-01 Timothy Hatcher <[email protected]>
+ Merge r187714. rdar://problem/23221163
+
+ 2015-07-31 Devin Rousso <[email protected]>
+
+ 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-12-01 Timothy Hatcher <[email protected]>
+
Merge r187708. rdar://problem/23221163
2015-07-31 Devin Rousso <[email protected]>
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (193045 => 193046)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-12-03 18:34:54 UTC (rev 193045)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-12-03 18:35:00 UTC (rev 193046)
@@ -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: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (193045 => 193046)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-12-03 18:34:54 UTC (rev 193045)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-12-03 18:35:00 UTC (rev 193046)
@@ -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: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (193045 => 193046)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-12-03 18:34:54 UTC (rev 193045)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-12-03 18:35:00 UTC (rev 193046)
@@ -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();
@@ -451,4 +469,10 @@
this._focusNextNewInspectorRule = true;
this.nodeStyles.addEmptyRule();
}
+
+ _removeSectionWithActiveEditor(event)
+ {
+ this._sectionWithActiveEditor.removeEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred, this._boundRemoveSectionWithActiveEditor);
+ this.refresh(true);
+ }
};
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js (193045 => 193046)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-03 18:34:54 UTC (rev 193045)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-03 18:35:00 UTC (rev 193046)
@@ -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)