Commit c43e58a8 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Make GetReattachParent a member of Node.

We will need it outside of node.cc for layout tree rebuild root.

Bug: 868810
Change-Id: If428d5c1f954686c70c35631718c5fa270c8971b
Reviewed-on: https://chromium-review.googlesource.com/1217422Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590223}
parent 3e9b07c4
...@@ -872,27 +872,27 @@ void Node::MarkAncestorsWithChildNeedsStyleRecalc() { ...@@ -872,27 +872,27 @@ void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
GetDocument().ScheduleLayoutTreeUpdateIfNeeded(); GetDocument().ScheduleLayoutTreeUpdateIfNeeded();
} }
static ContainerNode* GetReattachParent(Node& node) { ContainerNode* Node::GetReattachParent() const {
if (node.IsPseudoElement()) if (IsPseudoElement())
return node.ParentOrShadowHostNode(); return ParentOrShadowHostNode();
if (node.IsChildOfV1ShadowHost()) { if (IsChildOfV1ShadowHost()) {
if (HTMLSlotElement* slot = node.AssignedSlot()) if (HTMLSlotElement* slot = AssignedSlot())
return slot; return slot;
} }
if (node.IsInV0ShadowTree() || node.IsChildOfV0ShadowHost()) { if (IsInV0ShadowTree() || IsChildOfV0ShadowHost()) {
if (ShadowRootWhereNodeCanBeDistributedForV0(node)) { if (ShadowRootWhereNodeCanBeDistributedForV0(*this)) {
if (V0InsertionPoint* insertion_point = if (V0InsertionPoint* insertion_point =
const_cast<V0InsertionPoint*>(ResolveReprojection(&node))) { const_cast<V0InsertionPoint*>(ResolveReprojection(this))) {
return insertion_point; return insertion_point;
} }
} }
} }
return node.ParentOrShadowHostNode(); return ParentOrShadowHostNode();
} }
void Node::MarkAncestorsWithChildNeedsReattachLayoutTree() { void Node::MarkAncestorsWithChildNeedsReattachLayoutTree() {
for (ContainerNode* p = GetReattachParent(*this); for (ContainerNode* p = GetReattachParent();
p && !p->ChildNeedsReattachLayoutTree(); p = GetReattachParent(*p)) p && !p->ChildNeedsReattachLayoutTree(); p = p->GetReattachParent())
p->SetChildNeedsReattachLayoutTree(); p->SetChildNeedsReattachLayoutTree();
} }
......
...@@ -600,6 +600,7 @@ class CORE_EXPORT Node : public EventTarget { ...@@ -600,6 +600,7 @@ class CORE_EXPORT Node : public EventTarget {
bool IsChildOfV1ShadowHost() const; bool IsChildOfV1ShadowHost() const;
bool IsChildOfV0ShadowHost() const; bool IsChildOfV0ShadowHost() const;
ShadowRoot* V1ShadowRootOfParent() const; ShadowRoot* V1ShadowRootOfParent() const;
ContainerNode* GetReattachParent() const;
bool IsDocumentTypeNode() const { return getNodeType() == kDocumentTypeNode; } bool IsDocumentTypeNode() const { return getNodeType() == kDocumentTypeNode; }
virtual bool ChildTypeAllowed(NodeType) const { return false; } virtual bool ChildTypeAllowed(NodeType) const { return false; }
......
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