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

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

Issue 133643006: Revert "Revert "Implement Element.matches(selectors)"" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.idl ('k') | 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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 continue; 1600 continue;
1601 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create(); 1601 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create();
1602 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1602 const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
1603 long index = 0; 1603 long index = 0;
1604 PseudoId elementPseudoId = element->pseudoId(); 1604 PseudoId elementPseudoId = element->pseudoId();
1605 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) { 1605 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) {
1606 const CSSSelector* firstTagHistorySelector = selector; 1606 const CSSSelector* firstTagHistorySelector = selector;
1607 bool matched = false; 1607 bool matched = false;
1608 if (elementPseudoId) 1608 if (elementPseudoId)
1609 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|. 1609 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|.
1610 matched |= element->webkitMatchesSelector(firstTagHistorySelector->s electorText(), IGNORE_EXCEPTION); 1610 matched |= element->matches(firstTagHistorySelector->selectorText(), IGNORE_EXCEPTION);
1611 if (matched) 1611 if (matched)
1612 matchingSelectors->addItem(index); 1612 matchingSelectors->addItem(index);
1613 ++index; 1613 ++index;
1614 } 1614 }
1615 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create() 1615 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create()
1616 .setRule(ruleObject.release()) 1616 .setRule(ruleObject.release())
1617 .setMatchingSelectors(matchingSelectors.release()); 1617 .setMatchingSelectors(matchingSelectors.release());
1618 result->addItem(match); 1618 result->addItem(match);
1619 } 1619 }
1620 1620
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 documentsToChange.add(element->ownerDocument()); 1754 documentsToChange.add(element->ownerDocument());
1755 } 1755 }
1756 1756
1757 m_nodeIdToForcedPseudoState.clear(); 1757 m_nodeIdToForcedPseudoState.clear();
1758 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1758 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1759 (*it)->setNeedsStyleRecalc(); 1759 (*it)->setNeedsStyleRecalc();
1760 } 1760 }
1761 1761
1762 } // namespace WebCore 1762 } // namespace WebCore
1763 1763
OLDNEW
« no previous file with comments | « Source/core/dom/Element.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698