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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 new EnableResourceClient(this, styleSheetsToFetch, prpCallback); | 871 new EnableResourceClient(this, styleSheetsToFetch, prpCallback); |
872 } | 872 } |
873 | 873 |
874 void InspectorCSSAgent::wasEnabled(PassRefPtr<EnableCallback> callback) | 874 void InspectorCSSAgent::wasEnabled(PassRefPtr<EnableCallback> callback) |
875 { | 875 { |
876 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { | 876 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { |
877 // We were disabled while fetching resources. | 877 // We were disabled while fetching resources. |
878 return; | 878 return; |
879 } | 879 } |
880 | 880 |
881 // Re-read stylesheets, we know for sure we have content for all of them. | |
882 Vector<InspectorStyleSheet*> styleSheets; | 881 Vector<InspectorStyleSheet*> styleSheets; |
883 collectAllStyleSheets(styleSheets); | 882 collectAllStyleSheets(styleSheets); |
884 for (size_t i = 0; i < styleSheets.size(); ++i) | 883 for (size_t i = 0; i < styleSheets.size(); ++i) |
885 m_frontend->styleSheetAdded(styleSheets.at(i)->buildObjectForStyleSheetI
nfo()); | 884 m_frontend->styleSheetAdded(styleSheets.at(i)->buildObjectForStyleSheetI
nfo()); |
| 885 |
| 886 // More styleSheetAdded events will be generated below. |
| 887 m_instrumentingAgents->setInspectorCSSAgent(this); |
| 888 Vector<Document*> documents = m_domAgent->documents(); |
| 889 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) |
| 890 (*it)->styleEngine()->updateActiveStyleSheets(FullStyleUpdate); |
| 891 |
886 if (callback) | 892 if (callback) |
887 callback->sendSuccess(); | 893 callback->sendSuccess(); |
888 | |
889 m_instrumentingAgents->setInspectorCSSAgent(this); | |
890 } | 894 } |
891 | 895 |
892 void InspectorCSSAgent::disable(ErrorString*) | 896 void InspectorCSSAgent::disable(ErrorString*) |
893 { | 897 { |
894 m_instrumentingAgents->setInspectorCSSAgent(0); | 898 m_instrumentingAgents->setInspectorCSSAgent(0); |
895 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); | 899 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); |
896 } | 900 } |
897 | 901 |
898 void InspectorCSSAgent::didCommitLoad(Frame* frame, DocumentLoader* loader) | 902 void InspectorCSSAgent::didCommitLoad(Frame* frame, DocumentLoader* loader) |
899 { | 903 { |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 documentsToChange.add(element->ownerDocument()); | 1891 documentsToChange.add(element->ownerDocument()); |
1888 } | 1892 } |
1889 | 1893 |
1890 m_nodeIdToForcedPseudoState.clear(); | 1894 m_nodeIdToForcedPseudoState.clear(); |
1891 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1895 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
1892 (*it)->setNeedsStyleRecalc(); | 1896 (*it)->setNeedsStyleRecalc(); |
1893 } | 1897 } |
1894 | 1898 |
1895 } // namespace WebCore | 1899 } // namespace WebCore |
1896 | 1900 |
OLD | NEW |