88#include " nsContentUtils.h"
99#include " mozilla/dom/Document.h"
1010#include " mozilla/dom/HTMLSlotElement.h"
11- #include " mozilla/dom/XBLChildrenElement.h"
11+ #ifdef MOZ_XBL
12+ # include " mozilla/dom/XBLChildrenElement.h"
13+ #endif
1214#include " mozilla/dom/ShadowRoot.h"
1315#include " nsIAnonymousContentCreator.h"
1416#include " nsIFrame.h"
@@ -46,13 +48,17 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
4648 return mChild ;
4749 }
4850
51+ #ifdef MOZ_XBL
4952 MOZ_ASSERT (mChild ->IsActiveChildrenElement ());
5053 auto * childrenElement = static_cast <XBLChildrenElement*>(mChild );
5154 if (mIndexInInserted < childrenElement->InsertedChildrenLength ()) {
5255 return childrenElement->InsertedChild (mIndexInInserted ++);
5356 }
5457 mIndexInInserted = 0 ;
5558 mChild = mChild ->GetNextSibling ();
59+ #else
60+ MOZ_ASSERT_UNREACHABLE (" This needs to be revisited" );
61+ #endif
5662 } else if (mDefaultChild ) {
5763 // If we're already in default content, check if there are more nodes there
5864 MOZ_ASSERT (mChild );
@@ -88,6 +94,7 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
8894 // content.
8995 while (mChild ) {
9096 if (mChild ->IsActiveChildrenElement ()) {
97+ #ifdef MOZ_XBL
9198 // If the current child being iterated is a content insertion point
9299 // then the iterator needs to return the nodes distributed into
93100 // the content insertion point.
@@ -108,6 +115,9 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
108115 // If we have an insertion point with no assigned nodes and
109116 // no default content, move on to the next node.
110117 mChild = mChild ->GetNextSibling ();
118+ #else
119+ MOZ_ASSERT_UNREACHABLE (" This needs to be revisited" );
120+ #endif
111121 } else {
112122 // mChild is not an insertion point, thus it is the next node to
113123 // return from this iterator.
@@ -134,6 +144,7 @@ void FlattenedChildIterator::Init(bool aIgnoreXBL) {
134144 }
135145 }
136146
147+ #ifdef MOZ_XBL
137148 nsXBLBinding* binding =
138149 mParent ->OwnerDoc ()->BindingManager ()->GetBindingWithContent (mParent );
139150
@@ -142,6 +153,7 @@ void FlattenedChildIterator::Init(bool aIgnoreXBL) {
142153 mParent = binding->GetAnonymousContent ();
143154 mXBLInvolved = Some (true );
144155 }
156+ #endif
145157}
146158
147159bool FlattenedChildIterator::ComputeWhetherXBLIsInvolved () const {
@@ -199,9 +211,13 @@ nsIContent* ExplicitChildIterator::Get() const {
199211 }
200212
201213 if (mIndexInInserted ) {
214+ #ifdef MOZ_XBL
202215 MOZ_ASSERT (mChild ->IsActiveChildrenElement ());
203216 auto * childrenElement = static_cast <XBLChildrenElement*>(mChild );
204217 return childrenElement->InsertedChild (mIndexInInserted - 1 );
218+ #else
219+ MOZ_ASSERT_UNREACHABLE (" This needs to be revisited" );
220+ #endif
205221 }
206222
207223 return mDefaultChild ? mDefaultChild : mChild ;
@@ -224,6 +240,7 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
224240 return mChild ;
225241 }
226242
243+ #ifdef MOZ_XBL
227244 // NB: mIndexInInserted points one past the last returned child so we need
228245 // to look *two* indices back in order to return the previous child.
229246 MOZ_ASSERT (mChild ->IsActiveChildrenElement ());
@@ -232,6 +249,9 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
232249 return childrenElement->InsertedChild (mIndexInInserted - 1 );
233250 }
234251 mChild = mChild ->GetPreviousSibling ();
252+ #else
253+ MOZ_ASSERT_UNREACHABLE (" This needs to be revisited" );
254+ #endif
235255 } else if (mDefaultChild ) {
236256 // If we're already in default content, check if there are more nodes there
237257 mDefaultChild = mDefaultChild ->GetPreviousSibling ();
@@ -264,6 +284,7 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
264284 // content.
265285 while (mChild ) {
266286 if (mChild ->IsActiveChildrenElement ()) {
287+ #ifdef MOZ_XBL
267288 // If the current child being iterated is a content insertion point
268289 // then the iterator needs to return the nodes distributed into
269290 // the content insertion point.
@@ -279,6 +300,9 @@ nsIContent* ExplicitChildIterator::GetPreviousChild() {
279300 }
280301
281302 mChild = mChild ->GetPreviousSibling ();
303+ #else
304+ MOZ_ASSERT_UNREACHABLE (" This needs to be revisited" );
305+ #endif
282306 } else {
283307 // mChild is not an insertion point, thus it is the next node to
284308 // return from this iterator.
0 commit comments