зеркало из https://github.com/mozilla/gecko-dev.git
Bug 862118 - Remove GetAttributeToModifyOnNode r=ehsan
This commit is contained in:
Родитель
94e425874b
Коммит
23d55db958
|
@ -715,135 +715,6 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
return mRules->DidDoAction(selection, &ruleInfo, rv);
|
||||
}
|
||||
|
||||
// returns empty string if nothing to modify on node
|
||||
nsresult
|
||||
nsHTMLEditor::GetAttributeToModifyOnNode(nsIDOMNode *aNode, nsAString &aAttr)
|
||||
{
|
||||
aAttr.Truncate();
|
||||
|
||||
NS_NAMED_LITERAL_STRING(srcStr, "src");
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> nodeAsImage = do_QueryInterface(aNode);
|
||||
if (nodeAsImage)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> nodeAsAnchor = do_QueryInterface(aNode);
|
||||
if (nodeAsAnchor)
|
||||
{
|
||||
aAttr.AssignLiteral("href");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(bgStr, "background");
|
||||
nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
|
||||
if (element && element->IsHTML(nsGkAtoms::body)) {
|
||||
aAttr = bgStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (element && element->IsHTML(nsGkAtoms::table)) {
|
||||
aAttr = bgStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (element && element->IsHTML(nsGkAtoms::tr)) {
|
||||
aAttr = bgStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (element &&
|
||||
(element->IsHTML(nsGkAtoms::td) || element->IsHTML(nsGkAtoms::th))) {
|
||||
aAttr = bgStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLScriptElement> nodeAsScript = do_QueryInterface(aNode);
|
||||
if (nodeAsScript)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLEmbedElement> nodeAsEmbed = do_QueryInterface(aNode);
|
||||
if (nodeAsEmbed)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLObjectElement> nodeAsObject = do_QueryInterface(aNode);
|
||||
if (nodeAsObject)
|
||||
{
|
||||
aAttr.AssignLiteral("data");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLLinkElement> nodeAsLink = do_QueryInterface(aNode);
|
||||
if (nodeAsLink)
|
||||
{
|
||||
// Test if the link has a rel value indicating it to be a stylesheet
|
||||
nsAutoString linkRel;
|
||||
if (NS_SUCCEEDED(nodeAsLink->GetRel(linkRel)) && !linkRel.IsEmpty())
|
||||
{
|
||||
nsReadingIterator<PRUnichar> start;
|
||||
nsReadingIterator<PRUnichar> end;
|
||||
nsReadingIterator<PRUnichar> current;
|
||||
|
||||
linkRel.BeginReading(start);
|
||||
linkRel.EndReading(end);
|
||||
|
||||
// Walk through space delimited string looking for "stylesheet"
|
||||
for (current = start; current != end; ++current)
|
||||
{
|
||||
// Ignore whitespace
|
||||
if (nsCRT::IsAsciiSpace(*current))
|
||||
continue;
|
||||
|
||||
// Grab the next space delimited word
|
||||
nsReadingIterator<PRUnichar> startWord = current;
|
||||
do {
|
||||
++current;
|
||||
} while (current != end && !nsCRT::IsAsciiSpace(*current));
|
||||
|
||||
// Store the link for fix up if it says "stylesheet"
|
||||
if (Substring(startWord, current).LowerCaseEqualsLiteral("stylesheet"))
|
||||
{
|
||||
aAttr.AssignLiteral("href");
|
||||
return NS_OK;
|
||||
}
|
||||
if (current == end)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLFrameElement> nodeAsFrame = do_QueryInterface(aNode);
|
||||
if (nodeAsFrame)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLIFrameElement> nodeAsIFrame = do_QueryInterface(aNode);
|
||||
if (nodeAsIFrame)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> nodeAsInput = do_QueryInterface(aNode);
|
||||
if (nodeAsInput)
|
||||
{
|
||||
aAttr = srcStr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::AddInsertionListener(nsIContentFilter *aListener)
|
||||
{
|
||||
|
|
|
@ -565,7 +565,6 @@ protected:
|
|||
nsIDOMNode **aTargetNode,
|
||||
int32_t *aTargetOffset,
|
||||
bool *aDoContinue);
|
||||
nsresult GetAttributeToModifyOnNode(nsIDOMNode *aNode, nsAString &aAttrib);
|
||||
|
||||
bool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nullptr);
|
||||
nsresult StripFormattingNodes(nsIDOMNode *aNode, bool aOnlyList = false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче