| 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 return true; | 903 return true; |
| 904 } | 904 } |
| 905 | 905 |
| 906 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const | 906 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const |
| 907 { | 907 { |
| 908 if (!m_pageStyleSheet) | 908 if (!m_pageStyleSheet) |
| 909 return 0; | 909 return 0; |
| 910 | 910 |
| 911 ASSERT(!id.isEmpty()); | 911 ASSERT(!id.isEmpty()); |
| 912 ensureFlatRules(); | 912 ensureFlatRules(); |
| 913 return id.ordinal() >= m_flatRules.size() ? 0 : m_flatRules.at(id.ordinal())
; | 913 return id.ordinal() >= m_flatRules.size() ? 0 : m_flatRules.at(id.ordinal())
.get(); |
| 914 | 914 |
| 915 } | 915 } |
| 916 | 916 |
| 917 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody> InspectorStyleSheet::buildObject
ForStyleSheet() | 917 PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody> InspectorStyleSheet::buildObject
ForStyleSheet() |
| 918 { | 918 { |
| 919 CSSStyleSheet* styleSheet = pageStyleSheet(); | 919 CSSStyleSheet* styleSheet = pageStyleSheet(); |
| 920 if (!styleSheet) | 920 if (!styleSheet) |
| 921 return 0; | 921 return 0; |
| 922 | 922 |
| 923 RefPtr<CSSRuleList> cssRuleList = asCSSRuleList(styleSheet); | 923 RefPtr<CSSRuleList> cssRuleList = asCSSRuleList(styleSheet); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle) | 1263 void InspectorStyleSheet::revalidateStyle(CSSStyleDeclaration* pageStyle) |
| 1264 { | 1264 { |
| 1265 if (m_isRevalidating) | 1265 if (m_isRevalidating) |
| 1266 return; | 1266 return; |
| 1267 | 1267 |
| 1268 m_isRevalidating = true; | 1268 m_isRevalidating = true; |
| 1269 ensureFlatRules(); | 1269 ensureFlatRules(); |
| 1270 for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { | 1270 for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { |
| 1271 CSSStyleRule* parsedRule = m_flatRules.at(i); | 1271 CSSStyleRule* parsedRule = m_flatRules.at(i).get(); |
| 1272 if (parsedRule->style() == pageStyle) { | 1272 if (parsedRule->style() == pageStyle) { |
| 1273 if (parsedRule->styleRule()->properties()->asText() != pageStyle->cs
sText()) { | 1273 if (parsedRule->styleRule()->properties()->asText() != pageStyle->cs
sText()) { |
| 1274 // Clear the disabled properties for the invalid style here. | 1274 // Clear the disabled properties for the invalid style here. |
| 1275 m_inspectorStyles.remove(pageStyle); | 1275 m_inspectorStyles.remove(pageStyle); |
| 1276 setStyleText(pageStyle, pageStyle->cssText()); | 1276 setStyleText(pageStyle, pageStyle->cssText()); |
| 1277 } | 1277 } |
| 1278 break; | 1278 break; |
| 1279 } | 1279 } |
| 1280 } | 1280 } |
| 1281 m_isRevalidating = false; | 1281 m_isRevalidating = false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 return true; | 1323 return true; |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > InspectorStyleSheet::
buildArrayForRuleList(CSSRuleList* ruleList) | 1326 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > InspectorStyleSheet::
buildArrayForRuleList(CSSRuleList* ruleList) |
| 1327 { | 1327 { |
| 1328 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > result = TypeBuilder:
:Array<TypeBuilder::CSS::CSSRule>::create(); | 1328 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > result = TypeBuilder:
:Array<TypeBuilder::CSS::CSSRule>::create(); |
| 1329 if (!ruleList) | 1329 if (!ruleList) |
| 1330 return result.release(); | 1330 return result.release(); |
| 1331 | 1331 |
| 1332 RefPtr<CSSRuleList> refRuleList = ruleList; | 1332 RefPtr<CSSRuleList> refRuleList = ruleList; |
| 1333 Vector<CSSStyleRule*> rules; | 1333 CSSStyleRuleVector rules; |
| 1334 collectFlatRules(refRuleList, &rules); | 1334 collectFlatRules(refRuleList, &rules); |
| 1335 | 1335 |
| 1336 for (unsigned i = 0, size = rules.size(); i < size; ++i) | 1336 for (unsigned i = 0, size = rules.size(); i < size; ++i) |
| 1337 result->addItem(buildObjectForRule(rules.at(i))); | 1337 result->addItem(buildObjectForRule(rules.at(i).get())); |
| 1338 | 1338 |
| 1339 return result.release(); | 1339 return result.release(); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 void InspectorStyleSheet::collectFlatRules(PassRefPtr<CSSRuleList> ruleList, Vec
tor<CSSStyleRule*>* result) | 1342 void InspectorStyleSheet::collectFlatRules(PassRefPtr<CSSRuleList> ruleList, CSS
StyleRuleVector* result) |
| 1343 { | 1343 { |
| 1344 if (!ruleList) | 1344 if (!ruleList) |
| 1345 return; | 1345 return; |
| 1346 | 1346 |
| 1347 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) { | 1347 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) { |
| 1348 CSSRule* rule = ruleList->item(i); | 1348 CSSRule* rule = ruleList->item(i); |
| 1349 CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(rule); | 1349 CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(rule); |
| 1350 if (styleRule) | 1350 if (styleRule) |
| 1351 result->append(styleRule); | 1351 result->append(styleRule); |
| 1352 else { | 1352 else { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); | 1463 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); |
| 1464 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, result, m_element->document()->elementSheet()->contents()); | 1464 createCSSParser(m_element->document())->parseDeclaration(tempDeclaration.get
(), m_styleText, result, m_element->document()->elementSheet()->contents()); |
| 1465 return true; | 1465 return true; |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 } // namespace WebCore | 1468 } // namespace WebCore |
| 1469 | 1469 |
| 1470 #endif // ENABLE(INSPECTOR) | 1470 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |