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

10604 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 5dd777bdc1 Bug 1716863 - Make `HTMLEditor::HandleInsertText()` climb up the tree when `Selection` is in elements which cannot have text nodes r=m_kato
In most cases, it's called with selection range which is collapsed in a text
node, but otherwise, the selection may be in an element which cannot have
text nodes.  Therefore, before handling the insertion, it should look for
ancestor element which can have text nodes.

Note that this patch makes inserting text immediately before an inclusive
ancestor element whose parent can have a text node.  However, both Blink and
WebKit ignores if there are invisible/empty inline nodes.  So, even with
this patch, Gecko keeps failing in some tests of the WPT.  It should be handled
in a follow up bug because doing it requires complicated code.

Differential Revision: https://phabricator.services.mozilla.com/D119065
2021-07-06 04:55:28 +00:00
Masayuki Nakano 637a88b524 Bug 1718815 - part 4: Move `EditorBase::AppendNodeToSelectionAsRange()` and `EditorBase::ClearSelection()` to `HTMLEditor` r=m_kato
Depends on D119003

Differential Revision: https://phabricator.services.mozilla.com/D119004
2021-07-02 08:23:46 +00:00
Masayuki Nakano 46d18deed5 Bug 1718815 - part 3: Move `EditorBase::AutoTransactionBatch` to `HTMLEditor` r=m_kato
I guess that this class is replaced with `AutoPlaceholderBatch`, and both of
them are followed by its instances.  However, I don't want to change the
behavior in this bug.  Therefore, this patch just moves it into `HTMLEditor`.

Depends on D119002

Differential Revision: https://phabricator.services.mozilla.com/D119003
2021-07-02 08:23:45 +00:00
Masayuki Nakano a68528b057 Bug 1718815 - part 2: Move `EditorBase::AutoSelectionRestorer` and `EditorBase` methods called only by it to `HTMLEditor` r=m_kato
Unfortunately, marking its constructor and destructor as `MOZ_CAN_RUN_SCRIPT`,
`Maybe<AutoSelectionRestorer>::reset()` and
`Maybe<AutoSelectionRestorer>::emplace()` cause bustage.  Therefore, this patch
just mark them as `MOZ_CAN_RUN_SCRIPT_BOUNDARY`.

Note that `EditorBase::SavedSelectionRef()` cannot be moved to `HTMLEditor`
because `mEditActionData` is a private member of `EditorBase`.

Depends on D119001

Differential Revision: https://phabricator.services.mozilla.com/D119002
2021-07-02 08:23:45 +00:00
Masayuki Nakano 7ac37b46ec Bug 1718815 - part 1: Move `EditorBase::AddTransactionListener()` and `EditorBase::RemoveTransactionListener()` to `HTMLEditor` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D119001
2021-07-02 08:23:44 +00:00
Masayuki Nakano 1fc0882ecc Bug 1718607 - Make `TextServicesDocument` use `uint32_t` for offset in DOM node r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D118955
2021-06-30 09:07:35 +00:00
Masayuki Nakano 347bc5719a Bug 1714914 - Make editor classes treat offset in parent node as uint32_t r=m_kato
It should be treated as `uint32_t` since DOM API does so.  However, there are
some exceptions:

* Result of `nsINode::ComputeIndexOf()`
* Result of `nsAString` methods

They return `-1` as not found, and anyway, they cannot treat large integer
than `INT32_MAX`.  Therefore, this patch does not touch around them.

Differential Revision: https://phabricator.services.mozilla.com/D118933
2021-06-30 07:07:28 +00:00
Masayuki Nakano f8426533d4 Bug 1717178 - part 8: Get rid of `nsIEditor.doTransaction()` because of unused r=m_kato
Depends on D118803

Differential Revision: https://phabricator.services.mozilla.com/D118805
2021-06-28 12:08:51 +00:00
Masayuki Nakano 917dc274f8 Bug 1717178 - part 7: Get rid of `nsIEditor::AddEditorObserver()` and `nsIEditorObserver` interface because of unused r=m_kato
Depends on D118802

Differential Revision: https://phabricator.services.mozilla.com/D118803
2021-06-28 12:08:51 +00:00
Masayuki Nakano 5017e990c8 Bug 1717178 - part 6: Get rid of `nsIHTMLEditor.setCaretAfterElement()` because of unused r=m_kato
Depends on D118801

Differential Revision: https://phabricator.services.mozilla.com/D118802
2021-06-28 12:08:51 +00:00
Masayuki Nakano 3e099ba376 Bug 1717178 - part 5: Get rid of `nsIHTMLEditor.pasteNoFormatting()` because of unused r=m_kato
Depends on D118800

Differential Revision: https://phabricator.services.mozilla.com/D118801
2021-06-28 12:08:50 +00:00
Masayuki Nakano bc454f8841 Bug 1717178 - part 4: Get rid of `nsIHTMLEditor.getInlineProperty()` because of unused r=m_kato
Only `test_bug1140105.html` is its user, but it can be replaced with
`getInlinePropertyWithAttrValue()` since they do exactly same things:
https://searchfox.org/mozilla-central/rev/fc95c6ad297d9d257f05599d01741503f3f57326/editor/libeditor/HTMLStyleEditor.cpp#1685-1687,1719-1721

Depends on D118799

Differential Revision: https://phabricator.services.mozilla.com/D118800
2021-06-28 12:08:50 +00:00
Masayuki Nakano 4ac1a649ab Bug 1717178 - part 3: Get rid of `nsIHTMLObjectResizer.refreshResizers()` because of unused r=m_kato
Depends on D118798

Differential Revision: https://phabricator.services.mozilla.com/D118799
2021-06-28 12:08:49 +00:00
Masayuki Nakano ab7d00e972 Bug 1717178 - part 2: Get rid of `nsIHTMLAbsPosEditor.refreshGrabber()` because of unused r=m_kato
Depends on D118797

Differential Revision: https://phabricator.services.mozilla.com/D118798
2021-06-28 12:08:49 +00:00
Masayuki Nakano 807bae35f4 Bug 1717178 - part 1: Get rid of `nsIHTMLInlineTableEditor.refreshInlineTableEditingUI()` because of unused r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D118797
2021-06-28 12:08:49 +00:00
Masayuki Nakano ca0a51ea08 Bug 1716408 - Make enable `test_cut_copy_password.html` in all cases r=m_kato
The fix of bug 1676702 made the test stable.  So, let's try to enable it in
any environment.

Depends on D118758

Differential Revision: https://phabricator.services.mozilla.com/D118759
2021-06-28 06:31:08 +00:00
Masayuki Nakano 0b53199bb0 Bug 1676702 - part 3: Make `TextControlState` store unmasked range while it does not have `TextEditor` r=m_kato
`TextControlState` is alive during reframing, but `TextEditor` is not so.
Therefore, `TextControlState` should take the `PasswordMaskData` before
`TextEditor` is destroyed.  And if `TextEditor` is recreated, and the value
hasn't been modified, unmasked range should be restored in the new editor.

Depends on D118757

Differential Revision: https://phabricator.services.mozilla.com/D118758
2021-06-28 04:37:54 +00:00
Masayuki Nakano 63d372da2f Bug 1676702 - part 2: Make `TextControlState` initialize `TextEditor` with `PasswordMaskData` r=m_kato
During a `TextControlState` alive, `PasswordMaskData` should be alive too.
Otherwise, we cannot keep unmasked range at reframing.

Depends on D118756

Differential Revision: https://phabricator.services.mozilla.com/D118757
2021-06-28 04:37:54 +00:00
Masayuki Nakano 30130a49c1 Bug 1676702 - part 1: Make `TextEditor` store password masking data in a struct r=m_kato
The intermittent failure is caused by unexpected global reflow during the test.
If `<input type="password">` is reframed, `TextEditor` instance is recreated.
Then, the unmasked range of the editor stored by `TextEditor` is also lost.
Therefore, unmasked range is randomly lost by unexpected reflow.

If the global reflow is occurred by font list update etc which are not expected
by users, unmasked password field is unexpectedly masked.  So, this is a real
bug of `TextEditor`.

So, unmasked range needs to be stored outside `TextEditor` for making its
lifetime longer than `TextEditor`.  For doing it, first, `TextEditor` should
access password mask data via a pointer to a struct.  Then, fortunately,
we need to allocate it only when the `TextEditor` is a password editor.

Depends on D118755

Differential Revision: https://phabricator.services.mozilla.com/D118756
2021-06-28 04:37:53 +00:00
Masayuki Nakano 8927b994ea Bug 1676702 - part 0: Add automated tests for keeping unmasked range during reflows r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D118755
2021-06-28 04:37:53 +00:00
Masayuki Nakano 88b5b85325 Bug 1717749: Drop `MOZ_ASSERT` check for `nsIEditor.eEditorMailMask` r=m_kato
In my understanding at fixing bug 1717156, `nsIEditor.eEditorMailMask` won't be
set to `TextEditor` instance.  However for making consistent **spellchecker**
behavior on email composer, subject editor is also set this flag.  So, we need
to drop the check in `SetFlags` and IsMailEditor.

Differential Revision: https://phabricator.services.mozilla.com/D118561
2021-06-23 23:01:48 +00:00
Masayuki Nakano dcc8404a03 Bug 1717156 - part 7: Revert the change of the debug `printf` in `TextEditor.cpp` r=m_kato
I forgot to revert this before landing.

Differential Revision: https://phabricator.services.mozilla.com/D118447
2021-06-22 10:33:44 +00:00
Masayuki Nakano 3485a15088 Bug 1717156 - part 6: Get rid of `nsIEditor::eEditorDontEchoPassword` r=m_kato
It's used only by password field, i.e., only by `TextEditor`, and used
temporarily.  Additionally, there is some space in `TextEditor`.  So, we
can get rid of it, and make `TextEditor` store it directly.

Note that this allows to skip expensive `nsIEditor::SetFlags()` calls by
`AutoRestoreEditorState`.  This may improve setting `<input>.value` performance.

Differential Revision: https://phabricator.services.mozilla.com/D118266
2021-06-22 00:18:08 +00:00
Masayuki Nakano e178e6da17 Bug 1717156 - part 5: Get rid of `nsIEditor::eEditorNoCSSMask` r=m_kato
Now, `nsIEditor::eEditorNoCSSMask` is used only in the editor internally.
And it's available and meaningful only with `HTMLEditor` instance.  So,
we can get rid of it from `EditorBase`.  Fortunately, `HTMLEditor` always
creates `CSSEditUtils` and it stores the raw value indicating whether the
editor manager enabled or disabled CSS.  Therefore, we don't need new
member variable in `HTMLEditor` for storing the flag.  And this allows us
to remove `nsIEditor::SetFlags()` override of `HTMLEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D118265
2021-06-22 00:18:07 +00:00
Masayuki Nakano 148a74cbc3 Bug 1717156 - part 4: Drop `Tab` key handling in `EditorBase` r=m_kato
Now, `EditorBase::IsTabable()` returns true only when it's an `HTMLEditor`
instance and `nsIEditor::eEditorAllowInteraction` is not set.  Additionally,
nobody controls the flag of `TextEditor`.  So, we can make the flag available
only with `HTMLEditor` instance, and `Tab` key handling in `EditorBase`
can be moved to `HTMLEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D118264
2021-06-22 00:18:07 +00:00
Masayuki Nakano 88d2a84a0f Bug 1717156 - part 3: Get rid of `nsIEditor::eEditorFilterInputMask` and its accessor r=m_kato
Nobody (including comm-central and BlueGriffon) uses
`nsIEditor::eEditorFilterInputMask`.  Therefore, we can get rid of this and its
accessor, `EditorBase::IsInputFiltered()`.

Differential Revision: https://phabricator.services.mozilla.com/D118263
2021-06-22 00:18:06 +00:00
Masayuki Nakano 666946b157 Bug 1717156 - part 2: Get rid of `nsIEditor::eEditorWidgetMask` and its accessor r=m_kato
With the previous patch, we know `nsIEditor::eEditorWidgetMask` always
matches with `EditorBase::IsTextEditor()`.  And it's not referred from JS
(including comm-central and BlueGriffon).  So, we can get rid of it.

Differential Revision: https://phabricator.services.mozilla.com/D118262
2021-06-22 00:18:06 +00:00
Masayuki Nakano 0e68fa3f7e Bug 1717156 - part 1: Make editor type specific flags clearer with `MOZ_ASSERT` r=m_kato
Some `nsIEditor::eEditor*Mask` flags are now only for `TextEditor` or
`HTMLEditor`.  For making it clearer, add `MOZ_ASSERT` to the `SetFlags` and
each flag accessor.

Differential Revision: https://phabricator.services.mozilla.com/D118261
2021-06-22 00:18:05 +00:00
Kagami Sascha Rosylight e40714855d Bug 1716728 - Part 7: Move mPaddingBRElementForEmptyEditor to HTMLEditor r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118074
2021-06-21 01:49:01 +00:00
Kagami Sascha Rosylight 89ab198242 Bug 1716728 - Part 6: Add HTMLEditor::ReflectPaddingBRElementForEmptyEditor() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118071
2021-06-21 01:49:00 +00:00
Kagami Sascha Rosylight 17fdc5f56b Bug 1716728 - Part 5: Move EnsureNoPaddingBRElementForEmptyEditor to HTMLEditor r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118068
2021-06-21 01:49:00 +00:00
Kagami Sascha Rosylight 072dc887f9 Bug 1716728 - Part 4: Remove EnsureNoPaddingBRElementForEmptyEditor call for TextEditor r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118066
2021-06-21 01:49:00 +00:00
Kagami Sascha Rosylight 24eb2dca60 Bug 1716728 - Part 3: Move MaybeCreatePaddingBRElementForEmptyEditor to HTMLEditor r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118065
2021-06-21 01:48:59 +00:00
Kagami Sascha Rosylight 5dc38e6e2f Bug 1716728 - Part 2: Remove TextEditor::EnsurePaddingBRElementForEmptyEditor() r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118064
2021-06-21 01:48:59 +00:00
Kagami Sascha Rosylight 7851edce6e Bug 1716728 - Part 1: Use IsEmpty() instead of mPaddingBRElementForEmptyEditor existence check r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118063
2021-06-21 01:48:58 +00:00
Masayuki Nakano 698fd90470 Bug 1716746 - Rename `EditorBase::IsPlaintextEditor()` to `IsInPlaintextMode()` r=m_kato
Developers may be confused at `IsTextEditor()` and `IsPlaintextEditor()`. When
the latter is `true`, the former is always `true`, but it may be `true` when the
editor is `HTMLEditor` too. So, it's a mode of  `HTMLEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D118246
2021-06-18 20:35:48 +00:00
Kagami Sascha Rosylight 3f6f05b7eb Bug 1713334 - Part 6: Actively prevent text deletion in DeleteRangeTransaction r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118239
2021-06-18 00:36:56 +00:00
Kagami Sascha Rosylight 2de7595469 Bug 1713334 - Part 5: Allow caret to be at the end of text node r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117024
2021-06-18 00:36:55 +00:00
Kagami Sascha Rosylight 673eb02a8f Bug 1713334 - Part 4: Always select the text node r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117474
2021-06-18 00:36:55 +00:00
Kagami Sascha Rosylight 688fa49f4c Bug 1713334 - Part 3: Assume TextEditor always have a text node r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117023
2021-06-18 00:36:54 +00:00
Kagami Sascha Rosylight 9b640ade5b Bug 1713334 - Part 2: Initialize TextEditor always with a text node r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117022
2021-06-18 00:36:54 +00:00
Kagami Sascha Rosylight 8bbe7f3f11 Bug 1713334 - Part 1: Keep a text node inside text controls even if empty r=masayuki,Jamie
Doing so prevents confusion when detecting selection change.

Differential Revision: https://phabricator.services.mozilla.com/D116303
2021-06-18 00:36:53 +00:00
Masayuki Nakano 4fe63da099 Bug 1716720 - Clean up `TextEditor.h` and `HTMLEditor.h` r=m_kato
`TextEditor` is now a final class, so, it should be marked as so.  And this
patch modernize `virtual`, `override` and `final` keywords in them.

Differential Revision: https://phabricator.services.mozilla.com/D117998
2021-06-17 23:25:55 +00:00
Ryan VanderMeulen a337a14382 Backed out 5 changesets (bug 1713334) for causing bug 1716714.
Backed out changeset bd1c37ce2c61 (bug 1713334)
Backed out changeset 876ed18c5126 (bug 1713334)
Backed out changeset 5a4f4514d99a (bug 1713334)
Backed out changeset 7d7feef654c7 (bug 1713334)
Backed out changeset 61e15374e617 (bug 1713334)
2021-06-17 10:57:32 -04:00
Ryan VanderMeulen 52692e2ba0 Backed out changeset 2f69dc403886 (bug 1716714) for causing bug 1717007. 2021-06-17 10:56:58 -04:00
Kagami Sascha Rosylight 81c32a2ea5 Bug 1716714 - Temporarily convert text node assertion as diagnostic r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D118034
2021-06-17 05:30:28 +00:00
Masayuki Nakano bccd582eaf Bug 1716068 - Don't start autoscroll on editable content or document whose designMode is on r=smaug
When middle mouse paste is enabled and middle click occurs in an editable
content or it's in a document whose `designMode` is `on`, we shouldn't start
the autoscrolling because the click must be intended for pasting clipboard
content or primary selection to the position.

Differential Revision: https://phabricator.services.mozilla.com/D117987
2021-06-16 12:20:17 +00:00
Masayuki Nakano 5a85202b76 Bug 1716299 - Fix the flag name r=m_kato
`nsIDocumentEncoder.OutputRaw` was misspelled as `nsIDocumentEncoder.OutRaw`.

Then, I investigate the expected result more.  Then, I see that when only this
flag is set, any markups should be ignored except `<br>`.  Therefore, I modified
the 2 test results which check `<p>`, `<div>` and `<br>` elements.

Differential Revision: https://phabricator.services.mozilla.com/D117966
2021-06-16 10:47:27 +00:00
Andrew Halberstadt 7a16af4434 Bug 1700781 - Skip failing mochitest-plain tests with fission + xorigin, r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D117704
2021-06-15 18:24:18 +00:00
Kagami Sascha Rosylight 92d3464a2e Bug 1716350 - Remove redundant editor type checks r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117662
2021-06-15 10:45:20 +00:00