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

Side by Side Diff: third_party/WebKit/Source/core/dom/SelectorQuery.cpp

Issue 2803103002: Add lots more tests for SelectorQuery fast paths. (Closed)
Patch Set: refs woops. Created 3 years, 8 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 | third_party/WebKit/Source/core/dom/SelectorQueryTest.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) 2011, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return; 262 return;
263 } 263 }
264 // Since there exists some ancestor element which has the class name, we 264 // Since there exists some ancestor element which has the class name, we
265 // need to see all children of rootNode. 265 // need to see all children of rootNode.
266 if (AncestorHasClassName(root_node, selector->Value())) 266 if (AncestorHasClassName(root_node, selector->Value()))
267 break; 267 break;
268 268
269 const AtomicString& class_name = selector->Value(); 269 const AtomicString& class_name = selector->Value();
270 Element* element = ElementTraversal::FirstWithin(root_node); 270 Element* element = ElementTraversal::FirstWithin(root_node);
271 while (element) { 271 while (element) {
272 QUERY_STATS_INCREMENT(fast_class);
272 if (HasClassName(*element, class_name)) { 273 if (HasClassName(*element, class_name)) {
273 ExecuteForTraverseRoot<SelectorQueryTrait>(*element, root_node, 274 ExecuteForTraverseRoot<SelectorQueryTrait>(*element, root_node,
274 output); 275 output);
275 element = 276 element =
276 ElementTraversal::NextSkippingChildren(*element, &root_node); 277 ElementTraversal::NextSkippingChildren(*element, &root_node);
277 } else { 278 } else {
278 element = ElementTraversal::Next(*element, &root_node); 279 element = ElementTraversal::Next(*element, &root_node);
279 } 280 }
280 } 281 }
281 return; 282 return;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return entries_ 551 return entries_
551 .insert(selectors, SelectorQuery::Adopt(std::move(selector_list))) 552 .insert(selectors, SelectorQuery::Adopt(std::move(selector_list)))
552 .stored_value->value.get(); 553 .stored_value->value.get();
553 } 554 }
554 555
555 void SelectorQueryCache::Invalidate() { 556 void SelectorQueryCache::Invalidate() {
556 entries_.Clear(); 557 entries_.Clear();
557 } 558 }
558 559
559 } // namespace blink 560 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698