WebKit Bugzilla
Attachment 356421 Details for
Bug 192105
: Web Inspector: Audit: "Add Default Audits" shown when there are no filter results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192105-20181203153543.patch (text/plain), 16.10 KB, created by
Devin Rousso
on 2018-12-03 15:35:44 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2018-12-03 15:35:44 PST
Size:
16.10 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 55e1def12249965bbfc5c8d4f3a414d5643602dd..80cd13fa96f871f887aab926ad0846631b370fc2 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,29 @@ >+2018-12-03 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: Audit: "Add Default Audits" shown when there are no filter results >+ https://bugs.webkit.org/show_bug.cgi?id=192105 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Views/NavigationSidebarPanel.js: >+ (WI.NavigationSidebarPanel): >+ (WI.NavigationSidebarPanel.prototype.get hasActiveFilters): Added. >+ (WI.NavigationSidebarPanel.prototype.suppressFilteringOnTreeElements): >+ (WI.NavigationSidebarPanel.prototype.showEmptyContentPlaceholder): >+ (WI.NavigationSidebarPanel.prototype.hideEmptyContentPlaceholder): >+ (WI.NavigationSidebarPanel.prototype.updateEmptyContentPlaceholder): >+ (WI.NavigationSidebarPanel.prototype.updateFilter): >+ (WI.NavigationSidebarPanel.prototype._checkForEmptyFilterResults.checkTreeOutlineForEmptyFilterResults): >+ (WI.NavigationSidebarPanel.prototype._filterDidChange): >+ (WI.NavigationSidebarPanel.prototype._updateFilter): Deleted. >+ (WI.NavigationSidebarPanel.prototype._createEmptyContentPlaceholderIfNeeded): Deleted. >+ >+ * UserInterface/Views/AuditNavigationSidebarPanel.js: >+ (WI.AuditNavigationSidebarPanel.prototype._handleAuditTestRemoved): >+ Drive-by: change capitalization for consistency with other navigation sidebars. >+ >+ * Localizations/en.lproj/localizedStrings.js: >+ > 2018-11-30 Nikita Vasilyev <nvasilyev@apple.com> > > Web Inspector: Jumping from Computed to Styles should select property >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index 4c7f78679f59e235bcd34343112592c339e45f71..6e7643ba4fa5ba88530a93de59cfed1d8b70af82 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -592,6 +592,7 @@ localizedStrings["No"] = "No"; > localizedStrings["No Accessibility Information"] = "No Accessibility Information"; > localizedStrings["No Application Cache information available"] = "No Application Cache information available"; > localizedStrings["No Attributes"] = "No Attributes"; >+localizedStrings["No Audits"] = "No Audits"; > localizedStrings["No Box Model Information"] = "No Box Model Information"; > localizedStrings["No Canvas Contexts"] = "No Canvas Contexts"; > localizedStrings["No Canvas Selected"] = "No Canvas Selected"; >@@ -612,7 +613,6 @@ localizedStrings["No Results Found"] = "No Results Found"; > localizedStrings["No Search Results"] = "No Search Results"; > localizedStrings["No Watch Expressions"] = "No Watch Expressions"; > localizedStrings["No audit selected"] = "No audit selected"; >-localizedStrings["No audits"] = "No audits"; > localizedStrings["No matching ARIA role"] = "No matching ARIA role"; > localizedStrings["No preview available"] = "No preview available"; > localizedStrings["No request cookies."] = "No request cookies."; >diff --git a/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js >index 005c468836389d197a39eb4389222851649e7f02..a3adf2c184d611f268be3d5eb8bd2f8708d98c63 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/AuditNavigationSidebarPanel.js >@@ -101,6 +101,14 @@ WI.AuditNavigationSidebarPanel = class AuditNavigationSidebarPanel extends WI.Na > WI.auditManager.removeEventListener(null, null, this); > } > >+ updateFilter() >+ { >+ super.updateFilter(); >+ >+ if (!this.hasActiveFilters) >+ this._updateNoAuditsPlaceholder(); >+ } >+ > applyFiltersToTreeElement(treeElement) > { > super.applyFiltersToTreeElement(treeElement); >@@ -149,6 +157,30 @@ WI.AuditNavigationSidebarPanel = class AuditNavigationSidebarPanel extends WI.Na > this._startStopButtonNavigationItem.enabled = WI.auditManager.tests.length && WI.auditManager.runningState !== WI.AuditManager.RunningState.Stopping; > } > >+ _updateNoAuditsPlaceholder() >+ { >+ if (WI.auditManager.tests.length) >+ return; >+ >+ let contentPlaceholder = WI.createMessageTextView(WI.UIString("No Audits")); >+ >+ let defaultButtonElement = contentPlaceholder.appendChild(document.createElement("button")); >+ defaultButtonElement.textContent = WI.UIString("Add Default Audits"); >+ defaultButtonElement.addEventListener("click", () => { >+ WI.auditManager.addDefaultTestsIfNeeded(); >+ }); >+ >+ contentPlaceholder = this.showEmptyContentPlaceholder(contentPlaceholder); >+ >+ if (WI.auditManager.results.length) { >+ console.assert(this.contentTreeOutline.children[0] === this._resultsFolderTreeElement); >+ >+ // Move the placeholder to be the first element in the content area, where it will >+ // be styled such that only the button is visible. >+ this.contentView.element.insertBefore(contentPlaceholder, this.contentView.element.firstChild); >+ } >+ } >+ > _handleAuditTestAdded(event) > { > this._addTest(event.data.test); >@@ -168,27 +200,8 @@ WI.AuditNavigationSidebarPanel = class AuditNavigationSidebarPanel extends WI.Na > > this.element.classList.toggle("has-tests", !!WI.auditManager.tests.length); > >- if (!WI.auditManager.tests.length) { >- let contentPlaceholder = WI.createMessageTextView(WI.UIString("No audits")); >- >- let defaultButtonElement = contentPlaceholder.appendChild(document.createElement("button")); >- defaultButtonElement.textContent = WI.UIString("Add Default Audits"); >- defaultButtonElement.addEventListener("click", () => { >- WI.auditManager.addDefaultTestsIfNeeded(); >- }); >- >- contentPlaceholder = this.showEmptyContentPlaceholder(contentPlaceholder); >- >- if (WI.auditManager.results.length) { >- console.assert(this.contentTreeOutline.children[0] === this._resultsFolderTreeElement); >- >- // Move the placeholder to be the first element in the content area, where it will >- // be styled such that only the button is visible. >- this.contentView.element.insertBefore(contentPlaceholder, this.contentView.element.firstChild); >- } >- } >- > this._updateStartStopButtonNavigationItemState(); >+ this._updateNoAuditsPlaceholder(); > } > > _handleAuditTestScheduled(event) >diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >index 76bafa374919c78660785b0580cbc84dc8dd7797..b6a2cbc3183778defa05cd30cc21302b627c2bae 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >@@ -56,7 +56,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > this._filterBar.filters = this._filtersSetting.value; > > this._emptyContentPlaceholderElements = new Map; >- this._emptyFilterResults = new Map; >+ this._emptyFilterResults = new Set; > > this._shouldAutoPruneStaleTopLevelResourceTreeElements = shouldAutoPruneStaleTopLevelResourceTreeElements || false; > >@@ -72,6 +72,9 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > // Public > >+ get filterBar() { return this._filterBar; } >+ get hasActiveFilters() { return this._filterBar.hasActiveFilters(); } >+ > closed() > { > window.removeEventListener("resize", this._boundUpdateContentOverflowShadowVisibility); >@@ -106,11 +109,6 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > return this._contentBrowser.currentRepresentedObjects[0] || null; > } > >- get filterBar() >- { >- return this._filterBar; >- } >- > get restoringState() > { > return this._restoringState; >@@ -153,7 +151,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > for (let treeElement of treeElements) > treeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol] = true; > >- this._updateFilter(); >+ this.updateFilter(); > } > > treeElementForRepresentedObject(representedObject) >@@ -265,9 +263,12 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > treeOutline = treeOutline || this._contentTreeOutline; > >- let emptyContentPlaceholderElement = this._createEmptyContentPlaceholderIfNeeded(treeOutline, message); >- if (emptyContentPlaceholderElement.parentNode) >- return emptyContentPlaceholderElement; >+ let emptyContentPlaceholderElement = this._emptyContentPlaceholderElements.get(treeOutline); >+ if (emptyContentPlaceholderElement) >+ emptyContentPlaceholderElement.remove(); >+ >+ emptyContentPlaceholderElement = message instanceof Node ? message : WI.createMessageTextView(message); >+ this._emptyContentPlaceholderElements.set(treeOutline, emptyContentPlaceholderElement); > > let emptyContentPlaceholderParentElement = treeOutline.element.parentNode; > emptyContentPlaceholderParentElement.appendChild(emptyContentPlaceholderElement); >@@ -286,6 +287,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > return; > > emptyContentPlaceholderElement.remove(); >+ this._emptyContentPlaceholderElements.delete(treeOutline); > > this._updateContentOverflowShadowVisibility(); > } >@@ -297,7 +299,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > if (!treeOutline.children.length) { > // No tree elements, so no results. > this.showEmptyContentPlaceholder(message, treeOutline); >- } else if (!this._emptyFilterResults.get(treeOutline)) { >+ } else if (!this._emptyFilterResults.has(treeOutline)) { > // There are tree elements, and not all of them are hidden by the filter. > this.hideEmptyContentPlaceholder(treeOutline); > } >@@ -305,7 +307,45 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > updateFilter() > { >- this._updateFilter(); >+ let selectedTreeElement; >+ for (let treeOutline of this.contentTreeOutlines) { >+ if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) >+ continue; >+ >+ selectedTreeElement = treeOutline.selectedTreeElement; >+ if (selectedTreeElement) >+ break; >+ } >+ >+ let filters = this._filterBar.filters; >+ this._textFilterRegex = simpleGlobStringToRegExp(filters.text, "i"); >+ this._filtersSetting.value = filters; >+ this._filterFunctions = filters.functions; >+ >+ // Don't populate if we don't have any active filters. >+ // We only need to populate when a filter needs to reveal. >+ let dontPopulate = !this._filterBar.hasActiveFilters() && !this.shouldFilterPopulate(); >+ >+ // Update all trees that allow filtering. >+ for (let treeOutline of this.contentTreeOutlines) { >+ if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) >+ continue; >+ >+ let currentTreeElement = treeOutline.children[0]; >+ while (currentTreeElement && !currentTreeElement.root) { >+ if (!currentTreeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) { >+ const currentTreeElementWasHidden = currentTreeElement.hidden; >+ this.applyFiltersToTreeElement(currentTreeElement); >+ if (currentTreeElementWasHidden !== currentTreeElement.hidden) >+ this._treeElementWasFiltered(currentTreeElement); >+ } >+ >+ currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, dontPopulate); >+ } >+ } >+ >+ this._checkForEmptyFilterResults(); >+ this._updateContentOverflowShadowVisibility(); > } > > resetFilter() >@@ -514,7 +554,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > if (unfilteredTreeElementFound || !filterableTreeElementFound) { > this.hideEmptyContentPlaceholder(treeOutline); >- this._emptyFilterResults.set(treeOutline, false); >+ this._emptyFilterResults.delete(treeOutline); > return; > } > >@@ -528,7 +568,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > // All top level tree elements are hidden, so filtering hid everything. Show a message. > this.showEmptyContentPlaceholder(message, treeOutline); >- this._emptyFilterResults.set(treeOutline, true); >+ this._emptyFilterResults.add(treeOutline); > } > > for (let treeOutline of this.contentTreeOutlines) { >@@ -541,50 +581,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > > _filterDidChange() > { >- this._updateFilter(); >- } >- >- _updateFilter() >- { >- let selectedTreeElement; >- for (let treeOutline of this.contentTreeOutlines) { >- if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) >- continue; >- >- selectedTreeElement = treeOutline.selectedTreeElement; >- if (selectedTreeElement) >- break; >- } >- >- let filters = this._filterBar.filters; >- this._textFilterRegex = simpleGlobStringToRegExp(filters.text, "i"); >- this._filtersSetting.value = filters; >- this._filterFunctions = filters.functions; >- >- // Don't populate if we don't have any active filters. >- // We only need to populate when a filter needs to reveal. >- let dontPopulate = !this._filterBar.hasActiveFilters() && !this.shouldFilterPopulate(); >- >- // Update all trees that allow filtering. >- for (let treeOutline of this.contentTreeOutlines) { >- if (treeOutline.hidden || treeOutline[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) >- continue; >- >- let currentTreeElement = treeOutline.children[0]; >- while (currentTreeElement && !currentTreeElement.root) { >- if (!currentTreeElement[WI.NavigationSidebarPanel.SuppressFilteringSymbol]) { >- const currentTreeElementWasHidden = currentTreeElement.hidden; >- this.applyFiltersToTreeElement(currentTreeElement); >- if (currentTreeElementWasHidden !== currentTreeElement.hidden) >- this._treeElementWasFiltered(currentTreeElement); >- } >- >- currentTreeElement = currentTreeElement.traverseNextTreeElement(false, null, dontPopulate); >- } >- } >- >- this._checkForEmptyFilterResults(); >- this._updateContentOverflowShadowVisibility(); >+ this.updateFilter(); > } > > _treeElementAddedOrChanged(event) >@@ -734,18 +731,6 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > } > } > >- _createEmptyContentPlaceholderIfNeeded(treeOutline, message) >- { >- let emptyContentPlaceholderElement = this._emptyContentPlaceholderElements.get(treeOutline); >- if (emptyContentPlaceholderElement) >- return emptyContentPlaceholderElement; >- >- emptyContentPlaceholderElement = message instanceof Node ? message : WI.createMessageTextView(message); >- this._emptyContentPlaceholderElements.set(treeOutline, emptyContentPlaceholderElement); >- >- return emptyContentPlaceholderElement; >- } >- > _treeElementWasFiltered(treeElement) > { > if (treeElement.selected || treeElement.hidden)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192105
:
355922
|
355950
| 356421