Commit 4c7bc246 authored by Kyoko Muto's avatar Kyoko Muto Committed by Commit Bot

Merge FlatTreeTraversal and FlatTreeTraversalNG

BUG= 867331

Change-Id: I886542193ed17743d8e10c11ae9c2c5036c8187b
Reviewed-on: https://chromium-review.googlesource.com/1159937
Commit-Queue: Kyoko Muto <kymuto@google.com>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580464}
parent 37427655
......@@ -1729,7 +1729,6 @@ jumbo_source_set("unit_tests") {
"dom/events/event_target_test.cc",
"dom/events/listener_leak_test.cc",
"dom/first_letter_pseudo_element_test.cc",
"dom/flat_tree_traversal_ng_test.cc",
"dom/flat_tree_traversal_test.cc",
"dom/idle_deadline_test.cc",
"dom/layout_tree_builder_traversal_test.cc",
......
......@@ -140,8 +140,6 @@ blink_core_sources("dom") {
"first_letter_pseudo_element.h",
"flat_tree_traversal.cc",
"flat_tree_traversal.h",
"flat_tree_traversal_ng.cc",
"flat_tree_traversal_ng.h",
"frame_request_callback_collection.cc",
"frame_request_callback_collection.h",
"global_event_handlers.h",
......
......@@ -29,7 +29,6 @@
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal_ng.h"
#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h"
#include "third_party/blink/renderer/core/dom/node_traversal.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
......@@ -41,6 +40,8 @@ namespace blink {
class ContainerNode;
class Node;
bool CanBeDistributedToV0InsertionPoint(const Node& node);
// Flat tree version of |NodeTraversal|.
//
// None of member functions takes a |ShadowRoot| or an active insertion point,
......@@ -98,8 +99,6 @@ class CORE_EXPORT FlatTreeTraversal {
static bool IsDescendantOf(const Node& /*node*/, const Node& other);
static bool Contains(const ContainerNode& container, const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::Contains(container, node);
AssertPrecondition(container);
AssertPrecondition(node);
return container == node || IsDescendantOf(node, container);
......@@ -194,8 +193,6 @@ class CORE_EXPORT FlatTreeTraversal {
inline ContainerNode* FlatTreeTraversal::Parent(
const Node& node,
ParentTraversalDetails* details) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::Parent(node, details);
AssertPrecondition(node);
ContainerNode* result = TraverseParent(node, details);
AssertPostcondition(result);
......@@ -203,15 +200,11 @@ inline ContainerNode* FlatTreeTraversal::Parent(
}
inline Element* FlatTreeTraversal::ParentElement(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::ParentElement(node);
ContainerNode* parent = FlatTreeTraversal::Parent(node);
return parent && parent->IsElementNode() ? ToElement(parent) : nullptr;
}
inline Node* FlatTreeTraversal::NextSibling(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::NextSibling(node);
AssertPrecondition(node);
Node* result = TraverseSiblings(node, kTraversalDirectionForward);
AssertPostcondition(result);
......@@ -219,8 +212,6 @@ inline Node* FlatTreeTraversal::NextSibling(const Node& node) {
}
inline Node* FlatTreeTraversal::PreviousSibling(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::PreviousSibling(node);
AssertPrecondition(node);
Node* result = TraverseSiblings(node, kTraversalDirectionBackward);
AssertPostcondition(result);
......@@ -228,8 +219,6 @@ inline Node* FlatTreeTraversal::PreviousSibling(const Node& node) {
}
inline Node* FlatTreeTraversal::Next(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::Next(node);
AssertPrecondition(node);
Node* result = TraverseNext(node);
AssertPostcondition(result);
......@@ -238,8 +227,6 @@ inline Node* FlatTreeTraversal::Next(const Node& node) {
inline Node* FlatTreeTraversal::Next(const Node& node,
const Node* stay_within) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::Next(node, stay_within);
AssertPrecondition(node);
Node* result = TraverseNext(node, stay_within);
AssertPostcondition(result);
......@@ -248,8 +235,6 @@ inline Node* FlatTreeTraversal::Next(const Node& node,
inline Node* FlatTreeTraversal::NextSkippingChildren(const Node& node,
const Node* stay_within) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::NextSkippingChildren(node, stay_within);
AssertPrecondition(node);
Node* result = TraverseNextSkippingChildren(node, stay_within);
AssertPostcondition(result);
......@@ -286,8 +271,6 @@ inline Node* FlatTreeTraversal::TraverseNextSkippingChildren(
}
inline Node* FlatTreeTraversal::Previous(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::Previous(node);
AssertPrecondition(node);
Node* result = TraversePrevious(node);
AssertPostcondition(result);
......@@ -304,8 +287,6 @@ inline Node* FlatTreeTraversal::TraversePrevious(const Node& node) {
}
inline Node* FlatTreeTraversal::FirstChild(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::FirstChild(node);
AssertPrecondition(node);
Node* result = TraverseChild(node, kTraversalDirectionForward);
AssertPostcondition(result);
......@@ -313,8 +294,6 @@ inline Node* FlatTreeTraversal::FirstChild(const Node& node) {
}
inline Node* FlatTreeTraversal::LastChild(const Node& node) {
if (RuntimeEnabledFeatures::SlotInFlatTreeEnabled())
return FlatTreeTraversalNg::LastChild(node);
AssertPrecondition(node);
Node* result = TraverseLastChild(node);
AssertPostcondition(result);
......@@ -360,4 +339,4 @@ FlatTreeTraversal::InclusiveAncestorsOf(const Node& node) {
} // namespace blink
#endif
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FLAT_TREE_TRAVERSAL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment