| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 if (callback) | 507 if (callback) |
| 508 callback->sendSuccess(); | 508 callback->sendSuccess(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void InspectorCSSAgent::disable(ErrorString*) | 511 void InspectorCSSAgent::disable(ErrorString*) |
| 512 { | 512 { |
| 513 m_instrumentingAgents->setInspectorCSSAgent(0); | 513 m_instrumentingAgents->setInspectorCSSAgent(0); |
| 514 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); | 514 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); |
| 515 } | 515 } |
| 516 | 516 |
| 517 void InspectorCSSAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader) | 517 void InspectorCSSAgent::didCommitLoadForMainFrame() |
| 518 { | 518 { |
| 519 if (loader->frame() == frame->page()->mainFrame()) { | 519 reset(); |
| 520 reset(); | |
| 521 return; | |
| 522 } | |
| 523 | |
| 524 Vector<Document*> toDispose; | |
| 525 for (DocumentStyleSheets::iterator it = m_documentToCSSStyleSheets.begin();
it != m_documentToCSSStyleSheets.end(); ++it) { | |
| 526 Document* document = it->key; | |
| 527 if (!document->frame() || document->frame() == frame) | |
| 528 toDispose.append(document); | |
| 529 } | |
| 530 for (Vector<Document*>::iterator it = toDispose.begin(); it != toDispose.end
(); ++it) | |
| 531 documentDetached(*it); | |
| 532 } | 520 } |
| 533 | 521 |
| 534 void InspectorCSSAgent::mediaQueryResultChanged() | 522 void InspectorCSSAgent::mediaQueryResultChanged() |
| 535 { | 523 { |
| 536 flushPendingFrontendMessages(); | 524 flushPendingFrontendMessages(); |
| 537 m_frontend->mediaQueryResultChanged(); | 525 m_frontend->mediaQueryResultChanged(); |
| 538 } | 526 } |
| 539 | 527 |
| 540 void InspectorCSSAgent::willMutateRules() | 528 void InspectorCSSAgent::willMutateRules() |
| 541 { | 529 { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (documentCSSStyleSheets->isEmpty()) | 627 if (documentCSSStyleSheets->isEmpty()) |
| 640 m_documentToCSSStyleSheets.remove(document); | 628 m_documentToCSSStyleSheets.remove(document); |
| 641 } | 629 } |
| 642 | 630 |
| 643 void InspectorCSSAgent::documentDetached(Document* document) | 631 void InspectorCSSAgent::documentDetached(Document* document) |
| 644 { | 632 { |
| 645 m_invalidatedDocuments.remove(document); | 633 m_invalidatedDocuments.remove(document); |
| 646 setActiveStyleSheets(document, Vector<CSSStyleSheet*>(), ExistingFrontendRef
resh); | 634 setActiveStyleSheets(document, Vector<CSSStyleSheet*>(), ExistingFrontendRef
resh); |
| 647 } | 635 } |
| 648 | 636 |
| 649 void InspectorCSSAgent::frameDetachedFromParent(LocalFrame* frame) | |
| 650 { | |
| 651 documentDetached(frame->document()); | |
| 652 } | |
| 653 | |
| 654 bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy
pe pseudoType) | 637 bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy
pe pseudoType) |
| 655 { | 638 { |
| 656 if (m_nodeIdToForcedPseudoState.isEmpty()) | 639 if (m_nodeIdToForcedPseudoState.isEmpty()) |
| 657 return false; | 640 return false; |
| 658 | 641 |
| 659 int nodeId = m_domAgent->boundNodeId(element); | 642 int nodeId = m_domAgent->boundNodeId(element); |
| 660 if (!nodeId) | 643 if (!nodeId) |
| 661 return false; | 644 return false; |
| 662 | 645 |
| 663 NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(no
deId); | 646 NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(no
deId); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 documentsToChange.add(element->ownerDocument()); | 1341 documentsToChange.add(element->ownerDocument()); |
| 1359 } | 1342 } |
| 1360 | 1343 |
| 1361 m_nodeIdToForcedPseudoState.clear(); | 1344 m_nodeIdToForcedPseudoState.clear(); |
| 1362 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1345 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
| 1363 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); | 1346 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); |
| 1364 } | 1347 } |
| 1365 | 1348 |
| 1366 } // namespace WebCore | 1349 } // namespace WebCore |
| 1367 | 1350 |
| OLD | NEW |