<http://webkit.org/b/82362> Web Inspector: Provide private -[DOMNode inspect]
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 20:08:07 +0000 (20:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 20:08:07 +0000 (20:08 +0000)
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2012-03-27
Reviewed by Timothy Hatcher.

No new tests, this is only an ObjC SPI.

* bindings/objc/DOM.mm:
* bindings/objc/DOMPrivate.h:
(-[DOMNode inspect]):
Call through to InspectorController inspect for the node.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::handleMousePress):
(WebCore::InspectorDOMAgent::inspect):
Whenever we inspect an element, clear the node search.
The frontend already takes this approach.

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

Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/bindings/objc/DOMPrivate.h
Source/WebCore/inspector/InspectorDOMAgent.cpp

index 5cc3523..08de86d 100644 (file)
@@ -1,3 +1,22 @@
+2012-03-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        <http://webkit.org/b/82362> Web Inspector: Provide private -[DOMNode inspect]
+
+        Reviewed by Timothy Hatcher.
+
+        No new tests, this is only an ObjC SPI.
+
+        * bindings/objc/DOM.mm:
+        * bindings/objc/DOMPrivate.h:
+        (-[DOMNode inspect]):
+        Call through to InspectorController inspect for the node.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::handleMousePress):
+        (WebCore::InspectorDOMAgent::inspect):
+        Whenever we inspect an element, clear the node search.
+        The frontend already takes this approach.
+
 2012-03-27  Joe Mason  <jmason@rim.com>
 
         [BlackBerry] fix confusing destruction sequence in LayerCompositingThread
index 7bd99a1..b35ce4a 100644 (file)
 #import "WebScriptObjectPrivate.h"
 #import <wtf/HashMap.h>
 
+#if ENABLE(INSPECTOR)
+#import "InspectorController.h"
+#import "Page.h"
+#endif
+
 #if ENABLE(SVG_DOM_OBJC_BINDINGS)
 #import "DOMSVG.h"
 #import "SVGElementInstance.h"
@@ -389,6 +394,18 @@ id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
     range->textRects(rects);
     return kit(rects);
 }
+
+- (void)inspect
+{
+#if ENABLE(INSPECTOR)
+    WebCore::Node* node = core(self);
+    if (WebCore::Document* document = node->document()) {
+        if (WebCore::Page* page = document->page())
+            page->inspectorController()->inspect(node);
+    }
+#endif
+}
+
 @end
 
 @implementation DOMRange (DOMRangeExtensions)
index fe70bc9..456d92b 100644 (file)
@@ -29,6 +29,7 @@
 @interface DOMNode (DOMNodeExtensionsPendingPublic)
 - (NSImage *)renderedImage;
 - (NSArray *)textRects;
+- (void)inspect;
 @end
 
 // FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with
index 3c8cb1a..7c07591 100644 (file)
@@ -914,7 +914,6 @@ bool InspectorDOMAgent::handleMousePress()
 
     if (m_highlightData && m_highlightData->node) {
         RefPtr<Node> node = m_highlightData->node;
-        setSearchingForNode(false, 0);
         inspect(node.get());
     }
     return true;
@@ -922,6 +921,8 @@ bool InspectorDOMAgent::handleMousePress()
 
 void InspectorDOMAgent::inspect(Node* node)
 {
+    setSearchingForNode(false, 0);
+
     if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
         node = node->parentNode();
     m_nodeToFocus = node;