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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static void flattenSourceData(RuleSourceDataList* dataList, RuleSourceDataList*
target) | 105 static void flattenSourceData(RuleSourceDataList* dataList, RuleSourceDataList*
target) |
106 { | 106 { |
107 for (size_t i = 0; i < dataList->size(); ++i) { | 107 for (size_t i = 0; i < dataList->size(); ++i) { |
108 RefPtr<CSSRuleSourceData>& data = dataList->at(i); | 108 RefPtr<CSSRuleSourceData>& data = dataList->at(i); |
109 if (data->type == CSSRuleSourceData::STYLE_RULE) | 109 if (data->type == CSSRuleSourceData::STYLE_RULE) |
110 target->append(data); | 110 target->append(data); |
111 else if (data->type == CSSRuleSourceData::MEDIA_RULE) | 111 else if (data->type == CSSRuleSourceData::MEDIA_RULE) |
112 flattenSourceData(&data->childRules, target); | 112 flattenSourceData(&data->childRules, target); |
113 else if (data->type == CSSRuleSourceData::HOST_RULE) | 113 else if (data->type == CSSRuleSourceData::HOST_RULE) |
114 flattenSourceData(&data->childRules, target); | 114 flattenSourceData(&data->childRules, target); |
115 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
116 else if (data->type == CSSRuleSourceData::SUPPORTS_RULE) | 115 else if (data->type == CSSRuleSourceData::SUPPORTS_RULE) |
117 flattenSourceData(&data->childRules, target); | 116 flattenSourceData(&data->childRules, target); |
118 #endif | |
119 } | 117 } |
120 } | 118 } |
121 | 119 |
122 void ParsedStyleSheet::setSourceData(PassOwnPtr<RuleSourceDataList> sourceData) | 120 void ParsedStyleSheet::setSourceData(PassOwnPtr<RuleSourceDataList> sourceData) |
123 { | 121 { |
124 if (!sourceData) { | 122 if (!sourceData) { |
125 m_sourceData.clear(); | 123 m_sourceData.clear(); |
126 return; | 124 return; |
127 } | 125 } |
128 | 126 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 435 |
438 if (rule->type() == CSSRule::MEDIA_RULE) | 436 if (rule->type() == CSSRule::MEDIA_RULE) |
439 return static_cast<CSSMediaRule*>(rule)->cssRules(); | 437 return static_cast<CSSMediaRule*>(rule)->cssRules(); |
440 | 438 |
441 if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE) | 439 if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE) |
442 return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules(); | 440 return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules(); |
443 | 441 |
444 if (rule->type() == CSSRule::HOST_RULE) | 442 if (rule->type() == CSSRule::HOST_RULE) |
445 return static_cast<CSSHostRule*>(rule)->cssRules(); | 443 return static_cast<CSSHostRule*>(rule)->cssRules(); |
446 | 444 |
447 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
448 if (rule->type() == CSSRule::SUPPORTS_RULE) | 445 if (rule->type() == CSSRule::SUPPORTS_RULE) |
449 return static_cast<CSSSupportsRule*>(rule)->cssRules(); | 446 return static_cast<CSSSupportsRule*>(rule)->cssRules(); |
450 #endif | |
451 | 447 |
452 return 0; | 448 return 0; |
453 } | 449 } |
454 | 450 |
455 static void fillMediaListChain(CSSRule* rule, Array<TypeBuilder::CSS::CSSMedia>*
mediaArray) | 451 static void fillMediaListChain(CSSRule* rule, Array<TypeBuilder::CSS::CSSMedia>*
mediaArray) |
456 { | 452 { |
457 MediaList* mediaList; | 453 MediaList* mediaList; |
458 CSSRule* parentRule = rule; | 454 CSSRule* parentRule = rule; |
459 String sourceURL; | 455 String sourceURL; |
460 while (parentRule) { | 456 while (parentRule) { |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 | 1771 |
1776 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); | 1772 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); |
1777 OwnPtr<RuleSourceDataList> ruleSourceDataResult = adoptPtr(new RuleSourceDat
aList()); | 1773 OwnPtr<RuleSourceDataList> ruleSourceDataResult = adoptPtr(new RuleSourceDat
aList()); |
1778 StyleSheetHandler handler(m_styleText, ruleSourceDataResult.get()); | 1774 StyleSheetHandler handler(m_styleText, ruleSourceDataResult.get()); |
1779 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, &handler, m_element->document()->elementSheet()->contents()); | 1775 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, &handler, m_element->document()->elementSheet()->contents()); |
1780 return ruleSourceDataResult->first().release(); | 1776 return ruleSourceDataResult->first().release(); |
1781 } | 1777 } |
1782 | 1778 |
1783 } // namespace WebCore | 1779 } // namespace WebCore |
1784 | 1780 |
OLD | NEW |