Bug 604386 - Prune placeholder from text children, r=davidb, sr=bz, a=blocking

This commit is contained in:
Alexander Surkov 2010-10-16 00:34:35 +09:00
Родитель e2435552e0
Коммит 7ca32694f5
27 изменённых файлов: 75 добавлений и 51 удалений

Просмотреть файл

@ -74,9 +74,11 @@ nsAccTreeWalker::
if (aContent)
mState = new WalkState(aContent);
mChildType = aWalkAnonContent ? nsIContent::eAllChildren :
mChildFilter = aWalkAnonContent ? nsIContent::eAllChildren :
nsIContent::eAllButXBL;
mChildFilter |= nsIContent::eSkipPlaceholderContent;
MOZ_COUNT_CTOR(nsAccTreeWalker);
}
@ -99,7 +101,7 @@ nsAccTreeWalker::GetNextChildInternal(PRBool aNoWalkUp)
return nsnull;
if (!mState->childList)
mState->childList = mState->content->GetChildren(mChildType);
mState->childList = mState->content->GetChildren(mChildFilter);
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));

Просмотреть файл

@ -91,7 +91,7 @@ private:
void PopState();
nsCOMPtr<nsIWeakReference> mWeakShell;
PRInt32 mChildType;
PRInt32 mChildFilter;
WalkState* mState;
};

Просмотреть файл

@ -429,11 +429,8 @@
ID = "area14";
defAttrs = buildDefaultTextAttrs(ID, kInputFontSize);
// XXX: While we expose text leaf accessibles for placeholder we grab its
// style, bug 545817.
// attrs = { color: "rgb(109, 109, 109)" };
//testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);
todo(false, "enable commented tests when bug 545817 is fixed");
attrs = { };
testTextAttrs(ID, 0, attrs, defAttrs, 0, 0);
//////////////////////////////////////////////////////////////////////////
// area15, embed char tests, "*plain*plain**bold*bold*"

Просмотреть файл

@ -41,7 +41,7 @@
* Do tests.
*/
// gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpID = "eventdump"; // debug stuff
var gQueue = null;

Просмотреть файл

@ -53,9 +53,6 @@
{
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}
@ -126,9 +123,6 @@
{
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}

Просмотреть файл

@ -175,12 +175,18 @@ public:
* 3. native anonymous nodes
* 4. :after generated node
*/
eAllButXBL = 1
eAllButXBL = 1,
/**
* Skip native anonymous content created for placeholder of HTML input,
* used in conjunction with eAllChildren or eAllButXBL.
*/
eSkipPlaceholderContent = 2
};
/**
* Return either the XBL explicit children of the node or the XBL flattened
* tree children of the node, depending on the child type, as well as any
* tree children of the node, depending on the filter, as well as
* native anonymous children.
*
* @note calling this method with eAllButXBL will return children that are
@ -188,7 +194,7 @@ public:
* of this node in the tree, but those other nodes cannot be reached from the
* eAllButXBL child list.
*/
virtual already_AddRefed<nsINodeList> GetChildren(PRInt32 aChildType) = 0;
virtual already_AddRefed<nsINodeList> GetChildren(PRUint32 aFilter) = 0;
/**
* Get whether this content is C++-generated anonymous content

Просмотреть файл

@ -579,7 +579,7 @@ nsGenericDOMDataNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
}
already_AddRefed<nsINodeList>
nsGenericDOMDataNode::GetChildren(PRInt32 aChildType)
nsGenericDOMDataNode::GetChildren(PRUint32 aFilter)
{
return nsnull;
}

Просмотреть файл

@ -194,7 +194,7 @@ public:
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual already_AddRefed<nsINodeList> GetChildren(PRInt32 aChildType);
virtual already_AddRefed<nsINodeList> GetChildren(PRUint32 aFilter);
virtual nsIAtom *GetIDAttributeName() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;

Просмотреть файл

@ -3051,7 +3051,7 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
}
already_AddRefed<nsINodeList>
nsGenericElement::GetChildren(PRInt32 aChildType)
nsGenericElement::GetChildren(PRUint32 aFilter)
{
nsRefPtr<nsBaseContentList> list = new nsBaseContentList();
if (!list) {
@ -3076,7 +3076,7 @@ nsGenericElement::GetChildren(PRInt32 aChildType)
nsIDocument* document = GetOwnerDoc();
if (document) {
if (aChildType != eAllButXBL) {
if (!(aFilter & eAllButXBL)) {
childList = document->BindingManager()->GetXBLChildNodesFor(this);
if (!childList) {
childList = GetChildNodesList();
@ -3102,7 +3102,7 @@ nsGenericElement::GetChildren(PRInt32 aChildType)
// Append native anonymous content to the end.
nsIAnonymousContentCreator* creator = do_QueryFrame(frame);
if (creator) {
creator->AppendAnonymousContentTo(*list);
creator->AppendAnonymousContentTo(*list, aFilter);
}
// Append :after generated content.

Просмотреть файл

@ -378,7 +378,7 @@ public:
PRBool aCompileEventHandlers);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual already_AddRefed<nsINodeList> GetChildren(PRInt32 aChildType);
virtual already_AddRefed<nsINodeList> GetChildren(PRUint32 aFilter);
virtual nsIAtom *GetClassAttributeName() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,

Просмотреть файл

@ -1037,7 +1037,8 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsComboboxControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsComboboxControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mDisplayContent);
aElements.MaybeAppendElement(mButtonContent);

Просмотреть файл

@ -99,7 +99,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
virtual nsIFrame* CreateFrameFor(nsIContent* aContent);
#ifdef ACCESSIBILITY

Просмотреть файл

@ -345,7 +345,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsFileControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsFileControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mTextContent);
aElements.MaybeAppendElement(mBrowse);

Просмотреть файл

@ -93,7 +93,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
#ifdef ACCESSIBILITY
virtual already_AddRefed<nsAccessible> CreateAccessible();

Просмотреть файл

@ -132,7 +132,8 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements
}
void
nsGfxButtonControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsGfxButtonControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mTextContent);
}

Просмотреть файл

@ -76,7 +76,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
virtual nsIFrame* CreateFrameFor(nsIContent* aContent);
// nsIFormControlFrame

Просмотреть файл

@ -239,7 +239,8 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsIsIndexFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsIsIndexFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mTextContent);
aElements.MaybeAppendElement(mInputContent);

Просмотреть файл

@ -98,7 +98,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
NS_IMETHOD OnSubmit(nsPresContext* aPresContext);

Просмотреть файл

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

Просмотреть файл

@ -118,7 +118,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
// Utility methods to set current widget state

Просмотреть файл

@ -109,9 +109,10 @@ nsHTMLScrollFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsHTMLScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsHTMLScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
mInner.AppendAnonymousContentTo(aElements);
mInner.AppendAnonymousContentTo(aElements, aFilter);
}
void
@ -973,9 +974,10 @@ nsXULScrollFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsXULScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsXULScrollFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
mInner.AppendAnonymousContentTo(aElements);
mInner.AppendAnonymousContentTo(aElements, aFilter);
}
void
@ -2232,7 +2234,8 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsGfxScrollFrameInner::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsGfxScrollFrameInner::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mHScrollbarContent);
aElements.MaybeAppendElement(mVScrollbarContent);

Просмотреть файл

@ -82,7 +82,7 @@ public:
void ReloadChildFrames();
nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
void AppendAnonymousContentTo(nsBaseContentList& aElements);
void AppendAnonymousContentTo(nsBaseContentList& aElements, PRUint32 aFilter);
nsresult FireScrollPortEvent();
void PostOverflowEvent();
void Destroy();
@ -394,7 +394,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
// nsIScrollableFrame
virtual nsIFrame* GetScrolledFrame() const {
@ -592,7 +593,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);

Просмотреть файл

@ -73,9 +73,12 @@ public:
/**
* Appends "native" anonymous children created by CreateAnonymousContent()
* to the given content list.
* to the given content list depending on the filter.
*
* @see nsIContent::GetChildren for set of values used for filter.
*/
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements) = 0;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter) = 0;
/**
* Implementations can override this method to create special frames for the

Просмотреть файл

@ -136,7 +136,8 @@ nsVideoFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsVideoFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsVideoFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFliter)
{
aElements.MaybeAppendElement(mPosterImage);
aElements.MaybeAppendElement(mVideoControls);

Просмотреть файл

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

Просмотреть файл

@ -89,7 +89,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
};
//----------------------------------------------------------------------
@ -183,7 +184,8 @@ nsSVGUseFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsSVGUseFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsSVGUseFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
nsSVGUseElement *use = static_cast<nsSVGUseElement*>(mContent);
nsIContent* clone = use->GetAnonymousContent();

Просмотреть файл

@ -75,7 +75,8 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
{
@ -152,7 +153,8 @@ nsDocElementBoxFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
void
nsDocElementBoxFrame::AppendAnonymousContentTo(nsBaseContentList& aElements)
nsDocElementBoxFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter)
{
aElements.MaybeAppendElement(mPopupgroupContent);
aElements.MaybeAppendElement(mTooltipContent);