Title: [192784] trunk/Source/WebInspectorUI
- Revision
- 192784
- Author
- [email protected]
- Date
- 2015-11-28 00:51:13 -0800 (Sat, 28 Nov 2015)
Log Message
Web Inspector: REGRESSION: "Duplicate Selector" context menu item doesn't work
https://bugs.webkit.org/show_bug.cgi?id=151628
Patch by Devin Rousso <[email protected]> on 2015-11-28
Reviewed by Brian Burg.
Merged the two "add rule" functions inside DOMNodeStyles to create a
new rule with the given selector and use the generated best selector
for that node otherwise. This also preserves all fallbacks across all
functions for creating new CSS rules.
* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype.addEmptyRule): Deleted.
(WebInspector.DOMNodeStyles.prototype.addRuleWithSelector): Deleted.
(WebInspector.DOMNodeStyles.prototype.addRule):
Creates a new CSS rule using either the provided selector or the best
selector for the current node.
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype._handleContextMenuEvent):
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel.prototype.newRuleButtonClicked):
* UserInterface/Views/VisualStyleSelectorSection.js:
(WebInspector.VisualStyleSelectorSection.prototype._addNewRule):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (192783 => 192784)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-11-27 17:50:54 UTC (rev 192783)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-11-28 08:51:13 UTC (rev 192784)
@@ -1,3 +1,29 @@
+2015-11-28 Devin Rousso <[email protected]>
+
+ Web Inspector: REGRESSION: "Duplicate Selector" context menu item doesn't work
+ https://bugs.webkit.org/show_bug.cgi?id=151628
+
+ Reviewed by Brian Burg.
+
+ Merged the two "add rule" functions inside DOMNodeStyles to create a
+ new rule with the given selector and use the generated best selector
+ for that node otherwise. This also preserves all fallbacks across all
+ functions for creating new CSS rules.
+
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WebInspector.DOMNodeStyles.prototype.addEmptyRule): Deleted.
+ (WebInspector.DOMNodeStyles.prototype.addRuleWithSelector): Deleted.
+ (WebInspector.DOMNodeStyles.prototype.addRule):
+ Creates a new CSS rule using either the provided selector or the best
+ selector for the current node.
+
+ * UserInterface/Views/CSSStyleDeclarationSection.js:
+ (WebInspector.CSSStyleDeclarationSection.prototype._handleContextMenuEvent):
+ * UserInterface/Views/RulesStyleDetailsPanel.js:
+ (WebInspector.RulesStyleDetailsPanel.prototype.newRuleButtonClicked):
+ * UserInterface/Views/VisualStyleSelectorSection.js:
+ (WebInspector.VisualStyleSelectorSection.prototype._addNewRule):
+
2015-11-24 Brian Burg <[email protected]>
Web Inspector: save Inspector's breakpoints to localStorage whenever they are modified
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (192783 => 192784)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-11-27 17:50:54 UTC (rev 192783)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-11-28 08:51:13 UTC (rev 192784)
@@ -223,7 +223,7 @@
CSSAgent.getComputedStyleForNode.invoke({nodeId: this._node.id}, fetchedComputedStyle.bind(this));
}
- addEmptyRule()
+ addRule(selector = this._node.appropriateSelectorFor(true))
{
function addedRule(error, rulePayload)
{
@@ -235,8 +235,6 @@
this.refresh();
}
- let selector = this._node.appropriateSelectorFor(true);
-
// COMPATIBILITY (iOS 9): Before CSS.createStyleSheet, CSS.addRule could be called with a contextNode.
if (!CSSAgent.createStyleSheet) {
CSSAgent.addRule.invoke({contextNodeId: this._node.id , selector}, addedRule.bind(this));
@@ -251,24 +249,6 @@
WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._node.frame, inspectorStyleSheetAvailable.bind(this));
}
- addRuleWithSelector(selector)
- {
- if (!selector)
- return;
-
- function addedRule(error, rulePayload)
- {
- if (error)
- return;
-
- DOMAgent.markUndoableState();
-
- this.refresh();
- }
-
- CSSAgent.addRule.invoke({contextNodeId: this._node.id, selector}, addedRule.bind(this));
- }
-
get matchedRules()
{
return this._matchedRules;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (192783 => 192784)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-11-27 17:50:54 UTC (rev 192783)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js 2015-11-28 08:51:13 UTC (rev 192784)
@@ -438,7 +438,7 @@
if (this._delegate && typeof this._delegate.cssStyleDeclarationSectionFocusNextNewInspectorRule === "function")
this._delegate.cssStyleDeclarationSectionFocusNextNewInspectorRule();
- this._style.nodeStyles.addRuleWithSelector(this._currentSelectorText);
+ this._style.nodeStyles.addRule(this._currentSelectorText);
}.bind(this));
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (192783 => 192784)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-11-27 17:50:54 UTC (rev 192783)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js 2015-11-28 08:51:13 UTC (rev 192784)
@@ -388,7 +388,7 @@
return;
this._focusNextNewInspectorRule = true;
- this.nodeStyles.addEmptyRule();
+ this.nodeStyles.addRule();
}
// Protected
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js (192783 => 192784)
--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js 2015-11-27 17:50:54 UTC (rev 192783)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorSection.js 2015-11-28 08:51:13 UTC (rev 192784)
@@ -240,7 +240,7 @@
if (!this._nodeStyles)
return;
- this._nodeStyles.addEmptyRule();
+ this._nodeStyles.addRule();
this._focusNextNewInspectorRule = true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes