Commit Graph

129 Commits

Author SHA1 Message Date
Brian R. Bondy
ab466ccba9 Bug 574005 - Make obtaining CF_HTML directly work on Windows and Linux (application/x-moz-nativehtml); r=ehsan 2011-09-12 18:38:57 -04:00
Fabien Cazenave
ec441b95e5 Bug 570144 - After pressing Enter, editable DIVs in list items are duplicated; r=ehsan 2011-09-12 15:25:38 -04:00
Fabien Cazenave
de80659037 Bug 290026 - Outdent of List does not work properly; r=ehsan 2011-09-02 12:21:33 -04:00
Fabien Cazenave
82c46e275a Bug 291780 - List outdent is not working properly; r=ehsan 2011-09-02 12:19:09 -04:00
Fabien Cazenave
e48e824329 Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan
Issue #1: indent/justify* can create non-valid fragments.
When applying a block-level formatting to a text node, Gecko creates a div or
blockquote block around the text node and sets the corresponding "align" or
"style" attribute. This patch checks that the active editing host can contain
such a block-level element.

Issue #2: indent/justify* can modify the active editing host.
On the first child of the editable element, the selection is extended outside of
the active editing host -- which causes a few issues for our test cases.
In this patch, this issue is "solved" by modifying
`nsHTMLEditRules::GetPromotedPoint' for block-level operations.


** About the tests **

Sorry for the long explanation but I prefer to be as sharp as possible when I
have to modify existing unit tests.

This patch raises 34 unit test "failures" which are improvements.
Two test files are concerned and have been modified accordingly:
  * test_htmleditor_keyevent_handling
  * test_richtext2.html

One test has been clarified (no real modification):
  * test_bug414526.html

Of course, a specific unit test has been added, see `test_bug677752.html'.


** editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html **
Outdenting now works properly, which results in 4 `FAIL'.

  * 7372 ERROR TEST-UNEXPECTED-FAIL
      | non-tabbable HTML editor: Shift+Tab after Tab on UL
      - got "<ul><li id=\"target\">ul list item</li></ul>",
      expected "<ul><ul><li id=\"target\">ul list item</li></ul></ul>"

  * 7379 ERROR TEST-UNEXPECTED-FAIL
      | non-tabbable HTML editor: Shift+Tab on UL
      - got "ul list item",
      expected "<ul><li id=\"target\">ul list item</li></ul>"

  * 7415 ERROR TEST-UNEXPECTED-FAIL
      | non-tabbable HTML editor: Shift+Tab after Tab on OL -
      got "<ol><li id=\"target\">ol list item</li></ol>",
      expected "<ol><ol><li id=\"target\">ol list item</li></ol></ol>"

  * 7422 ERROR TEST-UNEXPECTED-FAIL
      | non-tabbable HTML editor: Shfit+Tab on OL
      - got "ol list item",
      expected "<ol><li id=\"target\">ol list item</li></ol>"


** editor/libeditor/html/tests/browserscope/test_richtext2.html **
The 15 tests that now pass result in 15 `FAIL' and 15 `UNEXPECTED_PASS'.
Here's an overview of what we had before the patch:

  * Section A - Apply Formatting Tests: +10 points
                    before patch: 21/31 (Selection:  9/31)
                     after patch: 28/31 (Selection: 12/31)

      FB:BQ_TEXT-1_SI    EXECUTION EXCEPTION
      FB:BQ_TEXT-1_SI    EXECUTION EXCEPTION
      FB:BQ_BR.BR-1_SM   EXECUTION EXCEPTION
      FB:BQ_BR.BR-1_SM   EXECUTION EXCEPTION
      IND_TEXT-1_SI      EXECUTION EXCEPTION
      IND_TEXT-1_SI      EXECUTION EXCEPTION
      JC_TEXT-1_SC       editing host is modified
      JF_TEXT-1_SC       editing host is modified
      JL_TEXT-1_SC       editing host is modified
      JR_TEXT-1_SC       editing host is modified

  * Section AC - Apply Formatting Tests, using styleWithCSS: +5 points
                    before patch:  7/18 (Selection:  5/18)
                     after patch: 12/18 (Selection:  5/18)

      IND_TEXT-1_SI      editing host is modified
      JC_TEXT-1_SC       editing host is modified
      JF_TEXT-1_SC       editing host is modified
      JL_TEXT-1_SC       editing host is modified
      JR_TEXT-1_SC       editing host is modified


** editor/libeditor/html/tests/test_bug414526.html **
This test has been clarified to get more explicit report messages -- the test
themselves haven't been changed. A `todo_is' test has been added.
This test is the one that shows that `IsNodeInActiveEditor' can't be modified,
and that limiting the range promotion for block-level operations is preferrable.
2011-08-23 15:10:14 -04:00
Fabien Cazenave
e60f67e68a Bug 680279 - Splitting Gmail rich-text list with Enter misplaces the caret; r=ehsan
The patch for bug 674861 has introduced a regression.
When a list is splitted, a new paragraph should inserted before the new list.
2011-08-19 18:14:04 -04:00
Ehsan Akhgari
1a870eac6e Backout changeset 46dc0fb0b1cb (bug 674770) because of yet another mochitest-3 Windows failure
--HG--
extra : rebase_source : a0739cd5d2eb66015d785c107151507f8a8113e3
2011-08-18 16:25:11 -04:00
Ehsan Akhgari
f53498d5e9 Bug 674770 - contenteditable breaks middle-click to open links when middlemouse.paste=true; r=roc 2011-07-28 17:42:38 -04:00
Fabien Cazenave
4862d93606 Bug 676401 - The document.queryCommandEnabled API doesn't take the active editing host into account; r=ehsan
* adding an `isSelectionEditable' readonly attribute in <nsIEditor>;
 * modified all ::IsCommandEnabled methods in editor/ to take it into account:

./libeditor/base/nsEditorCommands.cpp (15 commands)
  nsUndoCommand                   'undo'
  nsRedoCommand                   'redo'
  nsClearUndoCommand              'clearUndo'
  nsCutCommand                    'cut'
  nsCutOrDeleteCommand            ?
  nsCopyCommand                   'copy'
  nsCopyOrDeleteCommand           ?
  nsPasteCommand                  'paste'
  nsPasteTransferableCommand      ?
  nsSwitchTextDirectionCommand    ?
  nsDeleteCommand                 'delete'
  nsSelectAllCommand              'selectAll'
  nsSelectionMoveCommands         ?
  nsInsertPlaintextCommand        ?
  nsPasteQuotationCommand         ?

./composer/src/nsComposerCommands.cpp (15 commands)
  nsBaseStateUpdatingCommand      ?
  nsPasteNoFormattingCommand      ?
  nsRemoveListCommand             ?
  nsIndentCommand                 'indent'
  nsOutdentCommand                'outdent'
  nsMultiStateCommand             ?
  nsHighlightColorStateCommand    'hiliteColor'
  nsAbsolutePositioningCommand    ?
  nsDecreaseZIndexCommand         ?
  nsIncreaseZIndexCommand         ?
  nsRemoveStylesCommand           'removeFormat'
  nsIncreaseFontSizeCommand       'increaseFontSize'
  nsDecreaseFontSizeCommand       'decreaseFontSize'
  nsInsertHTMLCommand             'insertHTML'
  nsInsertTagCommand              ?

./composer/src/nsComposerDocumentCommands.cpp (3 commands)
  nsSetDocumentOptionsCommand     ?
  nsSetDocumentStateCommand       ?
  nsDocumentStateCommand          n/a (unpatched)
2011-08-17 13:28:03 -04:00
Fabien Cazenave
c85fd56970 Bug 456798 — Implement document.queryCommandSupported
Rationale: a command is supported if it can be converted to an internal Midas
command. `nsCommandManager::IsCommandSupported' might not be needed any more.

Corollary: document.queryCommandEnabled should return false on unsupported
commands without raising any exception.

Browserscope tests: +43 points = 258 failed tests...
 * Q section: 0/48 => 42/48
   42 tests used to fail (execution exception), now pass
 * QE section: 36/46 => 37/46
   garbage-1_TEXT-1 used to fail, now passes
In these two sections, a lot of tests that used to raise an exception now return
`false' (that's still a FAIL, but that's not the same kind of FAIL).

Other Browserscope tests are not affected by this patch.
The status of this test suite (currentStatus.js) has been updated accordingly.
2011-08-17 08:04:14 -04:00
Ms2ger
66ab4757eb Merge m-c to m-i 2011-08-13 14:47:03 +02:00
Malini Das
960a7c7495 Bug 367393 - Add a packed MochiKit that contains only SimpleTest dependencies- new tests. r=jmaher, a=test-only 2011-08-12 12:21:44 -04:00
Malini Das
a0832b693a Bug 367393 - Add a packed MochiKit that contains only SimpleTest dependencies- plain tests 2/2. r=jmaher, a=test-only 2011-08-12 12:21:44 -04:00
Malini Das
e306b1b5aa Bug 367393 - Add a packed MochiKit that contains only SimpleTest dependencies- chrome. r=jmaher, a=test-only 2011-08-12 12:21:36 -04:00
Fabien Cazenave
d46ef85530 Bug 442186 - execCommand justify* fails on first line of contenteditable; r=ehsan
Given the way GetPromotedPoint / IsNodeInActiveEditor are designed, when the
selection is in the first child element of the active editing host the
selection is extended outside of editor node.

As a result, `GetNodesFromSelection' (which is called at the beginning of
`WillAlign') returns two nodes:
1. an empty text node, which is enclosed in a <div style="text-align: ***">;
2. the first child element, which is destroyed when it's a <div>;

Proposed solution:
#1 can be avoided by checking that the node is editable in `WillAlign';
#2 can be avoided by not dropping <div> blocks in `RemoveAlignment'.
This is an opportunity to simplify `RemoveAlignment' a bit.
2011-08-10 19:03:34 -04:00
arno renevier
2485241198 Bug 338427 - Spellchecker should respect the langi attribute; r=ehsan 2011-08-12 15:12:45 -04:00
Ian Neal
081ca4e9b3 Test for Bug 291780 - List outdent is not working properly r=ehsan 2011-08-10 00:14:58 +01:00
Ian Neal
49689844b3 Test for Bug 290026 - Outdent of List does not work properly r=ehsan 2011-08-10 00:14:53 +01:00
Fabien Cazenave
5dd43c9b97 Bug 674861 - contentEditable lists should not be splittable; r=ehsan
In design mode, pressing [Return] twice in a list (ol, ul, dl) splits the list
and inserts a paragraph. When the list is the active editing host, it should not
be split.
2011-08-02 15:04:43 -04:00
Henri Sivonen
147c3287ec Bug 482909 part 2 - Implement an HTML/SVG/MathML sanitizer independently of parsers or serializers. r=bzbarsky. 2011-07-29 14:48:04 +03:00
Fabien Cazenave
9e280efb90 Bug 460740 - [contentEditable] invalid results when pressing Enter in a bunch of different cases; r=ehsan
In some situations, pressing Enter in a contentEditable node fails:
 * in an editable paragraph, list item or header, pressing Enter
   creates another editable block;
 * in an inline editable node, pressing Enter does nothing.

That's because nsHTMLEditRules::WillInsertBreak doesn't check for the active
editing host. This patch should fix it.
2011-07-26 17:38:23 -04:00
Jonathan Kamens
e4101fc489 Bug 489202 - selection moves to top when html containing meta, link, or style elements is pasted or inserted; r=ehsan 2011-07-26 13:59:50 -04:00
Fabien Cazenave
2c92600954 Bug 688599 - do not expand selection for deletion outside of the active editing host; r=ehsan
When a selection in an inline element is to be deleted, it is first expanded to
the parent block in order not to leave any empty inline element. This patch
ensures that the selection cannot be expanded outside of the contentEditable
element (active editing host).
2011-07-25 17:11:46 -04:00
Joel Maher
344f4a7302 Bug 666654 - split eventutils.js functions that are chrome only into chromeutils.js. r=ted, a=test-only 2011-07-23 09:02:40 -04:00
Fabien Cazenave
81bff8a94d Bug 449243 - contentEditable: insert <p> instead of <br>; r=ehsan
In editable elements, create a paragraph instead of a <br> node
when [Return] is pressed:
 * once in a header node (<h[1..6]>);
 * twice in a list item node (<li>).
2011-07-22 12:19:17 -04:00
arno renevier
ba6b969048 Bug 417418 - do not treat context click as double click anymore in editor; r=ehsan 2011-07-18 14:42:56 -04:00
Ehsan Akhgari
13c7a908e4 Backout changeset 65e0d40a57b7 (bug 417418) because of unit test failure 2011-07-18 16:29:22 -04:00
arno renevier
89a10e6166 Bug 417418 - do not treat context click as double click anymore in editor; r=ehsan 2011-07-18 14:42:56 -04:00
Ehsan Akhgari
4a9dec68d7 Bug 414526 - Backspace at the beginning of a contenteditable element or delete at the end of one should not affect the rest of the contenteditable elements on the page; r=roc
The main fix here involves the introduction of the nsHTMLEditor::IsNodeInActiveEditor
API.  This API returns true if the current selection in the document falls
inside the active editable section.  The patch adds a bunch of checks using
this API to various places in the code to make sure that editing operations do
not escape their editing host.

There are also some unrelated fixes to range promotion code which fix the
bugs that have existed in that code before, but because of the lack of this
check were not uncovered before.

This patch also removes the nsTextEditUtils::InBody API which only made sense
in designMode documents, and was insufficient for contenteditable elements.
2011-07-14 11:25:07 -04:00
Ehsan Akhgari
c6e514aa14 Bug 549262 - Enable the (shift-)space shortcut key for scrolling up/down in pages containing editable elements; r=roc
--HG--
extra : rebase_source : 99706dd2e678052b345b011ea76f17370ad1a227
2010-09-06 16:59:41 -04:00
Ehsan Akhgari
beba2dbb1d Bug 439808 - Make sure that deleting a selection works in inline contenteditable elements which have a non-editable parent block; r=roc
--HG--
extra : rebase_source : 74d3df996b904032696000daa532d217140d3b2d
2011-06-29 21:01:59 -04:00
Jonas Sicking
864793d608 Bug 658714 Part 9: Don't use EventGroups for system-group. r=smaug 2011-06-23 19:18:02 -07:00
Joel Maher
a184675917 Bug 664165 - move editor/libeditor/html/tests/test_contenteditable_text_input_handling.html to mochitest-chrome. r=masayuki, a=test-only 2011-06-19 11:56:44 -04:00
Ms2ger
35e44f908f Bug 659113 - Remove nsIDOMNSHTMLDocument; r=bz 2011-05-28 09:43:57 +02:00
Ehsan Akhgari
f9088e8fe4 Bug 649566 - @keyframe(s) missing from <style> sanitizing code in nsHTMLFragmentContentSink; r=bzbarsky 2011-04-13 18:12:32 -04:00
Kyle Huey
75ee2642d1 Merge m-c to bs. 2011-03-26 12:12:37 -04:00
Ehsan Akhgari
b50ffe71b6 Bug 611457 - Move the object which is supposed to survive the function's return out of the function so that a possible garbage collection doesn't collect it before it should be used; r=roc a=test-only 2011-03-12 00:07:37 -05:00
Ehsan Akhgari
b8feac7449 Bug 618041 - Move the object which is supposed to survive the function's return out of the function so that a possible garbage collection doesn't collect it before it should be used; r=roc a=test-only 2011-03-12 00:11:01 -05:00
Serge Gautherie
c690e45a6f Bug 634626 - test_bug366682 failures because spellchecking is disabled; (Bv1) s/CR+LF/LF/g, Remove ending whitespaces.
r=jmaher (a=test-only).
DONTBUILD
2011-02-17 20:19:35 +01:00
Mounir Lamouri
350253af3e Bug 629845 (1/2) - Don't make nsHTMLDocument::EditingStateChanged fails if BeginningOfDocument fails. r=ehsan a=blocking-final 2011-02-11 01:59:37 +01:00
Ehsan Akhgari
fa1dcf4c12 Bug 632326 - Synthesize a Paste command instead of calling the internal goDoCommand in the test for bug 520189; r=roc a=test-only 2011-02-08 21:50:51 -05:00
Ehsan Akhgari
8d74540d77 Test case for bug 635636; r=roc 2011-02-21 16:58:07 -05:00
Ehsan Akhgari
d98dd1278c Bug 642704 - Part 3: Remove test_set.py because it confuses our mochitest suite runner, and we don't need it to run the BrowserScope RichText2 suite; r=roc 2011-03-19 16:45:29 -04:00
Ehsan Akhgari
11e4fe7769 Bug 642704 - Part 2: Add a test driver to run the BrowserScope RichText2 test suite as a mochitest; r=roc 2011-03-19 16:44:30 -04:00
Ehsan Akhgari
705f18833c Bug 642704 - Part 1: Import the BrowserScope RichText2 test suite files into the tree; r=roc 2011-03-18 18:15:24 -04:00
Ehsan Akhgari
e4ad8f774b Bug 640321 - Register the mouse event handlers for the editor in the system group; r=roc 2011-03-16 15:34:30 -04:00
Ehsan Akhgari
561113cc04 Bug 628980 - browserscope richedit tests load http://www.google.com/intl/en_ALL/images/logo.gif over the network; r=roc a=NPOTB 2011-01-27 00:26:33 -05:00
Ehsan Akhgari
d48edb3f7d Bug 622371 - Only set the selection to the beginning of the editable document if the editor is being initialized by entering designMode; r=bzbarsky a=blocking-final+ 2011-01-06 17:13:51 -05:00
Ehsan Akhgari
b3f2d74515 Bug 620906 - Back out part of bug 289384 to make sure that scrollbars work in CKEditor fields again; r=roc a=blocking-final+ 2011-01-11 16:00:44 -05:00
Jonathan Kew
a9323f7452 bug 332636 - fix editor's handling of surrogate-pair combining marks with backspace. r=ehsan a=roc 2010-12-16 14:17:41 -08:00