Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 9d71742b36 Bug 662591 - HTMLEditor should set caret to start of first editable text node or before first editable inline node r=m_kato
Currently, HTMLEditor doesn't initialize caret position when it gets focus by
itself in most cases.  Only when it's in designMode, it may move caret to the
first visible (not checking CSS actually).

In most cases, caret position is adjusted when EditorBase::InitializeSelection()
calls Selection::SetAncestorLimiter().  If selected range is outside of
new limiter, it moves caret to start of the new limiter.  However, this is
really different behavior from the other browsers.  The other browsers try
to move caret to the first editable text node or before the first editable
content such as <img>, <input>, etc.

This difference causes a serious incompatible issue with Draft.js.  It doesn't
initialize caret position when it gets focus but it assumes that caret is
always set to before <br> element if there is no other content.

So, let's try to behave as what other browsers do as far as possible.

This patch makes editor behave as:
* if selection is already in the editing host except start of the editing host,
  does nothing.
* if there is non-editable element before any editable node, move caret to
  start of the editing host.
* if there is editable text node or element node which cannot have a text node,
  move its start or before it.
* if there is no editable nodes which can contain text nodes, move caret to
  start of the editing host.

Note that before applying this patch, in designMode, BeginningOfDocument() used
document element instead of <body> element.  Therefore, it may set odd position
if <head> element has some text nodes with <script> or <style>.  However,
this doesn't make sense and for making more consistent behavior between
designMode and contenteditable, this patch makes it use editing host (it's
<body> element if it's in designMode).

MozReview-Commit-ID: 5neYoTMq6Cc

--HG--
extra : rebase_source : c4d06b6864a221d7cd2833a007d73f7d67821e95
2018-03-02 14:20:25 +09:00
Makoto Kato 6e437ccf06 Bug 1436272 - Move noscript methods in nsIEditor to EditorBase. r=masayuki
Since We can use EditorBase/TextEditor/HTMLEditor directly,  we can
movei noscript methods in nsIEditor to each class.

Also, Init is unnecessary to use nsIDOMDocument and nsIContent since method
isn't in IDL.  And some methods are unused now.

MozReview-Commit-ID: D3B6oSlcT0L

--HG--
extra : rebase_source : 6cab2e6e7b4ba8cfb56d8320be24ca4afcbe55fb
extra : amend_source : 1d8c59086a9158a49dd270b64ecf8341ed4002ce
2018-02-07 15:28:04 +09:00
Ehsan Akhgari e9a78d5b18 Bug 1407854 - Part 1: Remove nsIEditor.createNode(); r=masayuki 2017-10-12 17:13:55 -04:00
Nicholas Nethercote c7df832636 Bug 1393642 - Remove nsIAtom/nsIAtomService usage from script in editor/. r=masayuki.
nsIHTMLEditor has several scriptable methods (addDefaultProperty(),
removeDefaultProperty(), etc.) that have nsIAtom parameters. We're in the
process of deCOMtaminating nsIAtom (bug 1392883) so these methods need to be
changed.

This patch does the following.

- It changes those methods to take an AString instead of an nsIAtom.

- For each existing method, it adds to HTMLEditor a new C++ method of the same
  name that takes an nsIAtom parameter.

- It updates TextEditorTest.cpp to use strings instead of atoms, in order to
  keep using the XPIDL methods.

- It updates test_bug1140105.html to pass strings instead of atoms to
  getInlineProperty(). This removes the use of nsIAtomService.

--HG--
extra : rebase_source : e005c3b5a08207b3d5d5fb55c47c8bc475b33453
2017-08-25 15:40:45 +10:00
Masayuki Nakano e1a21d5a3e Bug 1387317 - part5: AutoPlaceHolderBatch should take EditorBase instead of nsIEditor r=m_kato
AutoPlaceHolderBatch can take EditorBase class and its inherited class, AutoEditBatch, can be removed if we implement other constructor which doesn't take transaction name.

Additionally, nsIEditor::(Begin|End)PlaceHolderTransaction() are referred only by AutoPlaceHolderBatch.  Therefore, they can be non-public methods and removed from nsIEditor interface.

Note that this patch also repalces "PlaceHolder" with "Placeholder" since it's a word.

MozReview-Commit-ID: 5dw3kcX3bOx

--HG--
extra : rebase_source : e926cc1c2ebea70eb08e43778a8b52912b559b7b
2017-08-14 14:56:39 +09:00
Masayuki Nakano 722bf07347 Bug 1319340 - part1 Move AsTextEditor() and AsHTMLEditor() to nsIEditor r=m_kato
nsIEditor is still first contact with editor class for some modules.  They should be accessible to the concrete classes without QI.  Therefore, nsIEditor should have As*Editor() methods.

Additionally, this adds AsEditorBase().  That is always implemented but it might be necessary for some files for minimizing its include files.

MozReview-Commit-ID: 8WqkDJLiVDs

--HG--
extra : rebase_source : e51282df244efad62bc6fe04ab449e3beab440f9
2017-08-04 15:01:36 +09:00
Masayuki Nakano a2333fc4bb Bug 1060051 - Make editor related interfaces builtin classes if it's possible r=Ehsan,smaug
If we make nsIEditor a builtin class, that means that its instance can be only TextEditor or HTMLEditor.  Then, users of nsIEditor can use concrete classes such as EditorBase, TextEditor or HTMLEditor instead.  Then, the users can reduce unnecessary QI and a lot of virtual calls if we'll create non-virtual methods.

So, let's make editor related interfaces builtin classes.

MozReview-Commit-ID: 93WfsSDuJiJ

--HG--
extra : rebase_source : 39151eb4ffaaf195fec57234ea84c9f4066c58d1
2017-08-04 13:57:56 +09:00
Masayuki Nakano 9a58410ee2 Bug 1349178 Make nsIEditor.transactionManager readonly r=m_kato
There are no app which replaces transaction manager of editor.  Additionally, replacing transaction manager of an editor with different editor or same editor but after initialized again due to some reasons may cause unexpected problems.

Therefore, this patch makes it readonly.

MozReview-Commit-ID: K7zepOjrzvC

--HG--
extra : rebase_source : ee1944af57c8102628b8cffbc720d2b8e5e9088d
2017-03-21 20:57:15 +09:00
Masayuki Nakano 7436f01057 Bug 564411 Move all methods/attributes of nsIEditorIMESupport to nsIEditor r=smaug
Doing QI from nsIEditor to nsIEditorIMESupport doesn't make sense because editor should always support all methods and attributes of nsIEditorIMESupport (it does NOT mean that all nsIEditor implementation need to support IME).

This patch moves all of them to nsIEditor for avoiding redundant QIs.

MozReview-Commit-ID: DzIKuGHG4iy

--HG--
extra : rebase_source : cc5e9a6ae4572ebe461d9770ffa5c23d33dc8526
2016-12-20 21:47:31 +09:00
Masayuki Nakano 274f4c6cb1 Bug 1169139 Remove all trailing whitespaces in editor (IGNORE IDL) r=ehsan 2015-05-29 00:58:42 +09:00
Ehsan Akhgari 657ad4ff99 Bug 1120233 - Ensure that the delete command will stay enabled for password fields; r=roc 2015-01-22 23:26:59 -05:00
Mats Palmgren 2c38b0b6b7 Bug 1061468 - Notify the editor when removing the focused element is its ancestor limiter. r=ehsan 2014-09-09 23:27:56 +00:00
Olli Pettay 8dfe1d7cf5 Bug 1059705 - revert the change which made nsIEditor builtinclass, r=masayuki 2014-08-28 17:33:35 +03:00
Masayuki Nakano 877aa4d8fb Bug 1053048 Implement nsIEditor.isInEditAction readonly attribute r=ehsan, sr=smaug 2014-08-19 20:54:08 +09:00
Birunthan Mohanathas 4f1864539d Bug 1028565 - Part 5: Flatten editor/{idl,public}/ directories. r=ehsan
--HG--
rename : editor/public/nsEditorCID.h => editor/nsEditorCID.h
rename : editor/idl/nsIContentFilter.idl => editor/nsIContentFilter.idl
rename : editor/idl/nsIDocumentStateListener.idl => editor/nsIDocumentStateListener.idl
rename : editor/idl/nsIEditActionListener.idl => editor/nsIEditActionListener.idl
rename : editor/idl/nsIEditor.idl => editor/nsIEditor.idl
rename : editor/idl/nsIEditorIMESupport.idl => editor/nsIEditorIMESupport.idl
rename : editor/idl/nsIEditorMailSupport.idl => editor/nsIEditorMailSupport.idl
rename : editor/idl/nsIEditorObserver.idl => editor/nsIEditorObserver.idl
rename : editor/idl/nsIEditorSpellCheck.idl => editor/nsIEditorSpellCheck.idl
rename : editor/idl/nsIEditorStyleSheets.idl => editor/nsIEditorStyleSheets.idl
rename : editor/idl/nsIHTMLAbsPosEditor.idl => editor/nsIHTMLAbsPosEditor.idl
rename : editor/idl/nsIHTMLEditor.idl => editor/nsIHTMLEditor.idl
rename : editor/idl/nsIHTMLInlineTableEditor.idl => editor/nsIHTMLInlineTableEditor.idl
rename : editor/idl/nsIHTMLObjectResizeListener.idl => editor/nsIHTMLObjectResizeListener.idl
rename : editor/idl/nsIHTMLObjectResizer.idl => editor/nsIHTMLObjectResizer.idl
rename : editor/idl/nsIPlaintextEditor.idl => editor/nsIPlaintextEditor.idl
rename : editor/idl/nsITableEditor.idl => editor/nsITableEditor.idl
rename : editor/idl/nsIURIRefObject.idl => editor/nsIURIRefObject.idl
rename : editor/idl/nsPIEditorTransaction.idl => editor/nsPIEditorTransaction.idl
2014-07-16 12:02:34 -07:00