Commit 2445460b authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Rename NodeListRootType

This CL renames the enum to NodeListSearchRoot to better indicate that
the value refers to where the NodeList begins searching for elements.

Change-Id: I09aa6732fd52cc5a476f2ea42c0fbb3b2a7e92af
Reviewed-on: https://chromium-review.googlesource.com/897883Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534530}
parent 07e96311
......@@ -42,9 +42,9 @@ class CORE_EXPORT LiveNodeList : public NodeList, public LiveNodeListBase {
LiveNodeList(ContainerNode& owner_node,
CollectionType collection_type,
NodeListInvalidationType invalidation_type,
NodeListRootType root_type = NodeListRootType::kNode)
NodeListSearchRoot search_root = NodeListSearchRoot::kOwnerNode)
: LiveNodeListBase(owner_node,
root_type,
search_root,
invalidation_type,
collection_type) {
// Keep this in the child class because |registerNodeList| requires wrapper
......
......@@ -34,22 +34,22 @@
namespace blink {
enum class NodeListRootType {
kNode,
enum class NodeListSearchRoot {
kOwnerNode,
kTreeScope,
};
class CORE_EXPORT LiveNodeListBase : public GarbageCollectedMixin {
public:
LiveNodeListBase(ContainerNode& owner_node,
NodeListRootType root_type,
NodeListSearchRoot search_root,
NodeListInvalidationType invalidation_type,
CollectionType collection_type)
: owner_node_(owner_node),
root_type_(static_cast<unsigned>(root_type)),
search_root_(static_cast<unsigned>(search_root)),
invalidation_type_(invalidation_type),
collection_type_(collection_type) {
DCHECK_EQ(root_type_, static_cast<unsigned>(root_type));
DCHECK_EQ(search_root_, static_cast<unsigned>(search_root));
DCHECK_EQ(invalidation_type_, static_cast<unsigned>(invalidation_type));
DCHECK_EQ(collection_type_, static_cast<unsigned>(collection_type));
}
......@@ -60,7 +60,8 @@ class CORE_EXPORT LiveNodeListBase : public GarbageCollectedMixin {
void DidMoveToDocument(Document& old_document, Document& new_document);
ALWAYS_INLINE bool IsRootedAtTreeScope() const {
return root_type_ == static_cast<unsigned>(NodeListRootType::kTreeScope);
return search_root_ ==
static_cast<unsigned>(NodeListSearchRoot::kTreeScope);
}
ALWAYS_INLINE NodeListInvalidationType InvalidationType() const {
return static_cast<NodeListInvalidationType>(invalidation_type_);
......@@ -81,8 +82,8 @@ class CORE_EXPORT LiveNodeListBase : public GarbageCollectedMixin {
protected:
Document& GetDocument() const { return owner_node_->GetDocument(); }
ALWAYS_INLINE NodeListRootType RootType() const {
return static_cast<NodeListRootType>(root_type_);
ALWAYS_INLINE NodeListSearchRoot SearchRoot() const {
return static_cast<NodeListSearchRoot>(search_root_);
}
template <typename MatchFunc>
......@@ -102,7 +103,7 @@ class CORE_EXPORT LiveNodeListBase : public GarbageCollectedMixin {
private:
Member<ContainerNode> owner_node_; // Cannot be null.
const unsigned root_type_ : 1;
const unsigned search_root_ : 1;
const unsigned invalidation_type_ : 4;
const unsigned collection_type_ : 5;
};
......
......@@ -82,8 +82,9 @@ static bool ShouldTypeOnlyIncludeDirectChildren(CollectionType type) {
return false;
}
static NodeListRootType RootTypeFromCollectionType(const ContainerNode& owner,
CollectionType type) {
static NodeListSearchRoot SearchRootFromCollectionType(
const ContainerNode& owner,
CollectionType type) {
switch (type) {
case kDocImages:
case kDocApplets:
......@@ -109,12 +110,12 @@ static NodeListRootType RootTypeFromCollectionType(const ContainerNode& owner,
case kSelectedOptions:
case kDataListOptions:
case kMapAreas:
return NodeListRootType::kNode;
return NodeListSearchRoot::kOwnerNode;
case kFormControls:
if (IsHTMLFieldSetElement(owner))
return NodeListRootType::kNode;
return NodeListSearchRoot::kOwnerNode;
DCHECK(IsHTMLFormElement(owner));
return NodeListRootType::kTreeScope;
return NodeListSearchRoot::kTreeScope;
case kNameNodeListType:
case kRadioNodeListType:
case kRadioImgNodeListType:
......@@ -122,7 +123,7 @@ static NodeListRootType RootTypeFromCollectionType(const ContainerNode& owner,
break;
}
NOTREACHED();
return NodeListRootType::kNode;
return NodeListSearchRoot::kOwnerNode;
}
static NodeListInvalidationType InvalidationTypeExcludingIdAndNameAttributes(
......@@ -177,7 +178,7 @@ HTMLCollection::HTMLCollection(ContainerNode& owner_node,
CollectionType type,
ItemAfterOverrideType item_after_override_type)
: LiveNodeListBase(owner_node,
RootTypeFromCollectionType(owner_node, type),
SearchRootFromCollectionType(owner_node, type),
InvalidationTypeExcludingIdAndNameAttributes(type),
type),
overrides_item_after_(item_after_override_type == kOverridesItemAfter),
......
......@@ -37,7 +37,7 @@ LabelsNodeList::LabelsNodeList(ContainerNode& owner_node)
: LiveNodeList(owner_node,
kLabelsNodeListType,
kInvalidateForFormControls,
NodeListRootType::kTreeScope) {}
NodeListSearchRoot::kTreeScope) {}
LabelsNodeList::~LabelsNodeList() = default;
......
......@@ -44,8 +44,9 @@ RadioNodeList::RadioNodeList(ContainerNode& root_node,
: LiveNodeList(root_node,
type,
kInvalidateForFormControls,
IsHTMLFormElement(root_node) ? NodeListRootType::kTreeScope
: NodeListRootType::kNode),
IsHTMLFormElement(root_node)
? NodeListSearchRoot::kTreeScope
: NodeListSearchRoot::kOwnerNode),
name_(name) {}
RadioNodeList::~RadioNodeList() = default;
......
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