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

Side by Side Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 445023005: DevTools: reduce ResourceAgent dependency on PageAgent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/css/StyleSheet.h" 46 #include "core/css/StyleSheet.h"
47 #include "core/css/StyleSheetContents.h" 47 #include "core/css/StyleSheetContents.h"
48 #include "core/css/StyleSheetList.h" 48 #include "core/css/StyleSheetList.h"
49 #include "core/css/resolver/StyleResolver.h" 49 #include "core/css/resolver/StyleResolver.h"
50 #include "core/dom/Node.h" 50 #include "core/dom/Node.h"
51 #include "core/dom/StyleEngine.h" 51 #include "core/dom/StyleEngine.h"
52 #include "core/dom/Text.h" 52 #include "core/dom/Text.h"
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/html/HTMLHeadElement.h" 54 #include "core/html/HTMLHeadElement.h"
55 #include "core/html/VoidCallback.h" 55 #include "core/html/VoidCallback.h"
56 #include "core/inspector/EditedResourcesContentManager.h"
56 #include "core/inspector/InspectorHistory.h" 57 #include "core/inspector/InspectorHistory.h"
57 #include "core/inspector/InspectorPageAgent.h" 58 #include "core/inspector/InspectorPageAgent.h"
58 #include "core/inspector/InspectorResourceAgent.h" 59 #include "core/inspector/InspectorResourceAgent.h"
59 #include "core/inspector/InspectorResourceContentLoader.h" 60 #include "core/inspector/InspectorResourceContentLoader.h"
60 #include "core/inspector/InspectorState.h" 61 #include "core/inspector/InspectorState.h"
61 #include "core/inspector/InstrumentingAgents.h" 62 #include "core/inspector/InstrumentingAgents.h"
62 #include "core/loader/DocumentLoader.h" 63 #include "core/loader/DocumentLoader.h"
63 #include "core/page/Page.h" 64 #include "core/page/Page.h"
64 #include "core/rendering/InlineTextBox.h" 65 #include "core/rendering/InlineTextBox.h"
65 #include "core/rendering/RenderObject.h" 66 #include "core/rendering/RenderObject.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 }; 359 };
359 360
360 // static 361 // static
361 CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule) 362 CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule)
362 { 363 {
363 if (!rule || rule->type() != CSSRule::STYLE_RULE) 364 if (!rule || rule->type() != CSSRule::STYLE_RULE)
364 return 0; 365 return 0;
365 return toCSSStyleRule(rule); 366 return toCSSStyleRule(rule);
366 } 367 }
367 368
368 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA gent* pageAgent, InspectorResourceAgent* resourceAgent) 369 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA gent* pageAgent, InspectorResourceAgent* resourceAgent, EditedResourcesContentMa nager* editedResourcesContentManager)
369 : InspectorBaseAgent<InspectorCSSAgent>("CSS") 370 : InspectorBaseAgent<InspectorCSSAgent>("CSS")
370 , m_frontend(0) 371 , m_frontend(0)
371 , m_domAgent(domAgent) 372 , m_domAgent(domAgent)
372 , m_pageAgent(pageAgent) 373 , m_pageAgent(pageAgent)
373 , m_resourceAgent(resourceAgent) 374 , m_resourceAgent(resourceAgent)
375 , m_editedResourcesContentManager(editedResourcesContentManager)
374 , m_lastStyleSheetId(1) 376 , m_lastStyleSheetId(1)
375 , m_styleSheetsPendingMutation(0) 377 , m_styleSheetsPendingMutation(0)
376 , m_styleDeclarationPendingMutation(false) 378 , m_styleDeclarationPendingMutation(false)
377 , m_creatingViaInspectorStyleSheet(false) 379 , m_creatingViaInspectorStyleSheet(false)
378 , m_isSettingStyleSheetText(false) 380 , m_isSettingStyleSheetText(false)
379 { 381 {
380 m_domAgent->setDOMListener(this); 382 m_domAgent->setDOMListener(this);
381 } 383 }
382 384
383 InspectorCSSAgent::~InspectorCSSAgent() 385 InspectorCSSAgent::~InspectorCSSAgent()
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void InspectorCSSAgent::disable(ErrorString*) 470 void InspectorCSSAgent::disable(ErrorString*)
469 { 471 {
470 reset(); 472 reset();
471 m_instrumentingAgents->setInspectorCSSAgent(0); 473 m_instrumentingAgents->setInspectorCSSAgent(0);
472 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); 474 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false);
473 } 475 }
474 476
475 void InspectorCSSAgent::didCommitLoadForMainFrame() 477 void InspectorCSSAgent::didCommitLoadForMainFrame()
476 { 478 {
477 reset(); 479 reset();
478 m_pageAgent->clearEditedResourcesContent(); 480 m_editedResourcesContentManager->clear();
479 } 481 }
480 482
481 void InspectorCSSAgent::mediaQueryResultChanged() 483 void InspectorCSSAgent::mediaQueryResultChanged()
482 { 484 {
483 flushPendingFrontendMessages(); 485 flushPendingFrontendMessages();
484 m_frontend->mediaQueryResultChanged(); 486 m_frontend->mediaQueryResultChanged();
485 } 487 }
486 488
487 void InspectorCSSAgent::willMutateRules() 489 void InspectorCSSAgent::willMutateRules()
488 { 490 {
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 } 1183 }
1182 } 1184 }
1183 } 1185 }
1184 1186
1185 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet ) 1187 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet )
1186 { 1188 {
1187 RefPtrWillBeRawPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleShee tToInspectorStyleSheet.get(styleSheet); 1189 RefPtrWillBeRawPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleShee tToInspectorStyleSheet.get(styleSheet);
1188 if (!inspectorStyleSheet) { 1190 if (!inspectorStyleSheet) {
1189 String id = String::number(m_lastStyleSheetId++); 1191 String id = String::number(m_lastStyleSheetId++);
1190 Document* document = styleSheet->ownerDocument(); 1192 Document* document = styleSheet->ownerDocument();
1191 inspectorStyleSheet = InspectorStyleSheet::create(m_pageAgent, m_resourc eAgent, id, styleSheet, detectOrigin(styleSheet, document), InspectorDOMAgent::d ocumentURLString(document), this); 1193 inspectorStyleSheet = InspectorStyleSheet::create(m_pageAgent, m_resourc eAgent, m_editedResourcesContentManager, id, styleSheet, detectOrigin(styleSheet , document), InspectorDOMAgent::documentURLString(document), this);
1192 m_idToInspectorStyleSheet.set(id, inspectorStyleSheet); 1194 m_idToInspectorStyleSheet.set(id, inspectorStyleSheet);
1193 m_cssStyleSheetToInspectorStyleSheet.set(styleSheet, inspectorStyleSheet ); 1195 m_cssStyleSheetToInspectorStyleSheet.set(styleSheet, inspectorStyleSheet );
1194 if (m_creatingViaInspectorStyleSheet) 1196 if (m_creatingViaInspectorStyleSheet)
1195 m_documentToViaInspectorStyleSheet.add(document, inspectorStyleSheet ); 1197 m_documentToViaInspectorStyleSheet.add(document, inspectorStyleSheet );
1196 } 1198 }
1197 return inspectorStyleSheet.get(); 1199 return inspectorStyleSheet.get();
1198 } 1200 }
1199 1201
1200 String InspectorCSSAgent::unbindStyleSheet(InspectorStyleSheet* inspectorStyleSh eet) 1202 String InspectorCSSAgent::unbindStyleSheet(InspectorStyleSheet* inspectorStyleSh eet)
1201 { 1203 {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 m_nodeIdToForcedPseudoState.clear(); 1433 m_nodeIdToForcedPseudoState.clear();
1432 for (WillBeHeapHashSet<RawPtrWillBeMember<Document> >::iterator it = documen tsToChange.begin(), end = documentsToChange.end(); it != end; ++it) 1434 for (WillBeHeapHashSet<RawPtrWillBeMember<Document> >::iterator it = documen tsToChange.begin(), end = documentsToChange.end(); it != end; ++it)
1433 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); 1435 (*it)->setNeedsStyleRecalc(SubtreeStyleChange);
1434 } 1436 }
1435 1437
1436 void InspectorCSSAgent::trace(Visitor* visitor) 1438 void InspectorCSSAgent::trace(Visitor* visitor)
1437 { 1439 {
1438 visitor->trace(m_domAgent); 1440 visitor->trace(m_domAgent);
1439 visitor->trace(m_pageAgent); 1441 visitor->trace(m_pageAgent);
1440 visitor->trace(m_resourceAgent); 1442 visitor->trace(m_resourceAgent);
1443 visitor->trace(m_editedResourcesContentManager);
1441 #if ENABLE(OILPAN) 1444 #if ENABLE(OILPAN)
1442 visitor->trace(m_idToInspectorStyleSheet); 1445 visitor->trace(m_idToInspectorStyleSheet);
1443 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); 1446 visitor->trace(m_idToInspectorStyleSheetForInlineStyle);
1444 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); 1447 visitor->trace(m_cssStyleSheetToInspectorStyleSheet);
1445 visitor->trace(m_documentToCSSStyleSheets); 1448 visitor->trace(m_documentToCSSStyleSheets);
1446 visitor->trace(m_invalidatedDocuments); 1449 visitor->trace(m_invalidatedDocuments);
1447 visitor->trace(m_nodeToInspectorStyleSheet); 1450 visitor->trace(m_nodeToInspectorStyleSheet);
1448 visitor->trace(m_documentToViaInspectorStyleSheet); 1451 visitor->trace(m_documentToViaInspectorStyleSheet);
1449 #endif 1452 #endif
1450 visitor->trace(m_inspectorUserAgentStyleSheet); 1453 visitor->trace(m_inspectorUserAgentStyleSheet);
1451 InspectorBaseAgent::trace(visitor); 1454 InspectorBaseAgent::trace(visitor);
1452 } 1455 }
1453 1456
1454 } // namespace blink 1457 } // namespace blink
1455 1458
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698