Reviewed by Mitz.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Apr 2007 22:05:48 +0000 (22:05 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Apr 2007 22:05:48 +0000 (22:05 +0000)
        Bug 13437: Inspector does not update when navigating to a different page
        http://bugs.webkit.org/show_bug.cgi?id=13437

        * WebInspector/webInspector/inspector.js: Correctly update to a new root node
          if the new focus node and the old focus node don't have a common ancestor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@21006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebInspector/webInspector/inspector.js

index db8f7ab..4ad8589 100644 (file)
@@ -1,3 +1,13 @@
+2007-04-22  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Mitz.
+
+        Bug 13437: Inspector does not update when navigating to a different page
+        http://bugs.webkit.org/show_bug.cgi?id=13437
+
+        * WebInspector/webInspector/inspector.js: Correctly update to a new root node
+          if the new focus node and the old focus node don't have a common ancestor.
+
 2007-04-22  Darin Adler  <darin@apple.com>
 
         Reviewed by Adele.
index 30d655f..2a69038 100644 (file)
@@ -534,13 +534,20 @@ function updateRootNode(node)
 function updateFocusedNode(node)
 {
     if (!node || !focusedDOMNode || focusedDOMNode !== node) {
+        var oldFocusNode = focusedDOMNode;
         focusedDOMNode = node;
 
         updatePanes();
 
         if (focusedDOMNode) {
-            if (!rootDOMNode === node && !isAncestorNode.call(rootDOMNode, node))
-                updateRootNode(firstCommonNodeAncestor.call(focusedDOMNode, node));
+            if (rootDOMNode !== focusedDOMNode && !isAncestorNode.call(rootDOMNode, focusedDOMNode)) {
+                var newRoot = firstCommonNodeAncestor.call(oldFocusNode, focusedDOMNode);
+                if (!newRoot && focusedDOMNode.parentNode)
+                    newRoot = focusedDOMNode.parentNode;
+                else if(!newRoot)
+                    newRoot = focusedDOMNode;
+                updateRootNode(newRoot);
+            }
 
             var item = treeOutline.findTreeElement(focusedDOMNode);
             if (!item)