mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 718504 - Remove some GetChildAt callers; r=smaug
This commit is contained in:
parent
7b3abf90b0
commit
e3e8b35541
@ -1345,7 +1345,7 @@ nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
|
||||
if (foundItemContent->GetChildCount() > 1)
|
||||
return true; // Treat multiple child nodes as non-empty
|
||||
|
||||
nsIContent *innerItemContent = foundItemContent->GetChildAt(0);
|
||||
nsIContent *innerItemContent = foundItemContent->GetFirstChild();
|
||||
if (innerItemContent && !innerItemContent->TextIsOnlyWhitespace())
|
||||
return true;
|
||||
|
||||
|
@ -378,6 +378,11 @@ public:
|
||||
*/
|
||||
mozilla::dom::Element* AsElement();
|
||||
|
||||
/**
|
||||
* Return if this node has any children.
|
||||
*/
|
||||
bool HasChildren() const { return !!mFirstChild; }
|
||||
|
||||
/**
|
||||
* Get the number of children
|
||||
* @return the number of children
|
||||
|
@ -2916,14 +2916,12 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
||||
bool aForward)
|
||||
{
|
||||
PRInt32 tabIndex, childTabIndex;
|
||||
nsIContent *child;
|
||||
|
||||
PRUint32 count = aParent->GetChildCount();
|
||||
|
||||
if (aForward) {
|
||||
tabIndex = 0;
|
||||
for (PRUint32 index = 0; index < count; index++) {
|
||||
child = aParent->GetChildAt(index);
|
||||
for (nsIContent* child = aParent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
childTabIndex = GetNextTabIndex(child, aCurrentTabIndex, aForward);
|
||||
if (childTabIndex > aCurrentTabIndex && childTabIndex != tabIndex) {
|
||||
tabIndex = (tabIndex == 0 || childTabIndex < tabIndex) ? childTabIndex : tabIndex;
|
||||
@ -2939,8 +2937,9 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
||||
}
|
||||
else { /* !aForward */
|
||||
tabIndex = 1;
|
||||
for (PRUint32 index = 0; index < count; index++) {
|
||||
child = aParent->GetChildAt(index);
|
||||
for (nsIContent* child = aParent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
childTabIndex = GetNextTabIndex(child, aCurrentTabIndex, aForward);
|
||||
if ((aCurrentTabIndex == 0 && childTabIndex > tabIndex) ||
|
||||
(childTabIndex < aCurrentTabIndex && childTabIndex > tabIndex)) {
|
||||
@ -2996,23 +2995,18 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
|
||||
return nsnull;
|
||||
|
||||
Element *rootElement = aDocument->GetRootElement();
|
||||
if (rootElement) {
|
||||
if (aCheckVisibility && !rootElement->GetPrimaryFrame()) {
|
||||
return nsnull;
|
||||
}
|
||||
if (!rootElement) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Finally, check if this is a frameset
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
|
||||
if (htmlDoc) {
|
||||
PRUint32 childCount = rootElement->GetChildCount();
|
||||
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||
nsIContent *childContent = rootElement->GetChildAt(i);
|
||||
nsINodeInfo *ni = childContent->NodeInfo();
|
||||
if (childContent->IsHTML() &&
|
||||
ni->Equals(nsGkAtoms::frameset))
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
if (aCheckVisibility && !rootElement->GetPrimaryFrame()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Finally, check if this is a frameset
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
|
||||
if (htmlDoc && aDocument->GetHtmlChildElement(nsGkAtoms::frameset)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return rootElement;
|
||||
|
@ -1355,9 +1355,9 @@ nsPrintEngine::MapContentForPO(nsPrintObject* aPO,
|
||||
}
|
||||
|
||||
// walk children content
|
||||
PRUint32 count = aContent->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
nsIContent *child = aContent->GetChildAt(i);
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
MapContentForPO(aPO, child);
|
||||
}
|
||||
}
|
||||
@ -2763,13 +2763,11 @@ bool nsPrintEngine::HasFramesetChild(nsIContent* aContent)
|
||||
return false;
|
||||
}
|
||||
|
||||
PRUint32 numChildren = aContent->GetChildCount();
|
||||
|
||||
// do a breadth search across all siblings
|
||||
for (PRUint32 i = 0; i < numChildren; ++i) {
|
||||
nsIContent *child = aContent->GetChildAt(i);
|
||||
if (child->Tag() == nsGkAtoms::frameset &&
|
||||
child->IsHTML()) {
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTML(nsGkAtoms::frameset)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1671,10 +1671,9 @@ nsXULPopupManager::UpdateMenuItems(nsIContent* aPopup)
|
||||
// command attribute. If so, then several attributes must potentially be updated.
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(aPopup->GetDocument()));
|
||||
PRUint32 count = aPopup->GetChildCount();
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIContent> grandChild = aPopup->GetChildAt(i);
|
||||
|
||||
for (nsCOMPtr<nsIContent> grandChild = aPopup->GetFirstChild();
|
||||
grandChild;
|
||||
grandChild = grandChild->GetNextSibling()) {
|
||||
if (grandChild->NodeInfo()->Equals(nsGkAtoms::menuitem, kNameSpaceID_XUL)) {
|
||||
// See if we have a command attribute.
|
||||
nsAutoString command;
|
||||
|
@ -289,8 +289,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
|
||||
PRUint32 childCount = parent->GetChildCount();
|
||||
bool didAppend = false;
|
||||
while (node->GetChildCount()) {
|
||||
nsCOMPtr<nsIContent> child = node->GetChildAt(0);
|
||||
while (node->HasChildren()) {
|
||||
nsCOMPtr<nsIContent> child = node->GetFirstChild();
|
||||
rv = node->RemoveChildAt(0, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = parent->AppendChildTo(child, false);
|
||||
@ -517,8 +517,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
aBuilder->GetDocument());
|
||||
|
||||
PRUint32 pos = foster->IndexOf(table);
|
||||
|
||||
nsIContent* previousSibling = foster->GetChildAt(pos - 1);
|
||||
|
||||
nsIContent* previousSibling = table->GetPreviousSibling();
|
||||
if (previousSibling && previousSibling->IsNodeOfType(nsINode::eTEXT)) {
|
||||
return AppendTextToTextNode(buffer,
|
||||
length,
|
||||
|
@ -855,11 +855,11 @@ nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
|
||||
if (!parent)
|
||||
break;
|
||||
|
||||
nsIContent *parentsFirstChild = parent->GetChildAt(0);
|
||||
nsIContent* parentsFirstChild = parent->GetFirstChild();
|
||||
|
||||
// We don't want to look at a whitespace-only first child
|
||||
if (parentsFirstChild && parentsFirstChild->TextIsOnlyWhitespace()) {
|
||||
parentsFirstChild = parent->GetChildAt(1);
|
||||
parentsFirstChild = parentsFirstChild->GetNextSibling();
|
||||
}
|
||||
|
||||
if (parentsFirstChild != startContent) {
|
||||
|
@ -884,7 +884,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
nsIContent* parent = content->GetParent();
|
||||
// XXXzeniko hiding the first toolbar will result in an unwanted margin
|
||||
if (parent && parent->GetChildAt(0) == content) {
|
||||
if (parent && parent->GetFirstChild() == content) {
|
||||
aState = 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user