| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode,
PassOwnPtr<InspectorHighlightConfig> highlightConfig) | 326 void InspectorOverlay::setInspectMode(InspectorDOMAgent::SearchMode searchMode,
PassOwnPtr<InspectorHighlightConfig> highlightConfig) |
| 327 { | 327 { |
| 328 if (m_layoutEditor) | 328 if (m_layoutEditor) |
| 329 overlayClearSelection(true); | 329 overlayClearSelection(true); |
| 330 | 330 |
| 331 m_inspectMode = searchMode; | 331 m_inspectMode = searchMode; |
| 332 scheduleUpdate(); | 332 scheduleUpdate(); |
| 333 | 333 |
| 334 if (searchMode != InspectorDOMAgent::NotSearching) { | 334 if (searchMode != InspectorDOMAgent::NotSearching) { |
| 335 m_inspectModeHighlightConfig = highlightConfig; | 335 m_inspectModeHighlightConfig = std::move(highlightConfig); |
| 336 } else { | 336 } else { |
| 337 m_hoveredNodeForInspectMode.clear(); | 337 m_hoveredNodeForInspectMode.clear(); |
| 338 hideHighlight(); | 338 hideHighlight(); |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 void InspectorOverlay::setInspectedNode(Node* node) | 342 void InspectorOverlay::setInspectedNode(Node* node) |
| 343 { | 343 { |
| 344 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || (m_layoutEditor
&& m_layoutEditor->element() == node)) | 344 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || (m_layoutEditor
&& m_layoutEditor->element() == node)) |
| 345 return; | 345 return; |
| 346 | 346 |
| 347 if (m_layoutEditor) { | 347 if (m_layoutEditor) { |
| 348 m_layoutEditor->commitChanges(); | 348 m_layoutEditor->commitChanges(); |
| 349 m_layoutEditor.clear(); | 349 m_layoutEditor.clear(); |
| 350 } | 350 } |
| 351 initializeLayoutEditorIfNeeded(node); | 351 initializeLayoutEditorIfNeeded(node); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspector
HighlightConfig& highlightConfig) | 354 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspector
HighlightConfig& highlightConfig) |
| 355 { | 355 { |
| 356 m_quadHighlightConfig = highlightConfig; | 356 m_quadHighlightConfig = highlightConfig; |
| 357 m_highlightQuad = quad; | 357 m_highlightQuad = std::move(quad); |
| 358 m_omitTooltip = false; | 358 m_omitTooltip = false; |
| 359 scheduleUpdate(); | 359 scheduleUpdate(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 bool InspectorOverlay::isEmpty() | 362 bool InspectorOverlay::isEmpty() |
| 363 { | 363 { |
| 364 if (m_suspendCount) | 364 if (m_suspendCount) |
| 365 return true; | 365 return true; |
| 366 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); | 366 bool hasVisibleElements = m_highlightNode || m_eventTargetNode || m_highligh
tQuad || (m_resizeTimerActive && m_drawViewSize) || !m_pausedInDebuggerMessage.
isNull(); |
| 367 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; | 367 return !hasVisibleElements && m_inspectMode == InspectorDOMAgent::NotSearchi
ng; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 command->pushValue(protocol::StringValue::create(method)); | 549 command->pushValue(protocol::StringValue::create(method)); |
| 550 command->pushValue(protocol::StringValue::create(argument)); | 550 command->pushValue(protocol::StringValue::create(argument)); |
| 551 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); | 551 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void InspectorOverlay::evaluateInOverlay(const String& method, PassOwnPtr<protoc
ol::Value> argument) | 554 void InspectorOverlay::evaluateInOverlay(const String& method, PassOwnPtr<protoc
ol::Value> argument) |
| 555 { | 555 { |
| 556 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 556 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 557 OwnPtr<protocol::ListValue> command = protocol::ListValue::create(); | 557 OwnPtr<protocol::ListValue> command = protocol::ListValue::create(); |
| 558 command->pushValue(protocol::StringValue::create(method)); | 558 command->pushValue(protocol::StringValue::create(method)); |
| 559 command->pushValue(argument); | 559 command->pushValue(std::move(argument)); |
| 560 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); | 560 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld(
"dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen
ScriptsDisabled); |
| 561 } | 561 } |
| 562 | 562 |
| 563 String InspectorOverlay::evaluateInOverlayForTest(const String& script) | 563 String InspectorOverlay::evaluateInOverlayForTest(const String& script) |
| 564 { | 564 { |
| 565 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 565 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 566 v8::HandleScope handleScope(toIsolate(overlayMainFrame())); | 566 v8::HandleScope handleScope(toIsolate(overlayMainFrame())); |
| 567 v8::Local<v8::Value> string = toLocalFrame(overlayPage()->mainFrame())->scri
pt().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(script), ScriptCont
roller::ExecuteScriptWhenScriptsDisabled); | 567 v8::Local<v8::Value> string = toLocalFrame(overlayPage()->mainFrame())->scri
pt().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(script), ScriptCont
roller::ExecuteScriptWhenScriptsDisabled); |
| 568 return toCoreStringWithUndefinedOrNullCheck(string); | 568 return toCoreStringWithUndefinedOrNullCheck(string); |
| 569 } | 569 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 780 |
| 781 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) | 781 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) |
| 782 { | 782 { |
| 783 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg
ent) | 783 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node->
isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg
ent) |
| 784 return; | 784 return; |
| 785 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); | 785 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen
t, &overlayMainFrame()->script()); |
| 786 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); | 786 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde
n(true); |
| 787 } | 787 } |
| 788 | 788 |
| 789 } // namespace blink | 789 } // namespace blink |
| OLD | NEW |