Commit f8152e0a authored by flandy's avatar flandy Committed by Commit bot

DevTools: Allow clicks to register in SSP when swatch popover is open

Applying the style text to the tree element when the popover is hidden
causes the section to update, not allowing clicks to register.

It is unnecessary to apply the style text when the popover is hidden
(unless reverting back to original property text) because the change
has already been applied.

BUG=644779

Review-Url: https://codereview.chromium.org/2307463004
Cr-Commit-Position: refs/heads/master@{#417109}
parent d506d0d3
...@@ -79,8 +79,9 @@ WebInspector.BezierPopoverIcon.prototype = { ...@@ -79,8 +79,9 @@ WebInspector.BezierPopoverIcon.prototype = {
this._bezierEditor.removeEventListener(WebInspector.BezierEditor.Events.BezierChanged, this._boundBezierChanged); this._bezierEditor.removeEventListener(WebInspector.BezierEditor.Events.BezierChanged, this._boundBezierChanged);
delete this._bezierEditor; delete this._bezierEditor;
var propertyText = commitEdit ? this._treeElement.renderedPropertyText() : this._originalPropertyText; // Clicking between swatches in the same section should open each swatch popover. crbug.com/644779
this._treeElement.applyStyleText(propertyText, true); if (!commitEdit)
this._treeElement.applyStyleText(this._originalPropertyText, true);
this._treeElement.parentPane().setEditingStyle(false); this._treeElement.parentPane().setEditingStyle(false);
delete this._originalPropertyText; delete this._originalPropertyText;
} }
...@@ -206,8 +207,9 @@ WebInspector.ColorSwatchPopoverIcon.prototype = { ...@@ -206,8 +207,9 @@ WebInspector.ColorSwatchPopoverIcon.prototype = {
this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorChanged, this._boundSpectrumChanged); this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorChanged, this._boundSpectrumChanged);
delete this._spectrum; delete this._spectrum;
var propertyText = commitEdit ? this._treeElement.renderedPropertyText() : this._originalPropertyText; // Clicking between swatches in the same section should open each swatch popover. crbug.com/644779
this._treeElement.applyStyleText(propertyText, true); if (!commitEdit)
this._treeElement.applyStyleText(this._originalPropertyText, true);
this._treeElement.parentPane().setEditingStyle(false); this._treeElement.parentPane().setEditingStyle(false);
delete this._originalPropertyText; delete this._originalPropertyText;
} }
...@@ -288,8 +290,9 @@ WebInspector.ShadowSwatchPopoverHelper.prototype = { ...@@ -288,8 +290,9 @@ WebInspector.ShadowSwatchPopoverHelper.prototype = {
this._cssShadowEditor.removeEventListener(WebInspector.CSSShadowEditor.Events.ShadowChanged, this._boundShadowChanged); this._cssShadowEditor.removeEventListener(WebInspector.CSSShadowEditor.Events.ShadowChanged, this._boundShadowChanged);
delete this._cssShadowEditor; delete this._cssShadowEditor;
var propertyText = commitEdit ? this._treeElement.renderedPropertyText() : this._originalPropertyText; // Clicking between swatches in the same section should open each swatch popover. crbug.com/644779
this._treeElement.applyStyleText(propertyText, true); if (!commitEdit)
this._treeElement.applyStyleText(this._originalPropertyText, true);
this._treeElement.parentPane().setEditingStyle(false); this._treeElement.parentPane().setEditingStyle(false);
delete this._originalPropertyText; delete this._originalPropertyText;
} }
......
...@@ -2048,8 +2048,9 @@ WebInspector.StylePropertyTreeElement.prototype = { ...@@ -2048,8 +2048,9 @@ WebInspector.StylePropertyTreeElement.prototype = {
var cssShadowSwatch = WebInspector.CSSShadowSwatch.create(); var cssShadowSwatch = WebInspector.CSSShadowSwatch.create();
cssShadowSwatch.setCSSShadow(shadows[i]); cssShadowSwatch.setCSSShadow(shadows[i]);
new WebInspector.ShadowSwatchPopoverHelper(this, swatchPopoverHelper, cssShadowSwatch); new WebInspector.ShadowSwatchPopoverHelper(this, swatchPopoverHelper, cssShadowSwatch);
if (cssShadowSwatch.colorSwatch()) var colorSwatch = cssShadowSwatch.colorSwatch();
var colorSwatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, swatchPopoverHelper, cssShadowSwatch.colorSwatch()); if (colorSwatch)
new WebInspector.ColorSwatchPopoverIcon(this, swatchPopoverHelper, colorSwatch);
container.appendChild(cssShadowSwatch); container.appendChild(cssShadowSwatch);
} }
return container; return container;
......
...@@ -261,13 +261,13 @@ WebInspector.CSSShadowSwatch.prototype = { ...@@ -261,13 +261,13 @@ WebInspector.CSSShadowSwatch.prototype = {
setCSSShadow: function(model) setCSSShadow: function(model)
{ {
this._model = model; this._model = model;
this._colorSwatch = null;
this._contentElement.removeChildren(); this._contentElement.removeChildren();
var results = WebInspector.TextUtils.splitStringByRegexes(model.asCSSText(), [/inset/g, WebInspector.Color.Regex]); var results = WebInspector.TextUtils.splitStringByRegexes(model.asCSSText(), [/inset/g, WebInspector.Color.Regex]);
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
var result = results[i]; var result = results[i];
if (result.regexIndex === 1) { if (result.regexIndex === 1) {
this._colorSwatch = WebInspector.ColorSwatch.create(); if (!this._colorSwatch)
this._colorSwatch = WebInspector.ColorSwatch.create();
this._colorSwatch.setColorText(result.value); this._colorSwatch.setColorText(result.value);
this._contentElement.appendChild(this._colorSwatch); this._contentElement.appendChild(this._colorSwatch);
} else { } else {
...@@ -293,7 +293,7 @@ WebInspector.CSSShadowSwatch.prototype = { ...@@ -293,7 +293,7 @@ WebInspector.CSSShadowSwatch.prototype = {
}, },
/** /**
* @return {!WebInspector.ColorSwatch} * @return {?WebInspector.ColorSwatch}
*/ */
colorSwatch: function() colorSwatch: function()
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment