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

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

Issue 1213233016: Add missing initialization of RawPtr<> local var in r197835. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 exceptionState.throwDOMException(SyntaxError, "The rule '" + ruleText + "' could not be added in media rule."); 1055 exceptionState.throwDOMException(SyntaxError, "The rule '" + ruleText + "' could not be added in media rule.");
1056 return nullptr; 1056 return nullptr;
1057 } 1057 }
1058 return styleRule; 1058 return styleRule;
1059 } 1059 }
1060 1060
1061 CSSStyleRule* InspectorStyleSheet::insertCSSOMRuleBySourceRange(const SourceRang e& sourceRange, const String& ruleText, ExceptionState& exceptionState) 1061 CSSStyleRule* InspectorStyleSheet::insertCSSOMRuleBySourceRange(const SourceRang e& sourceRange, const String& ruleText, ExceptionState& exceptionState)
1062 { 1062 {
1063 ASSERT(m_sourceData); 1063 ASSERT(m_sourceData);
1064 1064
1065 RefPtrWillBeRawPtr<CSSRuleSourceData> containingRuleSourceData; 1065 RefPtrWillBeRawPtr<CSSRuleSourceData> containingRuleSourceData = nullptr;
1066 for (size_t i = 0; i < m_sourceData->size(); ++i) { 1066 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1067 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 1067 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
1068 if (ruleSourceData->ruleHeaderRange.start < sourceRange.start && sourceR ange.start < ruleSourceData->ruleBodyRange.start) { 1068 if (ruleSourceData->ruleHeaderRange.start < sourceRange.start && sourceR ange.start < ruleSourceData->ruleBodyRange.start) {
1069 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule inside rule selector."); 1069 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule inside rule selector.");
1070 return nullptr; 1070 return nullptr;
1071 } 1071 }
1072 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start) 1072 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start)
1073 continue; 1073 continue;
1074 if (!containingRuleSourceData || containingRuleSourceData->ruleBodyRange .length() > ruleSourceData->ruleBodyRange.length()) 1074 if (!containingRuleSourceData || containingRuleSourceData->ruleBodyRange .length() > ruleSourceData->ruleBodyRange.length())
1075 containingRuleSourceData = ruleSourceData; 1075 containingRuleSourceData = ruleSourceData;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 *newRange = SourceRange(range.start, range.start + text.length()); 1189 *newRange = SourceRange(range.start, range.start + text.length());
1190 innerSetText(sheetText, true); 1190 innerSetText(sheetText, true);
1191 } 1191 }
1192 1192
1193 void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod ified) 1193 void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod ified)
1194 { 1194 {
1195 OwnPtrWillBeRawPtr<RuleSourceDataList> ruleTree = adoptPtrWillBeNoop(new Rul eSourceDataList()); 1195 OwnPtrWillBeRawPtr<RuleSourceDataList> ruleTree = adoptPtrWillBeNoop(new Rul eSourceDataList());
1196 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(m_pageStyleSheet->contents()->parserContext()); 1196 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(m_pageStyleSheet->contents()->parserContext());
1197 StyleSheetHandler handler(text, m_pageStyleSheet->ownerDocument(), ruleTree. get()); 1197 StyleSheetHandler handler(text, m_pageStyleSheet->ownerDocument(), ruleTree. get());
1198 CSSParser::parseSheetForInspector(m_pageStyleSheet->contents()->parserContex t(), styleSheet.get(), text, handler); 1198 CSSParser::parseSheetForInspector(m_pageStyleSheet->contents()->parserContex t(), styleSheet.get(), text, handler);
1199 RefPtrWillBeRawPtr<CSSStyleSheet> sourceDataSheet; 1199 RefPtrWillBeRawPtr<CSSStyleSheet> sourceDataSheet = nullptr;
1200 if (toCSSImportRule(m_pageStyleSheet->ownerRule())) 1200 if (toCSSImportRule(m_pageStyleSheet->ownerRule()))
1201 sourceDataSheet = CSSStyleSheet::create(styleSheet, toCSSImportRule(m_pa geStyleSheet->ownerRule())); 1201 sourceDataSheet = CSSStyleSheet::create(styleSheet, toCSSImportRule(m_pa geStyleSheet->ownerRule()));
1202 else 1202 else
1203 sourceDataSheet = CSSStyleSheet::create(styleSheet, m_pageStyleSheet->ow nerNode()); 1203 sourceDataSheet = CSSStyleSheet::create(styleSheet, m_pageStyleSheet->ow nerNode());
1204 1204
1205 m_parsedFlatRules.clear(); 1205 m_parsedFlatRules.clear();
1206 collectFlatRules(sourceDataSheet.get(), &m_parsedFlatRules); 1206 collectFlatRules(sourceDataSheet.get(), &m_parsedFlatRules);
1207 1207
1208 m_sourceData = adoptPtrWillBeNoop(new RuleSourceDataList()); 1208 m_sourceData = adoptPtrWillBeNoop(new RuleSourceDataList());
1209 flattenSourceData(ruleTree.get(), m_sourceData.get()); 1209 flattenSourceData(ruleTree.get(), m_sourceData.get());
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 bool InspectorStyleSheetForInlineStyle::getText(String* result) 1634 bool InspectorStyleSheetForInlineStyle::getText(String* result)
1635 { 1635 {
1636 *result = elementStyleText(); 1636 *result = elementStyleText();
1637 return true; 1637 return true;
1638 } 1638 }
1639 1639
1640 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheetForInlineStyle::inspec torStyle(RefPtrWillBeRawPtr<CSSStyleDeclaration> style) 1640 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheetForInlineStyle::inspec torStyle(RefPtrWillBeRawPtr<CSSStyleDeclaration> style)
1641 { 1641 {
1642 if (!m_inspectorStyle) { 1642 if (!m_inspectorStyle) {
1643 const String& text = elementStyleText(); 1643 const String& text = elementStyleText();
1644 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData; 1644 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = nullptr;
1645 if (text.isEmpty()) { 1645 if (text.isEmpty()) {
1646 ruleSourceData = CSSRuleSourceData::create(StyleRule::Style); 1646 ruleSourceData = CSSRuleSourceData::create(StyleRule::Style);
1647 ruleSourceData->ruleBodyRange.start = 0; 1647 ruleSourceData->ruleBodyRange.start = 0;
1648 ruleSourceData->ruleBodyRange.end = 0; 1648 ruleSourceData->ruleBodyRange.end = 0;
1649 } else { 1649 } else {
1650 RuleSourceDataList ruleSourceDataResult; 1650 RuleSourceDataList ruleSourceDataResult;
1651 StyleSheetHandler handler(text, &m_element->document(), &ruleSourceD ataResult); 1651 StyleSheetHandler handler(text, &m_element->document(), &ruleSourceD ataResult);
1652 CSSParser::parseDeclarationListForInspector(parserContextForDocument (&m_element->document()), text, handler); 1652 CSSParser::parseDeclarationListForInspector(parserContextForDocument (&m_element->document()), text, handler);
1653 ruleSourceData = ruleSourceDataResult.first().release(); 1653 ruleSourceData = ruleSourceDataResult.first().release();
1654 } 1654 }
(...skipping 13 matching lines...) Expand all
1668 } 1668 }
1669 1669
1670 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) 1670 DEFINE_TRACE(InspectorStyleSheetForInlineStyle)
1671 { 1671 {
1672 visitor->trace(m_element); 1672 visitor->trace(m_element);
1673 visitor->trace(m_inspectorStyle); 1673 visitor->trace(m_inspectorStyle);
1674 InspectorStyleSheetBase::trace(visitor); 1674 InspectorStyleSheetBase::trace(visitor);
1675 } 1675 }
1676 1676
1677 } // namespace blink 1677 } // namespace blink
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