Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Side by Side Diff: Source/WebCore/inspector/InspectorStyleSheet.cpp

Issue 11348012: Merge 132462 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698