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

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

Issue 14821010: DevTools: Do not unbind stylesheets in multiframe documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test files left behind Created 7 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
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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 { 729 {
730 if (namedFlow->flowState() == NamedFlow::FlowStateNull) 730 if (namedFlow->flowState() == NamedFlow::FlowStateNull)
731 return; 731 return;
732 732
733 ErrorString errorString; 733 ErrorString errorString;
734 RefPtr<NamedFlow> protector(namedFlow); 734 RefPtr<NamedFlow> protector(namedFlow);
735 735
736 m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedF low, documentNodeId)); 736 m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedF low, documentNodeId));
737 } 737 }
738 738
739 void InspectorCSSAgent::activeStyleSheetsUpdated(const Vector<RefPtr<StyleSheet> >& newSheets) 739 void InspectorCSSAgent::activeStyleSheetsUpdated(Document* document, const Vecto r<RefPtr<StyleSheet> >& newSheets)
740 { 740 {
741 HashSet<CSSStyleSheet*> removedSheets; 741 HashSet<CSSStyleSheet*> removedSheets;
742 for (CSSStyleSheetToInspectorStyleSheet::iterator it = m_cssStyleSheetToInsp ectorStyleSheet.begin(); it != m_cssStyleSheetToInspectorStyleSheet.end(); ++it) { 742 for (CSSStyleSheetToInspectorStyleSheet::iterator it = m_cssStyleSheetToInsp ectorStyleSheet.begin(); it != m_cssStyleSheetToInspectorStyleSheet.end(); ++it) {
743 if (it->value->canBind()) 743 if (it->value->canBind() && (!it->key->ownerDocument() || it->key->owner Document() == document))
744 removedSheets.add(it->key); 744 removedSheets.add(it->key);
745 } 745 }
746 746
747 Vector<CSSStyleSheet*> newSheetsVector; 747 Vector<CSSStyleSheet*> newSheetsVector;
748 for (size_t i = 0, size = newSheets.size(); i < size; ++i) { 748 for (size_t i = 0, size = newSheets.size(); i < size; ++i) {
749 StyleSheet* newSheet = newSheets.at(i).get(); 749 StyleSheet* newSheet = newSheets.at(i).get();
750 if (newSheet->isCSSStyleSheet()) { 750 if (newSheet->isCSSStyleSheet()) {
751 StyleSheetAppender appender(m_cssStyleSheetToInspectorStyleSheet, ne wSheetsVector); 751 StyleSheetAppender appender(m_cssStyleSheetToInspectorStyleSheet, ne wSheetsVector);
752 appender.run(static_cast<CSSStyleSheet*>(newSheet)); 752 appender.run(static_cast<CSSStyleSheet*>(newSheet));
753 } 753 }
(...skipping 21 matching lines...) Expand all
775 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader> > addedHead ers = TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader>::create(); 775 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader> > addedHead ers = TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader>::create();
776 for (HashSet<CSSStyleSheet*>::iterator it = addedSheets.begin(); it != added Sheets.end(); ++it) { 776 for (HashSet<CSSStyleSheet*>::iterator it = addedSheets.begin(); it != added Sheets.end(); ++it) {
777 if (!m_cssStyleSheetToInspectorStyleSheet.contains(*it)) { 777 if (!m_cssStyleSheetToInspectorStyleSheet.contains(*it)) {
778 InspectorStyleSheet* newStyleSheet = bindStyleSheet(static_cast<CSSS tyleSheet*>(*it)); 778 InspectorStyleSheet* newStyleSheet = bindStyleSheet(static_cast<CSSS tyleSheet*>(*it));
779 if (m_frontend) 779 if (m_frontend)
780 m_frontend->styleSheetAdded(newStyleSheet->buildObjectForStyleSh eetInfo()); 780 m_frontend->styleSheetAdded(newStyleSheet->buildObjectForStyleSh eetInfo());
781 } 781 }
782 } 782 }
783 } 783 }
784 784
785 void InspectorCSSAgent::frameDetachedFromParent(Frame* frame)
786 {
787 Document* document = frame->document();
788 if (!document)
789 return;
790 Vector<RefPtr<StyleSheet> > newSheets;
791 activeStyleSheetsUpdated(document, newSheets);
792 }
793
785 bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy pe pseudoType) 794 bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy pe pseudoType)
786 { 795 {
787 if (m_nodeIdToForcedPseudoState.isEmpty()) 796 if (m_nodeIdToForcedPseudoState.isEmpty())
788 return false; 797 return false;
789 798
790 int nodeId = m_domAgent->boundNodeId(element); 799 int nodeId = m_domAgent->boundNodeId(element);
791 if (!nodeId) 800 if (!nodeId)
792 return false; 801 return false;
793 802
794 NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(no deId); 803 NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(no deId);
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 documentsToChange.add(element->ownerDocument()); 1473 documentsToChange.add(element->ownerDocument());
1465 } 1474 }
1466 1475
1467 m_nodeIdToForcedPseudoState.clear(); 1476 m_nodeIdToForcedPseudoState.clear();
1468 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1477 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1469 (*it)->styleResolverChanged(RecalcStyleImmediately); 1478 (*it)->styleResolverChanged(RecalcStyleImmediately);
1470 } 1479 }
1471 1480
1472 } // namespace WebCore 1481 } // namespace WebCore
1473 1482
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | Source/core/inspector/InspectorInstrumentation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698