1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_INLINE_FRAGMENT_TRAVERSAL_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_INLINE_FRAGMENT_TRAVERSAL_H_ 7 8 #include "third_party/blink/renderer/core/core_export.h" 9 #include "third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h" 10 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" 11 #include "third_party/blink/renderer/platform/wtf/vector.h" 12 13 namespace blink { 14 15 class NGPhysicalContainerFragment; 16 17 // Utility class for traversing the physical fragment tree. 18 class CORE_EXPORT NGInlineFragmentTraversal { 19 STATIC_ONLY(NGInlineFragmentTraversal); 20 21 public: 22 // Returns list of descendants in preorder. Offsets are relative to 23 // specified fragment. 24 static Vector<NGPhysicalFragmentWithOffset> DescendantsOf( 25 const NGPhysicalContainerFragment&); 26 27 // Returns list of inline fragments produced from the specified LayoutObject. 28 // The search is restricted in the subtree of |container|. 29 // Note: When |target| is a LayoutInline, some/all of its own box fragments 30 // may be absent from the fragment tree, in which case the nearest box/text 31 // descendant fragments are returned. 32 // Note 2: Most callers should use the enclosing block flow fragment of 33 // |target| as |container|. The only exception is 34 // LayoutInline::HitTestCulledInline(). 35 // TODO(xiaochengh): As |container| is redundant in most cases, split this 36 // function into two variants that takes/omits |container|. 37 static Vector<NGPhysicalFragmentWithOffset> SelfFragmentsOf( 38 const NGPhysicalContainerFragment& container, 39 const LayoutObject* target); 40 }; 41 42 } // namespace blink 43 44 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_NG_INLINE_FRAGMENT_TRAVERSAL_H_ 45