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

Side by Side Diff: Source/core/inspector/InspectorCSSAgent.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
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 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1611
1612 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) { 1612 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
1613 CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i)); 1613 CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i));
1614 RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule); 1614 RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule);
1615 if (!ruleObject) 1615 if (!ruleObject)
1616 continue; 1616 continue;
1617 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create(); 1617 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create();
1618 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1618 const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
1619 long index = 0; 1619 long index = 0;
1620 PseudoId elementPseudoId = element->pseudoId(); 1620 PseudoId elementPseudoId = element->pseudoId();
1621 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) { 1621 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(*selector)) {
1622 const CSSSelector* firstTagHistorySelector = selector; 1622 const CSSSelector* firstTagHistorySelector = selector;
1623 bool matched = false; 1623 bool matched = false;
1624 if (elementPseudoId) 1624 if (elementPseudoId)
1625 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|. 1625 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|.
1626 matched |= element->matches(firstTagHistorySelector->selectorText(), IGNORE_EXCEPTION); 1626 matched |= element->matches(firstTagHistorySelector->selectorText(), IGNORE_EXCEPTION);
1627 if (matched) 1627 if (matched)
1628 matchingSelectors->addItem(index); 1628 matchingSelectors->addItem(index);
1629 ++index; 1629 ++index;
1630 } 1630 }
1631 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create() 1631 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create()
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 documentsToChange.add(element->ownerDocument()); 1770 documentsToChange.add(element->ownerDocument());
1771 } 1771 }
1772 1772
1773 m_nodeIdToForcedPseudoState.clear(); 1773 m_nodeIdToForcedPseudoState.clear();
1774 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1774 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1775 (*it)->setNeedsStyleRecalc(); 1775 (*it)->setNeedsStyleRecalc();
1776 } 1776 }
1777 1777
1778 } // namespace WebCore 1778 } // namespace WebCore
1779 1779
OLDNEW
« no previous file with comments | « Source/core/html/shadow/HTMLContentElement.cpp ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698