mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 20:37:31 +09:00
Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version. Ref: Bug 1324996
This commit is contained in:
parent
b6b2792a35
commit
ec1301a85d
7 changed files with 51 additions and 64 deletions
|
|
@ -2330,11 +2330,9 @@ EditorBase::CloneAttributes(Element* aDest,
|
||||||
RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes();
|
RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes();
|
||||||
while (RefPtr<Attr> attr = destAttributes->Item(0)) {
|
while (RefPtr<Attr> attr = destAttributes->Item(0)) {
|
||||||
if (destInBody) {
|
if (destInBody) {
|
||||||
RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
RemoveAttribute(aDest, attr->NodeInfo()->NameAtom());
|
||||||
attr->NodeName());
|
|
||||||
} else {
|
} else {
|
||||||
ErrorResult ignored;
|
aDest->UnsetAttr(kNameSpaceID_None, attr->NodeInfo()->NameAtom(), true);
|
||||||
aDest->RemoveAttribute(attr->NodeName(), ignored);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2346,13 +2344,13 @@ EditorBase::CloneAttributes(Element* aDest,
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
attr->GetValue(value);
|
attr->GetValue(value);
|
||||||
if (destInBody) {
|
if (destInBody) {
|
||||||
SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value,
|
||||||
attr->NodeName(), value, false);
|
false);
|
||||||
} else {
|
} else {
|
||||||
// The element is not inserted in the document yet, we don't want to put
|
// The element is not inserted in the document yet, we don't want to put
|
||||||
// a transaction on the UndoStack
|
// a transaction on the UndoStack
|
||||||
SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
|
SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value,
|
||||||
attr->NodeName(), value, true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3302,15 +3302,15 @@ HTMLEditRules::WillMakeList(Selection* aSelection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsCOMPtr<nsIDOMElement> curElement = do_QueryInterface(curNode);
|
nsCOMPtr<Element> curElement = do_QueryInterface(curNode);
|
||||||
NS_NAMED_LITERAL_STRING(typestr, "type");
|
|
||||||
if (aBulletType && !aBulletType->IsEmpty()) {
|
if (aBulletType && !aBulletType->IsEmpty()) {
|
||||||
rv = mHTMLEditor->SetAttribute(curElement, typestr, *aBulletType);
|
rv = mHTMLEditor->SetAttribute(curElement, nsGkAtoms::type,
|
||||||
|
*aBulletType);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = mHTMLEditor->RemoveAttribute(curElement, typestr);
|
rv = mHTMLEditor->RemoveAttribute(curElement, nsGkAtoms::type);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -4836,7 +4836,6 @@ HTMLEditRules::AlignBlockContents(nsIDOMNode* aNode,
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||||
NS_ENSURE_TRUE(node && alignType, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(node && alignType, NS_ERROR_NULL_POINTER);
|
||||||
nsCOMPtr<nsIContent> firstChild, lastChild;
|
nsCOMPtr<nsIContent> firstChild, lastChild;
|
||||||
nsCOMPtr<Element> divNode;
|
|
||||||
|
|
||||||
bool useCSS = mHTMLEditor->IsCSSEnabled();
|
bool useCSS = mHTMLEditor->IsCSSEnabled();
|
||||||
|
|
||||||
|
|
@ -4844,24 +4843,25 @@ HTMLEditRules::AlignBlockContents(nsIDOMNode* aNode,
|
||||||
firstChild = mHTMLEditor->GetFirstEditableChild(*node);
|
firstChild = mHTMLEditor->GetFirstEditableChild(*node);
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
lastChild = mHTMLEditor->GetLastEditableChild(*node);
|
lastChild = mHTMLEditor->GetLastEditableChild(*node);
|
||||||
NS_NAMED_LITERAL_STRING(attr, "align");
|
|
||||||
if (!firstChild) {
|
if (!firstChild) {
|
||||||
// this cell has no content, nothing to align
|
// this cell has no content, nothing to align
|
||||||
} else if (firstChild == lastChild &&
|
} else if (firstChild == lastChild &&
|
||||||
firstChild->IsHTMLElement(nsGkAtoms::div)) {
|
firstChild->IsHTMLElement(nsGkAtoms::div)) {
|
||||||
// the cell already has a div containing all of its content: just
|
// the cell already has a div containing all of its content: just
|
||||||
// act on this div.
|
// act on this div.
|
||||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(firstChild);
|
RefPtr<Element> divElem = firstChild->AsElement();
|
||||||
if (useCSS) {
|
if (useCSS) {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult rv = mHTMLEditor->SetAttributeOrEquivalent(divElem, attr,
|
nsresult rv = mHTMLEditor->SetAttributeOrEquivalent(divElem,
|
||||||
|
nsGkAtoms::align,
|
||||||
*alignType, false);
|
*alignType, false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult rv = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
nsresult rv = mHTMLEditor->SetAttribute(divElem, nsGkAtoms::align,
|
||||||
|
*alignType);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -4869,28 +4869,29 @@ HTMLEditRules::AlignBlockContents(nsIDOMNode* aNode,
|
||||||
} else {
|
} else {
|
||||||
// else we need to put in a div, set the alignment, and toss in all the children
|
// else we need to put in a div, set the alignment, and toss in all the children
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
divNode = mHTMLEditor->CreateNode(nsGkAtoms::div, node, 0);
|
RefPtr<Element> divElem = mHTMLEditor->CreateNode(nsGkAtoms::div, node, 0);
|
||||||
NS_ENSURE_STATE(divNode);
|
NS_ENSURE_STATE(divElem);
|
||||||
// set up the alignment on the div
|
// set up the alignment on the div
|
||||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(divNode);
|
|
||||||
if (useCSS) {
|
if (useCSS) {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
mHTMLEditor->SetAttributeOrEquivalent(divElem, attr, *alignType, false);
|
mHTMLEditor->SetAttributeOrEquivalent(divElem, nsGkAtoms::align,
|
||||||
|
*alignType, false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult rv = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
nsresult rv =
|
||||||
|
mHTMLEditor->SetAttribute(divElem, nsGkAtoms::align, *alignType);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// tuck the children into the end of the active div
|
// tuck the children into the end of the active div
|
||||||
while (lastChild && (lastChild != divNode)) {
|
while (lastChild && (lastChild != divElem)) {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult rv = mHTMLEditor->MoveNode(lastChild, divNode, 0);
|
nsresult rv = mHTMLEditor->MoveNode(lastChild, divElem, 0);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
lastChild = mHTMLEditor->GetLastEditableChild(*node);
|
lastChild = mHTMLEditor->GetLastEditableChild(*node);
|
||||||
|
|
@ -6510,9 +6511,9 @@ HTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove ID attribute on the paragraph we just created
|
// remove ID attribute on the paragraph we just created
|
||||||
nsCOMPtr<nsIDOMElement> rightElt = do_QueryInterface(rightPara);
|
RefPtr<Element> rightElt = rightPara->AsElement();
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
rv = mHTMLEditor->RemoveAttribute(rightElt, NS_LITERAL_STRING("id"));
|
rv = mHTMLEditor->RemoveAttribute(rightElt, nsGkAtoms::id);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// check both halves of para to see if we need mozBR
|
// check both halves of para to see if we need mozBR
|
||||||
|
|
@ -8387,18 +8388,18 @@ HTMLEditRules::RemoveAlignment(nsIDOMNode* aNode,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
} else if (isBlock || HTMLEditUtils::IsHR(child)) {
|
} else if (isBlock || HTMLEditUtils::IsHR(child)) {
|
||||||
// the current node is a block element
|
// the current node is a block element
|
||||||
nsCOMPtr<nsIDOMElement> curElem = do_QueryInterface(child);
|
nsCOMPtr<Element> curElem = do_QueryInterface(child);
|
||||||
if (HTMLEditUtils::SupportsAlignAttr(child)) {
|
if (HTMLEditUtils::SupportsAlignAttr(child)) {
|
||||||
// remove the ALIGN attribute if this element can have it
|
// remove the ALIGN attribute if this element can have it
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
rv = mHTMLEditor->RemoveAttribute(curElem, NS_LITERAL_STRING("align"));
|
rv = mHTMLEditor->RemoveAttribute(curElem, nsGkAtoms::align);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
if (useCSS) {
|
if (useCSS) {
|
||||||
if (HTMLEditUtils::IsTable(child) || HTMLEditUtils::IsHR(child)) {
|
if (HTMLEditUtils::IsTable(child) || HTMLEditUtils::IsHR(child)) {
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
rv = mHTMLEditor->SetAttributeOrEquivalent(curElem,
|
rv = mHTMLEditor->SetAttributeOrEquivalent(curElem,
|
||||||
NS_LITERAL_STRING("align"),
|
nsGkAtoms::align,
|
||||||
aAlignType, false);
|
aAlignType, false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -8518,21 +8519,17 @@ HTMLEditRules::AlignBlock(Element& aElement,
|
||||||
nsresult rv = RemoveAlignment(aElement.AsDOMNode(), aAlignType,
|
nsresult rv = RemoveAlignment(aElement.AsDOMNode(), aAlignType,
|
||||||
aContentsOnly == ContentsOnly::yes);
|
aContentsOnly == ContentsOnly::yes);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_NAMED_LITERAL_STRING(attr, "align");
|
|
||||||
if (htmlEditor->IsCSSEnabled()) {
|
if (htmlEditor->IsCSSEnabled()) {
|
||||||
// Let's use CSS alignment; we use margin-left and margin-right for tables
|
// Let's use CSS alignment; we use margin-left and margin-right for tables
|
||||||
// and text-align for other block-level elements
|
// and text-align for other block-level elements
|
||||||
rv = htmlEditor->SetAttributeOrEquivalent(
|
rv = htmlEditor->SetAttributeOrEquivalent(
|
||||||
static_cast<nsIDOMElement*>(aElement.AsDOMNode()),
|
&aElement, nsGkAtoms::align, aAlignType, false);
|
||||||
attr, aAlignType, false);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
} else {
|
} else {
|
||||||
// HTML case; this code is supposed to be called ONLY if the element
|
// HTML case; this code is supposed to be called ONLY if the element
|
||||||
// supports the align attribute but we'll never know...
|
// supports the align attribute but we'll never know...
|
||||||
if (HTMLEditUtils::SupportsAlignAttr(aElement.AsDOMNode())) {
|
if (HTMLEditUtils::SupportsAlignAttr(aElement.AsDOMNode())) {
|
||||||
rv = htmlEditor->SetAttribute(
|
rv = htmlEditor->SetAttribute(&aElement, nsGkAtoms::align, aAlignType);
|
||||||
static_cast<nsIDOMElement*>(aElement.AsDOMNode()),
|
|
||||||
attr, aAlignType);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2529,7 +2529,7 @@ HTMLEditor::CreateElementWithDefaults(const nsAString& aTagName)
|
||||||
|
|
||||||
// New call to use instead to get proper HTML element, bug 39919
|
// New call to use instead to get proper HTML element, bug 39919
|
||||||
nsCOMPtr<nsIAtom> realTagAtom = NS_Atomize(realTagName);
|
nsCOMPtr<nsIAtom> realTagAtom = NS_Atomize(realTagName);
|
||||||
nsCOMPtr<Element> newElement = CreateHTMLContent(realTagAtom);
|
RefPtr<Element> newElement = CreateHTMLContent(realTagAtom);
|
||||||
if (!newElement) {
|
if (!newElement) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -2561,8 +2561,7 @@ HTMLEditor::CreateElementWithDefaults(const nsAString& aTagName)
|
||||||
} else if (tagName.EqualsLiteral("td")) {
|
} else if (tagName.EqualsLiteral("td")) {
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
SetAttributeOrEquivalent(
|
SetAttributeOrEquivalent(
|
||||||
static_cast<nsIDOMElement*>(newElement->AsDOMNode()),
|
newElement, nsGkAtoms::valign, NS_LITERAL_STRING("top"), true);
|
||||||
NS_LITERAL_STRING("valign"), NS_LITERAL_STRING("top"), true);
|
|
||||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||||
}
|
}
|
||||||
// ADD OTHER TAGS HERE
|
// ADD OTHER TAGS HERE
|
||||||
|
|
|
||||||
|
|
@ -926,35 +926,30 @@ HTMLEditor::SetFinalSize(int32_t aX,
|
||||||
// we want one transaction only from a user's point of view
|
// we want one transaction only from a user's point of view
|
||||||
AutoEditBatch batchIt(this);
|
AutoEditBatch batchIt(this);
|
||||||
|
|
||||||
NS_NAMED_LITERAL_STRING(widthStr, "width");
|
|
||||||
NS_NAMED_LITERAL_STRING(heightStr, "height");
|
|
||||||
|
|
||||||
nsCOMPtr<Element> resizedObject = do_QueryInterface(mResizedObject);
|
|
||||||
NS_ENSURE_TRUE(resizedObject, );
|
|
||||||
if (mResizedObjectIsAbsolutelyPositioned) {
|
if (mResizedObjectIsAbsolutelyPositioned) {
|
||||||
if (setHeight) {
|
if (setHeight) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::top, y);
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::top, y);
|
||||||
}
|
}
|
||||||
if (setWidth) {
|
if (setWidth) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::left, x);
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::left, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsCSSEnabled() || mResizedObjectIsAbsolutelyPositioned) {
|
if (IsCSSEnabled() || mResizedObjectIsAbsolutelyPositioned) {
|
||||||
if (setWidth && mResizedObject->HasAttr(kNameSpaceID_None, nsGkAtoms::width)) {
|
if (setWidth && mResizedObject->HasAttr(kNameSpaceID_None, nsGkAtoms::width)) {
|
||||||
RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), widthStr);
|
RemoveAttribute(mResizedObject, nsGkAtoms::width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setHeight && mResizedObject->HasAttr(kNameSpaceID_None,
|
if (setHeight && mResizedObject->HasAttr(kNameSpaceID_None,
|
||||||
nsGkAtoms::height)) {
|
nsGkAtoms::height)) {
|
||||||
RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), heightStr);
|
RemoveAttribute(mResizedObject, nsGkAtoms::height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setWidth) {
|
if (setWidth) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::width,
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
|
||||||
width);
|
width);
|
||||||
}
|
}
|
||||||
if (setHeight) {
|
if (setHeight) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::height,
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -964,30 +959,30 @@ HTMLEditor::SetFinalSize(int32_t aX,
|
||||||
// triggering an immediate reflow; otherwise, we have problems
|
// triggering an immediate reflow; otherwise, we have problems
|
||||||
// with asynchronous reflow
|
// with asynchronous reflow
|
||||||
if (setWidth) {
|
if (setWidth) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::width,
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
|
||||||
width);
|
width);
|
||||||
}
|
}
|
||||||
if (setHeight) {
|
if (setHeight) {
|
||||||
mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::height,
|
mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
if (setWidth) {
|
if (setWidth) {
|
||||||
nsAutoString w;
|
nsAutoString w;
|
||||||
w.AppendInt(width);
|
w.AppendInt(width);
|
||||||
SetAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), widthStr, w);
|
SetAttribute(mResizedObject, nsGkAtoms::width, w);
|
||||||
}
|
}
|
||||||
if (setHeight) {
|
if (setHeight) {
|
||||||
nsAutoString h;
|
nsAutoString h;
|
||||||
h.AppendInt(height);
|
h.AppendInt(height);
|
||||||
SetAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), heightStr, h);
|
SetAttribute(mResizedObject, nsGkAtoms::height, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setWidth) {
|
if (setWidth) {
|
||||||
mCSSEditUtils->RemoveCSSProperty(*resizedObject, *nsGkAtoms::width,
|
mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::width,
|
||||||
EmptyString());
|
EmptyString());
|
||||||
}
|
}
|
||||||
if (setHeight) {
|
if (setHeight) {
|
||||||
mCSSEditUtils->RemoveCSSProperty(*resizedObject, *nsGkAtoms::height,
|
mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::height,
|
||||||
EmptyString());
|
EmptyString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -744,8 +744,6 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
||||||
// if we weren't passed an attribute, then we want to
|
// if we weren't passed an attribute, then we want to
|
||||||
// remove any matching inlinestyles entirely
|
// remove any matching inlinestyles entirely
|
||||||
if (!aAttribute || aAttribute->IsEmpty()) {
|
if (!aAttribute || aAttribute->IsEmpty()) {
|
||||||
NS_NAMED_LITERAL_STRING(styleAttr, "style");
|
|
||||||
NS_NAMED_LITERAL_STRING(classAttr, "class");
|
|
||||||
|
|
||||||
bool hasStyleAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
bool hasStyleAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||||
bool hasClassAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
bool hasClassAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
||||||
|
|
@ -754,14 +752,14 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
||||||
// just remove the element... We need to create above the element
|
// just remove the element... We need to create above the element
|
||||||
// a span that will carry those styles or class, then we can delete
|
// a span that will carry those styles or class, then we can delete
|
||||||
// the node.
|
// the node.
|
||||||
nsCOMPtr<Element> spanNode =
|
RefPtr<Element> spanNode =
|
||||||
InsertContainerAbove(&aNode, nsGkAtoms::span);
|
InsertContainerAbove(&aNode, nsGkAtoms::span);
|
||||||
NS_ENSURE_STATE(spanNode);
|
NS_ENSURE_STATE(spanNode);
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
CloneAttribute(styleAttr, spanNode->AsDOMNode(), aNode.AsDOMNode());
|
CloneAttribute(nsGkAtoms::style, spanNode, aNode.AsElement());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv =
|
rv =
|
||||||
CloneAttribute(classAttr, spanNode->AsDOMNode(), aNode.AsDOMNode());
|
CloneAttribute(nsGkAtoms::_class, spanNode, aNode.AsElement());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
nsresult rv = RemoveContainer(&aNode);
|
nsresult rv = RemoveContainer(&aNode);
|
||||||
|
|
|
||||||
|
|
@ -1422,9 +1422,9 @@ TextEditRules::CreateMozBR(nsIDOMNode* inParent,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// give it special moz attr
|
// give it special moz attr
|
||||||
nsCOMPtr<nsIDOMElement> brElem = do_QueryInterface(brNode);
|
nsCOMPtr<Element> brElem = do_QueryInterface(brNode);
|
||||||
if (brElem) {
|
if (brElem) {
|
||||||
rv = mTextEditor->SetAttribute(brElem, NS_LITERAL_STRING("type"),
|
rv = mTextEditor->SetAttribute(brElem, nsGkAtoms::type,
|
||||||
NS_LITERAL_STRING("_moz"));
|
NS_LITERAL_STRING("_moz"));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -311,9 +311,9 @@ TextEditor::UpdateMetaCharset(nsIDOMDocument* aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
// set attribute to <original prefix> charset=text/html
|
// set attribute to <original prefix> charset=text/html
|
||||||
nsCOMPtr<nsIDOMElement> metaElement = do_QueryInterface(metaNode);
|
RefPtr<Element> metaElement = metaNode->AsElement();
|
||||||
MOZ_ASSERT(metaElement);
|
MOZ_ASSERT(metaElement);
|
||||||
rv = EditorBase::SetAttribute(metaElement, NS_LITERAL_STRING("content"),
|
rv = EditorBase::SetAttribute(metaElement, nsGkAtoms::content,
|
||||||
Substring(originalStart, start) +
|
Substring(originalStart, start) +
|
||||||
charsetEquals +
|
charsetEquals +
|
||||||
NS_ConvertASCIItoUTF16(aCharacterSet));
|
NS_ConvertASCIItoUTF16(aCharacterSet));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue