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

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

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