mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134280 - Get rid of Tag() - patch 2.11 - layout/xul - Fix all the occurrences, m=smaug, r=surkov
This commit is contained in:
parent
8b272ee6ab
commit
7dcc805fb9
@ -145,7 +145,7 @@ ListBoxObject::GetIndexOfItem(Element& aElement)
|
||||
static nsIContent*
|
||||
FindBodyContent(nsIContent* aParent)
|
||||
{
|
||||
if (aParent->Tag() == nsGkAtoms::listboxbody) {
|
||||
if (aParent->IsXULElement(nsGkAtoms::listboxbody)) {
|
||||
return aParent;
|
||||
}
|
||||
|
||||
|
@ -1116,11 +1116,10 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
|
||||
// Ignore 'width', 'height', 'screenX', 'screenY' and 'sizemode' on a
|
||||
// <window>.
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
if ((tag == nsGkAtoms::window ||
|
||||
tag == nsGkAtoms::page ||
|
||||
tag == nsGkAtoms::dialog ||
|
||||
tag == nsGkAtoms::wizard) &&
|
||||
if (mContent->IsAnyOfXULElements(nsGkAtoms::window,
|
||||
nsGkAtoms::page,
|
||||
nsGkAtoms::dialog,
|
||||
nsGkAtoms::wizard) &&
|
||||
(nsGkAtoms::width == aAttribute ||
|
||||
nsGkAtoms::height == aAttribute ||
|
||||
nsGkAtoms::screenX == aAttribute ||
|
||||
@ -1246,7 +1245,7 @@ nsBoxFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
RegUnregAccessKey(true);
|
||||
}
|
||||
else if (aAttribute == nsGkAtoms::rows &&
|
||||
tag == nsGkAtoms::tree) {
|
||||
mContent->IsXULElement(nsGkAtoms::tree)) {
|
||||
// Reflow ourselves and all our children if "rows" changes, since
|
||||
// nsTreeBodyFrame's layout reads this from its parent (this frame).
|
||||
PresContext()->PresShell()->
|
||||
@ -1877,16 +1876,13 @@ nsBoxFrame::RegUnregAccessKey(bool aDoReg)
|
||||
{
|
||||
MOZ_ASSERT(mContent);
|
||||
|
||||
// find out what type of element this is
|
||||
nsIAtom *atom = mContent->Tag();
|
||||
|
||||
// only support accesskeys for the following elements
|
||||
if (atom != nsGkAtoms::button &&
|
||||
atom != nsGkAtoms::toolbarbutton &&
|
||||
atom != nsGkAtoms::checkbox &&
|
||||
atom != nsGkAtoms::textbox &&
|
||||
atom != nsGkAtoms::tab &&
|
||||
atom != nsGkAtoms::radio) {
|
||||
if (!mContent->IsAnyOfXULElements(nsGkAtoms::button,
|
||||
nsGkAtoms::toolbarbutton,
|
||||
nsGkAtoms::checkbox,
|
||||
nsGkAtoms::textbox,
|
||||
nsGkAtoms::tab,
|
||||
nsGkAtoms::radio)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,7 @@ nsListBoxBodyFrame::GetIndexOfItem(nsIDOMElement* aItem, int32_t* _retval)
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
// we hit a list row, count it
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
// is this it?
|
||||
if (child == itemContent)
|
||||
return NS_OK;
|
||||
@ -607,7 +607,7 @@ nsListBoxBodyFrame::GetItemAtIndex(int32_t aIndex, nsIDOMElement** aItem)
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
// we hit a list row, check if it is the one we are looking for
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
// is this it?
|
||||
if (itemCount == aIndex) {
|
||||
return CallQueryInterface(child, aItem);
|
||||
@ -709,7 +709,7 @@ nsListBoxBodyFrame::ComputeIntrinsicISize(nsBoxLayoutState& aBoxLayoutState)
|
||||
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
nsRenderingContext* rendContext = aBoxLayoutState.GetRenderingContext();
|
||||
if (rendContext) {
|
||||
nsAutoString value;
|
||||
@ -747,7 +747,7 @@ nsListBoxBodyFrame::ComputeTotalRowCount()
|
||||
mRowCount = 0;
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
++mRowCount;
|
||||
}
|
||||
}
|
||||
@ -1099,7 +1099,7 @@ IsListItemChild(nsListBoxBodyFrame* aParent, nsIContent* aChild,
|
||||
nsIFrame** aChildFrame)
|
||||
{
|
||||
*aChildFrame = nullptr;
|
||||
if (!aChild->IsXULElement() || aChild->Tag() != nsGkAtoms::listitem) {
|
||||
if (!aChild->IsXULElement(nsGkAtoms::listitem)) {
|
||||
return false;
|
||||
}
|
||||
nsIFrame* existingFrame = aChild->GetPrimaryFrame();
|
||||
@ -1463,7 +1463,7 @@ nsListBoxBodyFrame::GetListItemContentAt(int32_t aIndex, nsIContent** aContent)
|
||||
int32_t itemsFound = 0;
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
++itemsFound;
|
||||
if (itemsFound-1 == aIndex) {
|
||||
*aContent = child;
|
||||
@ -1482,7 +1482,7 @@ nsListBoxBodyFrame::GetListItemNextSibling(nsIContent* aListItem, nsIContent** a
|
||||
nsIContent *prevKid = nullptr;
|
||||
FlattenedChildIterator iter(mContent);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == nsGkAtoms::listitem) {
|
||||
if (child->IsXULElement(nsGkAtoms::listitem)) {
|
||||
++aSiblingIndex;
|
||||
if (prevKid == aListItem) {
|
||||
*aContent = child;
|
||||
|
@ -279,8 +279,8 @@ nsMenuPopupFrame::CreateWidgetForView(nsView* aView)
|
||||
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(this, this);
|
||||
nsIContent* parentContent = GetContent()->GetParent();
|
||||
nsIAtom *tag = nullptr;
|
||||
if (parentContent)
|
||||
tag = parentContent->Tag();
|
||||
if (parentContent && parentContent->IsXULElement())
|
||||
tag = parentContent->NodeInfo()->NameAtom();
|
||||
widgetData.mSupportTranslucency = mode == eTransparencyTransparent;
|
||||
widgetData.mDropShadow = !(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist);
|
||||
widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);
|
||||
|
@ -232,7 +232,7 @@ nsScrollbarButtonFrame::GetChildWithTag(nsPresContext* aPresContext,
|
||||
|
||||
if (child) {
|
||||
// see if it is the child
|
||||
if (child->Tag() == atom)
|
||||
if (child->IsXULElement(atom))
|
||||
{
|
||||
result = childFrame;
|
||||
|
||||
@ -264,7 +264,7 @@ nsScrollbarButtonFrame::GetParentWithTag(nsIAtom* toFind, nsIFrame* start,
|
||||
// get the content node
|
||||
nsIContent* child = start->GetContent();
|
||||
|
||||
if (child && child->Tag() == toFind) {
|
||||
if (child && child->IsXULElement(toFind)) {
|
||||
result = start;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1569,7 +1569,7 @@ nsXULPopupManager::GetLastTriggerNode(nsIDocument* aDocument, bool aIsTooltip)
|
||||
// fired. In this case, just use the cached node, as the popup is not yet in
|
||||
// the list of open popups.
|
||||
if (mOpeningPopup && mOpeningPopup->GetCurrentDoc() == aDocument &&
|
||||
aIsTooltip == (mOpeningPopup->Tag() == nsGkAtoms::tooltip)) {
|
||||
aIsTooltip == mOpeningPopup->IsXULElement(nsGkAtoms::tooltip)) {
|
||||
node = do_QueryInterface(nsMenuPopupFrame::GetTriggerContent(GetPopupFrameForContent(mOpeningPopup, false)));
|
||||
}
|
||||
else {
|
||||
@ -2358,13 +2358,12 @@ nsXULPopupManager::IsValidMenuItem(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
bool aOnPopup)
|
||||
{
|
||||
int32_t ns = aContent->GetNameSpaceID();
|
||||
nsIAtom *tag = aContent->Tag();
|
||||
if (ns == kNameSpaceID_XUL) {
|
||||
if (tag != nsGkAtoms::menu && tag != nsGkAtoms::menuitem)
|
||||
if (aContent->IsXULElement()) {
|
||||
if (!aContent->IsAnyOfXULElements(nsGkAtoms::menu, nsGkAtoms::menuitem)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ns != kNameSpaceID_XHTML || !aOnPopup || tag != nsGkAtoms::option) {
|
||||
else if (!aOnPopup || !aContent->IsHTMLElement(nsGkAtoms::option)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ nsXULTooltipListener::MouseMove(nsIDOMEvent* aEvent)
|
||||
aEvent->InternalDOMEvent()->GetCurrentTarget());
|
||||
mSourceNode = do_GetWeakReference(sourceContent);
|
||||
#ifdef MOZ_XUL
|
||||
mIsSourceTree = sourceContent->Tag() == nsGkAtoms::treechildren;
|
||||
mIsSourceTree = sourceContent->IsXULElement(nsGkAtoms::treechildren);
|
||||
if (mIsSourceTree)
|
||||
CheckTreeBodyMove(mouseEvent);
|
||||
#endif
|
||||
@ -182,11 +182,9 @@ nsXULTooltipListener::MouseMove(nsIDOMEvent* aEvent)
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(eventTarget);
|
||||
while (targetContent && targetContent != sourceContent) {
|
||||
nsIAtom* tag = targetContent->Tag();
|
||||
if (targetContent->GetNameSpaceID() == kNameSpaceID_XUL &&
|
||||
(tag == nsGkAtoms::menupopup ||
|
||||
tag == nsGkAtoms::panel ||
|
||||
tag == nsGkAtoms::tooltip)) {
|
||||
if (targetContent->IsAnyOfXULElements(nsGkAtoms::menupopup,
|
||||
nsGkAtoms::panel,
|
||||
nsGkAtoms::tooltip)) {
|
||||
mSourceNode = nullptr;
|
||||
return;
|
||||
}
|
||||
@ -539,7 +537,7 @@ GetImmediateChild(nsIContent* aContent, nsIAtom *aTag, nsIContent** aResult)
|
||||
for (uint32_t i = 0; i < childCount; i++) {
|
||||
nsIContent *child = aContent->GetChildAt(i);
|
||||
|
||||
if (child->Tag() == aTag) {
|
||||
if (child->IsXULElement(aTag)) {
|
||||
*aResult = child;
|
||||
NS_ADDREF(*aResult);
|
||||
return;
|
||||
|
@ -194,8 +194,7 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
if (MOZ_UNLIKELY(!baseElement)) {
|
||||
desiredRows = 0;
|
||||
}
|
||||
else if (baseElement->Tag() == nsGkAtoms::select &&
|
||||
baseElement->IsHTMLElement()) {
|
||||
else if (baseElement->IsHTMLElement(nsGkAtoms::select)) {
|
||||
min.width = CalcMaxRowWidth();
|
||||
nsAutoString size;
|
||||
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
|
||||
@ -1786,8 +1785,7 @@ nsTreeBodyFrame::MarkDirtyIfSelect()
|
||||
{
|
||||
nsIContent* baseElement = GetBaseElement();
|
||||
|
||||
if (baseElement && baseElement->Tag() == nsGkAtoms::select &&
|
||||
baseElement->IsHTMLElement()) {
|
||||
if (baseElement && baseElement->IsHTMLElement(nsGkAtoms::select)) {
|
||||
// If we are an intrinsically sized select widget, we may need to
|
||||
// resize, if the widest item was removed or a new item was added.
|
||||
// XXX optimize this more
|
||||
|
@ -449,8 +449,7 @@ nsTreeContentView::GetCellText(int32_t aRow, nsITreeColumn* aCol, nsAString& _re
|
||||
&& !_retval.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
nsIAtom *rowTag = row->mContent->Tag();
|
||||
if (rowTag == nsGkAtoms::treeitem && row->mContent->IsXULElement()) {
|
||||
if (row->mContent->IsXULElement(nsGkAtoms::treeitem)) {
|
||||
nsIContent* realRow =
|
||||
nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treerow);
|
||||
if (realRow) {
|
||||
@ -723,7 +722,6 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// Make sure this notification concerns us.
|
||||
// First check the tag to see if it's one that we care about.
|
||||
nsIAtom* tag = aElement->Tag();
|
||||
|
||||
if (mBoxObject && (aElement == mRoot || aElement == mBody)) {
|
||||
mBoxObject->ClearStyleAndImageCaches();
|
||||
@ -736,11 +734,11 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
((parent = aElement->GetParent()) && !parent->IsXULElement())) {
|
||||
return;
|
||||
}
|
||||
if (tag != nsGkAtoms::treecol &&
|
||||
tag != nsGkAtoms::treeitem &&
|
||||
tag != nsGkAtoms::treeseparator &&
|
||||
tag != nsGkAtoms::treerow &&
|
||||
tag != nsGkAtoms::treecell) {
|
||||
if (!aElement->IsAnyOfXULElements(nsGkAtoms::treecol,
|
||||
nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator,
|
||||
nsGkAtoms::treerow,
|
||||
nsGkAtoms::treecell)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -750,14 +748,14 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
for (nsIContent* element = aElement; element != mBody; element = element->GetParent()) {
|
||||
if (!element)
|
||||
return; // this is not for us
|
||||
nsIAtom *parentTag = element->Tag();
|
||||
if (element->IsXULElement() && parentTag == nsGkAtoms::tree)
|
||||
if (element->IsXULElement(nsGkAtoms::tree))
|
||||
return; // this is not for us
|
||||
}
|
||||
|
||||
// Handle changes of the hidden attribute.
|
||||
if (aAttribute == nsGkAtoms::hidden &&
|
||||
(tag == nsGkAtoms::treeitem || tag == nsGkAtoms::treeseparator)) {
|
||||
aElement->IsAnyOfXULElements(nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator)) {
|
||||
bool hidden = aElement->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
@ -780,7 +778,7 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
return;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::treecol) {
|
||||
if (aElement->IsXULElement(nsGkAtoms::treecol)) {
|
||||
if (aAttribute == nsGkAtoms::properties) {
|
||||
if (mBoxObject) {
|
||||
nsCOMPtr<nsITreeColumns> cols;
|
||||
@ -794,7 +792,7 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeitem) {
|
||||
else if (aElement->IsXULElement(nsGkAtoms::treeitem)) {
|
||||
int32_t index = FindContent(aElement);
|
||||
if (index >= 0) {
|
||||
Row* row = mRows[index];
|
||||
@ -826,7 +824,7 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeseparator) {
|
||||
else if (aElement->IsXULElement(nsGkAtoms::treeseparator)) {
|
||||
int32_t index = FindContent(aElement);
|
||||
if (index >= 0) {
|
||||
if (aAttribute == nsGkAtoms::properties && mBoxObject) {
|
||||
@ -834,7 +832,7 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treerow) {
|
||||
else if (aElement->IsXULElement(nsGkAtoms::treerow)) {
|
||||
if (aAttribute == nsGkAtoms::properties) {
|
||||
nsCOMPtr<nsIContent> parent = aElement->GetParent();
|
||||
if (parent) {
|
||||
@ -845,7 +843,7 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treecell) {
|
||||
else if (aElement->IsXULElement(nsGkAtoms::treecell)) {
|
||||
if (aAttribute == nsGkAtoms::ref ||
|
||||
aAttribute == nsGkAtoms::properties ||
|
||||
aAttribute == nsGkAtoms::mode ||
|
||||
@ -889,16 +887,16 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
|
||||
|
||||
// Make sure this notification concerns us.
|
||||
// First check the tag to see if it's one that we care about.
|
||||
nsIAtom *childTag = aChild->Tag();
|
||||
|
||||
// Don't allow non-XUL nodes.
|
||||
if (!aChild->IsXULElement() || !aContainer->IsXULElement())
|
||||
return;
|
||||
if (childTag != nsGkAtoms::treeitem &&
|
||||
childTag != nsGkAtoms::treeseparator &&
|
||||
childTag != nsGkAtoms::treechildren &&
|
||||
childTag != nsGkAtoms::treerow &&
|
||||
childTag != nsGkAtoms::treecell) {
|
||||
|
||||
if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator,
|
||||
nsGkAtoms::treechildren,
|
||||
nsGkAtoms::treerow,
|
||||
nsGkAtoms::treecell)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -908,15 +906,14 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
|
||||
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
|
||||
if (!element)
|
||||
return; // this is not for us
|
||||
nsIAtom *parentTag = element->Tag();
|
||||
if (element->IsXULElement() && parentTag == nsGkAtoms::tree)
|
||||
if (element->IsXULElement(nsGkAtoms::tree))
|
||||
return; // this is not for us
|
||||
}
|
||||
|
||||
// Lots of codepaths under here that do all sorts of stuff, so be safe.
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
if (childTag == nsGkAtoms::treechildren) {
|
||||
if (aChild->IsXULElement(nsGkAtoms::treechildren)) {
|
||||
int32_t index = FindContent(aContainer);
|
||||
if (index >= 0) {
|
||||
Row* row = mRows[index];
|
||||
@ -930,16 +927,16 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (childTag == nsGkAtoms::treeitem ||
|
||||
childTag == nsGkAtoms::treeseparator) {
|
||||
else if (aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator)) {
|
||||
InsertRowFor(aContainer, aChild);
|
||||
}
|
||||
else if (childTag == nsGkAtoms::treerow) {
|
||||
else if (aChild->IsXULElement(nsGkAtoms::treerow)) {
|
||||
int32_t index = FindContent(aContainer);
|
||||
if (index >= 0 && mBoxObject)
|
||||
mBoxObject->InvalidateRow(index);
|
||||
}
|
||||
else if (childTag == nsGkAtoms::treecell) {
|
||||
else if (aChild->IsXULElement(nsGkAtoms::treecell)) {
|
||||
nsCOMPtr<nsIContent> parent = aContainer->GetParent();
|
||||
if (parent) {
|
||||
int32_t index = FindContent(parent);
|
||||
@ -960,16 +957,16 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
|
||||
|
||||
// Make sure this notification concerns us.
|
||||
// First check the tag to see if it's one that we care about.
|
||||
nsIAtom *tag = aChild->Tag();
|
||||
|
||||
// We don't consider non-XUL nodes.
|
||||
if (!aChild->IsXULElement() || !aContainer->IsXULElement())
|
||||
return;
|
||||
if (tag != nsGkAtoms::treeitem &&
|
||||
tag != nsGkAtoms::treeseparator &&
|
||||
tag != nsGkAtoms::treechildren &&
|
||||
tag != nsGkAtoms::treerow &&
|
||||
tag != nsGkAtoms::treecell) {
|
||||
|
||||
if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator,
|
||||
nsGkAtoms::treechildren,
|
||||
nsGkAtoms::treerow,
|
||||
nsGkAtoms::treecell)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -979,15 +976,14 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
|
||||
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) {
|
||||
if (!element)
|
||||
return; // this is not for us
|
||||
nsIAtom *parentTag = element->Tag();
|
||||
if (element->IsXULElement() && parentTag == nsGkAtoms::tree)
|
||||
if (element->IsXULElement(nsGkAtoms::tree))
|
||||
return; // this is not for us
|
||||
}
|
||||
|
||||
// Lots of codepaths under here that do all sorts of stuff, so be safe.
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
|
||||
if (tag == nsGkAtoms::treechildren) {
|
||||
if (aChild->IsXULElement(nsGkAtoms::treechildren)) {
|
||||
int32_t index = FindContent(aContainer);
|
||||
if (index >= 0) {
|
||||
Row* row = mRows[index];
|
||||
@ -1000,9 +996,8 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeitem ||
|
||||
tag == nsGkAtoms::treeseparator
|
||||
) {
|
||||
else if (aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
|
||||
nsGkAtoms::treeseparator)) {
|
||||
int32_t index = FindContent(aChild);
|
||||
if (index >= 0) {
|
||||
int32_t count = RemoveRow(index);
|
||||
@ -1010,12 +1005,12 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
|
||||
mBoxObject->RowCountChanged(index, -count);
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treerow) {
|
||||
else if (aChild->IsXULElement(nsGkAtoms::treerow)) {
|
||||
int32_t index = FindContent(aContainer);
|
||||
if (index >= 0 && mBoxObject)
|
||||
mBoxObject->InvalidateRow(index);
|
||||
}
|
||||
else if (tag == nsGkAtoms::treecell) {
|
||||
else if (aChild->IsXULElement(nsGkAtoms::treecell)) {
|
||||
nsCOMPtr<nsIContent> parent = aContainer->GetParent();
|
||||
if (parent) {
|
||||
int32_t index = FindContent(parent);
|
||||
@ -1045,15 +1040,14 @@ nsTreeContentView::Serialize(nsIContent* aContent, int32_t aParentIndex,
|
||||
|
||||
dom::FlattenedChildIterator iter(aContent);
|
||||
for (nsIContent* content = iter.GetNextChild(); content; content = iter.GetNextChild()) {
|
||||
nsIAtom *tag = content->Tag();
|
||||
int32_t count = aRows.Length();
|
||||
|
||||
if (content->IsXULElement()) {
|
||||
if (tag == nsGkAtoms::treeitem)
|
||||
SerializeItem(content, aParentIndex, aIndex, aRows);
|
||||
else if (tag == nsGkAtoms::treeseparator)
|
||||
SerializeSeparator(content, aParentIndex, aIndex, aRows);
|
||||
if (content->IsXULElement(nsGkAtoms::treeitem)) {
|
||||
SerializeItem(content, aParentIndex, aIndex, aRows);
|
||||
} else if (content->IsXULElement(nsGkAtoms::treeseparator)) {
|
||||
SerializeSeparator(content, aParentIndex, aIndex, aRows);
|
||||
}
|
||||
|
||||
*aIndex += aRows.Length() - count;
|
||||
}
|
||||
}
|
||||
@ -1122,29 +1116,25 @@ nsTreeContentView::GetIndexInSubtree(nsIContent* aContainer,
|
||||
if (content == aContent)
|
||||
break;
|
||||
|
||||
nsIAtom *tag = content->Tag();
|
||||
|
||||
if (content->IsXULElement()) {
|
||||
if (tag == nsGkAtoms::treeitem) {
|
||||
if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
(*aIndex)++;
|
||||
if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
|
||||
nsGkAtoms::_true, eCaseMatters) &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
nsIContent* child =
|
||||
nsTreeUtils::GetImmediateChild(content, nsGkAtoms::treechildren);
|
||||
if (child && child->IsXULElement())
|
||||
GetIndexInSubtree(child, aContent, aIndex);
|
||||
}
|
||||
if (content->IsXULElement(nsGkAtoms::treeitem)) {
|
||||
if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
(*aIndex)++;
|
||||
if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
|
||||
nsGkAtoms::_true, eCaseMatters) &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
nsIContent* child =
|
||||
nsTreeUtils::GetImmediateChild(content, nsGkAtoms::treechildren);
|
||||
if (child && child->IsXULElement())
|
||||
GetIndexInSubtree(child, aContent, aIndex);
|
||||
}
|
||||
}
|
||||
else if (tag == nsGkAtoms::treeseparator) {
|
||||
if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
(*aIndex)++;
|
||||
}
|
||||
}
|
||||
else if (content->IsXULElement(nsGkAtoms::treeseparator)) {
|
||||
if (! content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
(*aIndex)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1204,9 +1194,8 @@ nsTreeContentView::InsertRowFor(nsIContent* aParent, nsIContent* aChild)
|
||||
bool insertRow = false;
|
||||
|
||||
nsCOMPtr<nsIContent> grandParent = aParent->GetParent();
|
||||
nsIAtom* grandParentTag = grandParent->Tag();
|
||||
|
||||
if (grandParent->IsXULElement() && grandParentTag == nsGkAtoms::tree) {
|
||||
if (grandParent->IsXULElement(nsGkAtoms::tree)) {
|
||||
// Allow insertion to the outermost container.
|
||||
insertRow = true;
|
||||
}
|
||||
@ -1237,12 +1226,10 @@ int32_t
|
||||
nsTreeContentView::InsertRow(int32_t aParentIndex, int32_t aIndex, nsIContent* aContent)
|
||||
{
|
||||
nsAutoTArray<nsAutoPtr<Row>, 8> rows;
|
||||
nsIAtom *tag = aContent->Tag();
|
||||
if (aContent->IsXULElement()) {
|
||||
if (tag == nsGkAtoms::treeitem)
|
||||
SerializeItem(aContent, aParentIndex, &aIndex, rows);
|
||||
else if (tag == nsGkAtoms::treeseparator)
|
||||
SerializeSeparator(aContent, aParentIndex, &aIndex, rows);
|
||||
if (aContent->IsXULElement(nsGkAtoms::treeitem)) {
|
||||
SerializeItem(aContent, aParentIndex, &aIndex, rows);
|
||||
} else if (aContent->IsXULElement(nsGkAtoms::treeseparator)) {
|
||||
SerializeSeparator(aContent, aParentIndex, &aIndex, rows);
|
||||
}
|
||||
|
||||
// We can't use InsertElementsAt since the destination can't steal
|
||||
@ -1365,7 +1352,7 @@ nsTreeContentView::GetCell(nsIContent* aContainer, nsITreeColumn* aCol)
|
||||
int32_t j = 0;
|
||||
dom::FlattenedChildIterator iter(aContainer);
|
||||
for (nsIContent* cell = iter.GetNextChild(); cell; cell = iter.GetNextChild()) {
|
||||
if (cell->Tag() == nsGkAtoms::treecell) {
|
||||
if (cell->IsXULElement(nsGkAtoms::treecell)) {
|
||||
if (colAtom && cell->AttrValueIs(kNameSpaceID_None, nsGkAtoms::ref,
|
||||
colAtom, eCaseMatters)) {
|
||||
result = cell;
|
||||
|
@ -56,7 +56,7 @@ nsTreeUtils::GetImmediateChild(nsIContent* aContainer, nsIAtom* aTag)
|
||||
{
|
||||
dom::FlattenedChildIterator iter(aContainer);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == aTag) {
|
||||
if (child->IsXULElement(aTag)) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ nsTreeUtils::GetDescendantChild(nsIContent* aContainer, nsIAtom* aTag)
|
||||
{
|
||||
dom::FlattenedChildIterator iter(aContainer);
|
||||
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
|
||||
if (child->Tag() == aTag) {
|
||||
if (child->IsXULElement(aTag)) {
|
||||
return child;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user