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

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

Issue 106983004: Implement Element.matches(selectors) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix test Created 7 years 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 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 continue; 1615 continue;
1616 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create(); 1616 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array< int>::create();
1617 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1617 const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
1618 long index = 0; 1618 long index = 0;
1619 PseudoId elementPseudoId = element->pseudoId(); 1619 PseudoId elementPseudoId = element->pseudoId();
1620 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) { 1620 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(selector)) {
1621 const CSSSelector* firstTagHistorySelector = selector; 1621 const CSSSelector* firstTagHistorySelector = selector;
1622 bool matched = false; 1622 bool matched = false;
1623 if (elementPseudoId) 1623 if (elementPseudoId)
1624 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|. 1624 matched = matchesPseudoElement(selector, elementPseudoId); // Mo difies |selector|.
1625 matched |= element->webkitMatchesSelector(firstTagHistorySelector->s electorText(), IGNORE_EXCEPTION); 1625 matched |= element->matches(firstTagHistorySelector->selectorText(), IGNORE_EXCEPTION);
1626 if (matched) 1626 if (matched)
1627 matchingSelectors->addItem(index); 1627 matchingSelectors->addItem(index);
1628 ++index; 1628 ++index;
1629 } 1629 }
1630 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create() 1630 RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch: :create()
1631 .setRule(ruleObject.release()) 1631 .setRule(ruleObject.release())
1632 .setMatchingSelectors(matchingSelectors.release()); 1632 .setMatchingSelectors(matchingSelectors.release());
1633 result->addItem(match); 1633 result->addItem(match);
1634 } 1634 }
1635 1635
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 documentsToChange.add(element->ownerDocument()); 1769 documentsToChange.add(element->ownerDocument());
1770 } 1770 }
1771 1771
1772 m_nodeIdToForcedPseudoState.clear(); 1772 m_nodeIdToForcedPseudoState.clear();
1773 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it) 1773 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu mentsToChange.end(); it != end; ++it)
1774 (*it)->setNeedsStyleRecalc(); 1774 (*it)->setNeedsStyleRecalc();
1775 } 1775 }
1776 1776
1777 } // namespace WebCore 1777 } // namespace WebCore
1778 1778
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