| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 return nullptr; | 433 return nullptr; |
| 434 return toCSSMediaRule(rule); | 434 return toCSSMediaRule(rule); |
| 435 } | 435 } |
| 436 | 436 |
| 437 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA
gent* pageAgent, InspectorResourceAgent* resourceAgent) | 437 InspectorCSSAgent::InspectorCSSAgent(InspectorDOMAgent* domAgent, InspectorPageA
gent* pageAgent, InspectorResourceAgent* resourceAgent) |
| 438 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS") | 438 : InspectorBaseAgent<InspectorCSSAgent, InspectorFrontend::CSS>("CSS") |
| 439 , m_domAgent(domAgent) | 439 , m_domAgent(domAgent) |
| 440 , m_pageAgent(pageAgent) | 440 , m_pageAgent(pageAgent) |
| 441 , m_resourceAgent(resourceAgent) | 441 , m_resourceAgent(resourceAgent) |
| 442 , m_lastStyleSheetId(1) | 442 , m_lastStyleSheetId(1) |
| 443 , m_styleSheetsPendingMutation(0) | |
| 444 , m_styleDeclarationPendingMutation(false) | |
| 445 , m_creatingViaInspectorStyleSheet(false) | 443 , m_creatingViaInspectorStyleSheet(false) |
| 446 , m_isSettingStyleSheetText(false) | 444 , m_isSettingStyleSheetText(false) |
| 447 { | 445 { |
| 448 m_domAgent->setDOMListener(this); | 446 m_domAgent->setDOMListener(this); |
| 449 } | 447 } |
| 450 | 448 |
| 451 InspectorCSSAgent::~InspectorCSSAgent() | 449 InspectorCSSAgent::~InspectorCSSAgent() |
| 452 { | 450 { |
| 453 #if !ENABLE(OILPAN) | 451 #if !ENABLE(OILPAN) |
| 454 ASSERT(!m_domAgent); | 452 ASSERT(!m_domAgent); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 m_editedStyleElements.clear(); | 536 m_editedStyleElements.clear(); |
| 539 } | 537 } |
| 540 } | 538 } |
| 541 | 539 |
| 542 void InspectorCSSAgent::mediaQueryResultChanged() | 540 void InspectorCSSAgent::mediaQueryResultChanged() |
| 543 { | 541 { |
| 544 flushPendingProtocolNotifications(); | 542 flushPendingProtocolNotifications(); |
| 545 frontend()->mediaQueryResultChanged(); | 543 frontend()->mediaQueryResultChanged(); |
| 546 } | 544 } |
| 547 | 545 |
| 548 void InspectorCSSAgent::willMutateRules() | |
| 549 { | |
| 550 ++m_styleSheetsPendingMutation; | |
| 551 } | |
| 552 | |
| 553 void InspectorCSSAgent::didMutateRules(CSSStyleSheet* styleSheet) | |
| 554 { | |
| 555 --m_styleSheetsPendingMutation; | |
| 556 ASSERT(m_styleSheetsPendingMutation >= 0); | |
| 557 | |
| 558 if (!styleSheetEditInProgress()) { | |
| 559 Document* owner = styleSheet->ownerDocument(); | |
| 560 if (owner) | |
| 561 owner->modifiedStyleSheet(styleSheet, FullStyleUpdate); | |
| 562 } | |
| 563 } | |
| 564 | |
| 565 void InspectorCSSAgent::willMutateStyle() | |
| 566 { | |
| 567 m_styleDeclarationPendingMutation = true; | |
| 568 } | |
| 569 | |
| 570 void InspectorCSSAgent::didMutateStyle(CSSStyleDeclaration* style, bool isInline
Style) | |
| 571 { | |
| 572 ASSERT(m_styleDeclarationPendingMutation); | |
| 573 m_styleDeclarationPendingMutation = false; | |
| 574 if (!styleSheetEditInProgress() && !isInlineStyle) { | |
| 575 CSSStyleSheet* parentSheet = style->parentStyleSheet(); | |
| 576 Document* owner = parentSheet ? parentSheet->ownerDocument() : nullptr; | |
| 577 if (owner) | |
| 578 owner->modifiedStyleSheet(parentSheet, FullStyleUpdate); | |
| 579 } | |
| 580 } | |
| 581 | |
| 582 void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document) | 546 void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document) |
| 583 { | 547 { |
| 584 if (styleSheetEditInProgress()) | 548 if (m_isSettingStyleSheetText) |
| 585 return; | 549 return; |
| 586 | 550 |
| 587 m_invalidatedDocuments.add(document); | 551 m_invalidatedDocuments.add(document); |
| 588 if (m_creatingViaInspectorStyleSheet) | 552 if (m_creatingViaInspectorStyleSheet) |
| 589 flushPendingProtocolNotifications(); | 553 flushPendingProtocolNotifications(); |
| 590 } | 554 } |
| 591 | 555 |
| 592 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) | 556 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) |
| 593 { | 557 { |
| 594 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > newSheetsVector; | 558 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > newSheetsVector; |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 visitor->trace(m_documentToCSSStyleSheets); | 1529 visitor->trace(m_documentToCSSStyleSheets); |
| 1566 visitor->trace(m_invalidatedDocuments); | 1530 visitor->trace(m_invalidatedDocuments); |
| 1567 visitor->trace(m_nodeToInspectorStyleSheet); | 1531 visitor->trace(m_nodeToInspectorStyleSheet); |
| 1568 visitor->trace(m_documentToViaInspectorStyleSheet); | 1532 visitor->trace(m_documentToViaInspectorStyleSheet); |
| 1569 #endif | 1533 #endif |
| 1570 visitor->trace(m_inspectorUserAgentStyleSheet); | 1534 visitor->trace(m_inspectorUserAgentStyleSheet); |
| 1571 InspectorBaseAgent::trace(visitor); | 1535 InspectorBaseAgent::trace(visitor); |
| 1572 } | 1536 } |
| 1573 | 1537 |
| 1574 } // namespace blink | 1538 } // namespace blink |
| OLD | NEW |