| OLD | NEW |
| 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 Loading... |
| 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" |
| 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/layout/LayoutObject.h" | 63 #include "core/layout/LayoutObject.h" |
| 63 #include "core/layout/LayoutObjectInlines.h" | 64 #include "core/layout/LayoutObjectInlines.h" |
| 64 #include "core/layout/LayoutText.h" | 65 #include "core/layout/LayoutText.h" |
| 65 #include "core/layout/LayoutTextFragment.h" | 66 #include "core/layout/LayoutTextFragment.h" |
| 66 #include "core/layout/line/InlineTextBox.h" | 67 #include "core/layout/line/InlineTextBox.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 421 } |
| 421 | 422 |
| 422 // static | 423 // static |
| 423 CSSMediaRule* InspectorCSSAgent::asCSSMediaRule(CSSRule* rule) | 424 CSSMediaRule* InspectorCSSAgent::asCSSMediaRule(CSSRule* rule) |
| 424 { | 425 { |
| 425 if (!rule || rule->type() != CSSRule::MEDIA_RULE) | 426 if (!rule || rule->type() != CSSRule::MEDIA_RULE) |
| 426 return nullptr; | 427 return nullptr; |
| 427 return toCSSMediaRule(rule); | 428 return toCSSMediaRule(rule); |
| 428 } | 429 } |
| 429 | 430 |
| 430 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA
gent* pageAgent, InspectorResourceAgent* resourceAgent) | 431 InspectorCSSAgent::InspectorCSSAgent(LocalFrame* inspectedFrame, InspectorDOMAge
nt* domAgent, InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAge
nt) |
| 431 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS") | 432 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS") |
| 433 , m_inspectedFrame(inspectedFrame) |
| 432 , m_domAgent(domAgent) | 434 , m_domAgent(domAgent) |
| 433 , m_pageAgent(pageAgent) | 435 , m_pageAgent(pageAgent) |
| 434 , m_resourceAgent(resourceAgent) | 436 , m_resourceAgent(resourceAgent) |
| 435 , m_lastStyleSheetId(1) | 437 , m_lastStyleSheetId(1) |
| 436 , m_styleSheetsPendingMutation(0) | 438 , m_styleSheetsPendingMutation(0) |
| 437 , m_styleDeclarationPendingMutation(false) | 439 , m_styleDeclarationPendingMutation(false) |
| 438 , m_creatingViaInspectorStyleSheet(false) | 440 , m_creatingViaInspectorStyleSheet(false) |
| 439 , m_isSettingStyleSheetText(false) | 441 , m_isSettingStyleSheetText(false) |
| 440 { | 442 { |
| 441 m_domAgent->setDOMListener(this); | 443 m_domAgent->setDOMListener(this); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 520 |
| 519 void InspectorCSSAgent::disable(ErrorString*) | 521 void InspectorCSSAgent::disable(ErrorString*) |
| 520 { | 522 { |
| 521 reset(); | 523 reset(); |
| 522 m_instrumentingAgents->setInspectorCSSAgent(0); | 524 m_instrumentingAgents->setInspectorCSSAgent(0); |
| 523 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); | 525 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); |
| 524 } | 526 } |
| 525 | 527 |
| 526 void InspectorCSSAgent::didCommitLoadForLocalFrame(LocalFrame* frame) | 528 void InspectorCSSAgent::didCommitLoadForLocalFrame(LocalFrame* frame) |
| 527 { | 529 { |
| 528 if (frame == m_pageAgent->inspectedFrame()) { | 530 if (frame == m_inspectedFrame) { |
| 529 reset(); | 531 reset(); |
| 530 m_editedStyleSheets.clear(); | 532 m_editedStyleSheets.clear(); |
| 531 } | 533 } |
| 532 } | 534 } |
| 533 | 535 |
| 534 void InspectorCSSAgent::mediaQueryResultChanged() | 536 void InspectorCSSAgent::mediaQueryResultChanged() |
| 535 { | 537 { |
| 536 flushPendingProtocolNotifications(); | 538 flushPendingProtocolNotifications(); |
| 537 frontend()->mediaQueryResultChanged(); | 539 frontend()->mediaQueryResultChanged(); |
| 538 } | 540 } |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 String sourceURL = rule->parentStyleSheet()->contents()->baseURL(); | 1004 String sourceURL = rule->parentStyleSheet()->contents()->baseURL(); |
| 1003 if (sourceURL.isEmpty()) | 1005 if (sourceURL.isEmpty()) |
| 1004 sourceURL = InspectorDOMAgent::documentURLString(rule->parentStyleSh
eet()->ownerDocument()); | 1006 sourceURL = InspectorDOMAgent::documentURLString(rule->parentStyleSh
eet()->ownerDocument()); |
| 1005 result = buildMediaObject(rule->media(), MediaListSourceMediaRule, sourc
eURL, rule->parentStyleSheet()); | 1007 result = buildMediaObject(rule->media(), MediaListSourceMediaRule, sourc
eURL, rule->parentStyleSheet()); |
| 1006 } | 1008 } |
| 1007 *errorString = InspectorDOMAgent::toErrorString(exceptionState); | 1009 *errorString = InspectorDOMAgent::toErrorString(exceptionState); |
| 1008 } | 1010 } |
| 1009 | 1011 |
| 1010 void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String&
frameId, TypeBuilder::CSS::StyleSheetId* outStyleSheetId) | 1012 void InspectorCSSAgent::createStyleSheet(ErrorString* errorString, const String&
frameId, TypeBuilder::CSS::StyleSheetId* outStyleSheetId) |
| 1011 { | 1013 { |
| 1012 LocalFrame* frame = m_pageAgent->frameForId(frameId); | 1014 LocalFrame* frame = InspectorIdentifiers<LocalFrame>::lookup(frameId); |
| 1013 if (!frame) { | 1015 if (!frame || frame->instrumentingAgents() != m_inspectedFrame->instrumentin
gAgents()) { |
| 1014 *errorString = "Frame not found"; | 1016 *errorString = "Frame not found"; |
| 1015 return; | 1017 return; |
| 1016 } | 1018 } |
| 1017 | 1019 |
| 1018 Document* document = frame->document(); | 1020 Document* document = frame->document(); |
| 1019 if (!document) { | 1021 if (!document) { |
| 1020 *errorString = "Frame does not have a document"; | 1022 *errorString = "Frame does not have a document"; |
| 1021 return; | 1023 return; |
| 1022 } | 1024 } |
| 1023 | 1025 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 documentsToChange.add(element->ownerDocument()); | 1546 documentsToChange.add(element->ownerDocument()); |
| 1545 } | 1547 } |
| 1546 | 1548 |
| 1547 m_nodeIdToForcedPseudoState.clear(); | 1549 m_nodeIdToForcedPseudoState.clear(); |
| 1548 for (auto& document : documentsToChange) | 1550 for (auto& document : documentsToChange) |
| 1549 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::Inspector)); | 1551 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::Inspector)); |
| 1550 } | 1552 } |
| 1551 | 1553 |
| 1552 DEFINE_TRACE(InspectorCSSAgent) | 1554 DEFINE_TRACE(InspectorCSSAgent) |
| 1553 { | 1555 { |
| 1556 visitor->trace(m_inspectedFrame); |
| 1554 visitor->trace(m_domAgent); | 1557 visitor->trace(m_domAgent); |
| 1555 visitor->trace(m_pageAgent); | 1558 visitor->trace(m_pageAgent); |
| 1556 visitor->trace(m_resourceAgent); | 1559 visitor->trace(m_resourceAgent); |
| 1557 #if ENABLE(OILPAN) | 1560 #if ENABLE(OILPAN) |
| 1558 visitor->trace(m_idToInspectorStyleSheet); | 1561 visitor->trace(m_idToInspectorStyleSheet); |
| 1559 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); | 1562 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); |
| 1560 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); | 1563 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); |
| 1561 visitor->trace(m_documentToCSSStyleSheets); | 1564 visitor->trace(m_documentToCSSStyleSheets); |
| 1562 visitor->trace(m_invalidatedDocuments); | 1565 visitor->trace(m_invalidatedDocuments); |
| 1563 visitor->trace(m_nodeToInspectorStyleSheet); | 1566 visitor->trace(m_nodeToInspectorStyleSheet); |
| 1564 visitor->trace(m_documentToViaInspectorStyleSheet); | 1567 visitor->trace(m_documentToViaInspectorStyleSheet); |
| 1565 #endif | 1568 #endif |
| 1566 visitor->trace(m_inspectorUserAgentStyleSheet); | 1569 visitor->trace(m_inspectorUserAgentStyleSheet); |
| 1567 InspectorBaseAgent::trace(visitor); | 1570 InspectorBaseAgent::trace(visitor); |
| 1568 } | 1571 } |
| 1569 | 1572 |
| 1570 } // namespace blink | 1573 } // namespace blink |
| 1571 | 1574 |
| OLD | NEW |