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

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

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 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
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 void paintPageOverlay(const PageOverlay&, GraphicsContext& graphicsContext, const WebSize& webViewSize) const override 112 void paintPageOverlay(const PageOverlay&, GraphicsContext& graphicsContext, const WebSize& webViewSize) const override
113 { 113 {
114 if (m_overlay->isEmpty()) 114 if (m_overlay->isEmpty())
115 return; 115 return;
116 116
117 // Skip cache because the following paint may conflict with the view's r eal painting. 117 // Skip cache because the following paint may conflict with the view's r eal painting.
118 DisplayItemCacheSkipper cacheSkipper(graphicsContext); 118 DisplayItemCacheSkipper cacheSkipper(graphicsContext);
119 FrameView* view = m_overlay->overlayMainFrame()->view(); 119 FrameView* view = m_overlay->overlayMainFrame()->view();
120 ASSERT(!view->needsLayout()); 120 DCHECK(!view->needsLayout());
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:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 , m_timer(this, &InspectorOverlay::onTimer) 186 , m_timer(this, &InspectorOverlay::onTimer)
187 , m_suspendCount(0) 187 , m_suspendCount(0)
188 , m_inLayout(false) 188 , m_inLayout(false)
189 , m_needsUpdate(false) 189 , m_needsUpdate(false)
190 , m_inspectMode(InspectorDOMAgent::NotSearching) 190 , m_inspectMode(InspectorDOMAgent::NotSearching)
191 { 191 {
192 } 192 }
193 193
194 InspectorOverlay::~InspectorOverlay() 194 InspectorOverlay::~InspectorOverlay()
195 { 195 {
196 ASSERT(!m_overlayPage); 196 DCHECK(!m_overlayPage);
197 } 197 }
198 198
199 DEFINE_TRACE(InspectorOverlay) 199 DEFINE_TRACE(InspectorOverlay)
200 { 200 {
201 visitor->trace(m_highlightNode); 201 visitor->trace(m_highlightNode);
202 visitor->trace(m_eventTargetNode); 202 visitor->trace(m_eventTargetNode);
203 visitor->trace(m_overlayPage); 203 visitor->trace(m_overlayPage);
204 visitor->trace(m_overlayChromeClient); 204 visitor->trace(m_overlayChromeClient);
205 visitor->trace(m_overlayHost); 205 visitor->trace(m_overlayHost);
206 visitor->trace(m_debuggerAgent); 206 visitor->trace(m_debuggerAgent);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 Page* InspectorOverlay::overlayPage() 464 Page* InspectorOverlay::overlayPage()
465 { 465 {
466 if (m_overlayPage) 466 if (m_overlayPage)
467 return m_overlayPage.get(); 467 return m_overlayPage.get();
468 468
469 ScriptForbiddenScope::AllowUserAgentScript allowScript; 469 ScriptForbiddenScope::AllowUserAgentScript allowScript;
470 470
471 DEFINE_STATIC_LOCAL(Persistent<FrameLoaderClient>, dummyFrameLoaderClient, ( EmptyFrameLoaderClient::create())); 471 DEFINE_STATIC_LOCAL(Persistent<FrameLoaderClient>, dummyFrameLoaderClient, ( EmptyFrameLoaderClient::create()));
472 Page::PageClients pageClients; 472 Page::PageClients pageClients;
473 fillWithEmptyClients(pageClients); 473 fillWithEmptyClients(pageClients);
474 ASSERT(!m_overlayChromeClient); 474 DCHECK(!m_overlayChromeClient);
475 m_overlayChromeClient = InspectorOverlayChromeClient::create(m_webViewImpl-> page()->chromeClient(), *this); 475 m_overlayChromeClient = InspectorOverlayChromeClient::create(m_webViewImpl-> page()->chromeClient(), *this);
476 pageClients.chromeClient = m_overlayChromeClient.get(); 476 pageClients.chromeClient = m_overlayChromeClient.get();
477 m_overlayPage = Page::create(pageClients); 477 m_overlayPage = Page::create(pageClients);
478 478
479 Settings& settings = m_webViewImpl->page()->settings(); 479 Settings& settings = m_webViewImpl->page()->settings();
480 Settings& overlaySettings = m_overlayPage->settings(); 480 Settings& overlaySettings = m_overlayPage->settings();
481 481
482 overlaySettings.genericFontFamilySettings().updateStandard(settings.genericF ontFamilySettings().standard()); 482 overlaySettings.genericFontFamilySettings().updateStandard(settings.genericF ontFamilySettings().standard());
483 overlaySettings.genericFontFamilySettings().updateSerif(settings.genericFont FamilySettings().serif()); 483 overlaySettings.genericFontFamilySettings().updateSerif(settings.genericFont FamilySettings().serif());
484 overlaySettings.genericFontFamilySettings().updateSansSerif(settings.generic FontFamilySettings().sansSerif()); 484 overlaySettings.genericFontFamilySettings().updateSansSerif(settings.generic FontFamilySettings().sansSerif());
(...skipping 15 matching lines...) Expand all
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.get());
509 ScriptState* scriptState = ScriptState::forMainWorld(frame.get()); 509 ScriptState* scriptState = ScriptState::forMainWorld(frame.get());
510 ASSERT(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 ASSERT(!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)
520 evaluateInOverlay("setPlatform", "mac"); 520 evaluateInOverlay("setPlatform", "mac");
521 #elif OS(POSIX) 521 #elif OS(POSIX)
522 evaluateInOverlay("setPlatform", "linux"); 522 evaluateInOverlay("setPlatform", "linux");
523 #endif 523 #endif
524 524
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 void InspectorOverlay::overlaySteppedOver() 602 void InspectorOverlay::overlaySteppedOver()
603 { 603 {
604 if (m_debuggerAgent) { 604 if (m_debuggerAgent) {
605 ErrorString error; 605 ErrorString error;
606 m_debuggerAgent->stepOver(&error); 606 m_debuggerAgent->stepOver(&error);
607 } 607 }
608 } 608 }
609 609
610 void InspectorOverlay::overlayStartedPropertyChange(const String& property) 610 void InspectorOverlay::overlayStartedPropertyChange(const String& property)
611 { 611 {
612 ASSERT(m_layoutEditor); 612 DCHECK(m_layoutEditor);
613 m_layoutEditor->overlayStartedPropertyChange(property); 613 m_layoutEditor->overlayStartedPropertyChange(property);
614 } 614 }
615 615
616 void InspectorOverlay::overlayPropertyChanged(float value) 616 void InspectorOverlay::overlayPropertyChanged(float value)
617 { 617 {
618 ASSERT(m_layoutEditor); 618 DCHECK(m_layoutEditor);
619 m_layoutEditor->overlayPropertyChanged(value); 619 m_layoutEditor->overlayPropertyChanged(value);
620 } 620 }
621 621
622 void InspectorOverlay::overlayEndedPropertyChange() 622 void InspectorOverlay::overlayEndedPropertyChange()
623 { 623 {
624 ASSERT(m_layoutEditor); 624 DCHECK(m_layoutEditor);
625 m_layoutEditor->overlayEndedPropertyChange(); 625 m_layoutEditor->overlayEndedPropertyChange();
626 } 626 }
627 627
628 void InspectorOverlay::overlayNextSelector() 628 void InspectorOverlay::overlayNextSelector()
629 { 629 {
630 ASSERT(m_layoutEditor); 630 DCHECK(m_layoutEditor);
631 m_layoutEditor->nextSelector(); 631 m_layoutEditor->nextSelector();
632 } 632 }
633 633
634 void InspectorOverlay::overlayPreviousSelector() 634 void InspectorOverlay::overlayPreviousSelector()
635 { 635 {
636 ASSERT(m_layoutEditor); 636 DCHECK(m_layoutEditor);
637 m_layoutEditor->previousSelector(); 637 m_layoutEditor->previousSelector();
638 } 638 }
639 639
640 void InspectorOverlay::overlayClearSelection(bool commitChanges) 640 void InspectorOverlay::overlayClearSelection(bool commitChanges)
641 { 641 {
642 ASSERT(m_layoutEditor); 642 DCHECK(m_layoutEditor);
643 m_hoveredNodeForInspectMode = m_layoutEditor->element(); 643 m_hoveredNodeForInspectMode = m_layoutEditor->element();
644 644
645 if (commitChanges) 645 if (commitChanges)
646 m_layoutEditor->commitChanges(); 646 m_layoutEditor->commitChanges();
647 647
648 if (m_layoutEditor) { 648 if (m_layoutEditor) {
649 m_layoutEditor->dispose(); 649 m_layoutEditor->dispose();
650 m_layoutEditor.clear(); 650 m_layoutEditor.clear();
651 } 651 }
652 652
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/FullscreenController.cpp ('k') | third_party/WebKit/Source/web/LinkHighlightImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698