| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return; | 333 return; |
| 334 | 334 |
| 335 // FIXME: Use the actual rule type rather than STYLE_RULE? | 335 // FIXME: Use the actual rule type rather than STYLE_RULE? |
| 336 if (!m_commentParser) | 336 if (!m_commentParser) |
| 337 m_commentParser = createCSSParser(m_document); | 337 m_commentParser = createCSSParser(m_document); |
| 338 RuleSourceDataList sourceData; | 338 RuleSourceDataList sourceData; |
| 339 | 339 |
| 340 // FIXME: Use another subclass of BisonCSSParser::SourceDataHandler and asse
rt that | 340 // FIXME: Use another subclass of BisonCSSParser::SourceDataHandler and asse
rt that |
| 341 // no comments are encountered (will not need m_document and m_styleSheetCon
tents). | 341 // no comments are encountered (will not need m_document and m_styleSheetCon
tents). |
| 342 StyleSheetHandler handler(commentText, m_document, m_styleSheetContents, &so
urceData); | 342 StyleSheetHandler handler(commentText, m_document, m_styleSheetContents, &so
urceData); |
| 343 RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertySet::
create(); | 343 RefPtrWillBeRawPtr<MutableStylePropertySet> tempMutableStyle = MutableStyleP
ropertySet::create(); |
| 344 m_commentParser->parseDeclaration(tempMutableStyle.get(), commentText, &hand
ler, m_styleSheetContents); | 344 m_commentParser->parseDeclaration(tempMutableStyle.get(), commentText, &hand
ler, m_styleSheetContents); |
| 345 Vector<CSSPropertySourceData>& commentPropertyData = sourceData.first()->sty
leSourceData->propertyData; | 345 Vector<CSSPropertySourceData>& commentPropertyData = sourceData.first()->sty
leSourceData->propertyData; |
| 346 if (commentPropertyData.size() != 1) | 346 if (commentPropertyData.size() != 1) |
| 347 return; | 347 return; |
| 348 CSSPropertySourceData& propertyData = commentPropertyData.at(0); | 348 CSSPropertySourceData& propertyData = commentPropertyData.at(0); |
| 349 if (propertyData.range.length() != commentText.length()) | 349 if (propertyData.range.length() != commentText.length()) |
| 350 return; | 350 return; |
| 351 | 351 |
| 352 unsigned topRuleBodyRangeStart = m_currentRuleDataStack.last()->ruleBodyRang
e.start; | 352 unsigned topRuleBodyRangeStart = m_currentRuleDataStack.last()->ruleBodyRang
e.start; |
| 353 m_currentRuleDataStack.last()->styleSourceData->propertyData.append( | 353 m_currentRuleDataStack.last()->styleSourceData->propertyData.append( |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 .setValue(propertyEntry.value); | 544 .setValue(propertyEntry.value); |
| 545 result->addItem(entry); | 545 result->addItem(entry); |
| 546 } | 546 } |
| 547 | 547 |
| 548 return result.release(); | 548 return result.release(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 bool InspectorStyle::verifyPropertyText(const String& propertyText, bool canOmit
Semicolon) | 551 bool InspectorStyle::verifyPropertyText(const String& propertyText, bool canOmit
Semicolon) |
| 552 { | 552 { |
| 553 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); | 553 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); |
| 554 RefPtr<MutableStylePropertySet> tempMutableStyle = MutableStylePropertySet::
create(); | 554 RefPtrWillBeRawPtr<MutableStylePropertySet> tempMutableStyle = MutableStyleP
ropertySet::create(); |
| 555 RuleSourceDataList sourceData; | 555 RuleSourceDataList sourceData; |
| 556 RefPtrWillBeRawPtr<StyleSheetContents> styleSheetContents = StyleSheetConten
ts::create(strictCSSParserContext()); | 556 RefPtrWillBeRawPtr<StyleSheetContents> styleSheetContents = StyleSheetConten
ts::create(strictCSSParserContext()); |
| 557 String declarationText = propertyText + (canOmitSemicolon ? ";" : " ") + bog
usPropertyName + ": none"; | 557 String declarationText = propertyText + (canOmitSemicolon ? ";" : " ") + bog
usPropertyName + ": none"; |
| 558 StyleSheetHandler handler(declarationText, ownerDocument(), styleSheetConten
ts.get(), &sourceData); | 558 StyleSheetHandler handler(declarationText, ownerDocument(), styleSheetConten
ts.get(), &sourceData); |
| 559 createCSSParser(ownerDocument())->parseDeclaration(tempMutableStyle.get(), d
eclarationText, &handler, styleSheetContents.get()); | 559 createCSSParser(ownerDocument())->parseDeclaration(tempMutableStyle.get(), d
eclarationText, &handler, styleSheetContents.get()); |
| 560 Vector<CSSPropertySourceData>& propertyData = sourceData.first()->styleSourc
eData->propertyData; | 560 Vector<CSSPropertySourceData>& propertyData = sourceData.first()->styleSourc
eData->propertyData; |
| 561 unsigned propertyCount = propertyData.size(); | 561 unsigned propertyCount = propertyData.size(); |
| 562 | 562 |
| 563 // At least one property + the bogus property added just above should be pre
sent. | 563 // At least one property + the bogus property added just above should be pre
sent. |
| 564 if (propertyCount < 2) | 564 if (propertyCount < 2) |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 if (!m_element->isStyledElement()) | 1618 if (!m_element->isStyledElement()) |
| 1619 return nullptr; | 1619 return nullptr; |
| 1620 | 1620 |
| 1621 if (m_styleText.isEmpty()) { | 1621 if (m_styleText.isEmpty()) { |
| 1622 RefPtr<CSSRuleSourceData> result = CSSRuleSourceData::create(CSSRuleSour
ceData::STYLE_RULE); | 1622 RefPtr<CSSRuleSourceData> result = CSSRuleSourceData::create(CSSRuleSour
ceData::STYLE_RULE); |
| 1623 result->ruleBodyRange.start = 0; | 1623 result->ruleBodyRange.start = 0; |
| 1624 result->ruleBodyRange.end = 0; | 1624 result->ruleBodyRange.end = 0; |
| 1625 return result.release(); | 1625 return result.release(); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); | 1628 RefPtrWillBeRawPtr<MutableStylePropertySet> tempDeclaration = MutableStylePr
opertySet::create(); |
| 1629 RuleSourceDataList ruleSourceDataResult; | 1629 RuleSourceDataList ruleSourceDataResult; |
| 1630 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); | 1630 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); |
| 1631 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); | 1631 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); |
| 1632 return ruleSourceDataResult.first().release(); | 1632 return ruleSourceDataResult.first().release(); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 } // namespace WebCore | 1635 } // namespace WebCore |
| 1636 | 1636 |
| OLD | NEW |