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