Title: [185279] trunk/Source/WebInspectorUI
- Revision
- 185279
- Author
- [email protected]
- Date
- 2015-06-05 18:16:22 -0700 (Fri, 05 Jun 2015)
Log Message
Web Inspector: Highlighting a CSS section does not deselect previously highlighted CSS sections
https://bugs.webkit.org/show_bug.cgi?id=145399
Patch by Devin Rousso <[email protected]> on 2015-06-05
Reviewed by Timothy Hatcher.
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection): Added delegate variable to constructor.
(WebInspector.CSSStyleDeclarationSection.prototype.clearSelection):
(WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorFocused):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor): Added event listener to codeMirror on "focus".
(WebInspector.CSSStyleDeclarationTextEditor.prototype.clearSelection): Sets the cursor of the codeMirror to character 0 on line 0.
(WebInspector.CSSStyleDeclarationTextEditor.prototype._editorFocused): Function that calls the delegate function "editorFocused" when the codeMirror is focused
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
(WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionEditorFocused): Loops through all sections except for the ignoredSection (parameter) and clears the selected text in each of them.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (185278 => 185279)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-06-06 01:06:28 UTC (rev 185278)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-06-06 01:16:22 UTC (rev 185279)
@@ -1,3 +1,22 @@
+2015-06-05 Devin Rousso <[email protected]>
+
+ Web Inspector: Highlighting a CSS section does not deselect previously highlighted CSS sections
+ https://bugs.webkit.org/show_bug.cgi?id=145399
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/CSSStyleDeclarationSection.js:
+ (WebInspector.CSSStyleDeclarationSection): Added delegate variable to constructor.
+ (WebInspector.CSSStyleDeclarationSection.prototype.clearSelection):
+ (WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorFocused):
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor): Added event listener to codeMirror on "focus".
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype.clearSelection): Sets the cursor of the codeMirror to character 0 on line 0.
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._editorFocused): Function that calls the delegate function "editorFocused" when the codeMirror is focused
+ * UserInterface/Views/RulesStyleDetailsPanel.js:
+ (WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
+ (WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionEditorFocused): Loops through all sections except for the ignoredSection (parameter) and clears the selected text in each of them.
+
2015-06-05 Joseph Pecoraro <[email protected]>
REGRESSION (r185213): TypeError: undefined is not an object (evaluating 'WebInspector.clearLogOnReload.value')
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (185278 => 185279)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-06-06 01:06:28 UTC (rev 185278)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-06-06 01:16:22 UTC (rev 185279)
@@ -23,11 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.CSSStyleDeclarationSection = function(style)
+WebInspector.CSSStyleDeclarationSection = function(delegate, style)
{
// FIXME: Convert this to a WebInspector.Object subclass, and call super().
// WebInspector.Object.call(this);
+ this._delegate = delegate || null;
+
console.assert(style);
this._style = style || null;
@@ -275,6 +277,17 @@
this._propertiesTextEditor.updateLayout();
},
+ clearSelection: function()
+ {
+ this._propertiesTextEditor.clearSelection();
+ },
+
+ cssStyleDeclarationTextEditorFocused: function()
+ {
+ if (typeof this._delegate.cssStyleDeclarationSectionEditorFocused === "function")
+ this._delegate.cssStyleDeclarationSectionEditorFocused(this);
+ },
+
// Private
_commitSelector: function(mutations)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (185278 => 185279)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-06-06 01:06:28 UTC (rev 185278)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-06-06 01:16:22 UTC (rev 185279)
@@ -70,6 +70,9 @@
this._codeMirror.on("change", this._contentChanged.bind(this));
this._codeMirror.on("blur", this._editorBlured.bind(this));
+ if (typeof this._delegate.cssStyleDeclarationTextEditorFocused === "function")
+ this._codeMirror.on("focus", this._editorFocused.bind(this));
+
this.style = style;
}
@@ -221,6 +224,11 @@
return false;
}
+ clearSelection()
+ {
+ this._codeMirror.setCursor({line: 0, ch: 0});
+ }
+
// Protected
didDismissPopover(popover)
@@ -316,6 +324,12 @@
this._resetContent();
}
+ _editorFocused(codeMirror)
+ {
+ if (typeof this._delegate.cssStyleDeclarationTextEditorFocused === "function")
+ this._delegate.cssStyleDeclarationTextEditorFocused();
+ }
+
_contentChanged(codeMirror, change)
{
// Return early if the style isn't editable. This still can be called when readOnly is set because
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (185278 => 185279)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-06-06 01:06:28 UTC (rev 185278)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-06-06 01:16:22 UTC (rev 185279)
@@ -120,7 +120,7 @@
previousFocusedSection = section;
if (!section) {
- section = new WebInspector.CSSStyleDeclarationSection(style);
+ section = new WebInspector.CSSStyleDeclarationSection(this, style);
style.__rulesSection = section;
} else
section.refresh();
@@ -257,6 +257,14 @@
return false;
}
+ cssStyleDeclarationSectionEditorFocused(ignoredSection)
+ {
+ for (var section of this._sections) {
+ if (section !== ignoredSection)
+ section.clearSelection();
+ }
+ }
+
// Protected
shown()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes