gecko/editor/libeditor/html
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
..
crashtests Bug 663959 - Mark crashtests as asserting intermittently [r=ehsan] 2011-06-13 14:24:04 -07:00
tests Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan 2011-08-23 15:10:14 -04:00
Makefile.in Bug 545602 Unify the event listeners for editor r=smaug 2010-03-06 13:01:28 +09:00
nsEditorTxnLog.cpp Bug 562387 - Convert NS_NEWXPCOM/NS_DELETEXPCOM to new/delete. r=bsmedberg 2010-07-05 11:42:18 +02:00
nsEditorTxnLog.h
nsEditProperty.cpp Bug 534136 Part 1: Make atoms keep a pointer to an nsStringBuffer rather than storing the data inline. r=bsmedberg 2010-03-08 07:44:59 -08:00
nsHTMLAbsPosition.cpp Bug 663461 Part 1: Remove Add/RemoveEventListenerByIID from editor. r=smaug 2011-06-27 16:34:54 -07:00
nsHTMLAnonymousUtils.cpp Bug 657210 - Outparamdel nsEditor::GetPresShell; r=ehsan 2011-05-22 14:43:13 +02:00
nsHTMLCSSUtils.cpp Bug 664437 editor should use mozilla::Preferences r=ehsan 2011-06-17 09:59:29 +09:00
nsHTMLCSSUtils.h Bug 664437 editor should use mozilla::Preferences r=ehsan 2011-06-17 09:59:29 +09:00
nsHTMLDataTransfer.cpp Bug 612839 - Removed nsAHtml5FragmentParser. r=hsivonen 2011-08-14 10:39:26 -07:00
nsHTMLEditor.cpp Bug 677340 - Return already_AddRefed instead of nsCOMPtr from various functions in editor/; r=ehsan 2011-08-11 15:29:59 +02:00
nsHTMLEditor.h Bug 338427 - Spellchecker should respect the langi attribute; r=ehsan 2011-08-12 15:12:45 -04:00
nsHTMLEditorEventListener.cpp Bug 417418 - do not treat context click as double click anymore in editor; r=ehsan 2011-07-18 14:42:56 -04:00
nsHTMLEditorEventListener.h Bug 558970 nsEditorEventListener should store its owner as nsEditor rather than nsIEditor r=smaug 2010-04-19 21:20:42 +09:00
nsHTMLEditorLog.cpp Bug 572618 - Make debugging the editor easier - Part 4: multiline version of part 1; r=roc 2010-06-17 16:44:35 -04:00
nsHTMLEditorLog.h
nsHTMLEditorStyle.cpp Bug 661297 Part 1: Remove Add/RemoveEventListenerByIID API. r=smaug 2011-08-08 11:26:26 -07:00
nsHTMLEditRules.cpp Bug 677752 - [contentEditable] indent and justify* fail on editable nodes that have only one child; r=ehsan 2011-08-23 15:10:14 -04:00
nsHTMLEditRules.h Bug 671417 - Incorrect use of PRBool when other types are more appropriate or vice versa, r=bz,ehsan,dwitte,joe,vlad,luke,mak,roc 2011-07-26 23:43:37 -07:00
nsHTMLEditUtils.cpp Bug 617528 Part 2 - Core implementation r=smaug 2011-08-08 19:31:32 +02:00
nsHTMLEditUtils.h
nsHTMLInlineTableEditor.cpp Bug 657210 - Outparamdel nsEditor::GetPresShell; r=ehsan 2011-05-22 14:43:13 +02:00
nsHTMLObjectResizer.cpp Bug 663461 Part 1: Remove Add/RemoveEventListenerByIID from editor. r=smaug 2011-06-27 16:34:54 -07:00
nsHTMLObjectResizer.h Bug 663461 Part 1: Remove Add/RemoveEventListenerByIID from editor. r=smaug 2011-06-27 16:34:54 -07:00
nsHTMLURIRefObject.cpp Bug 572618 - Make debugging the editor easier - Part 4: multiline version of part 1; r=roc 2010-06-17 16:44:35 -04:00
nsHTMLURIRefObject.h
nsTableEditor.cpp Bug 677101, part c - Reduce nsIDOMText.h inclusions; r=volkmar 2011-08-11 15:29:58 +02:00
nsWSRunObject.cpp Bug 671672 - Reduce a bunch of console spam in debug builds caused by the HTML editor; r=roc 2011-07-14 17:06:37 -04:00
nsWSRunObject.h Bug 566552 Spell offset with an s especially nsHTMLEditor::AddPositioningOffet 2010-05-24 14:20:59 +02:00
TextEditorTest.cpp Bug 572618 - Make debugging the editor easier - Part 3: multiline version of part 2; r=roc 2010-06-17 16:40:48 -04:00
TextEditorTest.h
TypeInState.cpp Fix for bug 633738 (quora.com bloats out of control (part 3)) - make nsHTMLEditor participate in CC, clear editor from SHistory if we're not storing anything else. r=jst, a=jst. 2011-02-16 13:07:47 +01:00
TypeInState.h Fix for bug 633738 (quora.com bloats out of control (part 3)) - make nsHTMLEditor participate in CC, clear editor from SHistory if we're not storing anything else. r=jst, a=jst. 2011-02-16 13:07:47 +01:00