Commit a7827314 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

DevTools: move search in styles out of experimental. It proved to be stable.

R=apavlov@chromium.org

Review URL: https://codereview.chromium.org/211193004

git-svn-id: svn://svn.chromium.org/blink/trunk@169959 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3483ee6b
...@@ -90,9 +90,9 @@ WebInspector.ElementsPanel = function() ...@@ -90,9 +90,9 @@ WebInspector.ElementsPanel = function()
this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle, this._setPseudoClassForNodeId.bind(this)); this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle, this._setPseudoClassForNodeId.bind(this));
this._matchedStylesFilterBoxContainer = document.createElement("div"); this._matchedStylesFilterBoxContainer = document.createElement("div");
this._matchedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar"; this._matchedStylesFilterBoxContainer.className = "sidebar-pane-filter-box";
this._computedStylesFilterBoxContainer = document.createElement("div"); this._computedStylesFilterBoxContainer = document.createElement("div");
this._computedStylesFilterBoxContainer.className = "filter-box-container inspector-footer status-bar"; this._computedStylesFilterBoxContainer.className = "sidebar-pane-filter-box";
this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilterBoxContainer, this._computedStylesFilterBoxContainer); this.sidebarPanes.styles.setFilterBoxContainers(this._matchedStylesFilterBoxContainer, this._computedStylesFilterBoxContainer);
this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
...@@ -1268,10 +1268,8 @@ WebInspector.ElementsPanel.prototype = { ...@@ -1268,10 +1268,8 @@ WebInspector.ElementsPanel.prototype = {
computedPane.show(computedStylePanesWrapper); computedPane.show(computedStylePanesWrapper);
computedPane.setExpandCallback(expandComposite); computedPane.setExpandCallback(expandComposite);
if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
splitView.mainElement().appendChild(this._matchedStylesFilterBoxContainer); splitView.mainElement().appendChild(this._matchedStylesFilterBoxContainer);
splitView.sidebarElement().appendChild(this._computedStylesFilterBoxContainer); splitView.sidebarElement().appendChild(this._computedStylesFilterBoxContainer);
}
this.sidebarPaneView.addPane(compositePane); this.sidebarPaneView.addPane(compositePane);
} else { } else {
...@@ -1289,10 +1287,8 @@ WebInspector.ElementsPanel.prototype = { ...@@ -1289,10 +1287,8 @@ WebInspector.ElementsPanel.prototype = {
this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, tabSelected, this); this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, tabSelected, this);
if (WebInspector.experimentsSettings.cssStyleSearch.isEnabled()) {
stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxContainer); stylesPane.bodyElement.appendChild(this._matchedStylesFilterBoxContainer);
computedPane.bodyElement.appendChild(this._computedStylesFilterBoxContainer); computedPane.bodyElement.appendChild(this._computedStylesFilterBoxContainer);
}
this.sidebarPaneView.addPane(stylesPane); this.sidebarPaneView.addPane(stylesPane);
this.sidebarPaneView.addPane(computedPane); this.sidebarPaneView.addPane(computedPane);
......
...@@ -289,7 +289,6 @@ WebInspector.ExperimentsSettings = function(experimentsEnabled) ...@@ -289,7 +289,6 @@ WebInspector.ExperimentsSettings = function(experimentsEnabled)
this.timelineFlameChart = this._createExperiment("timelineFlameChart", "Enable FlameChart mode in Timeline"); this.timelineFlameChart = this._createExperiment("timelineFlameChart", "Enable FlameChart mode in Timeline");
this.heapSnapshotStatistics = this._createExperiment("heapSnapshotStatistics", "Show memory breakdown statistics in heap snapshots"); this.heapSnapshotStatistics = this._createExperiment("heapSnapshotStatistics", "Show memory breakdown statistics in heap snapshots");
this.timelineNoLiveUpdate = this._createExperiment("timelineNoLiveUpdate", "Timeline w/o live update"); this.timelineNoLiveUpdate = this._createExperiment("timelineNoLiveUpdate", "Timeline w/o live update");
this.cssStyleSearch = this._createExperiment("cssStyleSearch", "Enable Styles search and Computed style filtering");
this.powerProfiler = this._createExperiment("powerProfiler", "Enable power mode in Timeline"); this.powerProfiler = this._createExperiment("powerProfiler", "Enable power mode in Timeline");
this._cleanUpSetting(); this._cleanUpSetting();
......
...@@ -186,9 +186,6 @@ WebInspector.StylesSidebarPane.prototype = { ...@@ -186,9 +186,6 @@ WebInspector.StylesSidebarPane.prototype = {
*/ */
setFilterBoxContainers: function(matchedStylesElement, computedStylesElement) setFilterBoxContainers: function(matchedStylesElement, computedStylesElement)
{ {
if (!WebInspector.experimentsSettings.cssStyleSearch.isEnabled())
return;
matchedStylesElement.appendChild(this._createCSSFilterControl()); matchedStylesElement.appendChild(this._createCSSFilterControl());
this._computedStylePane.setFilterBoxContainer(computedStylesElement); this._computedStylePane.setFilterBoxContainer(computedStylesElement);
}, },
...@@ -209,23 +206,6 @@ WebInspector.StylesSidebarPane.prototype = { ...@@ -209,23 +206,6 @@ WebInspector.StylesSidebarPane.prototype = {
this._filterRegex = regex; this._filterRegex = regex;
} }
filterInput.addEventListener("keydown", tabHandler.bind(this), false);
/**
* @param {?Event} event
* @this {WebInspector.StylesSidebarPane}
*/
function tabHandler(event)
{
if (event.keyIdentifier !== "U+0009")
return;
event.consume(true);
var firstSection = this.sections[0][1];
if (!firstSection)
return;
firstSection._moveEditorFromSelector(event.shiftKey ? "backward" : "forward");
}
return filterInput; return filterInput;
}, },
...@@ -892,7 +872,6 @@ WebInspector.StylesSidebarPane.prototype = { ...@@ -892,7 +872,6 @@ WebInspector.StylesSidebarPane.prototype = {
var input = document.createElement("input"); var input = document.createElement("input");
input.type = "text"; input.type = "text";
input.placeholder = isComputedStyleFilter ? WebInspector.UIString("Filter") : WebInspector.UIString("Find in Styles"); input.placeholder = isComputedStyleFilter ? WebInspector.UIString("Filter") : WebInspector.UIString("Find in Styles");
input.className = "filter-box toolbar-search-control search-replace";
var boundSearchHandler = searchHandler.bind(this); var boundSearchHandler = searchHandler.bind(this);
/** /**
...@@ -902,6 +881,7 @@ WebInspector.StylesSidebarPane.prototype = { ...@@ -902,6 +881,7 @@ WebInspector.StylesSidebarPane.prototype = {
{ {
var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null; var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null;
filterCallback(regex); filterCallback(regex);
input.parentNode.classList.toggle("styles-filter-engaged", !!input.value);
this._updateFilter(isComputedStyleFilter); this._updateFilter(isComputedStyleFilter);
} }
input.addEventListener("input", boundSearchHandler, false); input.addEventListener("input", boundSearchHandler, false);
...@@ -934,7 +914,7 @@ WebInspector.StylesSidebarPane.prototype = { ...@@ -934,7 +914,7 @@ WebInspector.StylesSidebarPane.prototype = {
var section = sections[i]; var section = sections[i];
if (isComputedStyleFilter !== !!section.computedStyle) if (isComputedStyleFilter !== !!section.computedStyle)
continue; continue;
section.updateFilter(); section._updateFilter();
} }
} }
}, },
...@@ -1371,11 +1351,19 @@ WebInspector.StylePropertiesSection.prototype = { ...@@ -1371,11 +1351,19 @@ WebInspector.StylePropertiesSection.prototype = {
} }
}, },
updateFilter: function() _updateFilter: function()
{ {
if (this.styleRule.isAttribute)
return;
var regex = this._parentPane.filterRegex();
var hideRule = regex && !regex.test(this.element.textContent);
this.element.classList.toggle("hidden", hideRule);
if (hideRule)
return;
var children = this.propertiesTreeOutline.children; var children = this.propertiesTreeOutline.children;
for (var i = 0; i < children.length; ++i) for (var i = 0; i < children.length; ++i)
children[i].updateFilter(); children[i]._updateFilter();
if (this.styleRule.rule) if (this.styleRule.rule)
this._markSelectorHighlights(); this._markSelectorHighlights();
...@@ -1736,11 +1724,11 @@ WebInspector.ComputedStylePropertiesSection.prototype = { ...@@ -1736,11 +1724,11 @@ WebInspector.ComputedStylePropertiesSection.prototype = {
this.populated = false; this.populated = false;
}, },
updateFilter: function() _updateFilter: function()
{ {
var children = this.propertiesTreeOutline.children; var children = this.propertiesTreeOutline.children;
for (var i = 0; i < children.length; ++i) for (var i = 0; i < children.length; ++i)
children[i].updateFilter(); children[i]._updateFilter();
}, },
onpopulate: function() onpopulate: function()
...@@ -2150,10 +2138,10 @@ WebInspector.StylePropertyTreeElementBase.prototype = { ...@@ -2150,10 +2138,10 @@ WebInspector.StylePropertyTreeElementBase.prototype = {
} }
if (this.property.inactive) if (this.property.inactive)
this.listItemElement.classList.add("inactive"); this.listItemElement.classList.add("inactive");
this.updateFilter(); this._updateFilter();
}, },
updateFilter: function() _updateFilter: function()
{ {
var regEx = this.parentPane().filterRegex(); var regEx = this.parentPane().filterRegex();
this.listItemElement.classList.toggle("filter-match", !!regEx && (regEx.test(this.property.name) || regEx.test(this.property.value))); this.listItemElement.classList.toggle("filter-match", !!regEx && (regEx.test(this.property.name) || regEx.test(this.property.value)));
...@@ -2396,7 +2384,7 @@ WebInspector.ComputedStylePropertyTreeElement.prototype = { ...@@ -2396,7 +2384,7 @@ WebInspector.ComputedStylePropertyTreeElement.prototype = {
return this._stylesPane._computedStylePane; return this._stylesPane._computedStylePane;
}, },
updateFilter: function() _updateFilter: function()
{ {
var regEx = this.parentPane().filterRegex(); var regEx = this.parentPane().filterRegex();
this.listItemElement.classList.toggle("hidden", !!regEx && (!regEx.test(this.property.name) && !regEx.test(this.property.value))); this.listItemElement.classList.toggle("hidden", !!regEx && (!regEx.test(this.property.name) && !regEx.test(this.property.value)));
......
...@@ -609,12 +609,22 @@ ...@@ -609,12 +609,22 @@
position: absolute; position: absolute;
} }
input.filter-box { .sidebar-pane-filter-box {
display: flex;
border-top: 1px solid rgb(191, 191, 191);
flex-basis: 19px;
}
.sidebar-pane-filter-box > input {
outline: none !important; outline: none !important;
border: none;
width: 100%;
margin: 0 4px;
background: transparent;
} }
.sidebar-pane .filter-box-container > .filter-box { .styles-filter-engaged {
margin: 1px 1px 1px 2px; background-color: rgba(255, 255, 0, 0.5);
} }
.sidebar-pane.composite .metrics-and-computed .sidebar-pane-toolbar { .sidebar-pane.composite .metrics-and-computed .sidebar-pane-toolbar {
......
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