зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
3d7bbfe6ad
Коммит
da568364d2
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче