Commit Graph

24 Commits

Author SHA1 Message Date
Masayuki Nakano
16c36d15f7 Bug 1445569 - part 3: Make TextEditRules::CheckBidiLevelForDeletion() take |const EditorRawDOMPoint&| instead of |nsINode*| and offset in it r=m_kato
There are 2 callers of TextEditRules::CheckBidiLevelForDeletion().  One of them
will start to use EditorRawDOMPoint.  Therefore, making it take
|const EditorRawDOMPoint&| instead of |nsINode*| and offset in it keeps the
caller simpler.

MozReview-Commit-ID: DRJXo8gnzba

--HG--
extra : rebase_source : a64d1033699245f54a8f8e6a9b93457e12f33e6c
2018-03-15 18:38:46 +09:00
Makoto Kato
d89148b69b Bug 1436285 - Part 1. Don't use nsIDOMNode version of GetStartNodeAndOffset and GetEndNodeAndOffset. r=masayuki
To get a rid of some methods, I would like to replace nsIDOMNode usages with nsINode.

MozReview-Commit-ID: B0FVczayND0

--HG--
extra : rebase_source : ede058089332202ba0c05ddb61e0f119cbf52fcb
2018-02-28 11:32:28 +09:00
Masayuki Nakano
b2a3e52b16 Bug 1430021 - part 1: Move |RefPtr<TextEditRules> mRules| from TextEditor to EditorBase r=m_kato
For calling some methods of mRules from EditorBase, let's move mRules member
from TextEditor to EditorBase.

Unfortunately, TextEditRules.h depends on EditAction which is declared in
EditorBase.h and that caused unnecessary include hell of EditorBase.h.  So,
let's move it to an independent header file.

MozReview-Commit-ID: 5HiSZLP9WHH

--HG--
extra : rebase_source : 3e2c40385a6f3d6d1e03ef4e213434383bb37d5f
2018-01-12 19:01:04 +09:00
Masayuki Nakano
17f76b7cd6 Bug 1393337 - Get rid of nsIEditRules r=m_kato
nsIEditRules is a super class of only mozilla::TextEditRules and not scriptable.
So, we can get rid of it.

This patch merges RulesInfo with TextRulesInfo and name new class is RulesInfo
for minimizing the code change.

Additionally, adds two methods AsHTMLEditRules() and its const version.
They make existing cast code safer.

MozReview-Commit-ID: KwWH3ADj3Bv

--HG--
extra : rebase_source : 4517bdc95b530530e9756e07c4b6cce78c002073
2017-12-21 14:52:32 +09:00
Masayuki Nakano
ddf72056f7 Bug 1424676 - part 2: Redesign TextEditRules::CreateBR(), TextEditRules::CreateMozBR() and TextEditRules::CreateBRInternal() with |const EditorRawDOMPoint&| r=m_kato
TextEditRules has some wrappers of TextEditor::CreateBR().  Also they should
take |const EditorRawDOMPoint&| to specify the insertion point of new <br>
element.

Additionally, this patch makes them just return add-refed Element instead of
nsresult.  So, we can get rid of out param from it.

MozReview-Commit-ID: 3wfKGaTM89c

--HG--
extra : rebase_source : 47f0d89bc16f0858c7141b2035164adb9105493c
2017-12-11 16:37:10 +09:00
Makoto Kato
7f97c4e179 Bug 1408829 - Make spellCheckAfterEditorChange as noscript. r=masayuki
No one uses nsIInlineSpellChecker.spellCheckAfterEditorChange from script.
So I think we can mark this interface as noscript.

Since this method is scriptable, we need QI to get nsIDOMNode.  If we can
change to noscript, it can reduce QI to get nsIDOMNode.

MozReview-Commit-ID: GC0WuFyTlaZ

--HG--
extra : rebase_source : 16ca9fc548e86747ac17407be48295c709174fb5
2017-11-29 18:00:11 +09:00
Makoto Kato
90bfbaba4c Bug 1416080 - Part 2. CreateMozBR should use native dom node. r=masayuki
Part 1. moves native dom method of CreateBR, so we should use it for
CreateMozBR, and use native dom as parameter.

MozReview-Commit-ID: DHUB88HfowQ

--HG--
extra : rebase_source : 00fefd12b50bef0f1a9bd69e1b7992a19999d42f
2017-11-27 15:05:04 +09:00
Olli Pettay
045eeefaaa Bug 1390402, add a faster variant of TextEditor::GetDocumentIsEmpty(), r=masayuki
--HG--
extra : rebase_source : 3238aec96be5b0393c395ce8cce9a0489d2e671d
2017-08-24 13:53:34 +03:00
Masayuki Nakano
e4fb1c57a7 Bug 1385905 - part2: HTMLEditRules::SplitParagraph() should insert normal <br> element rather than moz-<br> element if split element and/or new element is empty r=m_kato
Currently, HTMLEditRules::SplitParagraph() inserts moz-<br> element when split element and/or new element causes empty line.  However, PlaintextSerializer ignores moz-<br> elements.  Therefore, empty lines which are created by SplitParagraph() will be removed when it's converted to plaintext.

So, it should insert normal <br> element for placeholder of empty lines instead.  Note that moz-<br> elements are appeared as normal <br> elements in the result of Element.innerHTML.  Additionally, Chromium always inserts a <br> element for empty block elements which are created by Enter key press.  Therefore, using normal <br> element in this case shouldn't cause any compatibility problems.

MozReview-Commit-ID: FNV41zEFWqQ

--HG--
extra : rebase_source : ece6c2e275e2a75d9d2871d62ed4204115792b99
2017-08-01 22:38:50 +09:00
Bevis Tseng
95b18d794e Bug 1382172 - Name nsITimerCallback instances in native implementation. r=billm
--HG--
extra : rebase_source : 84de1abfcc30a6964144c2e6718a508c71027b65
2017-07-27 02:18:20 +08:00
Masayuki Nakano
7231604754 Bug 596501 TextEditRules::WillOutputText() should handle itself if it can return only the text of first text node r=m_kato
TextEditor::OutputToString() uses DocumentEncoder if TextEditRules::WillOutputText() doesn't handle it.  However, TextEditRules::WillOutputText() doesn't handle it even if it's really simple case of <input type="text"> and <textarea>.
This patch makes TextEditRules::WillOutputText() handle it if DOM tree in the editor root element is expected and there is no special flag which requires complicated handling.

MozReview-Commit-ID: 3HvdTAWRpw0

--HG--
extra : rebase_source : ab3e630faa95ce8d4c1e9eb1786b7ece7212e38f
2017-06-16 19:08:10 +09:00
Makoto Kato
da0ebf60c0 Bug 1358025 - Part 2. Add SetText Transaction API. r=masayuki
Actually, input.value setter behaviour (when editor has focus) is the following.

- select all
- delete selection
 - delete text node
- insert text
 - create text node
  - create nsIFrame since we don't support lazy construction for editable element

It is too expensive to change text.  So I would like to change like the following when there is 1 text node only (normal case).  If child nodes isn't 1 text node only, use original way.

- set text on existed text node

So, for this fast path, I would like to add SetText transaction API.

MozReview-Commit-ID: A7bjXtCtSoB

--HG--
extra : rebase_source : ff6348d7a3304e676a0a4b897f91623962961ae0
2017-05-25 14:30:50 +09:00
Makoto Kato
353b47086e Bug 1360154 - Part 1. DocumentIsBody should return bool, not nsresult. r=masayuki
nsIEditRules::GetDocumentIsEmpty doesn't return error without null parameter, so we should use bool as return value instead.

MozReview-Commit-ID: HIoQmKu6ETF

--HG--
extra : rebase_source : 570452e7072d8e0e837bb2822c9c0ab9c0d1a8cf
2017-05-11 14:03:26 +09:00
Makoto Kato
bba54a63e6 Bug 1359008 - Don't use nsIDOM* in TextEditRules's member. r=masayuki
To clean up TextEditRules, I would like to replace nsIDOMNode with nsINode and nsIContent in TextEditRules.

GetTopEnclosingPre is unused define, so I also remove it.

MozReview-Commit-ID: 6LraexH5t4m

--HG--
extra : rebase_source : 1037dcfd949d544282dc30360bd43773f21fd929
2017-04-24 19:40:12 +09:00
Boris Zbarsky
f80dd7a663 Bug 1345237. Propagate uint32_t deeper into the editor state and text control frame code. r=mystor
MozReview-Commit-ID: KeUo8My6eBJ
2017-03-09 14:44:45 -05:00
Makoto Kato
6b3afdd60e Bug 1337273 - Don't use mTextEditor from HTMLEditRules. r=masayuki
HTMLEditRules can access both mTextEditor and mHTMLEditor, but we should use mHTMLEditor only on HTMLEditRules for readability.

MozReview-Commit-ID: HfzwAD554XQ

--HG--
extra : rebase_source : 7d722915a41eb878e2cd2ff711ac4925bd91d1d8
2017-02-08 18:32:32 +09:00
Makoto Kato
93a16746ac Bug 1328558 - Remove unused insertElement member from TextEditRules. r=masayuki
Remove insertElement from TextEditRules due to unused.  Also, comments into TextEditRules is out of date.  We should update it using currect enum.

MozReview-Commit-ID: B1wczFWh2Ya

--HG--
extra : rebase_source : 910338b2f5d20316dcf11928e964346fa4aa8411
2017-01-04 18:51:44 +09:00
Masayuki Nakano
f382711dc3 Bug 1260651 part.59 Rename nsEditor to mozilla::EditorBase (and also their file names) r=mccr8
This patch also renames:

EditorInputEventDispatcher -> mozilla::EditorInputEventDispatcher

And some variable names are renamed from aEditor or mEditor to aEditorBase or mEditorBase for making their types clearer.

MozReview-Commit-ID: 2FCXWpLMn8e

--HG--
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/EditorBase.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/EditorBase.h
2016-07-08 13:10:13 +09:00
Masayuki Nakano
a4ac19d311 Bug 1260651 part.58 Rename nsPlaintextEditor to mozilla::TextEditor (and their file names too) r=mccr8
This patch renames nsPlaintextEditor to mozilla::TextEditor.

Additionally, renames TextEditRules::mEditor to TextEditRules::mTextEditor for making its type clearer.

Finally, renaming following files:

nsPlaintextEditor.h -> TextEditor.h (exposed as mozilla/editor/TextEditor.h)
nsPlaintextEditor.cpp -> TextEditor.cpp
nsPlaintextDataTransfer.cpp -> TextEditorDataTransfer.cpp

MozReview-Commit-ID: Lw8oJi4WglA

--HG--
rename : editor/libeditor/nsPlaintextEditor.cpp => editor/libeditor/TextEditor.cpp
rename : editor/libeditor/nsPlaintextEditor.h => editor/libeditor/TextEditor.h
rename : editor/libeditor/nsPlaintextDataTransfer.cpp => editor/libeditor/TextEditorDataTransfer.cpp
2016-07-09 11:54:50 +09:00
Masayuki Nakano
5c69175a0a Bug 1260651 part.53 Rename nsRulesInfo to mozilla::RulesInfo and rename nsEditRules.h to nsIEditRules.h r=mccr8
MozReview-Commit-ID: LGqyvjv9pr6

--HG--
rename : editor/libeditor/nsEditRules.h => editor/libeditor/nsIEditRules.h
2016-07-07 19:33:32 +09:00
Masayuki Nakano
baafefc66e Bug 1260651 part.52 Rename nsAutoLockListener to mozilla::AutoLockListener r=mccr8
MozReview-Commit-ID: 728oPlrpb3Q
2016-06-24 21:22:26 +09:00
Masayuki Nakano
d8f7c7cf33 Bug 1260651 part.51 Rename nsAutoLockRulesSniffing to mozilla::AutoLockRulesSniffing r=mccr8
MozReview-Commit-ID: BnZ1Y3YXfMK
2016-06-24 21:19:18 +09:00
Masayuki Nakano
a0b8f02f00 Bug 1260651 part.50 Rename nsTextRulesInfo to mozilla::TextRulesInfo r=mccr8
MozReview-Commit-ID: Iny5k7WQlbS
2016-06-24 21:12:16 +09:00
Masayuki Nakano
94713accb3 Bug 1260651 part.49 Rename nsTextEditRules to mozilla::TextEditRules (and also their file names) r=mccr8
MozReview-Commit-ID: DzNeLcT1r1e

--HG--
rename : editor/libeditor/nsTextEditRules.cpp => editor/libeditor/TextEditRules.cpp
rename : editor/libeditor/nsTextEditRules.h => editor/libeditor/TextEditRules.h
rename : editor/libeditor/nsTextEditRulesBidi.cpp => editor/libeditor/TextEditRulesBidi.cpp
2016-07-09 11:34:41 +09:00