summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/HTMLEditorObjectResizer.cpp
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-04 11:16:59 +0200
committerGitHub <noreply@github.com>2020-08-04 11:16:59 +0200
commit267d32f4f3360bb583486391d3d9cb620458c5f0 (patch)
treed733f8d48ccb9e697603c41c140c7e2b807cecae /editor/libeditor/HTMLEditorObjectResizer.cpp
parent7c6d822be257898a3afdf64c082ba62b357f10f4 (diff)
parent5f6ecd756b06e40c889ddab70356d7033336763b (diff)
downloadUXP-267d32f4f3360bb583486391d3d9cb620458c5f0.tar
UXP-267d32f4f3360bb583486391d3d9cb620458c5f0.tar.gz
UXP-267d32f4f3360bb583486391d3d9cb620458c5f0.tar.lz
UXP-267d32f4f3360bb583486391d3d9cb620458c5f0.tar.xz
UXP-267d32f4f3360bb583486391d3d9cb620458c5f0.zip
Merge pull request #1623 from g4jc/libeditor_patch
Improve Performance of libeditor
Diffstat (limited to 'editor/libeditor/HTMLEditorObjectResizer.cpp')
-rw-r--r--editor/libeditor/HTMLEditorObjectResizer.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/editor/libeditor/HTMLEditorObjectResizer.cpp b/editor/libeditor/HTMLEditorObjectResizer.cpp
index 111a3f975..8ed5b6e4d 100644
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -926,35 +926,30 @@ HTMLEditor::SetFinalSize(int32_t aX,
// we want one transaction only from a user's point of view
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 (setHeight) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::top, y);
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::top, y);
}
if (setWidth) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::left, x);
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::left, x);
}
}
if (IsCSSEnabled() || mResizedObjectIsAbsolutelyPositioned) {
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,
nsGkAtoms::height)) {
- RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), heightStr);
+ RemoveAttribute(mResizedObject, nsGkAtoms::height);
}
if (setWidth) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::width,
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
width);
}
if (setHeight) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::height,
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
height);
}
} else {
@@ -964,30 +959,30 @@ HTMLEditor::SetFinalSize(int32_t aX,
// triggering an immediate reflow; otherwise, we have problems
// with asynchronous reflow
if (setWidth) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::width,
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::width,
width);
}
if (setHeight) {
- mCSSEditUtils->SetCSSPropertyPixels(*resizedObject, *nsGkAtoms::height,
+ mCSSEditUtils->SetCSSPropertyPixels(*mResizedObject, *nsGkAtoms::height,
height);
}
if (setWidth) {
nsAutoString w;
w.AppendInt(width);
- SetAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), widthStr, w);
+ SetAttribute(mResizedObject, nsGkAtoms::width, w);
}
if (setHeight) {
nsAutoString h;
h.AppendInt(height);
- SetAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject)), heightStr, h);
+ SetAttribute(mResizedObject, nsGkAtoms::height, h);
}
if (setWidth) {
- mCSSEditUtils->RemoveCSSProperty(*resizedObject, *nsGkAtoms::width,
+ mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::width,
EmptyString());
}
if (setHeight) {
- mCSSEditUtils->RemoveCSSProperty(*resizedObject, *nsGkAtoms::height,
+ mCSSEditUtils->RemoveCSSProperty(*mResizedObject, *nsGkAtoms::height,
EmptyString());
}
}