Bug 448329. Make selection code more robust when the selection boundary is not in a block. r+sr=peterv

--HG--
extra : rebase_source : dc75af58f6a093298d58197c31552fac1c4b5b1d
This commit is contained in:
Mats Palmgren 2009-02-19 20:55:40 +13:00
Родитель 5b97511c94
Коммит 0c917424d9
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -843,6 +843,9 @@ nsHTMLCSSUtils::GetCSSPropertyAtom(nsCSSEditableProperty aProperty, nsIAtom ** a
case eCSSEditableProperty_width:
*aAtom = nsEditProperty::cssWidth;
break;
case eCSSEditableProperty_NONE:
// intentionally empty
break;
}
}
}
@ -1406,6 +1409,11 @@ nsHTMLCSSUtils::GetElementContainerOrSelf(nsIDOMNode * aNode, nsIDOMElement ** a
nsresult res;
res = node->GetNodeType(&type);
if (NS_FAILED(res)) return res;
if (nsIDOMNode::DOCUMENT_NODE == type) {
return NS_ERROR_NULL_POINTER;
}
// loop until we find an element
while (node && nsIDOMNode::ELEMENT_NODE != type) {
parentNode = node;

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

@ -2365,7 +2365,8 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P
PRInt32 offset;
res = GetStartNodeAndOffset(selection, address_of(parent), &offset);
if (NS_FAILED(res)) return res;
if (!parent) return NS_ERROR_NULL_POINTER;
// is the selection collapsed?
PRBool bCollapsed;
res = selection->GetIsCollapsed(&bCollapsed);
@ -2399,6 +2400,8 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P
nsCOMPtr<nsIDOMNode> blockParent = nodeToExamine;
if (!isBlock) {
blockParent = GetBlockNodeParent(nodeToExamine);
if (!blockParent)
return NS_OK;
}
// Make sure to not walk off onto the Document node