зеркало из https://github.com/mozilla/pjs.git
Bug 742884 - Part c: Cleanup nsHTMLEditRules::GetListState; r=ehsan
This commit is contained in:
Родитель
c7be926630
Коммит
6f0823bf85
|
@ -685,41 +685,41 @@ nsHTMLEditRules::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
|
|||
nsresult res = GetListActionNodes(arrayOfNodes, false, true);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// examine list type for nodes in selection
|
||||
// Examine list type for nodes in selection.
|
||||
PRInt32 listCount = arrayOfNodes.Count();
|
||||
PRInt32 i;
|
||||
for (i=listCount-1; i>=0; i--)
|
||||
{
|
||||
nsIDOMNode* curNode = arrayOfNodes[i];
|
||||
|
||||
if (nsHTMLEditUtils::IsUnorderedList(curNode))
|
||||
for (PRInt32 i = listCount - 1; i >= 0; --i) {
|
||||
nsIDOMNode* curDOMNode = arrayOfNodes[i];
|
||||
nsCOMPtr<dom::Element> curElement = do_QueryInterface(curDOMNode);
|
||||
|
||||
if (!curElement) {
|
||||
bNonList = true;
|
||||
} else if (curElement->IsHTML(nsGkAtoms::ul)) {
|
||||
*aUL = true;
|
||||
else if (nsHTMLEditUtils::IsOrderedList(curNode))
|
||||
} else if (curElement->IsHTML(nsGkAtoms::ol)) {
|
||||
*aOL = true;
|
||||
else if (nsEditor::NodeIsType(curNode, nsEditProperty::li))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
PRInt32 offset;
|
||||
res = nsEditor::GetNodeLocation(curNode, address_of(parent), &offset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (nsHTMLEditUtils::IsUnorderedList(parent))
|
||||
*aUL = true;
|
||||
else if (nsHTMLEditUtils::IsOrderedList(parent))
|
||||
*aOL = true;
|
||||
}
|
||||
else if (nsEditor::NodeIsType(curNode, nsEditProperty::dl) ||
|
||||
nsEditor::NodeIsType(curNode, nsEditProperty::dt) ||
|
||||
nsEditor::NodeIsType(curNode, nsEditProperty::dd) )
|
||||
{
|
||||
} else if (curElement->IsHTML(nsGkAtoms::li)) {
|
||||
if (nsINode* parent = curElement->GetElementParent()) {
|
||||
if (parent->AsElement()->IsHTML(nsGkAtoms::ul)) {
|
||||
*aUL = true;
|
||||
} else if (parent->AsElement()->IsHTML(nsGkAtoms::ol)) {
|
||||
*aOL = true;
|
||||
}
|
||||
}
|
||||
} else if (curElement->IsHTML(nsGkAtoms::dl) ||
|
||||
curElement->IsHTML(nsGkAtoms::dt) ||
|
||||
curElement->IsHTML(nsGkAtoms::dd)) {
|
||||
*aDL = true;
|
||||
} else {
|
||||
bNonList = true;
|
||||
}
|
||||
else bNonList = true;
|
||||
}
|
||||
|
||||
// hokey arithmetic with booleans
|
||||
if ( (*aUL + *aOL + *aDL + bNonList) > 1) *aMixed = true;
|
||||
|
||||
return res;
|
||||
if ((*aUL + *aOL + *aDL + bNonList) > 1) {
|
||||
*aMixed = true;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
Загрузка…
Ссылка в новой задаче