Change the binding parent for native anonymous content to work like the binding parent for XBL anonymous content, and be the parent of the anonymous content subtree rather than the root of the anonymous content subtree. (Bug 436453) r=bzbarsky,smaug,surkov sr=bzbarsky

This commit is contained in:
L. David Baron 2008-07-22 21:50:20 -07:00
Родитель caae253454
Коммит 1347910ac9
24 изменённых файлов: 120 добавлений и 106 удалений

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

@ -191,8 +191,7 @@ NS_IMETHODIMP nsAccessNode::Init()
// so that nsDocAccessible::RefreshNodes() can find the anonymous subtree to release when
// the root node goes away
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (content && (content->IsNativeAnonymous() ||
content->GetBindingParent())) {
if (content && content->IsInAnonymousSubtree()) {
// Specific examples of where this is used: <input type="file"> and <xul:findbar>
nsCOMPtr<nsIAccessible> parentAccessible;
docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, getter_AddRefs(parentAccessible));

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

@ -796,7 +796,7 @@ nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsAutoString controlID;
if (!nsAccUtils::GetID(aForNode, controlID)) {
binding = aForNode->GetBindingParent();
if (binding == aForNode)
if (aForNode->IsRootOfNativeAnonymousSubtree()) // XXX Was this the intent?
return nsnull;
aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::anonid, controlID);

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

@ -1941,6 +1941,7 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
// Can get text from title of <toolbaritem> if we're a child of a <toolbaritem>
nsIContent *bindingParent = content->GetBindingParent();
// XXXldb: Why do we skip to bindingParent's parent?
nsIContent *parent = bindingParent? bindingParent->GetParent() :
content->GetParent();
while (parent) {

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

@ -1760,9 +1760,8 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
getter_AddRefs(childAccessNode));
childAccessNode->GetDOMNode(getter_AddRefs(possibleAnonNode));
nsCOMPtr<nsIContent> iterContent = do_QueryInterface(possibleAnonNode);
if (iterContent && (iterContent->IsNativeAnonymous() ||
iterContent->GetBindingParent())) {
// GetBindingParent() check is a perf win -- make sure we don't
if (iterContent && iterContent->IsInAnonymousSubtree()) {
// IsInAnonymousSubtree() check is a perf win -- make sure we don't
// shut down the same subtree twice since we'll reach non-anon content via
// DOM traversal later in this method
RefreshNodes(possibleAnonNode);

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

@ -640,7 +640,9 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
if (findContent->IsNodeOfType(nsINode::eHTML) &&
findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
nsIContent *parent = findContent->GetParent();
if (parent && parent->IsNativeAnonymous() && parent->GetChildCount() == 1) {
if (parent &&
parent->IsRootOfNativeAnonymousSubtree() &&
parent->GetChildCount() == 1) {
// This <br> is the only node in a text control, therefore it is the hacky
// "bogus node" used when there is no text in a control
*aHyperTextOffset = 0;

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

@ -146,7 +146,7 @@ public:
* @see nsIAnonymousContentCreator
* @return whether this content is anonymous
*/
PRBool IsNativeAnonymous() const
PRBool IsRootOfNativeAnonymousSubtree() const
{
return HasFlag(NODE_IS_ANONYMOUS);
}
@ -177,7 +177,7 @@ public:
}
nsIContent* content = GetBindingParent();
while (content) {
if (content->IsNativeAnonymous()) {
if (content->IsRootOfNativeAnonymousSubtree()) {
NS_ERROR("Element not marked to be in native anonymous subtree!");
break;
}
@ -189,6 +189,31 @@ public:
#endif
}
/**
* Returns true if and only if this node has a parent, but is not in
* its parent's child list.
*/
PRBool IsRootOfAnonymousSubtree() const
{
NS_ASSERTION(!IsRootOfNativeAnonymousSubtree() ||
(GetParent() && GetBindingParent() == GetParent()),
"root of native anonymous subtree must have parent equal "
"to binding parent");
nsIContent *bindingParent = GetBindingParent();
return bindingParent && bindingParent == GetParent();
}
/**
* Returns true if and only if there is NOT a path through child lists
* from the top of this node's parent chain back to this node.
*/
PRBool IsInAnonymousSubtree() const
{
NS_ASSERTION(!IsInNativeAnonymousSubtree() || GetBindingParent(),
"must have binding parent when in native anonymous subtree");
return GetBindingParent() != nsnull;
}
/**
* Get the namespace that this element's tag is defined in
* @return the namespace
@ -563,9 +588,12 @@ public:
}
/**
* Gets content node with the binding responsible for our construction (and
* existence). Used by anonymous content (XBL-generated). null for all
* explicit content.
* Gets content node with the binding (or native code, possibly on the
* frame) responsible for our construction (and existence). Used by
* anonymous content (both XBL-generated and native-anonymous).
*
* null for all explicit content (i.e., content reachable from the top
* of its GetParent() chain via child lists).
*
* @return the binding parent
*/

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

@ -1890,7 +1890,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
NS_ENSURE_TRUE(aContent, NS_ERROR_FAILURE);
// Don't capture state for anonymous content
if (aContent->IsNativeAnonymous() || aContent->GetBindingParent()) {
if (aContent->IsInAnonymousSubtree()) {
return NS_OK;
}

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

@ -2145,8 +2145,8 @@ nsDocument::ElementFromPoint(PRInt32 aX, PRInt32 aY, nsIDOMElement** aReturn)
// replace it with the first non-anonymous parent node of type element.
while (ptContent &&
!ptContent->IsNodeOfType(nsINode::eELEMENT) ||
ptContent->GetBindingParent() ||
ptContent->IsNativeAnonymous()) {
ptContent->IsInAnonymousSubtree()) {
// XXXldb: Faster to jump to GetBindingParent if non-null?
ptContent = ptContent->GetParent();
}

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

@ -592,8 +592,11 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
NS_PRECONDITION(aBindingParent != this || IsNativeAnonymous(),
"Only native anonymous content should have itself as its "
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
if (!aBindingParent && aParent) {
@ -605,13 +608,14 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsDataSlots *slots = GetDataSlots();
NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
NS_ASSERTION(IsNativeAnonymous() || !HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE) ||
NS_ASSERTION(IsRootOfNativeAnonymousSubtree() ||
!HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE) ||
aBindingParent->IsInNativeAnonymousSubtree(),
"Trying to re-bind content from native anonymous subtree to"
"non-native anonymous parent!");
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
if (IsNativeAnonymous() ||
aBindingParent->IsInNativeAnonymousSubtree()) {
if (IsRootOfNativeAnonymousSubtree() ||
aParent->IsInNativeAnonymousSubtree()) {
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
}
}

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

@ -435,18 +435,15 @@ nsIContent*
nsIContent::FindFirstNonNativeAnonymous() const
{
// This handles also nested native anonymous content.
nsIContent* content = GetBindingParent();
nsIContent* possibleResult =
!IsNativeAnonymous() ? const_cast<nsIContent*>(this) : nsnull;
while (content) {
if (content->IsNativeAnonymous()) {
content = possibleResult = content->GetParent();
} else {
content = content->GetBindingParent();
for (const nsIContent *content = this; content;
content = content->GetBindingParent()) {
if (!content->IsInNativeAnonymousSubtree()) {
// Oops, this function signature allows casting const to
// non-const. (Then again, so does GetChildAt(0)->GetParent().)
return const_cast<nsIContent*>(content);
}
}
return possibleResult;
return nsnull;
}
//----------------------------------------------------------------------
@ -2091,11 +2088,11 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_PRECONDITION(!aParent || !aDocument ||
!aParent->HasFlag(NODE_FORCE_XBL_BINDINGS),
"Parent in document but flagged as forcing XBL");
NS_PRECONDITION(aBindingParent != this || IsNativeAnonymous(),
"Only native anonymous content should have itself as its "
"own binding parent");
NS_PRECONDITION(!IsNativeAnonymous() || aBindingParent == this,
"Native anonymous content must have itself as its "
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
if (!aBindingParent && aParent) {
@ -2121,13 +2118,13 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
}
}
NS_ASSERTION(!aBindingParent || IsNativeAnonymous() ||
NS_ASSERTION(!aBindingParent || IsRootOfNativeAnonymousSubtree() ||
!HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE) ||
aBindingParent->IsInNativeAnonymousSubtree(),
"Trying to re-bind content from native anonymous subtree to"
"non-native anonymous parent!");
if (IsNativeAnonymous() ||
aBindingParent && aBindingParent->IsInNativeAnonymousSubtree()) {
if (IsRootOfNativeAnonymousSubtree() ||
aParent && aParent->IsInNativeAnonymousSubtree()) {
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
}
@ -2302,7 +2299,7 @@ FindNativeAnonymousSubtreeOwner(nsIContent* aContent)
if (aContent->IsInNativeAnonymousSubtree()) {
PRBool isNativeAnon = PR_FALSE;
while (aContent && !isNativeAnon) {
isNativeAnon = aContent->IsNativeAnonymous();
isNativeAnon = aContent->IsRootOfNativeAnonymousSubtree();
aContent = aContent->GetParent();
}
}
@ -2318,7 +2315,7 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
// Don't propagate mouseover and mouseout events when mouse is moving
// inside native anonymous content.
PRBool isAnonForEvents = aContent->IsNativeAnonymous();
PRBool isAnonForEvents = aContent->IsRootOfNativeAnonymousSubtree();
if ((aVisitor.mEvent->message == NS_MOUSE_ENTER_SYNTH ||
aVisitor.mEvent->message == NS_MOUSE_EXIT_SYNTH) &&
// This is an optimization - try to stop event propagation when

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

@ -134,10 +134,8 @@ nsDOMEvent::nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent)
mExplicitOriginalTarget = GetTargetFromFrame();
mTmpRealOriginalTarget = mExplicitOriginalTarget;
nsCOMPtr<nsIContent> content = do_QueryInterface(mExplicitOriginalTarget);
if (content) {
if (content->IsNativeAnonymous() || content->GetBindingParent()) {
mExplicitOriginalTarget = nsnull;
}
if (content && content->IsInAnonymousSubtree()) {
mExplicitOriginalTarget = nsnull;
}
}
}

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

@ -1263,15 +1263,11 @@ nsBindingManager::WalkRules(nsStyleSet* aStyleSet,
}
}
nsIContent* parent = content->GetBindingParent();
if (parent == content) {
NS_ASSERTION(content->IsNativeAnonymous(), "Unexpected binding parent");
break; // The anonymous content case is often deliberately hacked to
// return itself to cut off style inheritance here. Do that.
if (content->IsRootOfNativeAnonymousSubtree()) {
break; // Deliberately cut off style inheritance here.
}
content = parent;
content = content->GetBindingParent();
} while (content);
// If "content" is non-null that means we cut off inheritance at some point

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

@ -110,11 +110,10 @@ IsAncestorBinding(nsIDocument* aDocument,
NS_ASSERTION(aChild, "expected a child content");
PRUint32 bindingRecursion = 0;
nsIContent* bindingParent = aChild->GetBindingParent();
nsBindingManager* bindingManager = aDocument->BindingManager();
for (nsIContent* prev = aChild;
bindingParent && prev != bindingParent;
prev = bindingParent, bindingParent = bindingParent->GetBindingParent()) {
for (nsIContent *bindingParent = aChild->GetBindingParent();
bindingParent;
bindingParent = bindingParent->GetBindingParent()) {
nsXBLBinding* binding = bindingManager->GetBinding(bindingParent);
if (!binding) {
continue;

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

@ -1086,6 +1086,7 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
if (mNodeInfo->Equals(nsGkAtoms::label)) {
// For anonymous labels the unregistering must
// occur on the binding parent control.
// XXXldb: And what if the binding parent is null?
content = GetBindingParent();
}

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

@ -440,7 +440,7 @@ nsEditor::GetDesiredSpellCheckState()
return PR_FALSE;
}
if (content->IsNativeAnonymous()) {
if (content->IsRootOfNativeAnonymousSubtree()) {
content = content->GetParent();
}
@ -5241,7 +5241,7 @@ nsEditor::GetPIDOMEventTarget()
nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
if (content && content->IsNativeAnonymous())
if (content && content->IsRootOfNativeAnonymousSubtree())
{
mEventTarget = do_QueryInterface(content->GetParent());
piTarget = mEventTarget;

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

@ -188,7 +188,7 @@ nsHTMLEditor::CreateAnonymousElement(const nsAString & aTag, nsIDOMNode * aPare
// establish parenthood of the element
newContent->SetNativeAnonymous();
res = newContent->BindToTree(doc, parentContent, newContent, PR_TRUE);
res = newContent->BindToTree(doc, parentContent, parentContent, PR_TRUE);
if (NS_FAILED(res)) {
newContent->UnbindFromTree();
return res;

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

@ -5928,7 +5928,7 @@ nsHTMLEditor::IsAnonymousElement(nsIDOMElement * aElement, PRBool * aReturn)
{
NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
*aReturn = content->IsNativeAnonymous();
*aReturn = content->IsRootOfNativeAnonymousSubtree();
return NS_OK;
}

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

@ -366,7 +366,7 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
if (!aContent) {
return;
}
NS_ASSERTION(!aContent->IsNativeAnonymous(), "invalid call");
NS_ASSERTION(!aContent->IsRootOfNativeAnonymousSubtree(), "invalid call");
nsIDocument* doc = aContent->GetDocument();
nsIPresShell* shell = doc ? doc->GetPrimaryShell() : nsnull;

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

@ -411,21 +411,6 @@ FocusElementButNotDocument(nsIDocument* aDocument, nsIContent* aContent)
esm->SetFocusedContent(nsnull);
}
static PRBool
IsInNativeAnonymousSubtree(nsIContent* aContent)
{
while (aContent) {
nsIContent* bindingParent = aContent->GetBindingParent();
if (bindingParent == aContent) {
return PR_TRUE;
}
aContent = bindingParent;
}
return PR_FALSE;
}
void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
nsIDOMRange* aRange)
{
@ -451,7 +436,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
// <textarea> or text <input>, we need to get the outer frame
nsITextControlFrame *tcFrame = nsnull;
for ( ; content; content = content->GetParent()) {
if (!IsInNativeAnonymousSubtree(content)) {
if (!content->IsInNativeAnonymousSubtree()) {
nsIFrame* f = presShell->GetPrimaryFrameFor(content);
if (!f)
return;

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

@ -1915,8 +1915,9 @@ nsCSSFrameConstructor::CreateAttributeContent(nsIContent* aParentContent,
content->SetNativeAnonymous();
// Set aContent as the parent content so that event handling works.
rv = content->BindToTree(mDocument, aParentContent, content, PR_TRUE);
// Set aParentContent as the parent content so that event handling works.
// It is also the binding parent.
rv = content->BindToTree(mDocument, aParentContent, aParentContent, PR_TRUE);
if (NS_FAILED(rv)) {
content->UnbindFromTree();
return rv;
@ -1985,11 +1986,8 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIFrame* aParentFram
content->SetNativeAnonymous();
// Set aContent as the parent content and set the document object. This
// way event handling works
// Hack the binding parent to make document rules not match (not
// like it matters, since we already have a non-element style
// context... which is totally wacky, but anyway).
rv = content->BindToTree(mDocument, aContent, content, PR_TRUE);
// way event handling works. It is also the binding parent.
rv = content->BindToTree(mDocument, aContent, aContent, PR_TRUE);
if (NS_FAILED(rv)) {
content->UnbindFromTree();
return rv;
@ -2169,7 +2167,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIFrame* aParentFram
textContent->SetNativeAnonymous();
// Set aContent as the parent content so that event handling works.
nsresult rv = textContent->BindToTree(mDocument, aContent, textContent,
nsresult rv = textContent->BindToTree(mDocument, aContent, aContent,
PR_TRUE);
if (NS_FAILED(rv)) {
textContent->UnbindFromTree();
@ -3406,7 +3404,8 @@ IsSpecialContent(nsIContent* aContent,
aTag == nsGkAtoms::menuitem ||
aTag == nsGkAtoms::menubutton ||
aTag == nsGkAtoms::menubar ||
(aTag == nsGkAtoms::popupgroup && aContent->IsNativeAnonymous()) ||
(aTag == nsGkAtoms::popupgroup &&
aContent->IsRootOfNativeAnonymousSubtree()) ||
aTag == nsGkAtoms::iframe ||
aTag == nsGkAtoms::editor ||
aTag == nsGkAtoms::browser ||
@ -5699,20 +5698,17 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
nsIContent* content = newAnonymousItems[i];
NS_ASSERTION(content, "null anonymous content?");
nsIContent* bindingParent = content;
#ifdef MOZ_SVG
// least-surprise CSS binding until we do the SVG specified
// cascading rules for <svg:use> - bug 265894
if (aParent &&
aParent->NodeInfo()->Equals(nsGkAtoms::use, kNameSpaceID_SVG)) {
bindingParent = aParent;
} else
if (!aParent ||
!aParent->NodeInfo()->Equals(nsGkAtoms::use, kNameSpaceID_SVG))
#endif
{
content->SetNativeAnonymous();
}
rv = content->BindToTree(aDocument, aParent, bindingParent, PR_TRUE);
rv = content->BindToTree(aDocument, aParent, aParent, PR_TRUE);
if (NS_FAILED(rv)) {
content->UnbindFromTree();
return rv;
@ -5912,7 +5908,8 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState,
newFrame = NS_NewMenuBarFrame(mPresShell, aStyleContext);
}
else if (aTag == nsGkAtoms::popupgroup && aContent->IsNativeAnonymous()) {
else if (aTag == nsGkAtoms::popupgroup &&
aContent->IsRootOfNativeAnonymousSubtree()) {
// This frame contains child popups
newFrame = NS_NewPopupSetFrame(mPresShell, aStyleContext);
}
@ -6174,7 +6171,8 @@ nsCSSFrameConstructor::ConstructXULFrame(nsFrameConstructorState& aState,
}
#ifdef MOZ_XUL
if (aTag == nsGkAtoms::popupgroup && aContent->IsNativeAnonymous()) {
if (aTag == nsGkAtoms::popupgroup &&
aContent->IsRootOfNativeAnonymousSubtree()) {
nsIRootBox* rootBox = nsIRootBox::GetRootBox(mPresShell);
if (rootBox) {
NS_ASSERTION(rootBox->GetPopupSetFrame() == newFrame,
@ -10569,13 +10567,15 @@ static PRBool
IsBindingAncestor(nsIContent* aContent, nsIContent* aBindingRoot)
{
while (PR_TRUE) {
// Native-anonymous content doesn't contain insertion points, so
// we don't need to search through it.
if (aContent->IsRootOfNativeAnonymousSubtree())
return PR_FALSE;
nsIContent* bindingParent = aContent->GetBindingParent();
if (!bindingParent)
return PR_FALSE;
if (bindingParent == aBindingRoot)
return PR_TRUE;
if (bindingParent == aContent)
return PR_FALSE;
aContent = bindingParent;
}
}
@ -10673,6 +10673,8 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
// child frames, too.
// We also need to search if the child content is anonymous and scoped
// to the parent content.
// XXXldb What makes us continue the search once we're inside
// the anonymous subtree?
if (aParentContent == kidContent ||
(aParentContent && IsBindingAncestor(kidContent, aParentContent)))
{
@ -11652,7 +11654,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
// its primary frame to be a text frame). So use its parent for the
// first-letter.
nsIContent* letterContent = aTextContent->GetParent();
NS_ASSERTION(letterContent->GetBindingParent() != letterContent,
NS_ASSERTION(!letterContent->IsRootOfNativeAnonymousSubtree(),
"Reframes of this letter frame will mess with the root of a "
"native anonymous content subtree!");
InitAndRestoreFrame(aState, letterContent,
@ -11777,7 +11779,7 @@ nsCSSFrameConstructor::CreateLetterFrame(nsFrameConstructorState& aState,
// content for a non-text frame (because we want its primary frame to
// be a text frame). So use its parent for the first-letter.
nsIContent* letterContent = aTextContent->GetParent();
NS_ASSERTION(letterContent->GetBindingParent() != letterContent,
NS_ASSERTION(!letterContent->IsRootOfNativeAnonymousSubtree(),
"Reframes of this letter frame will mess with the root "
"of a native anonymous content subtree!");
letterFrame->Init(letterContent, aParentFrame, nsnull);
@ -12947,7 +12949,7 @@ nsCSSFrameConstructor::RestyleForAppend(nsIContent* aContainer,
NS_ASSERTION(index != aNewIndexInContainer, "yikes, nothing appended");
break;
}
NS_ASSERTION(!content->IsNativeAnonymous(),
NS_ASSERTION(!content->IsRootOfNativeAnonymousSubtree(),
"native anonymous nodes should not be in child lists");
}
}
@ -13006,7 +13008,7 @@ void
nsCSSFrameConstructor::RestyleForInsertOrChange(nsIContent* aContainer,
nsIContent* aChild)
{
NS_ASSERTION(!aChild->IsNativeAnonymous(),
NS_ASSERTION(!aChild->IsRootOfNativeAnonymousSubtree(),
"native anonymous nodes should not be in child lists");
PRUint32 selectorFlags =
aContainer ? (aContainer->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0;
@ -13087,7 +13089,7 @@ nsCSSFrameConstructor::RestyleForRemove(nsIContent* aContainer,
nsIContent* aOldChild,
PRInt32 aIndexInContainer)
{
NS_ASSERTION(!aOldChild->IsNativeAnonymous(),
NS_ASSERTION(!aOldChild->IsRootOfNativeAnonymousSubtree(),
"native anonymous nodes should not be in child lists");
PRUint32 selectorFlags =
aContainer ? (aContainer->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0;

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

@ -4635,7 +4635,7 @@ PresShell::CharacterDataChanged(nsIDocument *aDocument,
nsIContent *container = aContent->GetParent();
PRUint32 selectorFlags =
container ? (container->GetFlags() & NODE_ALL_SELECTOR_FLAGS) : 0;
if (selectorFlags != 0 && !aContent->IsNativeAnonymous()) {
if (selectorFlags != 0 && !aContent->IsRootOfNativeAnonymousSubtree()) {
PRUint32 index;
if (aInfo->mAppend &&
container->GetChildAt((index = container->GetChildCount() - 1)) ==

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

@ -273,8 +273,10 @@ NS_IMETHODIMP BRFrame::GetAccessible(nsIAccessible** aAccessible)
NS_ENSURE_TRUE(mContent, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsCOMPtr<nsIContent> parent = mContent->GetBindingParent();
if (parent && parent->IsNativeAnonymous() && parent->GetChildCount() == 1) {
nsIContent *parent = mContent->GetParent();
if (parent &&
parent->IsRootOfNativeAnonymousSubtree() &&
parent->GetChildCount() == 1) {
// This <br> is the only node in a text control, therefore it is the hacky
// "bogus node" used when there is no text in the control
return NS_ERROR_FAILURE;

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

@ -5717,7 +5717,7 @@ nsFrame::GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame)
//see bug 278197 comment #12 #13 for details
while ((siblingFrame = child->GetNextSibling()) &&
(content = siblingFrame->GetContent()) &&
!content->IsNativeAnonymous())
!content->IsRootOfNativeAnonymousSubtree())
child = siblingFrame;
*aFrame = child;
}
@ -5849,7 +5849,8 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
if (!isFocusable && !aWithMouse &&
GetType() == nsGkAtoms::scrollFrame &&
mContent->IsNodeOfType(nsINode::eHTML) &&
!mContent->IsNativeAnonymous() && mContent->GetParent() &&
!mContent->IsRootOfNativeAnonymousSubtree() &&
mContent->GetParent() &&
!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
// Elements with scrollable view are focusable with script & tabbable
// Otherwise you couldn't scroll them with keyboard, which is

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

@ -349,7 +349,7 @@ inDOMView::GetCellProperties(PRInt32 row, nsITreeColumn* col, nsISupportsArray *
if (!node) return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> content = do_QueryInterface(node->node);
if (content && content->GetBindingParent()) {
if (content && content->IsInAnonymousSubtree()) {
properties->AppendElement(kAnonymousAtom);
}