Bug 1190172 part 5 - Clean up nsHTMLEditor::NodeIsProperty; r=ehsan

--HG--
extra : rebase_source : 164836d19a9b9f3f2efe51276483b0d994245526
This commit is contained in:
Aryeh Gregor 2016-04-19 05:42:00 +02:00
Родитель 10a6476077
Коммит 2702783e0e
2 изменённых файлов: 7 добавлений и 12 удалений

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

@ -677,7 +677,7 @@ protected:
nsresult RemoveInlinePropertyImpl(nsIAtom* aProperty,
const nsAString* aAttribute);
bool NodeIsProperty(nsIDOMNode *aNode);
bool NodeIsProperty(nsINode& aNode);
bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);

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

@ -586,7 +586,7 @@ nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
// node is href - test if really <a href=...
(aProperty == nsGkAtoms::href && nsHTMLEditUtils::IsLink(node)) ||
// or node is any prop, and we asked to split them all
(!aProperty && NodeIsProperty(GetAsDOMNode(node))) ||
(!aProperty && NodeIsProperty(node)) ||
// or the style is specified in the style attribute
isSet) {
// Found a style node we need to split
@ -684,16 +684,11 @@ nsHTMLEditor::ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
return NS_OK;
}
bool nsHTMLEditor::NodeIsProperty(nsIDOMNode *aNode)
bool
nsHTMLEditor::NodeIsProperty(nsINode& aNode)
{
NS_ENSURE_TRUE(aNode, false);
if (!IsContainer(aNode)) return false;
if (!IsEditable(aNode)) return false;
if (IsBlockNode(aNode)) return false;
if (NodeIsType(aNode, nsGkAtoms::a)) {
return false;
}
return true;
return IsContainer(&aNode) && IsEditable(&aNode) && !IsBlockNode(&aNode) &&
!aNode.IsHTMLElement(nsGkAtoms::a);
}
nsresult nsHTMLEditor::ApplyDefaultProperties()
@ -740,7 +735,7 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
// and for named anchors
(aProperty == nsGkAtoms::name && nsHTMLEditUtils::IsNamedAnchor(&aNode)) ||
// or node is any prop and we asked for that
(!aProperty && NodeIsProperty(aNode.AsDOMNode()))
(!aProperty && NodeIsProperty(aNode))
)
) {
nsresult res;