| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 if (!rule) { | 837 if (!rule) { |
| 838 ec = NOT_FOUND_ERR; | 838 ec = NOT_FOUND_ERR; |
| 839 return false; | 839 return false; |
| 840 } | 840 } |
| 841 CSSStyleSheet* styleSheet = rule->parentStyleSheet(); | 841 CSSStyleSheet* styleSheet = rule->parentStyleSheet(); |
| 842 if (!styleSheet || !ensureParsedDataReady()) { | 842 if (!styleSheet || !ensureParsedDataReady()) { |
| 843 ec = NOT_FOUND_ERR; | 843 ec = NOT_FOUND_ERR; |
| 844 return false; | 844 return false; |
| 845 } | 845 } |
| 846 | 846 |
| 847 styleSheet->deleteRule(id.ordinal(), ec); | |
| 848 if (ec) | |
| 849 return false; | |
| 850 | |
| 851 RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style()); | 847 RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style()); |
| 852 if (!sourceData) { | 848 if (!sourceData) { |
| 853 ec = NOT_FOUND_ERR; | 849 ec = NOT_FOUND_ERR; |
| 854 return false; | 850 return false; |
| 855 } | 851 } |
| 856 | 852 |
| 853 styleSheet->deleteRule(id.ordinal(), ec); |
| 854 // |rule| MAY NOT be addressed after this line! |
| 855 |
| 856 if (ec) |
| 857 return false; |
| 858 |
| 857 String sheetText = m_parsedStyleSheet->text(); | 859 String sheetText = m_parsedStyleSheet->text(); |
| 858 sheetText.remove(sourceData->ruleHeaderRange.start, sourceData->ruleBodyRang
e.end - sourceData->ruleHeaderRange.start + 1); | 860 sheetText.remove(sourceData->ruleHeaderRange.start, sourceData->ruleBodyRang
e.end - sourceData->ruleHeaderRange.start + 1); |
| 859 m_parsedStyleSheet->setText(sheetText); | 861 m_parsedStyleSheet->setText(sheetText); |
| 860 fireStyleSheetChanged(); | 862 fireStyleSheetChanged(); |
| 861 return true; | 863 return true; |
| 862 } | 864 } |
| 863 | 865 |
| 864 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const | 866 CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const |
| 865 { | 867 { |
| 866 if (!m_pageStyleSheet) | 868 if (!m_pageStyleSheet) |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 | 1387 |
| 1386 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); | 1388 RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); |
| 1387 CSSParser p(m_element->document()); | 1389 CSSParser p(m_element->document()); |
| 1388 p.parseDeclaration(tempDeclaration.get(), m_styleText, result, m_element->do
cument()->elementSheet()->contents()); | 1390 p.parseDeclaration(tempDeclaration.get(), m_styleText, result, m_element->do
cument()->elementSheet()->contents()); |
| 1389 return true; | 1391 return true; |
| 1390 } | 1392 } |
| 1391 | 1393 |
| 1392 } // namespace WebCore | 1394 } // namespace WebCore |
| 1393 | 1395 |
| 1394 #endif // ENABLE(INSPECTOR) | 1396 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |