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

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

Issue 149513011: Pass around CSSSelector by reference instead of pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/web/WebSelector.cpp » ('j') | 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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectors; 1240 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectors;
1241 1241
1242 // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{'). 1242 // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{').
1243 String selectorText = rule->selectorText(); 1243 String selectorText = rule->selectorText();
1244 1244
1245 if (sourceData) 1245 if (sourceData)
1246 selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->te xt()); 1246 selectors = selectorsFromSource(sourceData.get(), m_parsedStyleSheet->te xt());
1247 else { 1247 else {
1248 selectors = TypeBuilder::Array<TypeBuilder::CSS::Selector>::create(); 1248 selectors = TypeBuilder::Array<TypeBuilder::CSS::Selector>::create();
1249 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1249 const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
1250 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) 1250 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(*selector))
1251 selectors->addItem(TypeBuilder::CSS::Selector::create().setValue(sel ector->selectorText()).release()); 1251 selectors->addItem(TypeBuilder::CSS::Selector::create().setValue(sel ector->selectorText()).release());
1252 } 1252 }
1253 RefPtr<TypeBuilder::CSS::SelectorList> result = TypeBuilder::CSS::SelectorLi st::create() 1253 RefPtr<TypeBuilder::CSS::SelectorList> result = TypeBuilder::CSS::SelectorLi st::create()
1254 .setSelectors(selectors) 1254 .setSelectors(selectors)
1255 .setText(selectorText) 1255 .setText(selectorText)
1256 .release(); 1256 .release();
1257 return result.release(); 1257 return result.release();
1258 } 1258 }
1259 1259
1260 PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS SStyleRule* rule, PassRefPtr<Array<TypeBuilder::CSS::CSSMedia> > mediaStack) 1260 PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS SStyleRule* rule, PassRefPtr<Array<TypeBuilder::CSS::CSSMedia> > mediaStack)
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1796
1797 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate(); 1797 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c reate();
1798 RuleSourceDataList ruleSourceDataResult; 1798 RuleSourceDataList ruleSourceDataResult;
1799 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult); 1799 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet()->contents(), &ruleSourceDataResult);
1800 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents()); 1800 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge t(), m_styleText, &handler, m_element->document().elementSheet()->contents());
1801 return ruleSourceDataResult.first().release(); 1801 return ruleSourceDataResult.first().release();
1802 } 1802 }
1803 1803
1804 } // namespace WebCore 1804 } // namespace WebCore
1805 1805
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/web/WebSelector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698