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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 view->paint(graphicsContext, CullRect(IntRect(0, 0, view->width(), view-
>height()))); | 121 view->paint(graphicsContext, CullRect(IntRect(0, 0, view->width(), view-
>height()))); |
122 } | 122 } |
123 | 123 |
124 private: | 124 private: |
125 Member<InspectorOverlay> m_overlay; | 125 Member<InspectorOverlay> m_overlay; |
126 }; | 126 }; |
127 | 127 |
128 | 128 |
129 class InspectorOverlay::InspectorOverlayChromeClient final : public EmptyChromeC
lient { | 129 class InspectorOverlay::InspectorOverlayChromeClient final : public EmptyChromeC
lient { |
130 public: | 130 public: |
131 static RawPtr<InspectorOverlayChromeClient> create(ChromeClient& client, Ins
pectorOverlay& overlay) | 131 static InspectorOverlayChromeClient* create(ChromeClient& client, InspectorO
verlay& overlay) |
132 { | 132 { |
133 return new InspectorOverlayChromeClient(client, overlay); | 133 return new InspectorOverlayChromeClient(client, overlay); |
134 } | 134 } |
135 | 135 |
136 DEFINE_INLINE_VIRTUAL_TRACE() | 136 DEFINE_INLINE_VIRTUAL_TRACE() |
137 { | 137 { |
138 visitor->trace(m_client); | 138 visitor->trace(m_client); |
139 visitor->trace(m_overlay); | 139 visitor->trace(m_overlay); |
140 EmptyChromeClient::trace(visitor); | 140 EmptyChromeClient::trace(visitor); |
141 } | 141 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 result->setNumber("height", size.height()); | 407 result->setNumber("height", size.height()); |
408 return result.release(); | 408 return result.release(); |
409 } | 409 } |
410 | 410 |
411 void InspectorOverlay::drawNodeHighlight() | 411 void InspectorOverlay::drawNodeHighlight() |
412 { | 412 { |
413 if (!m_highlightNode) | 413 if (!m_highlightNode) |
414 return; | 414 return; |
415 | 415 |
416 String selectors = m_nodeHighlightConfig.selectorList; | 416 String selectors = m_nodeHighlightConfig.selectorList; |
417 RawPtr<StaticElementList> elements = nullptr; | 417 StaticElementList* elements = nullptr; |
418 TrackExceptionState exceptionState; | 418 TrackExceptionState exceptionState; |
419 ContainerNode* queryBase = m_highlightNode->containingShadowRoot(); | 419 ContainerNode* queryBase = m_highlightNode->containingShadowRoot(); |
420 if (!queryBase) | 420 if (!queryBase) |
421 queryBase = m_highlightNode->ownerDocument(); | 421 queryBase = m_highlightNode->ownerDocument(); |
422 if (selectors.length()) | 422 if (selectors.length()) |
423 elements = queryBase->querySelectorAll(AtomicString(selectors), exceptio
nState); | 423 elements = queryBase->querySelectorAll(AtomicString(selectors), exceptio
nState); |
424 if (elements && !exceptionState.hadException()) { | 424 if (elements && !exceptionState.hadException()) { |
425 for (unsigned i = 0; i < elements->length(); ++i) { | 425 for (unsigned i = 0; i < elements->length(); ++i) { |
426 Element* element = elements->item(i); | 426 Element* element = elements->item(i); |
427 InspectorHighlight highlight(element, m_nodeHighlightConfig, false); | 427 InspectorHighlight highlight(element, m_nodeHighlightConfig, false); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 overlaySettings.setMinimumFontSize(settings.minimumFontSize()); | 488 overlaySettings.setMinimumFontSize(settings.minimumFontSize()); |
489 overlaySettings.setMinimumLogicalFontSize(settings.minimumLogicalFontSize())
; | 489 overlaySettings.setMinimumLogicalFontSize(settings.minimumLogicalFontSize())
; |
490 overlaySettings.setScriptEnabled(true); | 490 overlaySettings.setScriptEnabled(true); |
491 overlaySettings.setPluginsEnabled(false); | 491 overlaySettings.setPluginsEnabled(false); |
492 overlaySettings.setLoadsImagesAutomatically(true); | 492 overlaySettings.setLoadsImagesAutomatically(true); |
493 // FIXME: http://crbug.com/363843. Inspector should probably create its | 493 // FIXME: http://crbug.com/363843. Inspector should probably create its |
494 // own graphics layers and attach them to the tree rather than going | 494 // own graphics layers and attach them to the tree rather than going |
495 // through some non-composited paint function. | 495 // through some non-composited paint function. |
496 overlaySettings.setAcceleratedCompositingEnabled(false); | 496 overlaySettings.setAcceleratedCompositingEnabled(false); |
497 | 497 |
498 RawPtr<LocalFrame> frame = LocalFrame::create(&dummyFrameLoaderClient, &m_ov
erlayPage->frameHost(), 0); | 498 LocalFrame* frame = LocalFrame::create(&dummyFrameLoaderClient, &m_overlayPa
ge->frameHost(), 0); |
499 frame->setView(FrameView::create(frame.get())); | 499 frame->setView(FrameView::create(frame)); |
500 frame->init(); | 500 frame->init(); |
501 FrameLoader& loader = frame->loader(); | 501 FrameLoader& loader = frame->loader(); |
502 frame->view()->setCanHaveScrollbars(false); | 502 frame->view()->setCanHaveScrollbars(false); |
503 frame->view()->setTransparent(true); | 503 frame->view()->setTransparent(true); |
504 | 504 |
505 const WebData& overlayPageHTMLResource = Platform::current()->loadResource("
InspectorOverlayPage.html"); | 505 const WebData& overlayPageHTMLResource = Platform::current()->loadResource("
InspectorOverlayPage.html"); |
506 RefPtr<SharedBuffer> data = SharedBuffer::create(overlayPageHTMLResource.dat
a(), overlayPageHTMLResource.size()); | 506 RefPtr<SharedBuffer> data = SharedBuffer::create(overlayPageHTMLResource.dat
a(), overlayPageHTMLResource.size()); |
507 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "text/html"
, "UTF-8", KURL(), ForceSynchronousLoad))); | 507 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "text/html"
, "UTF-8", KURL(), ForceSynchronousLoad))); |
508 v8::Isolate* isolate = toIsolate(frame.get()); | 508 v8::Isolate* isolate = toIsolate(frame); |
509 ScriptState* scriptState = ScriptState::forMainWorld(frame.get()); | 509 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
510 DCHECK(scriptState); | 510 DCHECK(scriptState); |
511 ScriptState::Scope scope(scriptState); | 511 ScriptState::Scope scope(scriptState); |
512 v8::Local<v8::Object> global = scriptState->context()->Global(); | 512 v8::Local<v8::Object> global = scriptState->context()->Global(); |
513 v8::Local<v8::Value> overlayHostObj = toV8(m_overlayHost.get(), global, isol
ate); | 513 v8::Local<v8::Value> overlayHostObj = toV8(m_overlayHost.get(), global, isol
ate); |
514 DCHECK(!overlayHostObj.IsEmpty()); | 514 DCHECK(!overlayHostObj.IsEmpty()); |
515 v8CallOrCrash(global->Set(scriptState->context(), v8AtomicString(isolate, "I
nspectorOverlayHost"), overlayHostObj)); | 515 v8CallOrCrash(global->Set(scriptState->context(), v8AtomicString(isolate, "I
nspectorOverlayHost"), overlayHostObj)); |
516 | 516 |
517 #if OS(WIN) | 517 #if OS(WIN) |
518 evaluateInOverlay("setPlatform", "windows"); | 518 evaluateInOverlay("setPlatform", "windows"); |
519 #elif OS(MACOSX) | 519 #elif OS(MACOSX) |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 774 |
775 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) | 775 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) |
776 { | 776 { |
777 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive()) | 777 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive()) |
778 return; | 778 return; |
779 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); | 779 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); |
780 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); | 780 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); |
781 } | 781 } |
782 | 782 |
783 } // namespace blink | 783 } // namespace blink |
OLD | NEW |