Changeset 84781 in webkit
- Timestamp:
- Apr 25, 2011 10:10:51 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r84769 r84781 1 2011-04-25 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Alice Liu. 4 5 WebKit2: Web Inspector: Support highlighting page elements 6 https://bugs.webkit.org/show_bug.cgi?id=59263 7 <rdar://problem/8767659> 8 9 Support highlighting of page elements for the inspector in WebKit2 by 10 having the WebInspectorClient be a PageOverlay Client and be responsible 11 for calling InspectorController::drawNodeHighlight. 12 13 * WebProcess/WebCoreSupport/WebInspectorClient.cpp: 14 (WebKit::WebInspectorClient::highlight): Create our overlay if it hasn't been created, 15 or call setNeedsDisplay if it has. 16 (WebKit::WebInspectorClient::hideHighlight): Uninstall the page overlay if it exists. 17 (WebKit::WebInspectorClient::pageOverlayDestroyed): 18 (WebKit::WebInspectorClient::willMoveToWebPage): If it's being destroyed (moving to a null 19 WebPage), clear the member variable. 20 (WebKit::WebInspectorClient::didMoveToWebPage): 21 (WebKit::WebInspectorClient::drawRect): Call InspectorController::drawNodeHighlight. 22 (WebKit::WebInspectorClient::mouseEvent): 23 * WebProcess/WebCoreSupport/WebInspectorClient.h: 24 (WebKit::WebInspectorClient::WebInspectorClient): Add a new member variable. 25 1 26 2011-04-25 Jon Lee <jonlee@apple.com> 2 27 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
r79335 r84781 57 57 void WebInspectorClient::highlight(Node*) 58 58 { 59 notImplemented(); 59 if (!m_highlightOverlay) { 60 RefPtr<PageOverlay> highlightOverlay = PageOverlay::create(this); 61 m_highlightOverlay = highlightOverlay.get(); 62 m_page->installPageOverlay(highlightOverlay.release()); 63 } else 64 m_highlightOverlay->setNeedsDisplay(); 60 65 } 61 66 62 67 void WebInspectorClient::hideHighlight() 63 68 { 64 notImplemented(); 69 if (m_highlightOverlay) 70 m_page->uninstallPageOverlay(m_highlightOverlay, false); 65 71 } 66 72 … … 86 92 } 87 93 94 void WebInspectorClient::pageOverlayDestroyed(PageOverlay*) 95 { 96 } 97 98 void WebInspectorClient::willMoveToWebPage(PageOverlay*, WebPage* webPage) 99 { 100 if (webPage) 101 return; 102 103 // The page overlay is moving away from the web page, reset it. 104 ASSERT(m_highlightOverlay); 105 m_highlightOverlay = 0; 106 } 107 108 void WebInspectorClient::didMoveToWebPage(PageOverlay*, WebPage*) 109 { 110 } 111 112 void WebInspectorClient::drawRect(PageOverlay* overlay, WebCore::GraphicsContext& context, const WebCore::IntRect& dirtyRect) 113 { 114 m_page->corePage()->inspectorController()->drawNodeHighlight(context); 115 } 116 117 bool WebInspectorClient::mouseEvent(PageOverlay*, const WebMouseEvent&) 118 { 119 return false; 120 } 121 88 122 } // namespace WebKit 89 123 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
r72666 r84781 29 29 #if ENABLE(INSPECTOR) 30 30 31 #include "PageOverlay.h" 32 31 33 #include <WebCore/InspectorClient.h> 34 35 namespace WebCore { 36 class GraphicsContext; 37 class IntRect; 38 } 32 39 33 40 namespace WebKit { … … 35 42 class WebPage; 36 43 37 class WebInspectorClient : public WebCore::InspectorClient {44 class WebInspectorClient : public WebCore::InspectorClient, private PageOverlay::Client { 38 45 public: 39 46 WebInspectorClient(WebPage* page) 40 47 : m_page(page) 48 , m_highlightOverlay(0) 41 49 { 42 50 } … … 55 63 virtual bool sendMessageToFrontend(const String&); 56 64 65 // PageOverlay::Client 66 virtual void pageOverlayDestroyed(PageOverlay*); 67 virtual void willMoveToWebPage(PageOverlay*, WebPage*); 68 virtual void didMoveToWebPage(PageOverlay*, WebPage*); 69 virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect&); 70 virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&); 71 57 72 WebPage* m_page; 73 PageOverlay* m_highlightOverlay; 58 74 }; 59 75
Note: See TracChangeset
for help on using the changeset viewer.