bug 1016545 - Provide an iterator that iterates over all children of an element r=bz

This commit is contained in:
Trevor Saunders 2014-07-16 14:41:57 -04:00
parent 8a75f85287
commit 082dd2bdfd
32 changed files with 273 additions and 139 deletions

View File

@ -9,6 +9,7 @@
#include "nsAccessibilityService.h"
#include "DocAccessible.h"
#include "mozilla/dom/ChildIterator.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;
@ -22,13 +23,12 @@ namespace a11y {
struct WalkState
{
WalkState(nsIContent *aContent) :
content(aContent), childIdx(0), prevState(nullptr) {}
WalkState(nsIContent *aContent, uint32_t aFilter) :
content(aContent), prevState(nullptr), iter(aContent, aFilter) {}
nsCOMPtr<nsIContent> content;
nsCOMPtr<nsINodeList> childList;
uint32_t childIdx;
WalkState *prevState;
dom::AllChildrenIterator iter;
};
} // namespace a11y
@ -45,14 +45,13 @@ TreeWalker::
{
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
if (aContent)
mState = new WalkState(aContent);
mChildFilter = mContext->CanHaveAnonChildren() ?
nsIContent::eAllChildren : nsIContent::eAllButXBL;
mChildFilter |= nsIContent::eSkipPlaceholderContent;
if (aContent)
mState = new WalkState(aContent, mChildFilter);
MOZ_COUNT_CTOR(TreeWalker);
}
@ -74,17 +73,7 @@ TreeWalker::NextChildInternal(bool aNoWalkUp)
if (!mState || !mState->content)
return nullptr;
if (!mState->childList)
mState->childList = mState->content->GetChildren(mChildFilter);
uint32_t length = 0;
if (mState->childList)
mState->childList->GetLength(&length);
while (mState->childIdx < length) {
nsIContent* childNode = mState->childList->Item(mState->childIdx);
mState->childIdx++;
while (nsIContent* childNode = mState->iter.GetNextChild()) {
bool isSubtreeHidden = false;
Accessible* accessible = mFlags & eWalkCache ?
mDoc->GetAccessible(childNode) :
@ -95,7 +84,7 @@ TreeWalker::NextChildInternal(bool aNoWalkUp)
return accessible;
// Walk down into subtree to find accessibles.
if (!isSubtreeHidden) {
if (!isSubtreeHidden && childNode->IsElement()) {
PushState(childNode);
accessible = NextChildInternal(true);
if (accessible)
@ -123,14 +112,7 @@ TreeWalker::NextChildInternal(bool aNoWalkUp)
return nullptr;
PushState(parentNode->AsElement());
mState->childList = mState->content->GetChildren(mChildFilter);
length = 0;
if (mState->childList)
mState->childList->GetLength(&length);
while (mState->childIdx < length) {
nsIContent* childNode = mState->childList->Item(mState->childIdx);
mState->childIdx++;
while (nsIContent* childNode = mState->iter.GetNextChild()) {
if (childNode == anchorNode)
return NextChildInternal(false);
}
@ -153,7 +135,7 @@ TreeWalker::PopState()
void
TreeWalker::PushState(nsIContent* aContent)
{
WalkState* nextToLastState = new WalkState(aContent);
WalkState* nextToLastState = new WalkState(aContent, mChildFilter);
nextToLastState->prevState = mState;
mState = nextToLastState;
}

View File

@ -10,6 +10,8 @@
#include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIFrame.h"
namespace mozilla {
namespace dom {
@ -154,11 +156,15 @@ ExplicitChildIterator::GetNextChild()
return mChild;
}
FlattenedChildIterator::FlattenedChildIterator(nsIContent* aParent)
: ExplicitChildIterator(aParent), mXBLInvolved(false)
void
FlattenedChildIterator::Init(bool aIgnoreXBL)
{
if (aIgnoreXBL) {
return;
}
nsXBLBinding* binding =
aParent->OwnerDoc()->BindingManager()->GetBindingWithContent(aParent);
mParent->OwnerDoc()->BindingManager()->GetBindingWithContent(mParent);
if (binding) {
nsIContent* anon = binding->GetAnonymousContent();
@ -171,8 +177,8 @@ FlattenedChildIterator::FlattenedChildIterator(nsIContent* aParent)
// We set mXBLInvolved to true if either:
// - The node we're iterating has a binding with content attached to it.
// - The node is generated XBL content and has an <xbl:children> child.
if (!mXBLInvolved && aParent->GetBindingParent()) {
for (nsIContent* child = aParent->GetFirstChild();
if (!mXBLInvolved && mParent->GetBindingParent()) {
for (nsIContent* child = mParent->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
@ -281,5 +287,63 @@ ExplicitChildIterator::GetPreviousChild()
return mChild;
}
nsIContent*
AllChildrenIterator::GetNextChild()
{
if (mPhase == eNeedBeforeKid) {
mPhase = eNeedExplicitKids;
nsIFrame* frame = mOriginalContent->GetPrimaryFrame();
if (frame) {
nsIFrame* beforeFrame = nsLayoutUtils::GetBeforeFrame(frame);
if (beforeFrame) {
return beforeFrame->GetContent();
}
}
}
if (mPhase == eNeedExplicitKids) {
nsIContent* kid = ExplicitChildIterator::GetNextChild();
if (kid) {
return kid;
}
mPhase = eNeedAnonKids;
}
if (mPhase == eNeedAnonKids) {
if (mAnonKids.IsEmpty()) {
nsIAnonymousContentCreator* ac =
do_QueryFrame(mOriginalContent->GetPrimaryFrame());
if (ac) {
ac->AppendAnonymousContentTo(mAnonKids, mFlags);
}
}
if (!mAnonKids.IsEmpty()) {
nsIContent* nextKid = mAnonKids[0];
mAnonKids.RemoveElementAt(0);
if (mAnonKids.IsEmpty()) {
mPhase = eNeedAfterKid;
}
return nextKid;
}
mPhase = eNeedAfterKid;
}
if (mPhase == eNeedAfterKid) {
mPhase = eDone;
nsIFrame* frame = mOriginalContent->GetPrimaryFrame();
if (frame) {
nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(frame);
if (afterFrame) {
return afterFrame->GetContent();
}
}
}
return nullptr;
}
} // namespace dom
} // namespace mozilla

View File

@ -7,6 +7,8 @@
#ifndef ChildIterator_h
#define ChildIterator_h
#include "nsIContent.h"
/**
* Iterates over the children on a node. If a child is an insertion point,
* iterates over the children inserted there instead, or the default content
@ -107,16 +109,73 @@ protected:
class FlattenedChildIterator : public ExplicitChildIterator
{
public:
FlattenedChildIterator(nsIContent* aParent);
FlattenedChildIterator(nsIContent* aParent)
: ExplicitChildIterator(aParent), mXBLInvolved(false)
{
Init(false);
}
bool XBLInvolved() { return mXBLInvolved; }
private:
protected:
/**
* This constructor is a hack to help AllChildrenIterator which sometimes
* doesn't want to consider XBL.
*/
FlattenedChildIterator(nsIContent* aParent, bool aIgnoreXBL)
: ExplicitChildIterator(aParent), mXBLInvolved(false)
{
Init(aIgnoreXBL);
}
void Init(bool aIgnoreXBL);
// For certain optimizations, nsCSSFrameConstructor needs to know if the
// child list of the element that we're iterating matches its .childNodes.
bool mXBLInvolved;
};
/**
* AllChildrenIterator returns the children of a element including before /
* after content and optionally XBL children. It assumes that no mutation of
* the DOM or frame tree takes place during iteration, and will break horribly
* if that is not true.
*/
class AllChildrenIterator : private FlattenedChildIterator
{
public:
AllChildrenIterator(nsIContent* aNode, uint32_t aFlags) :
FlattenedChildIterator(aNode, (aFlags & nsIContent::eAllButXBL)),
mOriginalContent(aNode), mFlags(aFlags),
mPhase(eNeedBeforeKid) {}
#ifdef DEBUG
~AllChildrenIterator() { MOZ_ASSERT(!mMutationGuard.Mutated(0)); }
#endif
nsIContent* GetNextChild();
private:
enum IteratorPhase
{
eNeedBeforeKid,
eNeedExplicitKids,
eNeedAnonKids,
eNeedAfterKid,
eDone
};
nsIContent* mOriginalContent;
nsTArray<nsIContent*> mAnonKids;
uint32_t mFlags;
IteratorPhase mPhase;
#ifdef DEBUG
// XXX we should really assert there are no frame tree changes as well, but
// there's no easy way to do that.
nsMutationGuard mMutationGuard;
#endif
};
} // namespace dom
} // namespace mozilla

View File

@ -661,48 +661,9 @@ already_AddRefed<nsINodeList>
FragmentOrElement::GetChildren(uint32_t aFilter)
{
nsRefPtr<nsSimpleContentList> list = new nsSimpleContentList(this);
if (!list) {
return nullptr;
}
nsIFrame *frame = GetPrimaryFrame();
// Append :before generated content.
if (frame) {
nsIFrame *beforeFrame = nsLayoutUtils::GetBeforeFrame(frame);
if (beforeFrame) {
list->AppendElement(beforeFrame->GetContent());
}
}
// If XBL is bound to this node then append XBL anonymous content including
// explict content altered by insertion point if we were requested for XBL
// anonymous content, otherwise append explicit content with respect to
// insertion point if any.
if (!(aFilter & eAllButXBL)) {
FlattenedChildIterator iter(this);
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
list->AppendElement(child);
}
} else {
ExplicitChildIterator iter(this);
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
list->AppendElement(child);
}
}
if (frame) {
// Append native anonymous content to the end.
nsIAnonymousContentCreator* creator = do_QueryFrame(frame);
if (creator) {
creator->AppendAnonymousContentTo(*list, aFilter);
}
// Append :after generated content.
nsIFrame *afterFrame = nsLayoutUtils::GetAfterFrame(frame);
if (afterFrame) {
list->AppendElement(afterFrame->GetContent());
}
AllChildrenIterator iter(this, aFilter);
while (nsIContent* kid = iter.GetNextChild()) {
list->AppendElement(kid);
}
return list.forget();

View File

@ -61,6 +61,7 @@ EXPORTS.mozilla += [
EXPORTS.mozilla.dom += [
'Attr.h',
'ChildIterator.h',
'Comment.h',
'DocumentFragment.h',
'DocumentType.h',

View File

@ -83,10 +83,12 @@ nsColorControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsColorControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsColorControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mColorContent);
if (mColorContent) {
aElements.AppendElement(mColorContent);
}
}
nsresult

View File

@ -37,7 +37,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
// nsIFrame

View File

@ -1184,11 +1184,16 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsComboboxControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsComboboxControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mDisplayContent);
aElements.MaybeAppendElement(mButtonContent);
if (mDisplayContent) {
aElements.AppendElement(mDisplayContent);
}
if (mButtonContent) {
aElements.AppendElement(mButtonContent);
}
}
// XXXbz this is a for-now hack. Now that display:inline-block works,

View File

@ -59,7 +59,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) MOZ_OVERRIDE;

View File

@ -150,11 +150,16 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsFileControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsFileControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mBrowse);
aElements.MaybeAppendElement(mTextContent);
if (mBrowse) {
aElements.AppendElement(mBrowse);
}
if (mTextContent) {
aElements.AppendElement(mTextContent);
}
}
NS_QUERYFRAME_HEAD(nsFileControlFrame)

View File

@ -57,7 +57,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
#ifdef ACCESSIBILITY

View File

@ -69,10 +69,12 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements
}
void
nsGfxButtonControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsGfxButtonControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mTextContent);
if (mTextContent) {
aElements.AppendElement(mTextContent);
}
}
// Create the text content used as label for the button.

View File

@ -40,7 +40,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) MOZ_OVERRIDE;

View File

@ -79,10 +79,12 @@ nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsMeterFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsMeterFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mBarDiv);
if (mBarDiv) {
aElements.AppendElement(mBarDiv);
}
}
NS_QUERYFRAME_HEAD(nsMeterFrame)

View File

@ -42,7 +42,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,

View File

@ -676,11 +676,13 @@ nsNumberControlFrame::ShouldUseNativeStyleForSpinner() const
}
void
nsNumberControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsNumberControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
// Only one direct anonymous child:
aElements.MaybeAppendElement(mOuterWrapper);
if (mOuterWrapper) {
aElements.AppendElement(mOuterWrapper);
}
}
void

View File

@ -68,7 +68,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP

View File

@ -76,10 +76,12 @@ nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsProgressFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsProgressFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mBarDiv);
if (mBarDiv) {
aElements.AppendElement(mBarDiv);
}
}
NS_QUERYFRAME_HEAD(nsProgressFrame)

View File

@ -47,7 +47,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,

View File

@ -154,12 +154,20 @@ nsRangeFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsRangeFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsRangeFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mTrackDiv);
aElements.MaybeAppendElement(mProgressDiv);
aElements.MaybeAppendElement(mThumbDiv);
if (mTrackDiv) {
aElements.AppendElement(mTrackDiv);
}
if (mProgressDiv) {
aElements.AppendElement(mProgressDiv);
}
if (mThumbDiv) {
aElements.AppendElement(mThumbDiv);
}
}
class nsDisplayRangeFocusRing : public nsDisplayItem

View File

@ -64,7 +64,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,

View File

@ -394,15 +394,20 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsTextControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsTextControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
aElements.MaybeAppendElement(txtCtrl->GetRootEditorNode());
if (!(aFilter & nsIContent::eSkipPlaceholderContent))
aElements.MaybeAppendElement(txtCtrl->GetPlaceholderNode());
nsIContent* root = txtCtrl->GetRootEditorNode();
if (root) {
aElements.AppendElement(root);
}
nsIContent* placeholder = txtCtrl->GetPlaceholderNode();
if (placeholder && !(aFilter & nsIContent::eSkipPlaceholderContent))
aElements.AppendElement(placeholder);
}

View File

@ -82,7 +82,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual void SetInitialChildList(ChildListID aListID,

View File

@ -114,11 +114,19 @@ nsCanvasFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsCanvasFrame::AppendAnonymousContentTo(nsBaseContentList& aElements, uint32_t aFilter)
nsCanvasFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter)
{
aElements.MaybeAppendElement(mTouchCaretElement);
aElements.MaybeAppendElement(mSelectionCaretsStartElement);
aElements.MaybeAppendElement(mSelectionCaretsEndElement);
if (mTouchCaretElement) {
aElements.AppendElement(mTouchCaretElement);
}
if (mSelectionCaretsStartElement) {
aElements.AppendElement(mSelectionCaretsStartElement);
}
if (mSelectionCaretsEndElement) {
aElements.AppendElement(mSelectionCaretsEndElement);
}
}
void

View File

@ -68,7 +68,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, uint32_t aFilter) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter) MOZ_OVERRIDE;
// Touch caret handle function
mozilla::dom::Element* GetTouchCaretElement() const

View File

@ -104,7 +104,7 @@ nsHTMLScrollFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsHTMLScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsHTMLScrollFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
mHelper.AppendAnonymousContentTo(aElements, aFilter);
@ -1048,7 +1048,7 @@ nsXULScrollFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsXULScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsXULScrollFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
mHelper.AppendAnonymousContentTo(aElements, aFilter);
@ -3546,13 +3546,24 @@ ScrollFrameHelper::CreateAnonymousContent(
}
void
ScrollFrameHelper::AppendAnonymousContentTo(nsBaseContentList& aElements,
ScrollFrameHelper::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mHScrollbarContent);
aElements.MaybeAppendElement(mVScrollbarContent);
aElements.MaybeAppendElement(mScrollCornerContent);
aElements.MaybeAppendElement(mResizerContent);
if (mHScrollbarContent) {
aElements.AppendElement(mHScrollbarContent);
}
if (mVScrollbarContent) {
aElements.AppendElement(mVScrollbarContent);
}
if (mScrollCornerContent) {
aElements.AppendElement(mScrollCornerContent);
}
if (mResizerContent) {
aElements.AppendElement(mResizerContent);
}
}
void

View File

@ -58,7 +58,7 @@ public:
nsresult CreateAnonymousContent(
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aElements);
void AppendAnonymousContentTo(nsBaseContentList& aElements, uint32_t aFilter);
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter);
nsresult FireScrollPortEvent();
void PostOverflowEvent();
void Destroy();
@ -544,7 +544,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
// nsIScrollbarOwner
@ -833,7 +833,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;

View File

@ -69,7 +69,7 @@ public:
*
* @see nsIContent::GetChildren for set of values used for filter.
*/
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) = 0;
/**

View File

@ -121,12 +121,20 @@ nsVideoFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsVideoFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsVideoFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFliter)
{
aElements.MaybeAppendElement(mPosterImage);
aElements.MaybeAppendElement(mVideoControls);
aElements.MaybeAppendElement(mCaptionDiv);
if (mPosterImage) {
aElements.AppendElement(mPosterImage);
}
if (mVideoControls) {
aElements.AppendElement(mVideoControls);
}
if (mCaptionDiv) {
aElements.AppendElement(mCaptionDiv);
}
}
void

View File

@ -76,7 +76,7 @@ public:
}
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilters) MOZ_OVERRIDE;
nsIContent* GetPosterImage() { return mPosterImage; }

View File

@ -64,7 +64,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
private:
@ -243,10 +243,12 @@ nsSVGUseFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsSVGUseFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsSVGUseFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
SVGUseElement *use = static_cast<SVGUseElement*>(mContent);
nsIContent* clone = use->GetAnonymousContent();
aElements.MaybeAppendElement(clone);
if (clone) {
aElements.AppendElement(clone);
}
}

View File

@ -43,7 +43,7 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
@ -123,11 +123,16 @@ nsDocElementBoxFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
}
void
nsDocElementBoxFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nsDocElementBoxFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter)
{
aElements.MaybeAppendElement(mPopupgroupContent);
aElements.MaybeAppendElement(mTooltipContent);
if (mPopupgroupContent) {
aElements.AppendElement(mPopupgroupContent);
}
if (mTooltipContent) {
aElements.AppendElement(mTooltipContent);
}
}
NS_QUERYFRAME_HEAD(nsDocElementBoxFrame)