Commit Graph

26 Commits

Author SHA1 Message Date
Masayuki Nakano
235de70472 Bug 1467693 - Merge EditorBase::SwitchTextDirection() and EditorBase::SwitchTextDirectionTo() r=m_kato
There are two similar methods, but they are created with copy & paste.
So, the common code should be merged into new method, SetTextDirection().

Additionally, EditorBase::SwitchTextDirection() is a scriptable method but
nobody uses this from JS.  So, we can make it from nsIEditor and this
patch renames it to ToggleTextDirection() since current name is too
similar to SwitchTextDirectionTo().

MozReview-Commit-ID: BX3M1OKxiD5

--HG--
extra : rebase_source : 74a5ff65adc96ba69792f2e63daf14828c505270
2018-06-07 23:26:59 +09:00
Boris Zbarsky
c73f664888 Bug 1463981 part 3. Remove nsIDOMNode usage in editor. r=masayuki 2018-05-24 13:18:34 -04:00
Makoto Kato
71b2579c1e Bug 1463330 - Move CanPasteTransferable and PreDestroy to out of nsIEditor. r=masayuki
CanPasteTransferable and PreDestroy aren't used from script (inc. comm-central
and bluegriffon), so we should move these to out of nsIEditor.

MozReview-Commit-ID: GRfBobAm2qi

--HG--
extra : rebase_source : 812792ff43da24bfd9cb99c4b3127e6acdc43ba1
2018-05-22 18:23:21 +09:00
Adrian Wielgosik
3a8ef6cf8a Bug 1460940 - Remove nsIDOMDocument uses in editor/. r=bz
MozReview-Commit-ID: 8doC9drkrG9

--HG--
extra : rebase_source : 24ac8ea960faff10b04ef0f419bc6dc7b6556452
2018-05-11 19:46:15 +02:00
Boris Zbarsky
46cae9462a Bug 1387143 part 3. Stop using nsISelection in nsISelectionController. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
c9bcb72283 Bug 1455674 part 1. Stop using nsIDOMElement in nsIEditor. r=masayuki 2018-04-26 23:35:18 -04:00
Makoto Kato
3f513220d0 Bug 1455533 - Part 3. Remove unused nsIEditor.outputToStream. r=masayuki
No one uses outputToStream even if c-c and BlueGriffon.  We should remove this.

MozReview-Commit-ID: LEUtfc89DBe

--HG--
extra : rebase_source : f0c5aa918f577ca8a285afd2414fe3da6545fefc
2018-04-20 16:41:07 +09:00
Makoto Kato
da20106275 Bug 1455533 - Part 2. Devirtualize EditorBase::PostCreate. r=masayuki
No one uses postCreate from script even if c-c and BlueGriffon. So we should
devirtualize this

MozReview-Commit-ID: D3FKVEvG7Go

--HG--
extra : rebase_source : 9915a93ea8ae18bee251507a4c94fe66c0f03d0f
2018-04-20 16:40:24 +09:00
Makoto Kato
bda5448bb6 Bug 1455533 - Part 1. Devirtualize EditorBase::SyncRealTimeSpell. r=masayuki
No one uses syncRealTimeSpell from script even if c-c and BlueGriffon. So
we should devirtualize this

MozReview-Commit-ID: AoOb165dOFa

--HG--
extra : rebase_source : e1a9dcdfa6cfe6c918a06a2738c38a6cb9441a1d
2018-04-20 16:27:16 +09:00
Masayuki Nakano
9000054fed Bug 1454945 - Get rid of nsIEditor.suppressDispatchingInputEvent since nobody uses it from JS r=m_kato
So, this patch replaces the setter with non-virtual method and removing the
getter since where is already non-virtual getter method.

MozReview-Commit-ID: Is19Yriz8t8

--HG--
extra : rebase_source : bb2f49f380ddb2e2f96e8690effd8d47d24ae0ae
2018-04-18 22:57:41 +09:00
Masayuki Nakano
10bbfadf8f Bug 1448780 - Get rid of nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems r=m_kato
nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems are shortcut
property for nsITransactionManager.numberOfUndoItems and
nsITransactionManager.numberOfRedoItems of the editor.  However, anybody
uses nsITransactionManager directly.  So, we can get rid of them.

MozReview-Commit-ID: 70J0bsxDNCC

--HG--
extra : rebase_source : fd0847687fe595b257b0256a5f1faa5f2df5f972
2018-03-26 18:11:06 +09:00
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