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

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

Issue 1092123004: DevTools: remove dependency of most agents on InspectorPageAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed debug build Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorDOMAgent.h » ('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) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/InspectorHistory.h" 56 #include "core/inspector/InspectorHistory.h"
57 #include "core/inspector/InspectorIdentifiers.h"
57 #include "core/inspector/InspectorPageAgent.h" 58 #include "core/inspector/InspectorPageAgent.h"
59 #include "core/inspector/InspectorResolver.h"
58 #include "core/inspector/InspectorResourceAgent.h" 60 #include "core/inspector/InspectorResourceAgent.h"
59 #include "core/inspector/InspectorResourceContentLoader.h" 61 #include "core/inspector/InspectorResourceContentLoader.h"
60 #include "core/inspector/InspectorState.h" 62 #include "core/inspector/InspectorState.h"
61 #include "core/inspector/InstrumentingAgents.h" 63 #include "core/inspector/InstrumentingAgents.h"
62 #include "core/layout/LayoutObject.h" 64 #include "core/layout/LayoutObject.h"
63 #include "core/layout/LayoutObjectInlines.h" 65 #include "core/layout/LayoutObjectInlines.h"
64 #include "core/layout/LayoutText.h" 66 #include "core/layout/LayoutText.h"
65 #include "core/layout/LayoutTextFragment.h" 67 #include "core/layout/LayoutTextFragment.h"
66 #include "core/layout/line/InlineTextBox.h" 68 #include "core/layout/line/InlineTextBox.h"
67 #include "core/loader/DocumentLoader.h" 69 #include "core/loader/DocumentLoader.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 422 }
421 423
422 // static 424 // static
423 CSSMediaRule* InspectorCSSAgent::asCSSMediaRule(CSSRule* rule) 425 CSSMediaRule* InspectorCSSAgent::asCSSMediaRule(CSSRule* rule)
424 { 426 {
425 if (!rule || rule->type() != CSSRule::MEDIA_RULE) 427 if (!rule || rule->type() != CSSRule::MEDIA_RULE)
426 return nullptr; 428 return nullptr;
427 return toCSSMediaRule(rule); 429 return toCSSMediaRule(rule);
428 } 430 }
429 431
430 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA gent* pageAgent, InspectorResourceAgent* resourceAgent) 432 InspectorCSSAgent::InspectorCSSAgent(LocalFrame* inspectedFrame, InspectorDOMAge nt* domAgent, InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAge nt)
431 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS") 433 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS")
434 , m_inspectedFrame(inspectedFrame)
432 , m_domAgent(domAgent) 435 , m_domAgent(domAgent)
433 , m_pageAgent(pageAgent) 436 , m_pageAgent(pageAgent)
434 , m_resourceAgent(resourceAgent) 437 , m_resourceAgent(resourceAgent)
435 , m_lastStyleSheetId(1) 438 , m_lastStyleSheetId(1)
436 , m_styleSheetsPendingMutation(0) 439 , m_styleSheetsPendingMutation(0)
437 , m_styleDeclarationPendingMutation(false) 440 , m_styleDeclarationPendingMutation(false)
438 , m_creatingViaInspectorStyleSheet(false) 441 , m_creatingViaInspectorStyleSheet(false)
439 , m_isSettingStyleSheetText(false) 442 , m_isSettingStyleSheetText(false)
440 { 443 {
441 m_domAgent->setDOMListener(this); 444 m_domAgent->setDOMListener(this);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 521
519 void InspectorCSSAgent::disable(ErrorString*) 522 void InspectorCSSAgent::disable(ErrorString*)
520 { 523 {
521 reset(); 524 reset();
522 m_instrumentingAgents->setInspectorCSSAgent(0); 525 m_instrumentingAgents->setInspectorCSSAgent(0);
523 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); 526 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false);
524 } 527 }
525 528
526 void InspectorCSSAgent::didCommitLoadForLocalFrame(LocalFrame* frame) 529 void InspectorCSSAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
527 { 530 {
528 if (frame == m_pageAgent->inspectedFrame()) { 531 if (frame == m_inspectedFrame) {
529 reset(); 532 reset();
530 m_editedStyleSheets.clear(); 533 m_editedStyleSheets.clear();
531 m_editedStyleElements.clear(); 534 m_editedStyleElements.clear();
532 } 535 }
533 } 536 }
534 537
535 void InspectorCSSAgent::mediaQueryResultChanged() 538 void InspectorCSSAgent::mediaQueryResultChanged()
536 { 539 {
537 flushPendingProtocolNotifications(); 540 flushPendingProtocolNotifications();
538 frontend()->mediaQueryResultChanged(); 541 frontend()->mediaQueryResultChanged();
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 String sourceURL = rule->parentStyleSheet()->contents()->baseURL(); 1019 String sourceURL = rule->parentStyleSheet()->contents()->baseURL();
1017 if (sourceURL.isEmpty()) 1020 if (sourceURL.isEmpty())
1018 sourceURL = InspectorDOMAgent::documentURLString(rule->parentStyleSh eet()->ownerDocument()); 1021 sourceURL = InspectorDOMAgent::documentURLString(rule->parentStyleSh eet()->ownerDocument());
1019 result = buildMediaObject(rule->media(), MediaListSourceMediaRule, sourc eURL, rule->parentStyleSheet()); 1022 result = buildMediaObject(rule->media(), MediaListSourceMediaRule, sourc eURL, rule->parentStyleSheet());
1020 } 1023 }
1021 *errorString = InspectorDOMAgent::toErrorString(exceptionState); 1024 *errorString = InspectorDOMAgent::toErrorString(exceptionState);
1022 } 1025 }
1023 1026
1024 void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String& frameId, TypeBuilder::CSS::StyleSheetId* outStyleSheetId) 1027 void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String& frameId, TypeBuilder::CSS::StyleSheetId* outStyleSheetId)
1025 { 1028 {
1026 LocalFrame* frame = m_pageAgent->frameForId(frameId); 1029 LocalFrame* frame = InspectorResolver::resolveFrame(m_inspectedFrame, frameI d);
1027 if (!frame) { 1030 if (!frame) {
1028 *errorString = "Frame not found"; 1031 *errorString = "Frame not found";
1029 return; 1032 return;
1030 } 1033 }
1031 1034
1032 Document* document = frame->document(); 1035 Document* document = frame->document();
1033 if (!document) { 1036 if (!document) {
1034 *errorString = "Frame does not have a document"; 1037 *errorString = "Frame does not have a document";
1035 return; 1038 return;
1036 } 1039 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 documentsToChange.add(element->ownerDocument()); 1561 documentsToChange.add(element->ownerDocument());
1559 } 1562 }
1560 1563
1561 m_nodeIdToForcedPseudoState.clear(); 1564 m_nodeIdToForcedPseudoState.clear();
1562 for (auto& document : documentsToChange) 1565 for (auto& document : documentsToChange)
1563 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::Inspector)); 1566 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::Inspector));
1564 } 1567 }
1565 1568
1566 DEFINE_TRACE(InspectorCSSAgent) 1569 DEFINE_TRACE(InspectorCSSAgent)
1567 { 1570 {
1571 visitor->trace(m_inspectedFrame);
1568 visitor->trace(m_domAgent); 1572 visitor->trace(m_domAgent);
1569 visitor->trace(m_pageAgent); 1573 visitor->trace(m_pageAgent);
1570 visitor->trace(m_resourceAgent); 1574 visitor->trace(m_resourceAgent);
1571 #if ENABLE(OILPAN) 1575 #if ENABLE(OILPAN)
1572 visitor->trace(m_idToInspectorStyleSheet); 1576 visitor->trace(m_idToInspectorStyleSheet);
1573 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); 1577 visitor->trace(m_idToInspectorStyleSheetForInlineStyle);
1574 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); 1578 visitor->trace(m_cssStyleSheetToInspectorStyleSheet);
1575 visitor->trace(m_documentToCSSStyleSheets); 1579 visitor->trace(m_documentToCSSStyleSheets);
1576 visitor->trace(m_invalidatedDocuments); 1580 visitor->trace(m_invalidatedDocuments);
1577 visitor->trace(m_nodeToInspectorStyleSheet); 1581 visitor->trace(m_nodeToInspectorStyleSheet);
1578 visitor->trace(m_documentToViaInspectorStyleSheet); 1582 visitor->trace(m_documentToViaInspectorStyleSheet);
1579 #endif 1583 #endif
1580 visitor->trace(m_inspectorUserAgentStyleSheet); 1584 visitor->trace(m_inspectorUserAgentStyleSheet);
1581 InspectorBaseAgent::trace(visitor); 1585 InspectorBaseAgent::trace(visitor);
1582 } 1586 }
1583 1587
1584 } // namespace blink 1588 } // namespace blink
1585 1589
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorDOMAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698