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

Side by Side Diff: Source/WebCore/testing/Internals.cpp

Issue 13646003: DevTools: Remove ENABLE(INSPECTOR) and ENABLE(JAVASCRIPT_DEBUGGER) from the code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #endif 149 #endif
150 150
151 namespace WebCore { 151 namespace WebCore {
152 152
153 #if ENABLE(PAGE_POPUP) 153 #if ENABLE(PAGE_POPUP)
154 static MockPagePopupDriver* s_pagePopupDriver = 0; 154 static MockPagePopupDriver* s_pagePopupDriver = 0;
155 #endif 155 #endif
156 156
157 using namespace HTMLNames; 157 using namespace HTMLNames;
158 158
159 #if ENABLE(INSPECTOR)
160 class InspectorFrontendClientDummy : public InspectorFrontendClientLocal { 159 class InspectorFrontendClientDummy : public InspectorFrontendClientLocal {
161 public: 160 public:
162 InspectorFrontendClientDummy(InspectorController*, Page*); 161 InspectorFrontendClientDummy(InspectorController*, Page*);
163 virtual ~InspectorFrontendClientDummy() { } 162 virtual ~InspectorFrontendClientDummy() { }
164 virtual void attachWindow(DockSide) OVERRIDE { } 163 virtual void attachWindow(DockSide) OVERRIDE { }
165 virtual void detachWindow() OVERRIDE { } 164 virtual void detachWindow() OVERRIDE { }
166 165
167 virtual String localizedStringsURL() OVERRIDE { return String(); } 166 virtual String localizedStringsURL() OVERRIDE { return String(); }
168 167
169 virtual void bringToFront() OVERRIDE { } 168 virtual void bringToFront() OVERRIDE { }
(...skipping 23 matching lines...) Expand all
193 192
194 InspectorFrontendChannelDummy::InspectorFrontendChannelDummy(Page* page) 193 InspectorFrontendChannelDummy::InspectorFrontendChannelDummy(Page* page)
195 : m_frontendPage(page) 194 : m_frontendPage(page)
196 { 195 {
197 } 196 }
198 197
199 bool InspectorFrontendChannelDummy::sendMessageToFrontend(const String& message) 198 bool InspectorFrontendChannelDummy::sendMessageToFrontend(const String& message)
200 { 199 {
201 return InspectorClient::doDispatchMessageOnFrontendPage(m_frontendPage, mess age); 200 return InspectorClient::doDispatchMessageOnFrontendPage(m_frontendPage, mess age);
202 } 201 }
203 #endif // ENABLE(INSPECTOR)
204 202
205 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result) 203 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result)
206 { 204 {
207 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all")) 205 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all"))
208 result = DocumentMarker::AllMarkers(); 206 result = DocumentMarker::AllMarkers();
209 else if (equalIgnoringCase(markerType, "Spelling")) 207 else if (equalIgnoringCase(markerType, "Spelling"))
210 result = DocumentMarker::Spelling; 208 result = DocumentMarker::Spelling;
211 else if (equalIgnoringCase(markerType, "Grammar")) 209 else if (equalIgnoringCase(markerType, "Grammar"))
212 result = DocumentMarker::Grammar; 210 result = DocumentMarker::Grammar;
213 else if (equalIgnoringCase(markerType, "TextMatch")) 211 else if (equalIgnoringCase(markerType, "TextMatch"))
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 261 }
264 TextRun::setAllowsRoundingHacks(false); 262 TextRun::setAllowsRoundingHacks(false);
265 WebCore::overrideUserPreferredLanguages(Vector<String>()); 263 WebCore::overrideUserPreferredLanguages(Vector<String>());
266 WebCore::Settings::setUsesOverlayScrollbars(false); 264 WebCore::Settings::setUsesOverlayScrollbars(false);
267 #if ENABLE(PAGE_POPUP) 265 #if ENABLE(PAGE_POPUP)
268 delete s_pagePopupDriver; 266 delete s_pagePopupDriver;
269 s_pagePopupDriver = 0; 267 s_pagePopupDriver = 0;
270 if (page->chrome()) 268 if (page->chrome())
271 page->chrome()->client()->resetPagePopupDriver(); 269 page->chrome()->client()->resetPagePopupDriver();
272 #endif 270 #endif
273 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
274 if (page->inspectorController()) 271 if (page->inspectorController())
275 page->inspectorController()->setProfilerEnabled(false); 272 page->inspectorController()->setProfilerEnabled(false);
276 #endif
277 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN) 273 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN)
278 page->group().captionPreferences()->setTestingMode(false); 274 page->group().captionPreferences()->setTestingMode(false);
279 #endif 275 #endif
280 if (!page->mainFrame()->editor()->isContinuousSpellCheckingEnabled()) 276 if (!page->mainFrame()->editor()->isContinuousSpellCheckingEnabled())
281 page->mainFrame()->editor()->toggleContinuousSpellChecking(); 277 page->mainFrame()->editor()->toggleContinuousSpellChecking();
282 if (page->mainFrame()->editor()->isOverwriteModeEnabled()) 278 if (page->mainFrame()->editor()->isOverwriteModeEnabled())
283 page->mainFrame()->editor()->toggleOverwriteModeEnabled(); 279 page->mainFrame()->editor()->toggleOverwriteModeEnabled();
284 } 280 }
285 281
286 Internals::Internals(Document* document) 282 Internals::Internals(Document* document)
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 914
919 element->document()->updateLayoutIgnorePendingStylesheets(); 915 element->document()->updateLayoutIgnorePendingStylesheets();
920 RenderObject* renderer = element->renderer(); 916 RenderObject* renderer = element->renderer();
921 if (!renderer) 917 if (!renderer)
922 return ClientRect::create(); 918 return ClientRect::create();
923 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s()); 919 return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransform s());
924 } 920 }
925 921
926 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionCode& ec) 922 PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document , ExceptionCode& ec)
927 { 923 {
928 #if ENABLE(INSPECTOR)
929 if (!document || !document->page() || !document->page()->inspectorController ()) { 924 if (!document || !document->page() || !document->page()->inspectorController ()) {
930 ec = INVALID_ACCESS_ERR; 925 ec = INVALID_ACCESS_ERR;
931 return ClientRectList::create(); 926 return ClientRectList::create();
932 } 927 }
933 928
934 Highlight highlight; 929 Highlight highlight;
935 document->page()->inspectorController()->getHighlight(&highlight); 930 document->page()->inspectorController()->getHighlight(&highlight);
936 return ClientRectList::create(highlight.quads); 931 return ClientRectList::create(highlight.quads);
937 #else
938 UNUSED_PARAM(document);
939 UNUSED_PARAM(ec);
940 return ClientRectList::create();
941 #endif
942 } 932 }
943 933
944 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionCode& ec) 934 unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc eptionCode& ec)
945 { 935 {
946 if (!node) { 936 if (!node) {
947 ec = INVALID_ACCESS_ERR; 937 ec = INVALID_ACCESS_ERR;
948 return 0; 938 return 0;
949 } 939 }
950 940
951 DocumentMarker::MarkerTypes markerTypes = 0; 941 DocumentMarker::MarkerTypes markerTypes = 0;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 if (!allowShadowContent) 1413 if (!allowShadowContent)
1424 hitType |= HitTestRequest::DisallowShadowContent; 1414 hitType |= HitTestRequest::DisallowShadowContent;
1425 if (allowChildFrameContent) 1415 if (allowChildFrameContent)
1426 hitType |= HitTestRequest::AllowChildFrameContent; 1416 hitType |= HitTestRequest::AllowChildFrameContent;
1427 1417
1428 return document->nodesFromRect(x, y, topPadding, rightPadding, bottomPadding , leftPadding, hitType); 1418 return document->nodesFromRect(x, y, topPadding, rightPadding, bottomPadding , leftPadding, hitType);
1429 } 1419 }
1430 1420
1431 void Internals::emitInspectorDidBeginFrame() 1421 void Internals::emitInspectorDidBeginFrame()
1432 { 1422 {
1433 #if ENABLE(INSPECTOR)
1434 InspectorController* inspectorController = contextDocument()->frame()->page( )->inspectorController(); 1423 InspectorController* inspectorController = contextDocument()->frame()->page( )->inspectorController();
1435 inspectorController->didBeginFrame(); 1424 inspectorController->didBeginFrame();
1436 #endif
1437 } 1425 }
1438 1426
1439 void Internals::emitInspectorDidCancelFrame() 1427 void Internals::emitInspectorDidCancelFrame()
1440 { 1428 {
1441 #if ENABLE(INSPECTOR)
1442 InspectorController* inspectorController = contextDocument()->frame()->page( )->inspectorController(); 1429 InspectorController* inspectorController = contextDocument()->frame()->page( )->inspectorController();
1443 inspectorController->didCancelFrame(); 1430 inspectorController->didCancelFrame();
1444 #endif
1445 } 1431 }
1446 1432
1447 void Internals::setBatteryStatus(Document* document, const String& eventType, bo ol charging, double chargingTime, double dischargingTime, double level, Exceptio nCode& ec) 1433 void Internals::setBatteryStatus(Document* document, const String& eventType, bo ol charging, double chargingTime, double dischargingTime, double level, Exceptio nCode& ec)
1448 { 1434 {
1449 if (!document || !document->page()) { 1435 if (!document || !document->page()) {
1450 ec = INVALID_ACCESS_ERR; 1436 ec = INVALID_ACCESS_ERR;
1451 return; 1437 return;
1452 } 1438 }
1453 1439
1454 #if ENABLE(BATTERY_STATUS) 1440 #if ENABLE(BATTERY_STATUS)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 } 1515 }
1530 1516
1531 void Internals::toggleOverwriteModeEnabled(Document* document, ExceptionCode&) 1517 void Internals::toggleOverwriteModeEnabled(Document* document, ExceptionCode&)
1532 { 1518 {
1533 if (!document || !document->frame()) 1519 if (!document || !document->frame())
1534 return; 1520 return;
1535 1521
1536 document->frame()->editor()->toggleOverwriteModeEnabled(); 1522 document->frame()->editor()->toggleOverwriteModeEnabled();
1537 } 1523 }
1538 1524
1539 #if ENABLE(INSPECTOR)
1540 unsigned Internals::numberOfLiveNodes() const 1525 unsigned Internals::numberOfLiveNodes() const
1541 { 1526 {
1542 return InspectorCounters::counterValue(InspectorCounters::NodeCounter); 1527 return InspectorCounters::counterValue(InspectorCounters::NodeCounter);
1543 } 1528 }
1544 1529
1545 unsigned Internals::numberOfLiveDocuments() const 1530 unsigned Internals::numberOfLiveDocuments() const
1546 { 1531 {
1547 return InspectorCounters::counterValue(InspectorCounters::DocumentCounter); 1532 return InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
1548 } 1533 }
1549 1534
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 void Internals::setJavaScriptProfilingEnabled(bool enabled, ExceptionCode& ec) 1599 void Internals::setJavaScriptProfilingEnabled(bool enabled, ExceptionCode& ec)
1615 { 1600 {
1616 Page* page = contextDocument()->frame()->page(); 1601 Page* page = contextDocument()->frame()->page();
1617 if (!page || !page->inspectorController()) { 1602 if (!page || !page->inspectorController()) {
1618 ec = INVALID_ACCESS_ERR; 1603 ec = INVALID_ACCESS_ERR;
1619 return; 1604 return;
1620 } 1605 }
1621 1606
1622 page->inspectorController()->setProfilerEnabled(enabled); 1607 page->inspectorController()->setProfilerEnabled(enabled);
1623 } 1608 }
1624 #endif // ENABLE(INSPECTOR)
1625 1609
1626 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionCode&) 1610 bool Internals::hasGrammarMarker(Document* document, int from, int length, Excep tionCode&)
1627 { 1611 {
1628 if (!document || !document->frame()) 1612 if (!document || !document->frame())
1629 return 0; 1613 return 0;
1630 1614
1631 return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarke r::Grammar, from, length); 1615 return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarke r::Grammar, from, length);
1632 } 1616 }
1633 1617
1634 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&) 1618 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&)
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 #if USE(GSTREAMER) 2080 #if USE(GSTREAMER)
2097 HTMLMediaElement* element = toMediaElement(node); 2081 HTMLMediaElement* element = toMediaElement(node);
2098 element->player()->simulateAudioInterruption(); 2082 element->player()->simulateAudioInterruption();
2099 #else 2083 #else
2100 UNUSED_PARAM(node); 2084 UNUSED_PARAM(node);
2101 #endif 2085 #endif
2102 } 2086 }
2103 #endif 2087 #endif
2104 2088
2105 } 2089 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698