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

Revert of DevTools: Allow clicks to register in SSP when swatch popover is...

Revert of DevTools: Allow clicks to register in SSP when swatch popover is open (patchset #2 id:20001 of https://codereview.chromium.org/2307463004/ )

Reason for revert:
This breaks editing color swatches within shadow swatches. If you edit the color, and then edit the shadow, it reverts to the original color.

We should further examine the effects of majorChange=true in applyStyleText.

Original issue's description:
> 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
>
> Committed: https://crrev.com/f8152e0a1d9157f873363a8b40951af0f6e0d6eb
> Cr-Commit-Position: refs/heads/master@{#417109}

TBR=lushnikov@chromium.org,dgozman@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644779

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