| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 return; | 411 return; |
| 412 | 412 |
| 413 // FIXME: Use the actual rule type rather than STYLE_RULE? | 413 // FIXME: Use the actual rule type rather than STYLE_RULE? |
| 414 if (!m_commentParser) | 414 if (!m_commentParser) |
| 415 m_commentParser = createCSSParser(m_document); | 415 m_commentParser = createCSSParser(m_document); |
| 416 RuleSourceDataList sourceData; | 416 RuleSourceDataList sourceData; |
| 417 | 417 |
| 418 // FIXME: Use another subclass of CSSParser::SourceDataHandler and assert th
at | 418 // FIXME: Use another subclass of CSSParser::SourceDataHandler and assert th
at |
| 419 // no comments are encountered (will not need m_document and m_styleSheetCon
tents). | 419 // no comments are encountered (will not need m_document and m_styleSheetCon
tents). |
| 420 StyleSheetHandler handler(commentText, m_document, m_styleSheetContents, &so
urceData); | 420 StyleSheetHandler handler(commentText, m_document, m_styleSheetContents, &so
urceData); |
| 421 RefPtr<StylePropertySet> tempMutableStyle = StylePropertySet::create(); | 421 RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertySet::
create(); |
| 422 m_commentParser->parseDeclaration(tempMutableStyle.get(), commentText, &hand
ler, m_styleSheetContents); | 422 m_commentParser->parseDeclaration(tempMutableStyle.get(), commentText, &hand
ler, m_styleSheetContents); |
| 423 Vector<CSSPropertySourceData>& commentPropertyData = sourceData.first()->sty
leSourceData->propertyData; | 423 Vector<CSSPropertySourceData>& commentPropertyData = sourceData.first()->sty
leSourceData->propertyData; |
| 424 if (commentPropertyData.size() != 1) | 424 if (commentPropertyData.size() != 1) |
| 425 return; | 425 return; |
| 426 CSSPropertySourceData& propertyData = commentPropertyData.at(0); | 426 CSSPropertySourceData& propertyData = commentPropertyData.at(0); |
| 427 if (propertyData.range.length() != commentText.length()) | 427 if (propertyData.range.length() != commentText.length()) |
| 428 return; | 428 return; |
| 429 | 429 |
| 430 unsigned topRuleBodyRangeStart = m_currentRuleDataStack.last()->ruleBodyRang
e.start; | 430 unsigned topRuleBodyRangeStart = m_currentRuleDataStack.last()->ruleBodyRang
e.start; |
| 431 m_currentRuleDataStack.last()->styleSourceData->propertyData.append( | 431 m_currentRuleDataStack.last()->styleSourceData->propertyData.append( |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 if (!m_parentStyleSheet->ensureParsedDataReady()) { | 642 if (!m_parentStyleSheet->ensureParsedDataReady()) { |
| 643 ec = NOT_FOUND_ERR; | 643 ec = NOT_FOUND_ERR; |
| 644 return false; | 644 return false; |
| 645 } | 645 } |
| 646 | 646 |
| 647 Vector<InspectorStyleProperty> allProperties; | 647 Vector<InspectorStyleProperty> allProperties; |
| 648 populateAllProperties(allProperties); | 648 populateAllProperties(allProperties); |
| 649 | 649 |
| 650 if (!propertyText.stripWhiteSpace().isEmpty()) { | 650 if (!propertyText.stripWhiteSpace().isEmpty()) { |
| 651 RefPtr<StylePropertySet> tempMutableStyle = StylePropertySet::create(); | 651 RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertyS
et::create(); |
| 652 String declarationText = propertyText + " " + bogusPropertyName + ": non
e"; | 652 String declarationText = propertyText + " " + bogusPropertyName + ": non
e"; |
| 653 RuleSourceDataList sourceData; | 653 RuleSourceDataList sourceData; |
| 654 StyleSheetHandler handler(declarationText, ownerDocument(), m_style->par
entStyleSheet()->contents(), &sourceData); | 654 StyleSheetHandler handler(declarationText, ownerDocument(), m_style->par
entStyleSheet()->contents(), &sourceData); |
| 655 createCSSParser(ownerDocument())->parseDeclaration(tempMutableStyle.get(
), declarationText, &handler, m_style->parentStyleSheet()->contents()); | 655 createCSSParser(ownerDocument())->parseDeclaration(tempMutableStyle.get(
), declarationText, &handler, m_style->parentStyleSheet()->contents()); |
| 656 Vector<CSSPropertySourceData>& propertyData = sourceData.first()->styleS
ourceData->propertyData; | 656 Vector<CSSPropertySourceData>& propertyData = sourceData.first()->styleS
ourceData->propertyData; |
| 657 unsigned propertyCount = propertyData.size(); | 657 unsigned propertyCount = propertyData.size(); |
| 658 | 658 |
| 659 // At least one property + the bogus property added just above should be
present. | 659 // At least one property + the bogus property added just above should be
present. |
| 660 if (propertyCount < 2) { | 660 if (propertyCount < 2) { |
| 661 ec = SYNTAX_ERR; | 661 ec = SYNTAX_ERR; |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 if (!m_element->isStyledElement()) | 1850 if (!m_element->isStyledElement()) |
| 1851 return 0; | 1851 return 0; |
| 1852 | 1852 |
| 1853 if (m_styleText.isEmpty()) { | 1853 if (m_styleText.isEmpty()) { |
| 1854 RefPtr<CSSRuleSourceData> result = CSSRuleSourceData::create(CSSRuleSour
ceData::STYLE_RULE); | 1854 RefPtr<CSSRuleSourceData> result = CSSRuleSourceData::create(CSSRuleSour
ceData::STYLE_RULE); |
| 1855 result->ruleBodyRange.start = 0; | 1855 result->ruleBodyRange.start = 0; |
| 1856 result->ruleBodyRange.end = 0; | 1856 result->ruleBodyRange.end = 0; |
| 1857 return result.release(); | 1857 return result.release(); |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); | 1860 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); |
| 1861 RuleSourceDataList ruleSourceDataResult; | 1861 RuleSourceDataList ruleSourceDataResult; |
| 1862 StyleSheetHandler handler(m_styleText, m_element->document(), m_element->doc
ument()->elementSheet()->contents(), &ruleSourceDataResult); | 1862 StyleSheetHandler handler(m_styleText, m_element->document(), m_element->doc
ument()->elementSheet()->contents(), &ruleSourceDataResult); |
| 1863 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, &handler, m_element->document()->elementSheet()->contents()); | 1863 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, &handler, m_element->document()->elementSheet()->contents()); |
| 1864 return ruleSourceDataResult.first().release(); | 1864 return ruleSourceDataResult.first().release(); |
| 1865 } | 1865 } |
| 1866 | 1866 |
| 1867 } // namespace WebCore | 1867 } // namespace WebCore |
| 1868 | 1868 |
| OLD | NEW |