| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 m_isMutable(false), | 85 m_isMutable(false), |
| 86 m_hasFontFaceRule(o.m_hasFontFaceRule), | 86 m_hasFontFaceRule(o.m_hasFontFaceRule), |
| 87 m_hasViewportRule(o.m_hasViewportRule), | 87 m_hasViewportRule(o.m_hasViewportRule), |
| 88 m_hasMediaQueries(o.m_hasMediaQueries), | 88 m_hasMediaQueries(o.m_hasMediaQueries), |
| 89 m_hasSingleOwnerDocument(true), | 89 m_hasSingleOwnerDocument(true), |
| 90 m_isUsedFromTextCache(false), | 90 m_isUsedFromTextCache(false), |
| 91 m_parserContext(o.m_parserContext) { | 91 m_parserContext(o.m_parserContext) { |
| 92 // FIXME: Copy import rules. | 92 // FIXME: Copy import rules. |
| 93 ASSERT(o.m_importRules.isEmpty()); | 93 ASSERT(o.m_importRules.isEmpty()); |
| 94 | 94 |
| 95 // LazyParseCSS: Copying child rules is a strict point for lazy parsing, so |
| 96 // there is no need to copy lazy parsing state here. |
| 95 for (unsigned i = 0; i < m_childRules.size(); ++i) | 97 for (unsigned i = 0; i < m_childRules.size(); ++i) |
| 96 m_childRules[i] = o.m_childRules[i]->copy(); | 98 m_childRules[i] = o.m_childRules[i]->copy(); |
| 97 } | 99 } |
| 98 | 100 |
| 99 StyleSheetContents::~StyleSheetContents() {} | 101 StyleSheetContents::~StyleSheetContents() {} |
| 100 | 102 |
| 101 void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss) { | 103 void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss) { |
| 102 m_hasSyntacticallyValidCSSHeader = isValidCss; | 104 m_hasSyntacticallyValidCSSHeader = isValidCss; |
| 103 } | 105 } |
| 104 | 106 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); | 346 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); |
| 345 | 347 |
| 346 const ResourceResponse& response = cachedStyleSheet->response(); | 348 const ResourceResponse& response = cachedStyleSheet->response(); |
| 347 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); | 349 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); |
| 348 if (m_sourceMapURL.isEmpty()) { | 350 if (m_sourceMapURL.isEmpty()) { |
| 349 // Try to get deprecated header. | 351 // Try to get deprecated header. |
| 350 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); | 352 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); |
| 351 } | 353 } |
| 352 | 354 |
| 353 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); | 355 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); |
| 354 CSSParser::parseSheet(context, this, sheetText); | 356 CSSParser::parseSheet(context, this, sheetText, |
| 357 RuntimeEnabledFeatures::lazyParseCSSEnabled()); |
| 355 } | 358 } |
| 356 | 359 |
| 357 void StyleSheetContents::parseString(const String& sheetText) { | 360 void StyleSheetContents::parseString(const String& sheetText) { |
| 358 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); | 361 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); |
| 359 } | 362 } |
| 360 | 363 |
| 361 void StyleSheetContents::parseStringAtPosition( | 364 void StyleSheetContents::parseStringAtPosition( |
| 362 const String& sheetText, | 365 const String& sheetText, |
| 363 const TextPosition& startPosition) { | 366 const TextPosition& startPosition) { |
| 364 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); | 367 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 StyleSheetContents* root = rootStyleSheet(); | 474 StyleSheetContents* root = rootStyleSheet(); |
| 472 return root->clientSingleOwnerDocument(); | 475 return root->clientSingleOwnerDocument(); |
| 473 } | 476 } |
| 474 | 477 |
| 475 static bool childRulesHaveFailedOrCanceledSubresources( | 478 static bool childRulesHaveFailedOrCanceledSubresources( |
| 476 const HeapVector<Member<StyleRuleBase>>& rules) { | 479 const HeapVector<Member<StyleRuleBase>>& rules) { |
| 477 for (unsigned i = 0; i < rules.size(); ++i) { | 480 for (unsigned i = 0; i < rules.size(); ++i) { |
| 478 const StyleRuleBase* rule = rules[i].get(); | 481 const StyleRuleBase* rule = rules[i].get(); |
| 479 switch (rule->type()) { | 482 switch (rule->type()) { |
| 480 case StyleRuleBase::Style: | 483 case StyleRuleBase::Style: |
| 481 if (toStyleRule(rule)->properties().hasFailedOrCanceledSubresources()) | 484 if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources()) |
| 482 return true; | 485 return true; |
| 483 break; | 486 break; |
| 484 case StyleRuleBase::FontFace: | 487 case StyleRuleBase::FontFace: |
| 485 if (toStyleRuleFontFace(rule) | 488 if (toStyleRuleFontFace(rule) |
| 486 ->properties() | 489 ->properties() |
| 487 .hasFailedOrCanceledSubresources()) | 490 .hasFailedOrCanceledSubresources()) |
| 488 return true; | 491 return true; |
| 489 break; | 492 break; |
| 490 case StyleRuleBase::Media: | 493 case StyleRuleBase::Media: |
| 491 if (childRulesHaveFailedOrCanceledSubresources( | 494 if (childRulesHaveFailedOrCanceledSubresources( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 visitor->trace(m_importRules); | 669 visitor->trace(m_importRules); |
| 667 visitor->trace(m_namespaceRules); | 670 visitor->trace(m_namespaceRules); |
| 668 visitor->trace(m_childRules); | 671 visitor->trace(m_childRules); |
| 669 visitor->trace(m_loadingClients); | 672 visitor->trace(m_loadingClients); |
| 670 visitor->trace(m_completedClients); | 673 visitor->trace(m_completedClients); |
| 671 visitor->trace(m_ruleSet); | 674 visitor->trace(m_ruleSet); |
| 672 visitor->trace(m_referencedFromResource); | 675 visitor->trace(m_referencedFromResource); |
| 673 } | 676 } |
| 674 | 677 |
| 675 } // namespace blink | 678 } // namespace blink |
| OLD | NEW |