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" |
29 #include "InspectorTypeBuilder.h" | 30 #include "InspectorTypeBuilder.h" |
30 #include "StylePropertyShorthand.h" | 31 #include "StylePropertyShorthand.h" |
31 #include "bindings/v8/ExceptionState.h" | 32 #include "bindings/v8/ExceptionState.h" |
32 #include "bindings/v8/ExceptionStatePlaceholder.h" | 33 #include "bindings/v8/ExceptionStatePlaceholder.h" |
33 #include "core/css/CSSComputedStyleDeclaration.h" | 34 #include "core/css/CSSComputedStyleDeclaration.h" |
34 #include "core/css/CSSDefaultStyleSheets.h" | 35 #include "core/css/CSSDefaultStyleSheets.h" |
35 #include "core/css/CSSImportRule.h" | 36 #include "core/css/CSSImportRule.h" |
36 #include "core/css/CSSMediaRule.h" | 37 #include "core/css/CSSMediaRule.h" |
37 #include "core/css/CSSRule.h" | 38 #include "core/css/CSSRule.h" |
38 #include "core/css/CSSRuleList.h" | 39 #include "core/css/CSSRuleList.h" |
39 #include "core/css/CSSStyleRule.h" | 40 #include "core/css/CSSStyleRule.h" |
40 #include "core/css/CSSStyleSheet.h" | 41 #include "core/css/CSSStyleSheet.h" |
41 #include "core/css/MediaList.h" | 42 #include "core/css/MediaList.h" |
42 #include "core/css/MediaQuery.h" | 43 #include "core/css/MediaQuery.h" |
43 #include "core/css/StylePropertySet.h" | 44 #include "core/css/StylePropertySet.h" |
44 #include "core/css/StyleRule.h" | 45 #include "core/css/StyleRule.h" |
45 #include "core/css/StyleSheet.h" | 46 #include "core/css/StyleSheet.h" |
46 #include "core/css/StyleSheetContents.h" | 47 #include "core/css/StyleSheetContents.h" |
47 #include "core/css/StyleSheetList.h" | 48 #include "core/css/StyleSheetList.h" |
48 #include "core/css/resolver/StyleResolver.h" | 49 #include "core/css/resolver/StyleResolver.h" |
49 #include "core/dom/Node.h" | 50 #include "core/dom/Node.h" |
50 #include "core/dom/NodeList.h" | 51 #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" |
51 #include "core/frame/LocalFrame.h" | 56 #include "core/frame/LocalFrame.h" |
52 #include "core/html/HTMLHeadElement.h" | 57 #include "core/html/HTMLHeadElement.h" |
53 #include "core/html/VoidCallback.h" | |
54 #include "core/inspector/InspectorHistory.h" | 58 #include "core/inspector/InspectorHistory.h" |
55 #include "core/inspector/InspectorPageAgent.h" | 59 #include "core/inspector/InspectorPageAgent.h" |
56 #include "core/inspector/InspectorResourceAgent.h" | 60 #include "core/inspector/InspectorResourceAgent.h" |
57 #include "core/inspector/InspectorResourceContentLoader.h" | |
58 #include "core/inspector/InspectorState.h" | 61 #include "core/inspector/InspectorState.h" |
59 #include "core/inspector/InstrumentingAgents.h" | 62 #include "core/inspector/InstrumentingAgents.h" |
60 #include "core/loader/DocumentLoader.h" | 63 #include "core/loader/DocumentLoader.h" |
61 #include "core/page/Page.h" | 64 #include "core/page/Page.h" |
62 #include "core/rendering/InlineTextBox.h" | 65 #include "core/rendering/InlineTextBox.h" |
63 #include "core/rendering/RenderObject.h" | 66 #include "core/rendering/RenderObject.h" |
64 #include "core/rendering/RenderText.h" | 67 #include "core/rendering/RenderText.h" |
65 #include "core/rendering/RenderTextFragment.h" | 68 #include "core/rendering/RenderTextFragment.h" |
66 #include "platform/fonts/Font.h" | 69 #include "platform/fonts/Font.h" |
67 #include "platform/fonts/GlyphBuffer.h" | 70 #include "platform/fonts/GlyphBuffer.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 121 |
119 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { | 122 class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { |
120 WTF_MAKE_NONCOPYABLE(StyleSheetAction); | 123 WTF_MAKE_NONCOPYABLE(StyleSheetAction); |
121 public: | 124 public: |
122 StyleSheetAction(const String& name) | 125 StyleSheetAction(const String& name) |
123 : InspectorHistory::Action(name) | 126 : InspectorHistory::Action(name) |
124 { | 127 { |
125 } | 128 } |
126 }; | 129 }; |
127 | 130 |
128 class InspectorCSSAgent::InspectorResourceContentLoaderCallback FINAL : public V
oidCallback { | 131 class InspectorCSSAgent::EnableResourceClient FINAL : public StyleSheetResourceC
lient { |
129 public: | 132 public: |
130 InspectorResourceContentLoaderCallback(InspectorCSSAgent*, PassRefPtr<Enable
Callback>); | 133 EnableResourceClient(InspectorCSSAgent*, const Vector<InspectorStyleSheet*>&
, PassRefPtr<EnableCallback>); |
131 virtual void handleEvent() OVERRIDE; | 134 |
| 135 virtual void setCSSStyleSheet(const String&, const KURL&, const String&, con
st CSSStyleSheetResource*) OVERRIDE; |
132 | 136 |
133 private: | 137 private: |
| 138 RefPtr<EnableCallback> m_callback; |
134 InspectorCSSAgent* m_cssAgent; | 139 InspectorCSSAgent* m_cssAgent; |
135 RefPtr<EnableCallback> m_callback; | 140 int m_pendingResources; |
| 141 Vector<InspectorStyleSheet*> m_styleSheets; |
136 }; | 142 }; |
137 | 143 |
138 InspectorCSSAgent::InspectorResourceContentLoaderCallback::InspectorResourceCont
entLoaderCallback(InspectorCSSAgent* cssAgent, PassRefPtr<EnableCallback> callba
ck) | 144 InspectorCSSAgent::EnableResourceClient::EnableResourceClient(InspectorCSSAgent*
cssAgent, const Vector<InspectorStyleSheet*>& styleSheets, PassRefPtr<EnableCal
lback> callback) |
139 : m_cssAgent(cssAgent) | 145 : m_callback(callback) |
140 , m_callback(callback) | 146 , m_cssAgent(cssAgent) |
| 147 , m_pendingResources(styleSheets.size()) |
| 148 , m_styleSheets(styleSheets) |
141 { | 149 { |
| 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 } |
142 } | 157 } |
143 | 158 |
144 void InspectorCSSAgent::InspectorResourceContentLoaderCallback::handleEvent() | 159 void InspectorCSSAgent::EnableResourceClient::setCSSStyleSheet(const String&, co
nst KURL& url, const String&, const CSSStyleSheetResource* resource) |
145 { | 160 { |
146 // enable always succeeds. | 161 const_cast<CSSStyleSheetResource*>(resource)->removeClient(this); |
147 if (!m_callback->isActive()) | 162 --m_pendingResources; |
| 163 if (m_pendingResources) |
148 return; | 164 return; |
149 | 165 |
150 m_cssAgent->wasEnabled(); | 166 // enable always succeeds. |
151 m_callback->sendSuccess(); | 167 if (m_callback->isActive()) |
| 168 m_cssAgent->wasEnabled(m_callback.release()); |
| 169 delete this; |
152 } | 170 } |
153 | 171 |
154 class InspectorCSSAgent::SetStyleSheetTextAction FINAL : public InspectorCSSAgen
t::StyleSheetAction { | 172 class InspectorCSSAgent::SetStyleSheetTextAction FINAL : public InspectorCSSAgen
t::StyleSheetAction { |
155 WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction); | 173 WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction); |
156 public: | 174 public: |
157 SetStyleSheetTextAction(InspectorStyleSheetBase* styleSheet, const String& t
ext) | 175 SetStyleSheetTextAction(InspectorStyleSheetBase* styleSheet, const String& t
ext) |
158 : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText") | 176 : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText") |
159 , m_styleSheet(styleSheet) | 177 , m_styleSheet(styleSheet) |
160 , m_text(text) | 178 , m_text(text) |
161 { | 179 { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 394 |
377 void InspectorCSSAgent::discardAgent() | 395 void InspectorCSSAgent::discardAgent() |
378 { | 396 { |
379 m_domAgent->setDOMListener(0); | 397 m_domAgent->setDOMListener(0); |
380 m_domAgent = 0; | 398 m_domAgent = 0; |
381 } | 399 } |
382 | 400 |
383 void InspectorCSSAgent::restore() | 401 void InspectorCSSAgent::restore() |
384 { | 402 { |
385 if (m_state->getBoolean(CSSAgentState::cssAgentEnabled)) | 403 if (m_state->getBoolean(CSSAgentState::cssAgentEnabled)) |
386 wasEnabled(); | 404 wasEnabled(nullptr); |
387 } | 405 } |
388 | 406 |
389 void InspectorCSSAgent::flushPendingFrontendMessages() | 407 void InspectorCSSAgent::flushPendingFrontendMessages() |
390 { | 408 { |
391 if (!m_invalidatedDocuments.size()) | 409 if (!m_invalidatedDocuments.size()) |
392 return; | 410 return; |
393 HashSet<Document*> invalidatedDocuments; | 411 HashSet<Document*> invalidatedDocuments; |
394 m_invalidatedDocuments.swap(&invalidatedDocuments); | 412 m_invalidatedDocuments.swap(&invalidatedDocuments); |
395 for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != i
nvalidatedDocuments.end(); ++it) | 413 for (HashSet<Document*>::iterator it = invalidatedDocuments.begin(); it != i
nvalidatedDocuments.end(); ++it) |
396 updateActiveStyleSheets(*it, ExistingFrontendRefresh); | 414 updateActiveStyleSheets(*it, ExistingFrontendRefresh); |
(...skipping 12 matching lines...) Expand all Loading... |
409 } | 427 } |
410 | 428 |
411 void InspectorCSSAgent::resetNonPersistentData() | 429 void InspectorCSSAgent::resetNonPersistentData() |
412 { | 430 { |
413 resetPseudoStates(); | 431 resetPseudoStates(); |
414 } | 432 } |
415 | 433 |
416 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) | 434 void InspectorCSSAgent::enable(ErrorString*, PassRefPtr<EnableCallback> prpCallb
ack) |
417 { | 435 { |
418 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); | 436 m_state->setBoolean(CSSAgentState::cssAgentEnabled, true); |
419 if (!m_pageAgent->resourceContentLoader()) { | 437 |
420 wasEnabled(); | 438 Vector<InspectorStyleSheet*> styleSheets; |
421 prpCallback->sendSuccess(); | 439 collectAllStyleSheets(styleSheets); |
| 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); |
422 return; | 464 return; |
423 } | 465 } |
424 m_pageAgent->resourceContentLoader()->addListener(adoptPtr(new InspectorCSSA
gent::InspectorResourceContentLoaderCallback(this, prpCallback))); | 466 new EnableResourceClient(this, styleSheetsToFetch, prpCallback); |
425 } | 467 } |
426 | 468 |
427 void InspectorCSSAgent::wasEnabled() | 469 void InspectorCSSAgent::wasEnabled(PassRefPtr<EnableCallback> callback) |
428 { | 470 { |
429 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { | 471 if (!m_state->getBoolean(CSSAgentState::cssAgentEnabled)) { |
430 // We were disabled while fetching resources. | 472 // We were disabled while fetching resources. |
431 return; | 473 return; |
432 } | 474 } |
433 | 475 |
434 m_instrumentingAgents->setInspectorCSSAgent(this); | 476 m_instrumentingAgents->setInspectorCSSAgent(this); |
435 Vector<Document*> documents = m_domAgent->documents(); | 477 Vector<Document*> documents = m_domAgent->documents(); |
436 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) | 478 for (Vector<Document*>::iterator it = documents.begin(); it != documents.end
(); ++it) |
437 updateActiveStyleSheets(*it, InitialFrontendLoad); | 479 updateActiveStyleSheets(*it, InitialFrontendLoad); |
| 480 |
| 481 if (callback) |
| 482 callback->sendSuccess(); |
438 } | 483 } |
439 | 484 |
440 void InspectorCSSAgent::disable(ErrorString*) | 485 void InspectorCSSAgent::disable(ErrorString*) |
441 { | 486 { |
442 reset(); | 487 reset(); |
443 m_instrumentingAgents->setInspectorCSSAgent(0); | 488 m_instrumentingAgents->setInspectorCSSAgent(0); |
444 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); | 489 m_state->setBoolean(CSSAgentState::cssAgentEnabled, false); |
445 } | 490 } |
446 | 491 |
447 void InspectorCSSAgent::didCommitLoadForMainFrame() | 492 void InspectorCSSAgent::didCommitLoadForMainFrame() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 if (styleSheetEditInProgress()) | 539 if (styleSheetEditInProgress()) |
495 return; | 540 return; |
496 m_invalidatedDocuments.add(document); | 541 m_invalidatedDocuments.add(document); |
497 if (m_creatingViaInspectorStyleSheet) | 542 if (m_creatingViaInspectorStyleSheet) |
498 flushPendingFrontendMessages(); | 543 flushPendingFrontendMessages(); |
499 } | 544 } |
500 | 545 |
501 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) | 546 void InspectorCSSAgent::updateActiveStyleSheets(Document* document, StyleSheetsU
pdateType styleSheetsUpdateType) |
502 { | 547 { |
503 Vector<CSSStyleSheet*> newSheetsVector; | 548 Vector<CSSStyleSheet*> newSheetsVector; |
504 InspectorCSSAgent::collectAllDocumentStyleSheets(document, newSheetsVector); | 549 collectAllDocumentStyleSheets(document, newSheetsVector); |
505 setActiveStyleSheets(document, newSheetsVector, styleSheetsUpdateType); | 550 setActiveStyleSheets(document, newSheetsVector, styleSheetsUpdateType); |
506 } | 551 } |
507 | 552 |
508 void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
SStyleSheet*>& allSheetsVector, StyleSheetsUpdateType styleSheetsUpdateType) | 553 void InspectorCSSAgent::setActiveStyleSheets(Document* document, const Vector<CS
SStyleSheet*>& allSheetsVector, StyleSheetsUpdateType styleSheetsUpdateType) |
509 { | 554 { |
510 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad; | 555 bool isInitialFrontendLoad = styleSheetsUpdateType == InitialFrontendLoad; |
511 | 556 |
512 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets
.get(document); | 557 HashSet<CSSStyleSheet*>* documentCSSStyleSheets = m_documentToCSSStyleSheets
.get(document); |
513 if (!documentCSSStyleSheets) { | 558 if (!documentCSSStyleSheets) { |
514 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>(); | 559 documentCSSStyleSheets = new HashSet<CSSStyleSheet*>(); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 *errorString = "No node with given id found"; | 1162 *errorString = "No node with given id found"; |
1118 return 0; | 1163 return 0; |
1119 } | 1164 } |
1120 if (!node->isElementNode()) { | 1165 if (!node->isElementNode()) { |
1121 *errorString = "Not an element node"; | 1166 *errorString = "Not an element node"; |
1122 return 0; | 1167 return 0; |
1123 } | 1168 } |
1124 return toElement(node); | 1169 return toElement(node); |
1125 } | 1170 } |
1126 | 1171 |
1127 // static | 1172 void InspectorCSSAgent::collectAllStyleSheets(Vector<InspectorStyleSheet*>& resu
lt) |
| 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 |
1128 void InspectorCSSAgent::collectAllDocumentStyleSheets(Document* document, Vector
<CSSStyleSheet*>& result) | 1182 void InspectorCSSAgent::collectAllDocumentStyleSheets(Document* document, Vector
<CSSStyleSheet*>& result) |
1129 { | 1183 { |
1130 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > activeStyleSheets
= document->styleEngine()->activeStyleSheetsForInspector(); | 1184 const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > activeStyleSheets
= document->styleEngine()->activeStyleSheetsForInspector(); |
1131 for (WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >::const_iterator it
= activeStyleSheets.begin(); it != activeStyleSheets.end(); ++it) { | 1185 for (WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >::const_iterator it
= activeStyleSheets.begin(); it != activeStyleSheets.end(); ++it) { |
1132 CSSStyleSheet* styleSheet = it->get(); | 1186 CSSStyleSheet* styleSheet = it->get(); |
1133 InspectorCSSAgent::collectStyleSheets(styleSheet, result); | 1187 collectStyleSheets(styleSheet, result); |
1134 } | 1188 } |
1135 } | 1189 } |
1136 | 1190 |
1137 // static | |
1138 void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, Vector<CSS
StyleSheet*>& result) | 1191 void InspectorCSSAgent::collectStyleSheets(CSSStyleSheet* styleSheet, Vector<CSS
StyleSheet*>& result) |
1139 { | 1192 { |
1140 result.append(styleSheet); | 1193 result.append(styleSheet); |
1141 for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) { | 1194 for (unsigned i = 0, size = styleSheet->length(); i < size; ++i) { |
1142 CSSRule* rule = styleSheet->item(i); | 1195 CSSRule* rule = styleSheet->item(i); |
1143 if (rule->type() == CSSRule::IMPORT_RULE) { | 1196 if (rule->type() == CSSRule::IMPORT_RULE) { |
1144 CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)->styleShee
t(); | 1197 CSSStyleSheet* importedStyleSheet = toCSSImportRule(rule)->styleShee
t(); |
1145 if (importedStyleSheet) | 1198 if (importedStyleSheet) |
1146 InspectorCSSAgent::collectStyleSheets(importedStyleSheet, result
); | 1199 collectStyleSheets(importedStyleSheet, result); |
1147 } | 1200 } |
1148 } | 1201 } |
1149 } | 1202 } |
1150 | 1203 |
1151 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) | 1204 InspectorStyleSheet* InspectorCSSAgent::bindStyleSheet(CSSStyleSheet* styleSheet
) |
1152 { | 1205 { |
1153 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); | 1206 RefPtr<InspectorStyleSheet> inspectorStyleSheet = m_cssStyleSheetToInspector
StyleSheet.get(styleSheet); |
1154 if (!inspectorStyleSheet) { | 1207 if (!inspectorStyleSheet) { |
1155 String id = String::number(m_lastStyleSheetId++); | 1208 String id = String::number(m_lastStyleSheetId++); |
1156 Document* document = styleSheet->ownerDocument(); | 1209 Document* document = styleSheet->ownerDocument(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 documentsToChange.add(element->ownerDocument()); | 1447 documentsToChange.add(element->ownerDocument()); |
1395 } | 1448 } |
1396 | 1449 |
1397 m_nodeIdToForcedPseudoState.clear(); | 1450 m_nodeIdToForcedPseudoState.clear(); |
1398 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1451 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
1399 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); | 1452 (*it)->setNeedsStyleRecalc(SubtreeStyleChange); |
1400 } | 1453 } |
1401 | 1454 |
1402 } // namespace WebCore | 1455 } // namespace WebCore |
1403 | 1456 |
OLD | NEW |