// Copyright 2018 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_STYLE_TRAVERSAL_ROOT_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_TRAVERSAL_ROOT_H_ #include "base/dcheck_is_on.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/container_node.h" namespace blink { // Class used to represent a common ancestor for all dirty nodes in a DOM tree. // Subclasses implement the various types of dirtiness for style recalc, style // invalidation, and layout tree rebuild. The common ancestor is used as a // starting point for traversal to avoid unnecessary DOM tree traversal. // // The first dirty node is stored as a single root. When a second node is // added with a common child-dirty ancestor which is not dirty, we store that // as a common root. Any subsequent dirty nodes added whose closest child-dirty // ancestor is not itself dirty, or is the current root, will cause us to fall // back to use the document as the root node. In order to find a lowest common // ancestor we would have had to traverse up the ancestor chain to see if we are // below the current common root or not. // // Note that when the common ancestor candidate passed into Update is itself // dirty, we know that we are currently below the current root node and don't // have to modify it. class CORE_EXPORT StyleTraversalRoot { … }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_TRAVERSAL_ROOT_H_