Commit Graph

150 Commits

Author SHA1 Message Date
Masayuki Nakano
145d565bb0 Bug 392159 Use nsIClipboard::SupportsSelectionClipboard() instead of #ifdef in nsEditorEventListener r=ehsan 2011-11-30 11:57:41 +09:00
Masayuki Nakano
c51f522330 Bug 697842 stopPropagation() shouldn't break IME composition r=ehsan 2011-11-27 09:36:36 +09:00
Masayuki Nakano
e5b55da467 Bug 674770 part.4 Add new tests for pasting by middle click r=ehsan 2011-11-26 13:51:49 +09:00
Ehsan Akhgari
8e6c11ce28 Bug 674770 part.3 Add tests for middle-clicking on anchor element when the page has contenteditable element r=roc 2011-11-26 13:51:49 +09:00
Oonishi Atsushi
ebc58fb880 Bug 311007 - Add aFlags arg to onLocationChange(...), to distinguish between same-document and different-document. r=smaug, sr=bzbarsky 2011-11-10 15:01:11 +01:00
Ed Morley
6a998be2c5 Backout 4997c6f8b24d (bug 616542) for causing locally run mochitest-browser-chrome test runs to fail 2011-11-05 18:35:59 +00:00
Rail Aliiev
364e83c545 Bug 616542 - Shorten file path length of mochitest; r=ted 2011-11-04 21:13:42 +00:00
Jonas Sicking
0588c874fd Bug 687400: Kill Node.isSameNode. r=smaug 2011-10-28 19:52:27 -07:00
Ehsan Akhgari
74d9b6f1fb Backout changeset be42bc18185a (bug 612128) because of bug 688423 2011-10-25 22:32:55 -04:00
Ehsan Akhgari
8cfbed187e Bug 612128 - Prevent the editor from modifying nodes which are not under an editing host; r=roc,bzbarsky
This patch ensures that the NODE_IS_EDITABLE flag is only set on nodes living
under an editing host.  Things like text controls which used to have that flag
previously will not have it any more.  The flag would be set on their anonymous
div node instead.  Note that if text controls actually fall under an editing
host, they will get the NODE_IS_EDITABLE flag.

This patch also makes nsHTMLEditor::IsEditable return sane results (text nodes
are always considered to be editable).

--HG--
extra : rebase_source : 37317b4d95c2ea957be81420583a98a24f0864ac
2010-11-16 15:45:49 -05:00
Ehsan Akhgari
6142aabb94 Bug 688789 - Stop touching the frame tree to determine whether a node is editable or not; r=roc 2011-10-17 00:11:29 -04:00
Joel Maher
fd8629a74b Bug 573735 - support waitForClipboard events in e10s. r=jdm,ted 2011-10-14 07:52:02 -04:00
Ehsan Akhgari
3f9bc5233b Backout changeset bc4f8b8d18b3 (bug 674770) because of the failing test on Windows 2011-10-12 13:51:14 -04:00
Ehsan Akhgari
9c7c34b3ee Bug 674770 - contenteditable breaks middle-click to open links when middlemouse.paste=true; r=roc 2011-09-29 15:24:13 -04:00
Ehsan Akhgari
85e673bce7 Backout changeset a72195ce0eaa (bug 612128) becasue of Fennec regressions 2011-09-22 18:09:44 -04:00
Martijn Wargers
c3d7075c86 Bug 634626 - Move test_bug36682 to mochitest chrome, add layout.spellcheckDefault pref test; r=ehsan 2011-09-22 17:35:24 +01:00
Masayuki Nakano
54e3afdd66 Bug 543789 part.7 Dispatch compositionupdate event and set data value of compositionend event in all IME handling tests r=smaug, sr=roc 2011-09-22 18:17:41 +09:00
Brian R. Bondy
785005832f Bug 598289 - Test case for CF_HTML parsing with StartHTML/EndHTML set to -1. r=ehsan 2011-09-21 13:22:54 -04:00
Ehsan Akhgari
ec2d83e852 Bug 612128 - Prevent the editor from modifying nodes which are not under an editing host; r=roc,bzbarsky
This patch ensures that the NODE_IS_EDITABLE flag is only set on nodes living
under an editing host.  Things like text controls which used to have that flag
previously will not have it any more.  The flag would be set on their anonymous
div node instead.  Note that if text controls actually fall under an editing
host, they will get the NODE_IS_EDITABLE flag.

This patch also makes nsHTMLEditor::IsEditable return sane results (text nodes
are always considered to be editable).
2010-11-16 15:45:49 -05:00
Ian Neil
3b5e70377b Test case for bug 552782; r=ehsan 2011-09-20 12:27:24 -04:00
Ed Morley
7be2d82964 Backout changeset b8d354d37128 (bug 574005) for Linux M3 orange; a=bbondy 2011-09-13 00:49:59 +01:00
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