Changeset 196362 in webkit


Ignore:
Timestamp:
Feb 9, 2016 10:02:53 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Regression: Web Inspector: Sometimes in Elements panel two elements showed as selected at the same time
https://bugs.webkit.org/show_bug.cgi?id=149742
<rdar://problem/24492481>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-02-09
Reviewed by Timothy Hatcher.

  • UserInterface/Views/DOMTreeElement.js:

(WebInspector.DOMTreeElement.prototype.moveChild):
Since removing and re-adding this tree element may forgot its
entire child tree, re-select the selected child that may have
just been lost in the shuffle.

  • UserInterface/Views/TreeOutline.js:

(WebInspector.TreeOutline.prototype._forgetTreeElement):
When forgetting the selected tree element, also deselect the
forgotten tree element so it clears its selected state.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r196348 r196362  
     12016-02-09  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Regression: Web Inspector: Sometimes in Elements panel two elements showed as selected at the same time
     4        https://bugs.webkit.org/show_bug.cgi?id=149742
     5        <rdar://problem/24492481>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Views/DOMTreeElement.js:
     10        (WebInspector.DOMTreeElement.prototype.moveChild):
     11        Since removing and re-adding this tree element may forgot its
     12        entire child tree, re-select the selected child that may have
     13        just been lost in the shuffle.
     14
     15        * UserInterface/Views/TreeOutline.js:
     16        (WebInspector.TreeOutline.prototype._forgetTreeElement):
     17        When forgetting the selected tree element, also deselect the
     18        forgotten tree element so it clears its selected state.
     19
    1202016-02-09  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r196275 r196362  
    333333    moveChild(child, targetIndex)
    334334    {
    335         var wasSelected = child.selected;
     335        // No move needed if the child is already in the right place.
     336        if (this.children[targetIndex] === child)
     337            return;
     338
     339        var originalSelectedChild = this.treeOutline.selectedTreeElement;
     340
    336341        this.removeChild(child);
    337342        this.insertChild(child, targetIndex);
    338         if (wasSelected)
    339             child.select();
     343
     344        if (originalSelectedChild !== this.treeOutline.selectedTreeElement)
     345            originalSelectedChild.select();
    340346    }
    341347
  • trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

    r195303 r196362  
    363363    _forgetTreeElement(element)
    364364    {
    365         if (this.selectedTreeElement === element)
     365        if (this.selectedTreeElement === element) {
     366            element.deselect(true)
    366367            this.selectedTreeElement = null;
     368        }
    367369        if (this._knownTreeElements[element.identifier])
    368370            this._knownTreeElements[element.identifier].remove(element, true);
Note: See TracChangeset for help on using the changeset viewer.