#include "third_party/blink/renderer/core/dom/nth_index_cache.h"
#include "third_party/blink/renderer/core/css/css_selector_list.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
namespace blink {
NthIndexCache::NthIndexCache(Document& document)
: … { … }
NthIndexCache::~NthIndexCache() { … }
void NthIndexCache::Key::Trace(Visitor* visitor) const { … }
unsigned NthIndexCache::Key::GetHash() const { … }
namespace {
const unsigned kCachedSiblingCountLimit = …;
unsigned UncachedNthOfTypeIndex(Element& element, unsigned& sibling_count) { … }
unsigned UncachedNthLastOfTypeIndex(Element& element, unsigned& sibling_count) { … }
}
bool NthIndexCache::MatchesFilter(
Element* element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) { … }
unsigned NthIndexCache::UncachedNthChildIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context,
unsigned& sibling_count) { … }
unsigned NthIndexCache::UncachedNthLastChildIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context,
unsigned& sibling_count) { … }
unsigned NthIndexCache::NthChildIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) { … }
unsigned NthIndexCache::NthLastChildIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) { … }
unsigned NthIndexCache::NthOfTypeIndex(Element& element) { … }
unsigned NthIndexCache::NthLastOfTypeIndex(Element& element) { … }
void NthIndexCache::EnsureCache() { … }
void NthIndexCache::CacheNthIndexDataForParent(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) { … }
void NthIndexCache::CacheNthOfTypeIndexDataForParent(Element& element) { … }
unsigned NthIndexData::NthIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) const { … }
unsigned NthIndexData::NthOfTypeIndex(Element& element) const { … }
unsigned NthIndexData::NthLastIndex(
Element& element,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) const { … }
unsigned NthIndexData::NthLastOfTypeIndex(Element& element) const { … }
NthIndexData::NthIndexData(
ContainerNode& parent,
const CSSSelectorList* filter,
const SelectorChecker* selector_checker,
const SelectorChecker::SelectorCheckingContext* context) { … }
NthIndexData::NthIndexData(ContainerNode& parent, const QualifiedName& type) { … }
void NthIndexData::Trace(Visitor* visitor) const { … }
}