Skip to content

Commit

Permalink
Web Inspector: clicking on a path component that has no siblings shou…
Browse files Browse the repository at this point in the history
…ld select it

https://bugs.webkit.org/show_bug.cgi?id=181772

Reviewed by Joseph Pecoraro.

* UserInterface/Views/HierarchicalPathComponent.js:
(WI.HierarchicalPathComponent.prototype._updateSelectElement):
(WI.HierarchicalPathComponent.prototype._selectElementMouseDown):


Canonical link: https://commits.webkit.org/197613@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed Jan 18, 2018
1 parent 8d62963 commit eaf5601
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
11 changes: 11 additions & 0 deletions Source/WebInspectorUI/ChangeLog
@@ -1,3 +1,14 @@
2018-01-17 Devin Rousso <webkit@devinrousso.com>

Web Inspector: clicking on a path component that has no siblings should select it
https://bugs.webkit.org/show_bug.cgi?id=181772

Reviewed by Joseph Pecoraro.

* UserInterface/Views/HierarchicalPathComponent.js:
(WI.HierarchicalPathComponent.prototype._updateSelectElement):
(WI.HierarchicalPathComponent.prototype._selectElementMouseDown):

2018-01-17 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Add back localized strings for Styles sidebar panels
Expand Down
Expand Up @@ -263,17 +263,7 @@ WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
sibling = sibling.nextSibling;
}

// Since the change event only fires when the selection actually changes we are
// stuck with either not showing the current selection in the menu or accepting that
// the user can't select what is already selected again. Selecting the same item
// again can be desired (for selecting the main resource while looking at an image).
// So if there is only one option, don't make it be selected by default. This lets
// you select the top level item which usually has no siblings to go back.
// FIXME: Make this work when there are multiple options with a selectedIndex.
if (this._selectElement.options.length === 1)
this._selectElement.selectedIndex = -1;
else
this._selectElement.selectedIndex = previousSiblingCount;
this._selectElement.selectedIndex = previousSiblingCount;
}

_selectElementMouseOver(event)
Expand All @@ -291,6 +281,12 @@ WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
_selectElementMouseDown(event)
{
this._updateSelectElement();

if (this._selectElement.options.length === 1) {
event.preventDefault();

this._selectElementSelectionChanged();
}
}

_selectElementMouseUp(event)
Expand Down

0 comments on commit eaf5601

Please sign in to comment.