| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // TODO(horo): When we will use the original URL as the base URL, we can rem
ove this check. crbug.com/553535 | 326 // TODO(horo): When we will use the original URL as the base URL, we can rem
ove this check. crbug.com/553535 |
| 327 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { | 327 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { |
| 328 const KURL originalURL(cachedStyleSheet->response().originalURLViaServic
eWorker()); | 328 const KURL originalURL(cachedStyleSheet->response().originalURLViaServic
eWorker()); |
| 329 // |originalURL| is empty when the response is created in the SW. | 329 // |originalURL| is empty when the response is created in the SW. |
| 330 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) | 330 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) |
| 331 isSameOriginRequest = false; | 331 isSameOriginRequest = false; |
| 332 } | 332 } |
| 333 | 333 |
| 334 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_
parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh
eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict; | 334 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_
parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCh
eck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict; |
| 335 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); | 335 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); |
| 336 if (RuntimeEnabledFeatures::lazyParseCSSEnabled()) |
| 337 m_sheetText = sheetText; |
| 336 | 338 |
| 337 const ResourceResponse& response = cachedStyleSheet->response(); | 339 const ResourceResponse& response = cachedStyleSheet->response(); |
| 338 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); | 340 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); |
| 339 if (m_sourceMapURL.isEmpty()) { | 341 if (m_sourceMapURL.isEmpty()) { |
| 340 // Try to get deprecated header. | 342 // Try to get deprecated header. |
| 341 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); | 343 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); |
| 342 } | 344 } |
| 343 | 345 |
| 344 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); | 346 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); |
| 345 CSSParser::parseSheet(context, this, sheetText); | 347 CSSParser::parseSheet(context, this, sheetText, RuntimeEnabledFeatures::lazy
ParseCSSEnabled()); |
| 346 } | 348 } |
| 347 | 349 |
| 348 void StyleSheetContents::parseString(const String& sheetText) | 350 void StyleSheetContents::parseString(const String& sheetText) |
| 349 { | 351 { |
| 350 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); | 352 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); |
| 351 } | 353 } |
| 352 | 354 |
| 353 void StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te
xtPosition& startPosition) | 355 void StyleSheetContents::parseStringAtPosition(const String& sheetText, const Te
xtPosition& startPosition) |
| 354 { | 356 { |
| 355 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); | 357 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 StyleSheetContents* root = rootStyleSheet(); | 469 StyleSheetContents* root = rootStyleSheet(); |
| 468 return root->clientSingleOwnerDocument(); | 470 return root->clientSingleOwnerDocument(); |
| 469 } | 471 } |
| 470 | 472 |
| 471 static bool childRulesHaveFailedOrCanceledSubresources(const HeapVector<Member<S
tyleRuleBase>>& rules) | 473 static bool childRulesHaveFailedOrCanceledSubresources(const HeapVector<Member<S
tyleRuleBase>>& rules) |
| 472 { | 474 { |
| 473 for (unsigned i = 0; i < rules.size(); ++i) { | 475 for (unsigned i = 0; i < rules.size(); ++i) { |
| 474 const StyleRuleBase* rule = rules[i].get(); | 476 const StyleRuleBase* rule = rules[i].get(); |
| 475 switch (rule->type()) { | 477 switch (rule->type()) { |
| 476 case StyleRuleBase::Style: | 478 case StyleRuleBase::Style: |
| 477 if (toStyleRule(rule)->properties().hasFailedOrCanceledSubresources(
)) | 479 if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources()) |
| 478 return true; | 480 return true; |
| 479 break; | 481 break; |
| 480 case StyleRuleBase::FontFace: | 482 case StyleRuleBase::FontFace: |
| 481 if (toStyleRuleFontFace(rule)->properties().hasFailedOrCanceledSubre
sources()) | 483 if (toStyleRuleFontFace(rule)->properties().hasFailedOrCanceledSubre
sources()) |
| 482 return true; | 484 return true; |
| 483 break; | 485 break; |
| 484 case StyleRuleBase::Media: | 486 case StyleRuleBase::Media: |
| 485 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) | 487 if (childRulesHaveFailedOrCanceledSubresources(toStyleRuleMedia(rule
)->childRules())) |
| 486 return true; | 488 return true; |
| 487 break; | 489 break; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 visitor->trace(m_importRules); | 666 visitor->trace(m_importRules); |
| 665 visitor->trace(m_namespaceRules); | 667 visitor->trace(m_namespaceRules); |
| 666 visitor->trace(m_childRules); | 668 visitor->trace(m_childRules); |
| 667 visitor->trace(m_loadingClients); | 669 visitor->trace(m_loadingClients); |
| 668 visitor->trace(m_completedClients); | 670 visitor->trace(m_completedClients); |
| 669 visitor->trace(m_ruleSet); | 671 visitor->trace(m_ruleSet); |
| 670 visitor->trace(m_referencedFromResource); | 672 visitor->trace(m_referencedFromResource); |
| 671 } | 673 } |
| 672 | 674 |
| 673 } // namespace blink | 675 } // namespace blink |
| OLD | NEW |