Backout changeset b3a4fcd6e166 (bug 1190172 part 4)

--HG--
extra : rebase_source : ea006b33268fb46c0aac352a8ca63194102c51f8
This commit is contained in:
Masayuki Nakano 2016-04-23 20:01:03 +09:00
parent a82e07913d
commit 4656c119c1
2 changed files with 21 additions and 0 deletions

View File

@ -678,6 +678,7 @@ protected:
const nsAString* aAttribute);
bool NodeIsProperty(nsIDOMNode *aNode);
bool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);

View File

@ -848,6 +848,26 @@ nsHTMLEditor::IsOnlyAttribute(const nsIContent* aContent,
return true;
}
bool nsHTMLEditor::HasAttr(nsIDOMNode* aNode,
const nsAString* aAttribute)
{
NS_ENSURE_TRUE(aNode, false);
if (!aAttribute || aAttribute->IsEmpty()) {
// everybody has the 'null' attribute
return true;
}
// get element
nsCOMPtr<dom::Element> element = do_QueryInterface(aNode);
NS_ENSURE_TRUE(element, false);
nsCOMPtr<nsIAtom> atom = NS_Atomize(*aAttribute);
NS_ENSURE_TRUE(atom, false);
return element->HasAttr(kNameSpaceID_None, atom);
}
nsresult
nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange* inRange)
{