gecko-dev/editor/libeditor
Masayuki Nakano f802692190 Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato
Currently, HTMLEditRules::WillInsertBreak() checks if the editing host can
contain a <p> element as a child or a descendant.  However, this is not enough.
If an inline element has a block element which can contain a <p> element,
current implementation considers to insert a <br>.  This is possible when
* The editing host is an unknown element including user defined element.
* The editing host is an inline element and its children and/or descendants
  were added by JS.  E.g., <span contenteditable> element can have <div>
  element.

I think that we should consider to insert a <br> element when:
- There is no block ancestors in the editing host.
- The editing host is the only block element and it cannot contain <p> element
  or the default paragraph separator is <br> element.
- The nearest block ancestor isn't a single-line container declared in the
  execCommand spec and there are no block elements which can contain <p>
  element.

Note that Chromium checks if CSS box of ancestors is block too.  However,
it must be out of scope of this bug.

MozReview-Commit-ID: HdjU9t83Nd1

--HG--
extra : rebase_source : 7030671268a610613359b5d8ae5d126e120f59bd
2017-10-27 01:27:44 +09:00
..
crashtests Backed out changeset 10e5f407149d (bug 1402196) 2017-10-24 09:42:12 +02:00
tests Bug 748315 - Part 5. Update browserscope test result. r=masayuki 2017-10-25 16:13:10 +09:00
CSSEditUtils.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
CSSEditUtils.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
ChangeAttributeTransaction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
ChangeAttributeTransaction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
ChangeStyleTransaction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
ChangeStyleTransaction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
CompositionTransaction.cpp Bug 1393355 - Move SetTextRangeStyle from nsISelectionPrivate to Selection. r=masayuki 2017-08-24 16:56:12 +09:00
CompositionTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
CreateElementTransaction.cpp Bug 1407854 - Part 2: Add an optional argument to CreateNode() to allow callers to pass the child node when they know it; r=masayuki 2017-10-12 17:13:55 -04:00
CreateElementTransaction.h Bug 1407854 - Part 2: Add an optional argument to CreateNode() to allow callers to pass the child node when they know it; r=masayuki 2017-10-12 17:13:55 -04:00
DeleteNodeTransaction.cpp Bug 1372859 - Remove SelAdj* method of nsIDOM* version from RangeUpdater. r=masayuki 2017-06-14 19:34:38 +09:00
DeleteNodeTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
DeleteRangeTransaction.cpp Bug 1407352 - Avoid calling GetChildAt() in DeleteRangeTransaction::CreateTxnsToDeleteBetween(); r=masayuki 2017-10-11 01:49:55 -04:00
DeleteRangeTransaction.h Bug 1407352 - Avoid calling GetChildAt() in DeleteRangeTransaction::CreateTxnsToDeleteBetween(); r=masayuki 2017-10-11 01:49:55 -04:00
DeleteTextTransaction.cpp Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
DeleteTextTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
EditActionListener.h
EditAggregateTransaction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
EditAggregateTransaction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
EditTransactionBase.cpp
EditTransactionBase.h
EditorBase.cpp Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
EditorBase.h Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
EditorCommands.cpp Bug 1319340 - part8: EditorCommands should use TextEditor instead of nsIEditor, nsIPlaintextEditor and nsIEditorMailSupport r=m_kato 2017-08-04 20:41:20 +09:00
EditorCommands.h
EditorController.cpp
EditorController.h
EditorEventListener.cpp Bug 1411612: Kill nsINode::eCONTENT. r=bz 2017-10-25 17:19:11 +02:00
EditorEventListener.h Bug 1344149 EditorEventListener shouldn't handle odd focus/blur events which may be created in chrome script r=smaug 2017-03-08 15:24:55 +09:00
EditorUtils.cpp Bug 1392867 - Part 1: Add an overload of EditorUtils::IsDescendantOf() which returns an nsIContent* out argument for the child node found instead of its index in the parent; r=masayuki 2017-08-23 01:00:07 -04:00
EditorUtils.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
EditorUtils.js
EditorUtils.manifest
HTMLAbsPositionEditor.cpp Bug 1380292 - Don't turn on object resizer, inline table editor and etc when element isn't into editor. r=masayuki 2017-09-09 10:49:02 -04:00
HTMLAnonymousNodeEditor.cpp Bug 1407924 - Avoid conversion from nsAtom to string if possible. r=masayuki 2017-10-12 16:28:28 +09:00
HTMLEditRules.cpp Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditRules.h Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditUtils.cpp Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditUtils.h Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditor.cpp Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditor.h Bug 1411687 - part 2: Rewrite the check to insert a <br> element in HTMLEditRules::WillInsertBreak() r=m_kato 2017-10-27 01:27:44 +09:00
HTMLEditorDataTransfer.cpp Bug 1411687 - part 0: Get rid of HTMLEditor::GetBlockNodeParent(nsIDOMNode*) r=m_kato 2017-10-26 22:37:45 +09:00
HTMLEditorEventListener.cpp Bug 1391978 - Part 1. Replace nsISelection::GetRangeCount with Selection::RangeCount. r=masayuki 2017-08-28 14:52:25 +09:00
HTMLEditorEventListener.h Bug 1387317 - part2: EditorEventListener should stop using interface methods as far as possible r=m_kato 2017-08-08 11:25:36 +09:00
HTMLEditorObjectResizer.cpp Bug 1408767 - HTMLEditor::MouseMove: Remove two unused variables r=m_kato 2017-10-15 19:32:43 +02:00
HTMLEditorObjectResizerUtils.h Bug 1374207 - part3: Editor classes should use concrete classes instead of nsI*Editor r=m_kato 2017-06-22 15:02:59 +09:00
HTMLInlineTableEditor.cpp Bug 1380292 - Don't turn on object resizer, inline table editor and etc when element isn't into editor. r=masayuki 2017-09-09 10:49:02 -04:00
HTMLStyleEditor.cpp Bug 1364133 - Part 1. Check whether SplitNode returns error. r=masayuki 2017-10-11 17:58:24 +09:00
HTMLTableEditor.cpp Bug 1409162. Make nsTableCellFrame::GetColIndex/GetRowIndex faster. r=mats 2017-10-17 15:39:36 -04:00
HTMLURIRefObject.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
HTMLURIRefObject.h
InsertNodeTransaction.cpp Backed out changeset d59889304b3f (bug 1408125) for asserting in clipboard test editor/libeditor/tests/test_bug1306532.html. r=backout on a CLOSED TREE 2017-10-14 00:05:15 +02:00
InsertNodeTransaction.h Backed out changeset d59889304b3f (bug 1408125) for asserting in clipboard test editor/libeditor/tests/test_bug1306532.html. r=backout on a CLOSED TREE 2017-10-14 00:05:15 +02:00
InsertTextTransaction.cpp Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
InsertTextTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
InternetCiter.cpp
InternetCiter.h
JoinNodeTransaction.cpp Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
JoinNodeTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
ManualNAC.h Bug 1386110 - Use a smart pointer to reliably de-register NAC regardless of how it goes away. r=masayuki 2017-08-03 20:26:11 -07:00
PlaceholderTransaction.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
PlaceholderTransaction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
SelectionState.cpp Bug 1395080 - Part 1. Replace nsIDOMRange::GetCollapsed with nsRange::Collapsed. r=masayuki 2017-09-01 12:19:11 +09:00
SelectionState.h Bug 1392564 - Use nursery purple buffer for nsRange and RangeItem, r=mccr8 2017-08-22 17:47:00 +03:00
SplitNodeTransaction.cpp Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
SplitNodeTransaction.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
StyleSheetTransactions.cpp Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
StyleSheetTransactions.h Bug 1349138 Edit transactions should store their editor instance with strong reference r=smaug 2017-03-21 19:00:36 +09:00
TextEditRules.cpp Backed out changeset 19fee71d7e27 (bug 1408125) 2017-10-14 00:05:10 +02:00
TextEditRules.h Bug 1390402, add a faster variant of TextEditor::GetDocumentIsEmpty(), r=masayuki 2017-08-24 13:53:34 +03:00
TextEditRulesBidi.cpp
TextEditUtils.cpp
TextEditUtils.h
TextEditor.cpp Backed out changeset febed94fa592 (bug 1408227) for asserting at editor/libeditor/EditorBase.cpp:2513 during execution of web-platform-test /editing/run/inserttext.html. r=backout on a CLOSED TREE 2017-10-13 19:48:22 +02:00
TextEditor.h Backed out changeset febed94fa592 (bug 1408227) for asserting at editor/libeditor/EditorBase.cpp:2513 during execution of web-platform-test /editing/run/inserttext.html. r=backout on a CLOSED TREE 2017-10-13 19:48:22 +02:00
TextEditorDataTransfer.cpp Bug 1391978 - Part 1. Replace nsISelection::GetRangeCount with Selection::RangeCount. r=masayuki 2017-08-28 14:52:25 +09:00
TextEditorTest.cpp Bug 1391978 - Part 9. Replace nsISelection::GetAnchorNode with Selection::GetAnchorNode. r=masayuki 2017-08-25 16:12:39 +09:00
TextEditorTest.h
TypeInState.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
TypeInState.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
WSRunObject.cpp Bug 1409520 - part 1: WSRunObject::InsertText() should update aInOutChildAtOffset after it might be modified r=m_kato 2017-10-23 21:47:56 +09:00
WSRunObject.h Backed out changeset febed94fa592 (bug 1408227) for asserting at editor/libeditor/EditorBase.cpp:2513 during execution of web-platform-test /editing/run/inserttext.html. r=backout on a CLOSED TREE 2017-10-13 19:48:22 +02:00
moz.build Bug 1386110 - Use a smart pointer to reliably de-register NAC regardless of how it goes away. r=masayuki 2017-08-03 20:26:11 -07:00
nsIAbsorbingTransaction.h Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
nsIEditRules.h Bug 1360154 - Part 1. DocumentIsBody should return bool, not nsresult. r=masayuki 2017-05-11 14:03:26 +09:00