Bug 620906 - Back out part of bug 289384 to make sure that scrollbars work in CKEditor fields again; r=roc a=blocking-final+
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 11 Jan 2011 16:00:44 -0500
changeset 60317 985c54525bc0c39d7e624c68ca2966bd4456b804
parent 60316 635f0075c1840533991994bcdfe381dea43648f5
child 60318 556f7620b78fdd0d5b0714cc4b6fc472258d438d
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking-final
bugs620906, 289384
milestone2.0b10pre
Bug 620906 - Back out part of bug 289384 to make sure that scrollbars work in CKEditor fields again; r=roc a=blocking-final+
content/html/document/src/nsHTMLDocument.cpp
editor/libeditor/html/tests/Makefile.in
editor/libeditor/html/tests/test_bug620906.html
editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
layout/style/contenteditable.css
layout/style/designmode.css
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -3372,22 +3372,16 @@ nsHTMLDocument::EditingStateChanged()
       // contentEditable is being turned on (and designMode is off).
       updateState = PR_FALSE;
     }
 
     rv = presShell->SetAgentStyleSheets(agentSheets);
     NS_ENSURE_SUCCESS(rv, rv);
 
     presShell->ReconstructStyleData();
-
-    if (designMode) {
-      // We need to flush styles here because we're setting an XBL binding in
-      // designmode.css.
-      FlushPendingNotifications(Flush_Style);
-    }
   }
 
   mEditingState = newState;
 
   if (makeWindowEditable) {
     // Set the editor to not insert br's on return when in p
     // elements by default.
     // XXX Do we only want to do this for designMode?
--- a/editor/libeditor/html/tests/Makefile.in
+++ b/editor/libeditor/html/tests/Makefile.in
@@ -64,16 +64,17 @@ include $(topsrcdir)/config/rules.mk
 		test_bug550434.html \
 		test_bug551704.html \
 		test_bug592592.html \
 		test_bug597784.html \
 		test_bug599322.html \
 		test_bug607584.html \
 		test_bug611182.html \
 		test_bug612447.html \
+		test_bug620906.html \
 		test_CF_HTML_clipboard.html \
 		test_contenteditable_focus.html \
 		test_contenteditable_text_input_handling.html \
 		test_htmleditor_keyevent_handling.html \
 		test_select_all_without_body.html \
 		file_select_all_without_body.html \
 		test_root_element_replacement.html \
 		$(NULL)
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/html/tests/test_bug620906.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=620906
+-->
+<head>
+  <title>Test for Bug 620906</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620906">Mozilla Bug 620906</a>
+<p id="display"></p>
+<div id="content">
+  <iframe src="data:text/html,
+    <body contenteditable
+          onmousedown='
+            document.designMode=&quot;on&quot;;
+            document.designMode=&quot;off&quot;;
+          '
+    >
+      <div style='height: 1000px;'></div>
+    </body>">
+    </iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 620906 **/
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(function() {
+  var iframe = document.querySelector("iframe");
+  is(iframe.contentWindow.scrollY, 0, "Sanity check");
+  var rect = iframe.getBoundingClientRect();
+  setTimeout(function() {
+    synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
+    setTimeout(function() {
+      isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work");
+      SimpleTest.finish();
+    }, 0);
+  }, 0);
+});
+
+</script>
+</pre>
+</body>
+</html>
--- a/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
+++ b/editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html
@@ -165,45 +165,45 @@ function runTests()
     check(aDescription + "Backspace", true, true, true);
 
     reset("");
     synthesizeKey("VK_BACK_SPACE", { shiftKey: true });
     check(aDescription + "Shift+Backspace", true, true, true);
 
     reset("");
     synthesizeKey("VK_BACK_SPACE", { ctrlKey: true });
-    check(aDescription + "Ctrl+Backspace", true, true, kIsWin || aIsReadonly);
+    check(aDescription + "Ctrl+Backspace", true, true, aIsReadonly);
 
     reset("");
     synthesizeKey("VK_BACK_SPACE", { altKey: true });
-    check(aDescription + "Alt+Backspace", true, true, kIsLinux ? aIsReadonly : true);
+    check(aDescription + "Alt+Backspace", true, true, aIsReadonly);
 
     reset("");
     synthesizeKey("VK_BACK_SPACE", { metaKey: true });
     check(aDescription + "Meta+Backspace", true, true, aIsReadonly);
 
     // Delete key:
     //   If editor is readonly, it doesn't consume.
     //   If editor is editable, delete is consumed.
     //   Otherwise, editor doesn't consume the event.
     reset("");
     synthesizeKey("VK_DELETE", { });
     check(aDescription + "Delete", true, true, !aIsReadonly);
 
     reset("");
     synthesizeKey("VK_DELETE", { shiftKey: true });
-    check(aDescription + "Shift+Delete", true, true, !kIsLinux);
+    check(aDescription + "Shift+Delete", true, true, false);
 
     reset("");
     synthesizeKey("VK_DELETE", { ctrlKey: true });
-    check(aDescription + "Ctrl+Delete", true, true, kIsWin);
+    check(aDescription + "Ctrl+Delete", true, true, false);
 
     reset("");
     synthesizeKey("VK_DELETE", { altKey: true });
-    check(aDescription + "Alt+Delete", true, true, kIsMac);
+    check(aDescription + "Alt+Delete", true, true, false);
 
     reset("");
     synthesizeKey("VK_DELETE", { metaKey: true });
     check(aDescription + "Meta+Delete", true, true, false);
 
     // Return key:
     //   If editor is readonly, it doesn't consume.
     //   If editor is editable and not single line editor, it consumes Return
--- a/layout/style/contenteditable.css
+++ b/layout/style/contenteditable.css
@@ -33,20 +33,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 @namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
 
-[contenteditable=""], [contenteditable="true"] {
-  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#editor");
-}
-
 *|*::-moz-canvas {
   cursor: text;
 }
 
 *|*:focus:-moz-read-write :-moz-read-only {
   -moz-user-select: all !important;
 }
 
--- a/layout/style/designmode.css
+++ b/layout/style/designmode.css
@@ -31,15 +31,11 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-:root {
-  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#editor");
-}
-
 *|* {
   -moz-user-modify: read-write;
 }