// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/core/css/check_pseudo_has_argument_context.h" #include "third_party/blink/renderer/core/css/check_pseudo_has_fast_reject_filter.h" #include "third_party/blink/renderer/core/css/css_selector_list.h" #include "third_party/blink/renderer/core/dom/element_traversal.h" namespace blink { namespace { // Iterator class for the compound selectors in the :has() argument selector. // During iteration, this class collects :has() pseudo class argument // hashes for fast rejection and provides current compound information. class CheckPseudoHasArgumentCompoundIterator { … }; CheckPseudoHasArgumentCompoundIterator::CheckPseudoHasArgumentCompoundIterator( const CSSSelector* compound, Vector<unsigned>& pseudo_has_argument_hashes) : … { … } // Collect sibling relationship within a simple selector in ':has()' argument. // // In most cases, a simple selector doesn't have any sibling relationships // in it. (.e.g. 'div', '.item', ':hover') // But it can have implicit sibling relationships if it is a child indexed // pseudo class or a logical combination pseudo class containing a complex // selector. // - :nth-child(3) : An element that matches this selector has relationships // with its siblings since the match result can be affected // by sibling existence. // - :is(.a ~ .b) : An element that matches this selector has relationships // with its siblings since the match result can be affected // by siblings' class values. // - :is(.a ~ .b .c) : An element that matches this selector has relationships // with its ancestors' siblings since the match result can // be affected by ancestors' siblings' class values. // // static void CheckPseudoHasArgumentCompoundIterator:: CollectAffectedByFlagsFromSimpleSelector(const CSSSelector* simple_selector, AffectedByFlags& affected_by) { … } void CheckPseudoHasArgumentCompoundIterator::operator++() { … } } // namespace CheckPseudoHasArgumentContext::CheckPseudoHasArgumentContext( const CSSSelector* selector) : … { … } CheckPseudoHasArgumentTraversalIterator:: CheckPseudoHasArgumentTraversalIterator( Element& has_anchor_element, CheckPseudoHasArgumentContext& context) : … { … } Element* CheckPseudoHasArgumentTraversalIterator::LastWithin(Element* element) { … } void CheckPseudoHasArgumentTraversalIterator::operator++() { … } } // namespace blink