зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1190172 part 5 - Clean up nsHTMLEditor::NodeIsProperty; r=ehsan
This commit is contained in:
Родитель
8aec477e68
Коммит
4965f76e10
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче