Bug 1158452. Pass in the right node when messing with font sizes in editor. r=ehsan
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 27 Apr 2015 15:29:22 -0400
changeset 241271 ef79ced353a60eb76ad7cfae39b396b858e57af7
parent 241270 92cfbfb1a4648e5decf3b8cb9429e9e2f66bb149
child 241272 59a85976b7fd35fe09feb619f2adb5c4d9f4ccf0
push id59067
push userbzbarsky@mozilla.com
push dateMon, 27 Apr 2015 19:39:38 +0000
treeherdermozilla-inbound@ef79ced353a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1158452
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1158452. Pass in the right node when messing with font sizes in editor. r=ehsan
editor/libeditor/crashtests/1158452.html
editor/libeditor/crashtests/crashtests.list
editor/libeditor/nsHTMLEditorStyle.cpp
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/crashtests/1158452.html
@@ -0,0 +1,10 @@
+
+<div>
+<div>
+aaaaaaa
+</script>
+<script type="text/javascript"> 
+document.designMode = "on"
+window.getSelection().modify("extend", "backward", "line")
+document.execCommand("increasefontsize","",null);
+</script>
--- a/editor/libeditor/crashtests/crashtests.list
+++ b/editor/libeditor/crashtests/crashtests.list
@@ -56,8 +56,9 @@ load 768748.html
 load 768765.html
 needs-focus load 771749.html
 load 772282.html
 load 776323.html
 needs-focus load 793866.html
 load 1057677.html
 needs-focus load 1128787.html
 load 1134545.html
+load 1158452.html
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -1497,21 +1497,18 @@ nsHTMLEditor::RelativeFontChange(FontSiz
       // the subtree iterator works - it will not have reported them).
       if (IsTextNode(startNode) && IsEditable(startNode)) {
         res = RelativeFontChangeOnTextNode(aDir == FontSize::incr ? +1 : -1,
             static_cast<nsIDOMCharacterData*>(startNode->AsDOMNode()),
             range->StartOffset(), startNode->Length());
         NS_ENSURE_SUCCESS(res, res);
       }
       if (IsTextNode(endNode) && IsEditable(endNode)) {
-        nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(endNode);
-        int32_t endOffset;
-        range->GetEndOffset(&endOffset);
         res = RelativeFontChangeOnTextNode(aDir == FontSize::incr ? +1 : -1,
-            static_cast<nsIDOMCharacterData*>(startNode->AsDOMNode()),
+            static_cast<nsIDOMCharacterData*>(endNode->AsDOMNode()),
             0, range->EndOffset());
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
 
   return NS_OK;
 }