1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* State that is passed down to UnbindToTree. */
9 #ifndef mozilla_dom_UnbindContext_h__
10 #define mozilla_dom_UnbindContext_h__
12 #include "mozilla/Attributes.h"
15 namespace mozilla::dom
{
17 struct MOZ_STACK_CLASS UnbindContext final
{
18 // The root of the subtree being unbound.
19 nsINode
& Root() const { return mRoot
; }
20 // Whether we're the root of the subtree being unbound.
21 bool IsUnbindRoot(const nsINode
* aNode
) const { return &mRoot
== aNode
; }
22 // The parent node of the subtree we're unbinding from.
23 nsINode
* GetOriginalSubtreeParent() const { return mOriginalParent
; }
25 explicit UnbindContext(nsINode
& aRoot
)
26 : mRoot(aRoot
), mOriginalParent(aRoot
.GetParentNode()) {}
30 nsINode
* const mOriginalParent
;
33 } // namespace mozilla::dom