Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: third_party/WebKit/Source/web/InspectorOverlay.cpp

Issue 1984593002: Remove OwnPtr::release() calls in web/ & wtf/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with trunk. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 drawViewSize(); 395 drawViewSize();
396 if (m_layoutEditor && !m_highlightNode) 396 if (m_layoutEditor && !m_highlightNode)
397 m_layoutEditor->rebuild(); 397 m_layoutEditor->rebuild();
398 } 398 }
399 399
400 static PassOwnPtr<protocol::DictionaryValue> buildObjectForSize(const IntSize& s ize) 400 static PassOwnPtr<protocol::DictionaryValue> buildObjectForSize(const IntSize& s ize)
401 { 401 {
402 OwnPtr<protocol::DictionaryValue> result = protocol::DictionaryValue::create (); 402 OwnPtr<protocol::DictionaryValue> result = protocol::DictionaryValue::create ();
403 result->setNumber("width", size.width()); 403 result->setNumber("width", size.width());
404 result->setNumber("height", size.height()); 404 result->setNumber("height", size.height());
405 return result.release(); 405 return result;
406 } 406 }
407 407
408 void InspectorOverlay::drawNodeHighlight() 408 void InspectorOverlay::drawNodeHighlight()
409 { 409 {
410 if (!m_highlightNode) 410 if (!m_highlightNode)
411 return; 411 return;
412 412
413 String selectors = m_nodeHighlightConfig.selectorList; 413 String selectors = m_nodeHighlightConfig.selectorList;
414 StaticElementList* elements = nullptr; 414 StaticElementList* elements = nullptr;
415 TrackExceptionState exceptionState; 415 TrackExceptionState exceptionState;
416 ContainerNode* queryBase = m_highlightNode->containingShadowRoot(); 416 ContainerNode* queryBase = m_highlightNode->containingShadowRoot();
417 if (!queryBase) 417 if (!queryBase)
418 queryBase = m_highlightNode->ownerDocument(); 418 queryBase = m_highlightNode->ownerDocument();
419 if (selectors.length()) 419 if (selectors.length())
420 elements = queryBase->querySelectorAll(AtomicString(selectors), exceptio nState); 420 elements = queryBase->querySelectorAll(AtomicString(selectors), exceptio nState);
421 if (elements && !exceptionState.hadException()) { 421 if (elements && !exceptionState.hadException()) {
422 for (unsigned i = 0; i < elements->length(); ++i) { 422 for (unsigned i = 0; i < elements->length(); ++i) {
423 Element* element = elements->item(i); 423 Element* element = elements->item(i);
424 InspectorHighlight highlight(element, m_nodeHighlightConfig, false); 424 InspectorHighlight highlight(element, m_nodeHighlightConfig, false);
425 OwnPtr<protocol::DictionaryValue> highlightJSON = highlight.asProtoc olValue(); 425 OwnPtr<protocol::DictionaryValue> highlightJSON = highlight.asProtoc olValue();
426 evaluateInOverlay("drawHighlight", highlightJSON.release()); 426 evaluateInOverlay("drawHighlight", std::move(highlightJSON));
427 } 427 }
428 } 428 }
429 429
430 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli ghtNode->document().frame(); 430 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli ghtNode->document().frame();
431 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a ppendElementInfo); 431 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a ppendElementInfo);
432 if (m_eventTargetNode) 432 if (m_eventTargetNode)
433 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh tConfig); 433 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh tConfig);
434 434
435 OwnPtr<protocol::DictionaryValue> highlightJSON = highlight.asProtocolValue( ); 435 OwnPtr<protocol::DictionaryValue> highlightJSON = highlight.asProtocolValue( );
436 evaluateInOverlay("drawHighlight", highlightJSON.release()); 436 evaluateInOverlay("drawHighlight", std::move(highlightJSON));
437 } 437 }
438 438
439 void InspectorOverlay::drawQuadHighlight() 439 void InspectorOverlay::drawQuadHighlight()
440 { 440 {
441 if (!m_highlightQuad) 441 if (!m_highlightQuad)
442 return; 442 return;
443 443
444 InspectorHighlight highlight; 444 InspectorHighlight highlight;
445 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline); 445 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline);
446 evaluateInOverlay("drawHighlight", highlight.asProtocolValue()); 446 evaluateInOverlay("drawHighlight", highlight.asProtocolValue());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 void InspectorOverlay::reset(const IntSize& viewportSize, const IntPoint& docume ntScrollOffset) 530 void InspectorOverlay::reset(const IntSize& viewportSize, const IntPoint& docume ntScrollOffset)
531 { 531 {
532 OwnPtr<protocol::DictionaryValue> resetData = protocol::DictionaryValue::cre ate(); 532 OwnPtr<protocol::DictionaryValue> resetData = protocol::DictionaryValue::cre ate();
533 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale Factor()); 533 resetData->setNumber("deviceScaleFactor", m_webViewImpl->page()->deviceScale Factor());
534 resetData->setNumber("pageScaleFactor", m_webViewImpl->page()->pageScaleFact or()); 534 resetData->setNumber("pageScaleFactor", m_webViewImpl->page()->pageScaleFact or());
535 resetData->setObject("viewportSize", buildObjectForSize(viewportSize)); 535 resetData->setObject("viewportSize", buildObjectForSize(viewportSize));
536 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame ()->pageZoomFactor()); 536 resetData->setNumber("pageZoomFactor", m_webViewImpl->mainFrameImpl()->frame ()->pageZoomFactor());
537 resetData->setNumber("scrollX", documentScrollOffset.x()); 537 resetData->setNumber("scrollX", documentScrollOffset.x());
538 resetData->setNumber("scrollY", documentScrollOffset.y()); 538 resetData->setNumber("scrollY", documentScrollOffset.y());
539 evaluateInOverlay("reset", resetData.release()); 539 evaluateInOverlay("reset", std::move(resetData));
540 } 540 }
541 541
542 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument) 542 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument)
543 { 543 {
544 ScriptForbiddenScope::AllowUserAgentScript allowScript; 544 ScriptForbiddenScope::AllowUserAgentScript allowScript;
545 OwnPtr<protocol::ListValue> command = protocol::ListValue::create(); 545 OwnPtr<protocol::ListValue> command = protocol::ListValue::create();
546 command->pushValue(protocol::StringValue::create(method)); 546 command->pushValue(protocol::StringValue::create(method));
547 command->pushValue(protocol::StringValue::create(argument)); 547 command->pushValue(protocol::StringValue::create(argument));
548 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld( "dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen ScriptsDisabled); 548 toLocalFrame(overlayPage()->mainFrame())->script().executeScriptInMainWorld( "dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhen ScriptsDisabled);
549 } 549 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node) 782 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node)
783 { 783 {
784 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent) 784 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || !node || !node-> isElementNode() || !node->ownerDocument()->isActive() || !m_cssAgent || !m_domAg ent)
785 return; 785 return;
786 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script()); 786 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgen t, &overlayMainFrame()->script());
787 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true); 787 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverridde n(true);
788 } 788 }
789 789
790 } // namespace blink 790 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698