// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_SELECTOR_FILTER_PARENT_SCOPE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_SELECTOR_FILTER_PARENT_SCOPE_H_ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/selector_filter.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" namespace blink { // Maintains the parent element stack (and bloom filter) inside RecalcStyle. // SelectorFilterParentScope for the parent element is added to the stack before // recalculating style for its children. The bloom filter is populated lazily by // PushParentIfNeeded(). class CORE_EXPORT SelectorFilterParentScope { … }; // When starting the style recalc, we push an object of this class onto the // stack to establish a root scope for the SelectorFilter for a document to // make the style recalc re-entrant. If we do a style recalc for a document // inside a style recalc for another document (which can happen when // synchronously loading an svg generated content image), the previous_ pointer // for the root scope of the inner recalc will point to the current scope of the // outer one, but the root scope will isolate the inner from trying to push any // parent stacks in the outer document. class CORE_EXPORT SelectorFilterRootScope final : private SelectorFilterParentScope { … }; inline SelectorFilterParentScope::SelectorFilterParentScope( Element* parent, ScopeType scope_type) : … { … } inline SelectorFilterParentScope::~SelectorFilterParentScope() { … } inline void SelectorFilterParentScope::EnsureParentStackIsPushed() { … } inline void SelectorFilterParentScope::PushParentIfNeeded() { … } } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_RESOLVER_SELECTOR_FILTER_PARENT_SCOPE_H_