2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "domstubs.idl"
|
2003-07-18 23:03:34 +04:00
|
|
|
|
2018-04-07 01:32:25 +03:00
|
|
|
webidl CharacterData;
|
2018-05-24 20:18:34 +03:00
|
|
|
webidl Node;
|
2020-08-04 17:59:03 +03:00
|
|
|
webidl Range;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
Bug 1739545 - part 2: Redesign `TextServicesDocument::DidJoinNodes()` methods r=m_kato
There is 2 overloads. One is `TextServicesDocument`'s method, and the latter is
for `nsIEditActionListener`. The latter could occur if `TextServicesDocument`
is added to the editor when there is no inline spellchecker, `EditorSpellCheck`
or `mozSpellChecker`.
https://searchfox.org/mozilla-central/rev/d2f8488b6a704443a5c5bfc6d2878171b5f0d393/editor/libeditor/EditorBase.cpp#2388,2391,2393,2396,2398
I don't know whether this is possible case, but unfortunately,
`nsIEditActionListener::DidJoinNodes()` is not implemented by JS and implemented
only by `TextServicesDocument`. Therefore, we can make it "noscript" and use
non-scriptable classes as arguments.
This patch makes them get jointed point and removed content node and the joining
direction for fixing bug 1735608. Unfortunately, there is no test framework
to check the result in `TextServicesDocument` nor the new path. The latter
should be tested when we fix bug 1735608 later.
Differential Revision: https://phabricator.services.mozilla.com/D130458
2021-11-09 04:09:20 +03:00
|
|
|
%{C++
|
|
|
|
#include "mozilla/EditorDOMPoint.h"
|
|
|
|
class nsINode;
|
|
|
|
class nsIContent;
|
|
|
|
namespace mozilla {
|
|
|
|
template class EditorDOMPointBase<nsINode*, nsIContent*>;
|
|
|
|
} // namespace mozilla
|
|
|
|
%}
|
|
|
|
|
|
|
|
[ref] native EditorRawDOMPointRef(mozilla::EditorDOMPointBase<nsINode*, nsIContent*>);
|
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/*
|
|
|
|
Editor Action Listener interface to outside world
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-05-28 18:58:42 +03:00
|
|
|
* A generic editor action listener interface.
|
2001-03-28 03:11:08 +04:00
|
|
|
* <P>
|
|
|
|
* nsIEditActionListener is the interface used by applications wishing to be notified
|
|
|
|
* when the editor modifies the DOM tree.
|
|
|
|
*
|
|
|
|
* Note: this is the wrong class to implement if you are interested in generic
|
|
|
|
* change notifications. For generic notifications, you should implement
|
|
|
|
* nsIDocumentObserver.
|
|
|
|
*/
|
|
|
|
[scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)]
|
2018-01-13 04:10:05 +03:00
|
|
|
interface nsIEditActionListener : nsISupports
|
|
|
|
{
|
2015-05-28 18:58:42 +03:00
|
|
|
/**
|
2001-03-28 03:11:08 +04:00
|
|
|
* Called after the editor deletes a node.
|
|
|
|
* @param aChild The node to delete
|
|
|
|
* @param aResult The result of the delete node operation.
|
|
|
|
*/
|
2018-05-24 20:18:34 +03:00
|
|
|
void DidDeleteNode(in Node aChild, in nsresult aResult);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2015-05-28 18:58:42 +03:00
|
|
|
/**
|
2001-03-28 03:11:08 +04:00
|
|
|
* Called after the editor joins 2 nodes.
|
Bug 1739545 - part 2: Redesign `TextServicesDocument::DidJoinNodes()` methods r=m_kato
There is 2 overloads. One is `TextServicesDocument`'s method, and the latter is
for `nsIEditActionListener`. The latter could occur if `TextServicesDocument`
is added to the editor when there is no inline spellchecker, `EditorSpellCheck`
or `mozSpellChecker`.
https://searchfox.org/mozilla-central/rev/d2f8488b6a704443a5c5bfc6d2878171b5f0d393/editor/libeditor/EditorBase.cpp#2388,2391,2393,2396,2398
I don't know whether this is possible case, but unfortunately,
`nsIEditActionListener::DidJoinNodes()` is not implemented by JS and implemented
only by `TextServicesDocument`. Therefore, we can make it "noscript" and use
non-scriptable classes as arguments.
This patch makes them get jointed point and removed content node and the joining
direction for fixing bug 1735608. Unfortunately, there is no test framework
to check the result in `TextServicesDocument` nor the new path. The latter
should be tested when we fix bug 1735608 later.
Differential Revision: https://phabricator.services.mozilla.com/D130458
2021-11-09 04:09:20 +03:00
|
|
|
* @param aJoinedPoint The joined point. If aLeftNodeWasRemoved is true,
|
|
|
|
* it points after inserted left node content in the
|
|
|
|
* right node. Otherwise, it points start of inserted
|
|
|
|
* right node content in the left node.
|
|
|
|
* @param aRemovedNode The removed node.
|
|
|
|
* @param aLeftNodeWasRemoved
|
|
|
|
* true if left node is removed and its contents were
|
|
|
|
* moved into start of the right node.
|
|
|
|
* false if right node is removed and its contents were
|
|
|
|
* moved into end of the left node.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
Bug 1739545 - part 2: Redesign `TextServicesDocument::DidJoinNodes()` methods r=m_kato
There is 2 overloads. One is `TextServicesDocument`'s method, and the latter is
for `nsIEditActionListener`. The latter could occur if `TextServicesDocument`
is added to the editor when there is no inline spellchecker, `EditorSpellCheck`
or `mozSpellChecker`.
https://searchfox.org/mozilla-central/rev/d2f8488b6a704443a5c5bfc6d2878171b5f0d393/editor/libeditor/EditorBase.cpp#2388,2391,2393,2396,2398
I don't know whether this is possible case, but unfortunately,
`nsIEditActionListener::DidJoinNodes()` is not implemented by JS and implemented
only by `TextServicesDocument`. Therefore, we can make it "noscript" and use
non-scriptable classes as arguments.
This patch makes them get jointed point and removed content node and the joining
direction for fixing bug 1735608. Unfortunately, there is no test framework
to check the result in `TextServicesDocument` nor the new path. The latter
should be tested when we fix bug 1735608 later.
Differential Revision: https://phabricator.services.mozilla.com/D130458
2021-11-09 04:09:20 +03:00
|
|
|
[noscript]
|
|
|
|
void DidJoinContents([const] in EditorRawDOMPointRef aJoinedPoint,
|
|
|
|
[const] in Node aRemovedNode,
|
|
|
|
in bool aLeftNodeWasRemoved);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2015-05-28 18:58:42 +03:00
|
|
|
/**
|
2001-03-28 03:11:08 +04:00
|
|
|
* Called after the editor inserts text.
|
2018-04-07 01:32:25 +03:00
|
|
|
* @param aTextNode This node getting inserted text.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aOffset The offset in aTextNode to insert at.
|
|
|
|
* @param aString The string that gets inserted.
|
|
|
|
* @param aResult The result of the insert text operation.
|
|
|
|
*/
|
2018-04-07 01:32:25 +03:00
|
|
|
void DidInsertText(in CharacterData aTextNode,
|
2018-03-19 22:45:55 +03:00
|
|
|
in long aOffset,
|
2018-09-06 11:02:43 +03:00
|
|
|
in AString aString,
|
2018-03-19 22:45:55 +03:00
|
|
|
in nsresult aResult);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2015-05-28 18:58:42 +03:00
|
|
|
/**
|
2001-03-28 03:11:08 +04:00
|
|
|
* Called before the editor deletes text.
|
2018-04-07 01:32:25 +03:00
|
|
|
* @param aTextNode This node getting text deleted.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aOffset The offset in aTextNode to delete at.
|
|
|
|
* @param aLength The amount of text to delete.
|
|
|
|
*/
|
2018-04-07 01:32:25 +03:00
|
|
|
void WillDeleteText(in CharacterData aTextNode,
|
2018-03-19 22:45:55 +03:00
|
|
|
in long aOffset,
|
|
|
|
in long aLength);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2020-08-04 17:59:03 +03:00
|
|
|
/**
|
|
|
|
* Called before the editor deletes the ranges.
|
|
|
|
* @param aRangesToDelete The ranges to be deleted.
|
|
|
|
*/
|
|
|
|
void WillDeleteRanges(in Array<Range> aRangesToDelete);
|
2001-03-28 03:11:08 +04:00
|
|
|
};
|