Commit 3418a116 authored by Hayato Ito's avatar Hayato Ito Committed by Commit Bot

Use UpdateDistributionForFlatTreeTraversal in selector_query

This is a follow-up CL for http://crrev.com/c/1025155.
SelectorQuery updates distribution only for traversing a flat tree.

Bug: 776656
Change-Id: I07312acc73abdc593a7ef81f04761bacc3d978d0
Reviewed-on: https://chromium-review.googlesource.com/1029560Reviewed-by: default avatarTakayoshi Kochi <kochi@chromium.org>
Commit-Queue: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553938}
parent abe7bb09
...@@ -111,7 +111,7 @@ inline bool SelectorMatches(const CSSSelector& selector, ...@@ -111,7 +111,7 @@ inline bool SelectorMatches(const CSSSelector& selector,
bool SelectorQuery::Matches(Element& target_element) const { bool SelectorQuery::Matches(Element& target_element) const {
QUERY_STATS_RESET(); QUERY_STATS_RESET();
if (needs_updated_distribution_) if (needs_updated_distribution_)
target_element.UpdateDistributionForUnknownReasons(); target_element.UpdateDistributionForFlatTreeTraversal();
return SelectorListMatches(target_element, target_element); return SelectorListMatches(target_element, target_element);
} }
...@@ -120,7 +120,7 @@ Element* SelectorQuery::Closest(Element& target_element) const { ...@@ -120,7 +120,7 @@ Element* SelectorQuery::Closest(Element& target_element) const {
if (selectors_.IsEmpty()) if (selectors_.IsEmpty())
return nullptr; return nullptr;
if (needs_updated_distribution_) if (needs_updated_distribution_)
target_element.UpdateDistributionForUnknownReasons(); target_element.UpdateDistributionForFlatTreeTraversal();
for (Element* current_element = &target_element; current_element; for (Element* current_element = &target_element; current_element;
current_element = current_element->parentElement()) { current_element = current_element->parentElement()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment