Bug 1190172 part 3 - Remove old method variants; r=ehsan

This commit is contained in:
Aryeh Gregor 2016-04-23 19:25:54 +09:00
Родитель 3b6aac3ba5
Коммит 516d35791d
2 изменённых файлов: 6 добавлений и 36 удалений

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

@ -670,10 +670,6 @@ protected:
nsIContent** aOutLeftNode = nullptr,
nsIContent** aOutRightNode = nullptr);
nsresult ApplyDefaultProperties();
nsresult RemoveStyleInside(nsIDOMNode *aNode,
nsIAtom *aProperty,
const nsAString *aAttribute,
const bool aChildrenOnly = false);
nsresult RemoveStyleInside(nsIContent& aNode,
nsIAtom* aProperty,
const nsAString* aAttribute,
@ -685,7 +681,6 @@ protected:
bool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);
nsresult RemoveBlockContainer(nsIDOMNode *inNode);

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

@ -673,7 +673,7 @@ nsHTMLEditor::ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
// selection.
nsAutoTrackDOMPoint tracker(mRangeUpdater,
address_of(newSelParent), &newSelOffset);
res = RemoveStyleInside(GetAsDOMNode(leftNode), aProperty, aAttribute);
res = RemoveStyleInside(*leftNode, aProperty, aAttribute);
NS_ENSURE_SUCCESS(res, res);
}
// reset our node offset values to the resulting new sel point
@ -710,19 +710,6 @@ nsresult nsHTMLEditor::ApplyDefaultProperties()
return res;
}
nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
// null here means remove all properties
nsIAtom *aProperty,
const nsAString *aAttribute,
const bool aChildrenOnly)
{
NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
NS_ENSURE_STATE(content);
return RemoveStyleInside(*content, aProperty, aAttribute, aChildrenOnly);
}
nsresult
nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
nsIAtom* aProperty,
@ -834,17 +821,6 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
return NS_OK;
}
bool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode,
const nsAString *aAttribute)
{
NS_ENSURE_TRUE(aNode && aAttribute, false); // ooops
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
NS_ENSURE_TRUE(content, false); // ooops
return IsOnlyAttribute(content, *aAttribute);
}
bool
nsHTMLEditor::IsOnlyAttribute(const nsIContent* aContent,
const nsAString& aAttribute)
@ -1353,21 +1329,21 @@ nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
// Not the easy case. Range not contained in single text node.
nsCOMPtr<nsIContentIterator> iter = NS_NewContentSubtreeIterator();
nsTArray<nsCOMPtr<nsINode>> arrayOfNodes;
nsTArray<OwningNonNull<nsIContent>> arrayOfNodes;
// Iterate range and build up array
for (iter->Init(range); !iter->IsDone(); iter->Next()) {
nsCOMPtr<nsINode> node = iter->GetCurrentNode();
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
if (IsEditable(node)) {
arrayOfNodes.AppendElement(node);
if (IsEditable(node) && node->IsContent()) {
arrayOfNodes.AppendElement(*node->AsContent());
}
}
// Loop through the list, remove the property on each node
for (auto& node : arrayOfNodes) {
res = RemoveStyleInside(GetAsDOMNode(node), aProperty, aAttribute);
res = RemoveStyleInside(node, aProperty, aAttribute);
NS_ENSURE_SUCCESS(res, res);
if (IsCSSEnabled() &&
mHTMLCSSUtils->IsCSSEditableProperty(node, aProperty,
@ -1382,8 +1358,7 @@ nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
// "inverting" the style
mHTMLCSSUtils->IsCSSInvertible(*aProperty, aAttribute)) {
NS_NAMED_LITERAL_STRING(value, "-moz-editor-invert-value");
SetInlinePropertyOnNode(*node->AsContent(), *aProperty,
aAttribute, value);
SetInlinePropertyOnNode(node, *aProperty, aAttribute, value);
}
}
}