| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "web/InspectorOverlay.h" | 29 #include "web/InspectorOverlay.h" |
| 30 | 30 |
| 31 #include <memory> |
| 32 |
| 31 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 32 #include "bindings/core/v8/ScriptSourceCode.h" | 34 #include "bindings/core/v8/ScriptSourceCode.h" |
| 33 #include "bindings/core/v8/V8InspectorOverlayHost.h" | 35 #include "bindings/core/v8/V8InspectorOverlayHost.h" |
| 34 #include "core/dom/Node.h" | 36 #include "core/dom/Node.h" |
| 35 #include "core/dom/StaticNodeList.h" | 37 #include "core/dom/StaticNodeList.h" |
| 36 #include "core/frame/FrameHost.h" | 38 #include "core/frame/FrameHost.h" |
| 37 #include "core/frame/FrameView.h" | 39 #include "core/frame/FrameView.h" |
| 38 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/LocalFrameClient.h" |
| 39 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 40 #include "core/frame/VisualViewport.h" | 43 #include "core/frame/VisualViewport.h" |
| 41 #include "core/input/EventHandler.h" | 44 #include "core/input/EventHandler.h" |
| 42 #include "core/inspector/InspectorOverlayHost.h" | 45 #include "core/inspector/InspectorOverlayHost.h" |
| 43 #include "core/layout/api/LayoutViewItem.h" | 46 #include "core/layout/api/LayoutViewItem.h" |
| 44 #include "core/loader/EmptyClients.h" | 47 #include "core/loader/EmptyClients.h" |
| 45 #include "core/loader/FrameLoadRequest.h" | 48 #include "core/loader/FrameLoadRequest.h" |
| 46 #include "core/page/ChromeClient.h" | 49 #include "core/page/ChromeClient.h" |
| 47 #include "core/page/Page.h" | 50 #include "core/page/Page.h" |
| 48 #include "platform/ScriptForbiddenScope.h" | 51 #include "platform/ScriptForbiddenScope.h" |
| 49 #include "platform/graphics/GraphicsContext.h" | 52 #include "platform/graphics/GraphicsContext.h" |
| 50 #include "platform/graphics/paint/CullRect.h" | 53 #include "platform/graphics/paint/CullRect.h" |
| 51 #include "public/platform/Platform.h" | 54 #include "public/platform/Platform.h" |
| 52 #include "public/platform/WebData.h" | 55 #include "public/platform/WebData.h" |
| 56 #include "v8/include/v8.h" |
| 53 #include "web/ChromeClientImpl.h" | 57 #include "web/ChromeClientImpl.h" |
| 54 #include "web/PageOverlay.h" | 58 #include "web/PageOverlay.h" |
| 55 #include "web/WebInputEventConversion.h" | 59 #include "web/WebInputEventConversion.h" |
| 56 #include "web/WebLocalFrameImpl.h" | 60 #include "web/WebLocalFrameImpl.h" |
| 57 #include "wtf/AutoReset.h" | 61 #include "wtf/AutoReset.h" |
| 58 #include <memory> | |
| 59 #include <v8.h> | |
| 60 | 62 |
| 61 namespace blink { | 63 namespace blink { |
| 62 | 64 |
| 63 namespace { | 65 namespace { |
| 64 | 66 |
| 65 Node* hoveredNodeForPoint(LocalFrame* frame, | 67 Node* hoveredNodeForPoint(LocalFrame* frame, |
| 66 const IntPoint& pointInRootFrame, | 68 const IntPoint& pointInRootFrame, |
| 67 bool ignorePointerEventsNone) { | 69 bool ignorePointerEventsNone) { |
| 68 HitTestRequest::HitTestRequestType hitType = | 70 HitTestRequest::HitTestRequestType hitType = |
| 69 HitTestRequest::Move | HitTestRequest::ReadOnly | | 71 HitTestRequest::Move | HitTestRequest::ReadOnly | |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 return 1.0f; | 497 return 1.0f; |
| 496 return frame->host()->chromeClient().windowToViewportScalar(1.0f); | 498 return frame->host()->chromeClient().windowToViewportScalar(1.0f); |
| 497 } | 499 } |
| 498 | 500 |
| 499 Page* InspectorOverlay::overlayPage() { | 501 Page* InspectorOverlay::overlayPage() { |
| 500 if (m_overlayPage) | 502 if (m_overlayPage) |
| 501 return m_overlayPage.get(); | 503 return m_overlayPage.get(); |
| 502 | 504 |
| 503 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 505 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 504 | 506 |
| 505 DEFINE_STATIC_LOCAL(FrameLoaderClient, dummyFrameLoaderClient, | 507 DEFINE_STATIC_LOCAL(LocalFrameClient, dummyLocalFrameClient, |
| 506 (EmptyFrameLoaderClient::create())); | 508 (EmptyLocalFrameClient::create())); |
| 507 Page::PageClients pageClients; | 509 Page::PageClients pageClients; |
| 508 fillWithEmptyClients(pageClients); | 510 fillWithEmptyClients(pageClients); |
| 509 DCHECK(!m_overlayChromeClient); | 511 DCHECK(!m_overlayChromeClient); |
| 510 m_overlayChromeClient = InspectorOverlayChromeClient::create( | 512 m_overlayChromeClient = InspectorOverlayChromeClient::create( |
| 511 m_frameImpl->frame()->host()->chromeClient(), *this); | 513 m_frameImpl->frame()->host()->chromeClient(), *this); |
| 512 pageClients.chromeClient = m_overlayChromeClient.get(); | 514 pageClients.chromeClient = m_overlayChromeClient.get(); |
| 513 m_overlayPage = Page::create(pageClients); | 515 m_overlayPage = Page::create(pageClients); |
| 514 | 516 |
| 515 Settings& settings = m_frameImpl->frame()->page()->settings(); | 517 Settings& settings = m_frameImpl->frame()->page()->settings(); |
| 516 Settings& overlaySettings = m_overlayPage->settings(); | 518 Settings& overlaySettings = m_overlayPage->settings(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 531 overlaySettings.setMinimumLogicalFontSize( | 533 overlaySettings.setMinimumLogicalFontSize( |
| 532 settings.getMinimumLogicalFontSize()); | 534 settings.getMinimumLogicalFontSize()); |
| 533 overlaySettings.setScriptEnabled(true); | 535 overlaySettings.setScriptEnabled(true); |
| 534 overlaySettings.setPluginsEnabled(false); | 536 overlaySettings.setPluginsEnabled(false); |
| 535 overlaySettings.setLoadsImagesAutomatically(true); | 537 overlaySettings.setLoadsImagesAutomatically(true); |
| 536 // FIXME: http://crbug.com/363843. Inspector should probably create its | 538 // FIXME: http://crbug.com/363843. Inspector should probably create its |
| 537 // own graphics layers and attach them to the tree rather than going | 539 // own graphics layers and attach them to the tree rather than going |
| 538 // through some non-composited paint function. | 540 // through some non-composited paint function. |
| 539 overlaySettings.setAcceleratedCompositingEnabled(false); | 541 overlaySettings.setAcceleratedCompositingEnabled(false); |
| 540 | 542 |
| 541 LocalFrame* frame = LocalFrame::create(&dummyFrameLoaderClient, | 543 LocalFrame* frame = LocalFrame::create(&dummyLocalFrameClient, |
| 542 &m_overlayPage->frameHost(), 0); | 544 &m_overlayPage->frameHost(), 0); |
| 543 frame->setView(FrameView::create(*frame)); | 545 frame->setView(FrameView::create(*frame)); |
| 544 frame->init(); | 546 frame->init(); |
| 545 FrameLoader& loader = frame->loader(); | 547 FrameLoader& loader = frame->loader(); |
| 546 frame->view()->setCanHaveScrollbars(false); | 548 frame->view()->setCanHaveScrollbars(false); |
| 547 frame->view()->setTransparent(true); | 549 frame->view()->setTransparent(true); |
| 548 | 550 |
| 549 const WebData& overlayPageHTMLResource = | 551 const WebData& overlayPageHTMLResource = |
| 550 Platform::current()->loadResource("InspectorOverlayPage.html"); | 552 Platform::current()->loadResource("InspectorOverlayPage.html"); |
| 551 RefPtr<SharedBuffer> data = SharedBuffer::create( | 553 RefPtr<SharedBuffer> data = SharedBuffer::create( |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 bool InspectorOverlay::shouldSearchForNode() { | 787 bool InspectorOverlay::shouldSearchForNode() { |
| 786 return m_inspectMode != InspectorDOMAgent::NotSearching; | 788 return m_inspectMode != InspectorDOMAgent::NotSearching; |
| 787 } | 789 } |
| 788 | 790 |
| 789 void InspectorOverlay::inspect(Node* node) { | 791 void InspectorOverlay::inspect(Node* node) { |
| 790 if (m_domAgent) | 792 if (m_domAgent) |
| 791 m_domAgent->inspect(node); | 793 m_domAgent->inspect(node); |
| 792 } | 794 } |
| 793 | 795 |
| 794 } // namespace blink | 796 } // namespace blink |
| OLD | NEW |