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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/inspector/InspectorCSSAgent.h" | 26 #include "core/inspector/InspectorCSSAgent.h" |
27 | 27 |
28 #include "CSSPropertyNames.h" | 28 #include "CSSPropertyNames.h" |
29 #include "FetchInitiatorTypeNames.h" | |
30 #include "InspectorTypeBuilder.h" | 29 #include "InspectorTypeBuilder.h" |
31 #include "StylePropertyShorthand.h" | 30 #include "StylePropertyShorthand.h" |
32 #include "bindings/v8/ExceptionState.h" | 31 #include "bindings/v8/ExceptionState.h" |
33 #include "bindings/v8/ExceptionStatePlaceholder.h" | 32 #include "bindings/v8/ExceptionStatePlaceholder.h" |
34 #include "core/css/CSSComputedStyleDeclaration.h" | 33 #include "core/css/CSSComputedStyleDeclaration.h" |
35 #include "core/css/CSSDefaultStyleSheets.h" | 34 #include "core/css/CSSDefaultStyleSheets.h" |
36 #include "core/css/CSSImportRule.h" | 35 #include "core/css/CSSImportRule.h" |
37 #include "core/css/CSSMediaRule.h" | 36 #include "core/css/CSSMediaRule.h" |
38 #include "core/css/CSSRule.h" | 37 #include "core/css/CSSRule.h" |
39 #include "core/css/CSSRuleList.h" | 38 #include "core/css/CSSRuleList.h" |
40 #include "core/css/CSSStyleRule.h" | 39 #include "core/css/CSSStyleRule.h" |
41 #include "core/css/CSSStyleSheet.h" | 40 #include "core/css/CSSStyleSheet.h" |
42 #include "core/css/MediaList.h" | 41 #include "core/css/MediaList.h" |
43 #include "core/css/MediaQuery.h" | 42 #include "core/css/MediaQuery.h" |
44 #include "core/css/StylePropertySet.h" | 43 #include "core/css/StylePropertySet.h" |
45 #include "core/css/StyleRule.h" | 44 #include "core/css/StyleRule.h" |
46 #include "core/css/StyleSheet.h" | 45 #include "core/css/StyleSheet.h" |
47 #include "core/css/StyleSheetContents.h" | 46 #include "core/css/StyleSheetContents.h" |
48 #include "core/css/StyleSheetList.h" | 47 #include "core/css/StyleSheetList.h" |
49 #include "core/css/resolver/StyleResolver.h" | 48 #include "core/css/resolver/StyleResolver.h" |
50 #include "core/dom/Node.h" | 49 #include "core/dom/Node.h" |
51 #include "core/dom/NodeList.h" | 50 #include "core/dom/NodeList.h" |
52 #include "core/fetch/CSSStyleSheetResource.h" | |
53 #include "core/fetch/ResourceClient.h" | |
54 #include "core/fetch/ResourceFetcher.h" | |
55 #include "core/fetch/StyleSheetResourceClient.h" | |
56 #include "core/frame/LocalFrame.h" | 51 #include "core/frame/LocalFrame.h" |
57 #include "core/html/HTMLHeadElement.h" | 52 #include "core/html/HTMLHeadElement.h" |
| 53 #include "core/html/VoidCallback.h" |
58 #include "core/inspector/InspectorHistory.h" | 54 #include "core/inspector/InspectorHistory.h" |
59 #include "core/inspector/InspectorPageAgent.h" | 55 #include "core/inspector/InspectorPageAgent.h" |
60 #include "core/inspector/InspectorResourceAgent.h" | 56 #include "core/inspector/InspectorResourceAgent.h" |
| 57 #include "core/inspector/InspectorResourceContentLoader.h" |
61 #include "core/inspector/InspectorState.h" | 58 #include "core/inspector/InspectorState.h" |
62 #include "core/inspector/InstrumentingAgents.h" | 59 #include "core/inspector/InstrumentingAgents.h" |
63 #include "core/loader/DocumentLoader.h" | 60 #include "core/loader/DocumentLoader.h" |
64 #include "core/page/Page.h" | 61 #include "core/page/Page.h" |
65 #include "core/rendering/InlineTextBox.h" | 62 #include "core/rendering/InlineTextBox.h" |
66 #include "core/rendering/RenderObject.h" | 63 #include "core/rendering/RenderObject.h" |
67 #include "core/rendering/RenderText.h" | 64 #include "core/rendering/RenderText.h" |
68 #include "core/rendering/RenderTextFragment.h" | 65 #include "core/rendering/RenderTextFragment.h" |
69 #include "platform/fonts/Font.h" | 66 #include "platform/fonts/Font.h" |
70 #include "platform/fonts/GlyphBuffer.h" | 67 #include "platform/fonts/GlyphBuffer.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 118 |
122 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { | 119 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { |
123 WTF_MAKE_NONCOPYABLE(StyleSheetAction); | 120 WTF_MAKE_NONCOPYABLE(StyleSheetAction); |
124 public: | 121 public: |
125 StyleSheetAction(const String& name) | 122 StyleSheetAction(const String& name) |
126 : InspectorHistory::Action(name) | 123 : InspectorHistory::Action(name) |
127 { | 124 { |
128 } | 125 } |
129 }; | 126 }; |
130 | 127 |
131 class InspectorCSSAgent::EnableResourceClient FINAL : public StyleSheetResourceC
lient { | 128 class InspectorCSSAgent::InspectorResourceContentLoaderCallback FINAL : public V
oidCallback { |
132 public: | 129 public: |
133 EnableResourceClient(InspectorCSSAgent*, const Vector<InspectorStyleSheet*>&
, PassRefPtr<EnableCallback>); | 130 InspectorResourceContentLoaderCallback(InspectorCSSAgent*, PassRefPtr<Enable
Callback>); |
134 | 131 virtual void handleEvent() OVERRIDE; |
135 virtual void setCSSStyleSheet(const String&, const KURL&, const String&, con
st CSSStyleSheetResource*) OVERRIDE; | |
136 | 132 |
137 private: | 133 private: |
| 134 InspectorCSSAgent* m_cssAgent; |
138 RefPtr<EnableCallback> m_callback; | 135 RefPtr<EnableCallback> m_callback; |
139 InspectorCSSAgent* m_cssAgent; | |
140 int m_pendingResources; | |
141 Vector<InspectorStyleSheet*> m_styleSheets; | |
142 }; | 136 }; |
143 | 137 |
144 InspectorCSSAgent::EnableResourceClient::EnableResourceClient(InspectorCSSAgent*
cssAgent, const Vector<InspectorStyleSheet*>& styleSheets, PassRefPtr<EnableCal
lback> callback) | 138 InspectorCSSAgent::InspectorResourceContentLoaderCallback::InspectorResourceCont
entLoaderCallback(InspectorCSSAgent* cssAgent, PassRefPtr<EnableCallback> callba
ck) |
145 : m_callback(callback) | 139 : m_cssAgent(cssAgent) |
146 , m_cssAgent(cssAgent) | 140 , m_callback(callback) |
147 , m_pendingResources(styleSheets.size()) | |
148 , m_styleSheets(styleSheets) | |
149 { | 141 { |
150 for (size_t i = 0; i < styleSheets.size(); ++i) { | |
151 InspectorStyleSheet* styleSheet = styleSheets.at(i); | |
152 Document* document = styleSheet->ownerDocument(); | |
153 FetchRequest request(ResourceRequest(styleSheet->finalURL()), FetchIniti
atorTypeNames::internal); | |
154 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleSheet
(request); | |
155 resource->addClient(this); | |
156 } | |
157 } | 142 } |
158 | 143 |
159 void InspectorCSSAgent::EnableResourceClient::setCSSStyleSheet(const String&, co
nst KURL& url, const String&, const CSSStyleSheetResource* resource) | 144 void InspectorCSSAgent::InspectorResourceContentLoaderCallback::handleEvent() |
160 { | 145 { |
161 const_cast<CSSStyleSheetResource*>(resource)->removeClient(this); | 146 // enable always succeeds. |
162 --m_pendingResources; | 147 if (!m_callback->isActive()) |
163 if (m_pendingResources) | |
164 return; | 148 return; |
165 | 149 |
166 // enable always succeeds. | 150 m_cssAgent->wasEnabled(); |
167 if (m_callback->isActive()) | 151 m_callback->sendSuccess(); |
168 m_cssAgent->wasEnabled(m_callback.release()); | |
169 delete this; | |
170 } | 152 } |
171 | 153 |
172 class InspectorCSSAgent::SetStyleSheetTextAction FINAL : public InspectorCSSAgen
t::StyleSheetAction { | 154 class InspectorCSSAgent::SetStyleSheetTextAction FINAL : public InspectorCSSAgen
t::StyleSheetAction { |
173 WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction); | 155 WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction); |
174 public: | 156 public: |
175 SetStyleSheetTextAction(InspectorStyleSheetBase* styleSheet, const String& t
ext) | 157 SetStyleSheetTextAction(InspectorStyleSheetBase* styleSheet, const String& t
ext) |
176 : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText") | 158 : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText") |
177 , m_styleSheet(styleSheet) | 159 , m_styleSheet(styleSheet) |
178 , m_text(text) | 160 , m_text(text) |
179 { | 161 { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 376 |
395 void InspectorCSSAgent::discardAgent() | 377 void InspectorCSSAgent::discardAgent() |
396 { | 378 { |
397 m_domAgent->setDOMListener(0); | 379 m_domAgent->setDOMListener(0); |
398 m_domAgent = 0; | 380 m_domAgent = 0; |
399 } | 381 } |
400 | 382 |
401 void InspectorCSSAgent::restore() | 383 void InspectorCSSAgent::restore() |
402 { | 384 { |
403 if (m_state->getBoolean(CSSAgentState::cssAgentEnabled)) | 385 if (m_state->getBoolean(CSSAgentState::cssAgentEnabled)) |
404 wasEnabled(nullptr); | 386 wasEnabled(); |
405 } | 387 } |
406 | 388 |
407 void InspectorCSSAgent::flushPendingFrontendMessages() | 389 void InspectorCSSAgent::flushPendingFrontendMessages() |
408 { | 390 { |
409 if (!m_invalidatedDocuments.size()) | 391 if (!m_invalidatedDocuments.size()) |
410 return; | 392 return; |
411 HashSet<Document*> invalidatedDocuments; | 393 HashSet<Document*> invalidatedDocuments; |
412 m_invalidatedDocuments.swap(&invalidatedDocuments); | 394 m_invalidatedDocuments.swap(&invalidatedDocuments); |
413 for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != i
nvalidatedDocuments.end(); ++it) | 395 for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != i
nvalidatedDocuments.end(); ++it) |
414 updateActiveStyleSheets(*it, ExistingFrontendRefresh); | 396 updateActiveStyleSheets(*it, ExistingFrontendRefresh); |
(...skipping 12 matching lines...) Expand all Loading... |
427 } | 409 } |
428 | 410 |
429 void InspectorCSSAgent::resetNonPersistentData() | 411 void InspectorCSSAgent::resetNonPersistentData() |
430 { | 412 { |
431 resetPseudoStates(); | 413 resetPseudoStates(); |
432 } | 414 } |
433 | 415 |
434 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) | 416 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) |
435 { | 417 { |
436 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); | 418 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); |
437 | 419 if (!m_pageAgent->resourceContentLoader()) { |
438 Vector<InspectorStyleSheet*> styleSheets; | 420 wasEnabled(); |
439 collectAllStyleSheets(styleSheets); | 421 prpCallback->sendSuccess(); |
440 | |
441 // Re-issue stylesheet requets for resources that are no longer in memory ca
che. | |
442 Vector<InspectorStyleSheet*> styleSheetsToFetch; | |
443 HashSet<String> urlsToFetch; | |
444 for (size_t i = 0; i < styleSheets.size(); ++i) { | |
445 InspectorStyleSheet* styleSheet = styleSheets.at(i); | |
446 String url = styleSheet->finalURL(); | |
447 if (urlsToFetch.contains(url)) | |
448 continue; | |
449 CSSStyleSheet* pageStyleSheet = styleSheet->pageStyleSheet(); | |
450 if (pageStyleSheet->isInline() || !pageStyleSheet->contents()->loadCompl
eted()) | |
451 continue; | |
452 Document* document = styleSheet->ownerDocument(); | |
453 if (!document) | |
454 continue; | |
455 Resource* cachedResource = document->fetcher()->cachedResource(document-
>completeURL(url)); | |
456 if (cachedResource) | |
457 continue; | |
458 urlsToFetch.add(styleSheet->finalURL()); | |
459 styleSheetsToFetch.append(styleSheet); | |
460 } | |
461 | |
462 if (styleSheetsToFetch.isEmpty()) { | |
463 wasEnabled(prpCallback); | |
464 return; | 422 return; |
465 } | 423 } |
466 new EnableResourceClient(this, styleSheetsToFetch, prpCallback); | 424 m_pageAgent->resourceContentLoader()->addListener(adoptPtr(new InspectorCSSA
gent::InspectorResourceContentLoaderCallback(this, prpCallback))); |
467 } | 425 } |
468 | 426 |
469 void InspectorCSSAgent::wasEnabled(PassRefPtr<EnableCallback> callback) | 427 void InspectorCSSAgent::wasEnabled() |
470 { | 428 { |
471 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { | 429 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { |
472 // We were disabled while fetching resources. | 430 // We were disabled while fetching resources. |
473 return; | 431 return; |
474 } | 432 } |
475 | 433 |
476 m_instrumentingAgents->setInspectorCSSAgent(this); | 434 m_instrumentingAgents->setInspectorCSSAgent(this); |
477 Vector<Document*> documents = m_domAgent->documents(); | 435 Vector<Document*> documents = m_domAgent->documents(); |
478 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) | 436 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) |
479 updateActiveStyleSheets(*it, InitialFrontendLoad); | 437 updateActiveStyleSheets(*it, InitialFrontendLoad); |
480 | |
481 if (callback) | |
482 callback->sendSuccess(); | |
483 } | 438 } |
484 | 439 |
485 void InspectorCSSAgent::disable(ErrorString*) | 440 void InspectorCSSAgent::disable(ErrorString*) |
486 { | 441 { |
487 reset(); | 442 reset(); |
488 m_instrumentingAgents->setInspectorCSSAgent(0); | 443 m_instrumentingAgents->setInspectorCSSAgent(0); |
489 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); | 444 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); |
490 } | 445 } |
491 | 446 |
492 void InspectorCSSAgent::didCommitLoadForMainFrame() | 447 void InspectorCSSAgent::didCommitLoadForMainFrame() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (styleSheetEditInProgress()) | 494 if (styleSheetEditInProgress()) |
540 return; | 495 return; |
541 m_invalidatedDocuments.add(document); | 496 m_invalidatedDocuments.add(document); |
542 if (m_creatingViaInspectorStyleSheet) | 497 if (m_creatingViaInspectorStyleSheet) |
543 flushPendingFrontendMessages(); | 498 flushPendingFrontendMessages(); |
544 } | 499 } |
545 | 500 |
546 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) | 501 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) |
547 { | 502 { |
548 Vector<CSSStyleSheet*> newSheetsVector; | 503 Vector<CSSStyleSheet*> newSheetsVector; |
549 collectAllDocumentStyleSheets(document, newSheetsVector); | 504 InspectorCSSAgent::collectAllDocumentStyleSheets(document, newSheetsVector); |
550 setActiveStyleSheets(document, newSheetsVector, styleSheetsUpdateType); | 505 setActiveStyleSheets(document, newSheetsVector, styleSheetsUpdateType); |
551 } | 506 } |
552 | 507 |
553 void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
SStyleSheet*>& allSheetsVector, StyleSheetsUpdateType styleSheetsUpdateType) | 508 void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
SStyleSheet*>& allSheetsVector, StyleSheetsUpdateType styleSheetsUpdateType) |
554 { | 509 { |
555 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad; | 510 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad; |
556 | 511 |
557 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets
.get(document); | 512 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets
.get(document); |
558 if (!documentCSSStyleSheets) { | 513 if (!documentCSSStyleSheets) { |
559 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>(); | 514 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>(); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 *errorString = "No node with given id found"; | 1117 *errorString = "No node with given id found"; |
1163 return 0; | 1118 return 0; |
1164 } | 1119 } |
1165 if (!node->isElementNode()) { | 1120 if (!node->isElementNode()) { |
1166 *errorString = "Not an element node"; | 1121 *errorString = "Not an element node"; |
1167 return 0; | 1122 return 0; |
1168 } | 1123 } |
1169 return toElement(node); | 1124 return toElement(node); |
1170 } | 1125 } |
1171 | 1126 |
1172 void InspectorCSSAgent::collectAllStyleSheets(Vector<InspectorStyleSheet*>& resu
lt) | 1127 // static |
1173 { | |
1174 Vector<CSSStyleSheet*> cssStyleSheets; | |
1175 Vector<Document*> documents = m_domAgent->documents(); | |
1176 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) | |
1177 collectAllDocumentStyleSheets(*it, cssStyleSheets); | |
1178 for (Vector<CSSStyleSheet*>::iterator it = cssStyleSheets.begin(); it != css
StyleSheets.end(); ++it) | |
1179 result.append(bindStyleSheet(*it)); | |
1180 } | |
1181 | |
1182 void InspectorCSSAgent::collectAllDocumentStyleSheets(Document* document, Vector
<CSSStyleSheet*>& result) | 1128 void InspectorCSSAgent::collectAllDocumentStyleSheets(Document* document, Vector
<CSSStyleSheet*>& result) |
1183 { | 1129 { |
1184 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > activeStyleSheets
= document->styleEngine()->activeStyleSheetsForInspector(); | 1130 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > activeStyleSheets
= document->styleEngine()->activeStyleSheetsForInspector(); |
1185 for (WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >::const_iterator it
= activeStyleSheets.begin(); it != activeStyleSheets.end(); ++it) { | 1131 for (WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >::const_iterator it
= activeStyleSheets.begin(); it != activeStyleSheets.end(); ++it) { |
1186 CSSStyleSheet* styleSheet = it->get(); | 1132 CSSStyleSheet* styleSheet = it->get(); |
1187 collectStyleSheets(styleSheet, result); | 1133 InspectorCSSAgent::collectStyleSheets(styleSheet, result); |
1188 } | 1134 } |
1189 } | 1135 } |
1190 | 1136 |
| 1137 // static |
1191 void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, Vector<CSS
StyleSheet*>& result) | 1138 void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, Vector<CSS
StyleSheet*>& result) |
1192 { | 1139 { |
1193 result.append(styleSheet); | 1140 result.append(styleSheet); |
1194 for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) { | 1141 for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) { |
1195 CSSRule* rule = styleSheet->item(i); | 1142 CSSRule* rule = styleSheet->item(i); |
1196 if (rule->type() == CSSRule::IMPORT_RULE) { | 1143 if (rule->type() == CSSRule::IMPORT_RULE) { |
1197 CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)->styleShee
t(); | 1144 CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)->styleShee
t(); |
1198 if (importedStyleSheet) | 1145 if (importedStyleSheet) |
1199 collectStyleSheets(importedStyleSheet, result); | 1146 InspectorCSSAgent::collectStyleSheets(importedStyleSheet, result
); |
1200 } | 1147 } |
1201 } | 1148 } |
1202 } | 1149 } |
1203 | 1150 |
1204 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) | 1151 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) |
1205 { | 1152 { |
1206 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); | 1153 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); |
1207 if (!inspectorStyleSheet) { | 1154 if (!inspectorStyleSheet) { |
1208 String id = String::number(m_lastStyleSheetId++); | 1155 String id = String::number(m_lastStyleSheetId++); |
1209 Document* document = styleSheet->ownerDocument(); | 1156 Document* document = styleSheet->ownerDocument(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 documentsToChange.add(element->ownerDocument()); | 1394 documentsToChange.add(element->ownerDocument()); |
1448 } | 1395 } |
1449 | 1396 |
1450 m_nodeIdToForcedPseudoState.clear(); | 1397 m_nodeIdToForcedPseudoState.clear(); |
1451 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1398 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
1452 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); | 1399 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); |
1453 } | 1400 } |
1454 | 1401 |
1455 } // namespace WebCore | 1402 } // namespace WebCore |
1456 | 1403 |
OLD | NEW |