From 961331ed07e81a9505df718ca0210b8beee18cf4 Mon Sep 17 00:00:00 2001 From: "ojan@google.com" Date: Thu, 26 Feb 2009 19:22:27 +0000 Subject: Hook up inspector highlighting again. This time we use upstream's drawNodeHighlight methods. BUG=5178 Review URL: http://codereview.chromium.org/31010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10497 0039d316-1c4b-4281-b951-d872f2087c98 --- DEPS | 2 +- webkit/glue/inspector_client_impl.cc | 12 ++++-------- webkit/glue/inspector_client_impl.h | 4 ++++ webkit/glue/webframe_impl.cc | 7 ++----- webkit/glue/webframe_impl.h | 7 ------- webkit/glue/webview_impl.cc | 9 --------- webkit/glue/webview_impl.h | 2 -- 7 files changed, 11 insertions(+), 32 deletions(-) diff --git a/DEPS b/DEPS index 0a3ace4..9d057fd 100644 --- a/DEPS +++ b/DEPS @@ -19,7 +19,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@167", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@10447", + "/trunk/deps/third_party/WebKit@10496", "src/third_party/icu38": "/trunk/deps/third_party/icu38@10364", diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc index cc28821..3ee29a1 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -105,7 +105,7 @@ void WebInspectorClient::closeWindow() { inspector_web_view_ = NULL; WebFrameImpl* frame = inspected_web_view_->main_frame(); - if (frame && frame->inspected_node()) + if (inspected_node_) hideHighlight(); if (inspected_web_view_->page()) @@ -145,20 +145,16 @@ static void invalidateNodeBoundingRect(WebViewImpl* web_view) { } void WebInspectorClient::highlight(Node* node) { - WebFrameImpl* frame = inspected_web_view_->main_frame(); - - if (frame->inspected_node()) + if (inspected_node_) hideHighlight(); + inspected_node_ = node; invalidateNodeBoundingRect(inspected_web_view_); - frame->selectNodeFromInspector(node); } void WebInspectorClient::hideHighlight() { - WebFrameImpl* frame = static_cast(inspected_web_view_->GetMainFrame()); - + inspected_node_ = 0; invalidateNodeBoundingRect(inspected_web_view_); - frame->selectNodeFromInspector(NULL); } void WebInspectorClient::inspectedURLChanged(const String& newURL) { diff --git a/webkit/glue/inspector_client_impl.h b/webkit/glue/inspector_client_impl.h index 92b1ead..8e8e4fa 100644 --- a/webkit/glue/inspector_client_impl.h +++ b/webkit/glue/inspector_client_impl.h @@ -47,6 +47,10 @@ private: // The WebViewImpl of the page being inspected; gets passed to the constructor scoped_refptr inspected_web_view_; + // The node selected in the web inspector. Used for highlighting it on the + // page. + WebCore::Node* inspected_node_; + // The WebView of the Inspector popup window WebViewImpl* inspector_web_view_; }; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 81af58d..a2ecb7e 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -94,6 +94,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "HTMLHeadElement.h" #include "HTMLLinkElement.h" #include "HistoryItem.h" +#include "InspectorController.h" #include "markup.h" #include "Page.h" #include "PlatformContextSkia.h" @@ -289,7 +290,6 @@ MSVC_PUSH_DISABLE_WARNING(4355) MSVC_POP_WARNING() currently_loading_request_(NULL), plugin_delegate_(NULL), - inspected_node_(NULL), active_match_frame_(NULL), active_match_index_(-1), locating_active_rect_(false), @@ -954,10 +954,6 @@ void WebFrameImpl::InvalidateIfNecessary() { } } -void WebFrameImpl::selectNodeFromInspector(WebCore::Node* node) { - inspected_node_ = node; -} - void WebFrameImpl::AddMarker(WebCore::Range* range) { // Use a TextIterator to visit the potentially multiple nodes the range // covers. @@ -1457,6 +1453,7 @@ void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect) { #endif if (frame_->document() && frameview()) { frameview()->paint(&gc, dirty_rect); + frame_->page()->inspectorController()->drawNodeHighlight(gc); } else { gc.fillRect(dirty_rect, Color::white); } diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 546b8c9b..cefe3839 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -222,10 +222,6 @@ class WebFrameImpl : public WebFrame, public base::RefCounted { WebDataSourceImpl* GetDataSourceImpl() const; WebDataSourceImpl* GetProvisionalDataSourceImpl() const; - const WebCore::Node* inspected_node() const { - return inspected_node_; - } - void selectNodeFromInspector(WebCore::Node* node); // Returns which frame has an active match. This function should only be @@ -322,9 +318,6 @@ class WebFrameImpl : public WebFrame, public base::RefCounted { // Handling requests from TextInputController on this frame. scoped_ptr webtextinput_impl_; - // The node selected in the web inspector. Used for highlighting it on the page. - WebCore::Node* inspected_node_; - // A way for the main frame to keep track of which frame has an active // match. Should be NULL for all other frames. WebFrameImpl* active_match_frame_; diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 4db2ac0..dca001d 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1639,15 +1639,6 @@ void WebViewImpl::StartDragging(const WebDropData& drop_data) { } } -const WebCore::Node* WebViewImpl::getInspectedNode(WebCore::Frame* frame) { - DCHECK(frame); - WebFrameImpl* webframe_impl = WebFrameImpl::FromFrame(frame); - if (!webframe_impl) - return NULL; - - return webframe_impl->inspected_node(); -} - void WebViewImpl::ImageResourceDownloadDone(ImageResourceFetcher* fetcher, bool errored, const SkBitmap& image) { diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 2c0a118..c13f419 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -183,8 +183,6 @@ class WebViewImpl : public WebView, public base::RefCounted { // Start a system drag and drop operation. void StartDragging(const WebDropData& drop_data); - virtual const WebCore::Node* getInspectedNode(WebCore::Frame* frame); - // ImageResourceFetcher callback. void ImageResourceDownloadDone(ImageResourceFetcher* fetcher, bool errored, -- cgit v1.1