Commit Graph

9540 Commits

Author SHA1 Message Date
Christoph Kerschbaumer
7271448df4 Bug 1584282: Remove forgotten debug statement within test_bug629172.html from Bug 1497200. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D47307

--HG--
extra : moz-landing-system : lando
2019-09-26 16:48:43 +00:00
Jorg K
389a1827c2 Bug 1581774 - revert part of rev 5e2fad03c885 from bug 1507543 for Thunderbirds since it breaks the spellcheck. r=m_kato
--HG--
extra : rebase_source : 8dd6fdf15b48115691d21c476875a9bc5cd48591
2019-09-26 09:42:42 +02:00
Tim Nguyen
b0d1ddb586 Bug 1581956 - Make search-textbox not use the <textbox> tag. r=surkov,MarcoZ
Differential Revision: https://phabricator.services.mozilla.com/D46219

--HG--
extra : moz-landing-system : lando
2019-09-25 19:12:48 +00:00
Christoph Kerschbaumer
53d5895e71 Bug 1497200: Apply Meta CSP to about:downloads. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D45330

--HG--
extra : moz-landing-system : lando
2019-09-25 13:50:28 +00:00
Makoto Kato
2c7f1d861c Bug 1474978 - Add crashtest. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D46756

--HG--
extra : moz-landing-system : lando
2019-09-23 10:37:40 +00:00
Mirko Brodesser
a962446e79 Bug 1581523: part 4) Don't set mWrapColumn depending on <body>'s style. r=jorgk
Instead, rely on the proper initialization of `mWrapColumn` via
`nsPlainTextSerializer::Init`.

This will allow to move `mWrapColumn` to `nsPlainTextSerializer::Settings::mWrapColumn`,
simplifying reasoning about it.

Differential Revision: https://phabricator.services.mozilla.com/D46129

--HG--
extra : moz-landing-system : lando
2019-09-23 11:43:59 +00:00
Masayuki Nakano
5d03660aa8 Bug 1581206 - Reconvert browser_bug629172.js to mochitest r=Ehsan
Currently, we can use chrome process's shortcut key with
`EventUtils.synthesizeKey()` with enabling `"test.events.async.enabled"` pref.
So, we should reconvert it to a mochitest for making it more stable.

Oddly, when I try to run this test as test-verify on macOS, it permanently
fails rendering resizer of `<textarea>` elements immediately after creation.
Therefore, this patch disables this test in test-verify on macOS.

Differential Revision: https://phabricator.services.mozilla.com/D46578

--HG--
rename : editor/libeditor/tests/browser_bug629172.js => editor/libeditor/tests/test_bug629172.html
extra : moz-landing-system : lando
2019-09-20 14:56:47 +00:00
Masayuki Nakano
52da57f7a9 Bug 1581337 - Make HTMLEditor::DeleteMostAncestorMailCiteElementIfEmpty() do nothing if found mail-cite element is not empty r=m_kato
When rewriting `DeleteMostAncestorMailCiteElementIfEmpty()` with early-return
style, I forgot to make it do nothing when found element is empty:
https://searchfox.org/mozilla-central/rev/94e642e6036dc694b07cab895c9b5b267f0db065/editor/libeditor/HTMLEditRules.cpp#4078
This patch restores it.

Differential Revision: https://phabricator.services.mozilla.com/D46122

--HG--
extra : moz-landing-system : lando
2019-09-18 11:38:35 +00:00
Masayuki Nakano
58f9c64190 Bug 1581034 - part 2: Get rid of TextEditUtils::IsBreak() and TextEditUtils itself r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45811

--HG--
extra : moz-landing-system : lando
2019-09-18 12:37:14 +00:00
Masayuki Nakano
4f5eae49b0 Bug 1581034 - part 1: Get rid of TextEditUtils::IsBody() r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45810

--HG--
extra : moz-landing-system : lando
2019-09-18 10:29:01 +00:00
Masayuki Nakano
9973ff7319 Bug 1540029 - part 11: Get rid of AutoEditInitRulesTrigger r=m_kato
Only for solving the order of `AutoEditInitRulesTrigger` destruction when
`HTMLEditor::Init()` calls `TextEditor::Init()`, `TextEditor` has unnecessary
counter and the initialization code is made harder to understand.

Therefore, this patch makes `TextEditor::Init()` and `HTMLEditor::Init()`
directly call `InitEditorContentAndSelection()` at appropriate time.
Additionally, `HTMLEditor::Init()` can call `EditorBase::Init()` instead of
`TextEditor::Init()` since `TextEditor::Init()` does nothing for `HTMLEditor`
actually.

Differential Revision: https://phabricator.services.mozilla.com/D45793

--HG--
extra : moz-landing-system : lando
2019-09-18 10:14:40 +00:00
Masayuki Nakano
6789366d5e Bug 1540029 - part 10: Get rid of TextEditRules and HTMLEditRules r=m_kato
Now, we can get rid of `TextEditRules` and `HTMLEditRules` completely.
And also this patch renames their cpp files to `TextEditSubActionHandler`
and `HTMLEditSubActionHandler`.

`TextEditor::Init()` and `HTMLEditor::Init()` are still complicated due to
`AutoEditInitRulesTrigger`.  The following patch will remove it.

Differential Revision: https://phabricator.services.mozilla.com/D45792

--HG--
rename : editor/libeditor/HTMLEditRules.cpp => editor/libeditor/HTMLEditSubActionHandler.cpp
rename : editor/libeditor/TextEditRules.cpp => editor/libeditor/TextEditSubActionHandler.cpp
extra : moz-landing-system : lando
2019-09-18 08:40:08 +00:00
Masayuki Nakano
d2ae4d5d88 Bug 1540029 - part 9: Move TextEditRules::Init() and HTMLEditRules::Init() to TextEditor and HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45791

--HG--
extra : moz-landing-system : lando
2019-09-18 08:21:37 +00:00
Masayuki Nakano
8b7e7ba3d1 Bug 1540029 - part 8: Replace HTMLEditRules::GetParagraphState() with new stack only class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45790

--HG--
extra : moz-landing-system : lando
2019-09-18 08:20:29 +00:00
Masayuki Nakano
ed4c1cd65a Bug 1540029 - part 7: Replace HTMLEditRules::GetAlignment() with new stack only class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45789

--HG--
extra : moz-landing-system : lando
2019-09-18 06:26:56 +00:00
Masayuki Nakano
6ff81fdbe4 Bug 1540029 - part 6: Replace HTMLEditRules::GetListItemState() with new stack only class r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45788

--HG--
extra : moz-landing-system : lando
2019-09-18 04:42:55 +00:00
Masayuki Nakano
320d1209c9 Bug 1540029 - part 5: Replace HTMLEditRules::GetListState() with new stack class r=m_kato
It takes a lot of `bool` out arguments.  Therefore, we should make it a
stack only class and caller should retrieve only necessary information.

Differential Revision: https://phabricator.services.mozilla.com/D45787

--HG--
extra : moz-landing-system : lando
2019-09-18 03:39:00 +00:00
Masayuki Nakano
b3115e6972 Bug 1540029 - part 4: Merge BeforeEdit() and OnStartToHandleTopLevelEditSubAction(), and AfterEdit() and OnEndHandlingTopLevelEditSubAction() r=m_kato
And also this patch make each `AutoEditSubActionNotifier` creator check
the result of `OnStartToHandleTopLevelEditSubAction()` at least for
`NS_ERROR_EDITOR_DESTROYED`.

We need to take care of its destructor's result later, though.

Differential Revision: https://phabricator.services.mozilla.com/D45786

--HG--
extra : moz-landing-system : lando
2019-09-18 03:01:28 +00:00
Makoto Kato
c147a2e204 Bug 1571375 - Don't remove white space when committing composition. r=masayuki
This is regression by bug 1530649.

After landing bug 1530649, we try to scan end point of replacement text. But
in this bug's situation, afterRun becomes same as current ws run by landing
bug 1530649. To get white space type of next of replacement end, we have to
scan around end point again.

Differential Revision: https://phabricator.services.mozilla.com/D45947

--HG--
extra : moz-landing-system : lando
2019-09-18 03:56:25 +00:00
Masayuki Nakano
59ca43a5a6 Bug 1540029 - part 3: Move HTMLEditRules::DocumentModified() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45785

--HG--
extra : moz-landing-system : lando
2019-09-17 07:22:01 +00:00
Masayuki Nakano
db32271cec Bug 1540029 - part 2: Get rid of TextEditRules::DocumentIsEmpty() and HTMLEditRules::DocumentIsEmpty() r=m_kato
`TextEditRules::DocumentIsEmpty()` is a wrapper of `TextEditor::IsEmpty()` so
that we can get rid of it simply.

`HTMLEditRules::DocumentIsEmpty()` needs to change.  It's oddly checks only
`EditorBase::mPaddingBRElementForEmptyEditor` is `nullptr` or not.  However,
the editor may be completely empty.  And the result may be different from
`TextEditor::IsEmpty()` which is not overridden by `HTMLEditor`.  For partially
solving this issue, this patch makes `HTMLEditor` overrides `IsEmpty()` and
optimizes `TextEditor::IsEmpty()`.

With this change, the caller of `HTMLEditRules::DocumentIsEmpty()` may behave
differently in the only caller, `HTMLEditor::SelectEntireDocument()`.  And
unfortunately, its root called from `SelectAllCommand::DoCommand()`.  However,
it does just collapse `Selection` into the root element (`<body>` or
`Document.documentElement`) if it returns `true`.  Therefore, this change
must be safe since anyway `SelectionRefPtr()->SelectAllChildren()` with
the root element is exactly same as `SelectionRefPtr()->Collapse()` with
the empty root element if it's truly empty.

Differential Revision: https://phabricator.services.mozilla.com/D45784

--HG--
extra : moz-landing-system : lando
2019-09-17 06:58:06 +00:00
Masayuki Nakano
9ee5b3bbef Bug 1540029 - part 1: Move old edit action listener methods of HTMLEditRules to EditorBase::TopLevelEditSubActionData r=m_kato
The main purpose of them is modifying
`TopLevelEditSubActionData::mChangedRange`.  Therefore, they should be in the
struct.

Differential Revision: https://phabricator.services.mozilla.com/D45783

--HG--
extra : moz-landing-system : lando
2019-09-17 04:27:59 +00:00
Masayuki Nakano
bbcb8b3a63 Bug 1574852 - part 113: Move TextEditRules::CreateTrailingBRIfNeeded() and TextEditRules::CollapseSelectionToTrailingBRIfNeeded() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45496

--HG--
extra : moz-landing-system : lando
2019-09-17 02:47:49 +00:00
Masayuki Nakano
5b0eb574be Bug 1574852 - part 112: Make TextEditor::InsertWithQuotationsAsSubAction() virtual and HTMLEditor override it r=m_kato
It requires different preparation in `TextEditor` and `HTMLEditor` but it's
not split.  Therefore, we should make it virtual and override it to use
different preparation code.  Fortunately, its code is enough simple to
duplicate.

Additionally, this removes unnecessary code from `TextEditRules` and
`HTMLEditRules` including `WillDoAction()` and `DidDoAction()`!

Differential Revision: https://phabricator.services.mozilla.com/D45495

--HG--
extra : moz-landing-system : lando
2019-09-17 02:47:26 +00:00
Masayuki Nakano
119bd889bd Bug 1574852 - part 111: Make methods calling HTMLEditRules::WillDoAction() with EditSubAction::eInsertElement stop using it r=m_kato
Unfortunately, `EditSubAction::eInsertElement` is used by 4 methods and one
of them is too big method.  But we should move what old `WillInsert()` does
into them for stop making anybody use `HTMLEditRules`.

Differential Revision: https://phabricator.services.mozilla.com/D45494

--HG--
extra : moz-landing-system : lando
2019-09-17 03:13:09 +00:00
Masayuki Nakano
0549668bb1 Bug 1574852 - part 110: Split HTMLEditor::WillInsert() r=m_kato
It does 4 different things so that it looks like a black-box from the
callers.

First, only `HTMLEditRules::WillDoAction()` refers `aCancel` out argument.
Therefore, it should check whether it's cancelled or not directly.

Next, `EnsureNoPaddingBRElementForEmptyEditor()` should be called by each
caller directly.

Then, the renaming part can be split to 2 methods.  One is adjusting
caret position and the other preparing inline style for new content.


Unfortunately, this patch makes each caller messy.  I think that for the
3rd job (i.e., adjusting caret position), each caller should retrieve the
adjusted caret position and use it directly instead of handling with
`Selection` in the future.

Differential Revision: https://phabricator.services.mozilla.com/D45493

--HG--
extra : moz-landing-system : lando
2019-09-17 02:21:53 +00:00
Masayuki Nakano
0da92b7d7d Bug 1574852 - part 109: Move TextEditRules::WillSetText() to TextEditor r=m_kato
And also renaming `EditorBase::SetTextImpl()`.

Differential Revision: https://phabricator.services.mozilla.com/D45492

--HG--
extra : moz-landing-system : lando
2019-09-17 02:21:35 +00:00
Gurzau Raul
ba23dcf114 Backed out 2 changesets (bug 1574852) for assertion failures at TextEditRules.cpp
Backed out changeset f54f6af6359d (bug 1574852)
Backed out changeset 2b6968592570 (bug 1574852)
2019-09-15 02:32:09 +03:00
Masayuki Nakano
bf1c1cfd11 Bug 1574852 - part 110: Split HTMLEditor::WillInsert() r=m_kato
It does 4 different things so that it looks like a black-box from the
callers.

First, only `HTMLEditRules::WillDoAction()` refers `aCancel` out argument.
Therefore, it should check whether it's cancelled or not directly.

Next, `EnsureNoPaddingBRElementForEmptyEditor()` should be called by each
caller directly.

Then, the renaming part can be split to 2 methods.  One is adjusting
caret position and the other preparing inline style for new content.


Unfortunately, this patch makes each caller messy.  I think that for the
3rd job (i.e., adjusting caret position), each caller should retrieve the
adjusted caret position and use it directly instead of handling with
`Selection` in the future.

Differential Revision: https://phabricator.services.mozilla.com/D45493

--HG--
extra : moz-landing-system : lando
2019-09-14 15:12:03 +00:00
Masayuki Nakano
87f73d9008 Bug 1574852 - part 109: Move TextEditRules::WillSetText() to TextEditor r=m_kato
And also renaming `EditorBase::SetTextImpl()`.

Differential Revision: https://phabricator.services.mozilla.com/D45492

--HG--
extra : moz-landing-system : lando
2019-09-14 15:12:03 +00:00
Masayuki Nakano
75507785e6 Bug 1574852 - part 108: Move TextEditRules::WillOutputText() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45491

--HG--
extra : moz-landing-system : lando
2019-09-13 03:44:33 +00:00
Masayuki Nakano
af80a20e09 Bug 1574852 - part 107: Get rid of TextEditRules::GetTextNodeAroundSelectionStartContainer() since nobody uses it r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45490

--HG--
extra : moz-landing-system : lando
2019-09-13 03:39:13 +00:00
Masayuki Nakano
438470f81e Bug 1574852 - part 106-2: Move calling DeleteSelectionWithTransaction() and HTMLEditor specific post handling into HandleDeleteSelection() from TextEditor::DeleteSelectionAsSubAction() r=m_kato
In `TextEditor::HandleDeleteSelection()`, we have only one path of returning
`EditActionIgnored()`.  Therefore, it should call
`DeleteSelectionWithTransaction()` directly.

On the other hand, it's not clear in `HTMLEditor::HandleDeleteSelection()`
since it may be called recursively by its helper methods.  Therefore,
this patch creates `HTMLEditor::HandleDeleteSelectionInternal()` for the
recursive calls and makes `HTMLEditor::HandleDeleteSelection()` call
`DeleteSelectionWithTransaction()` if nobody handled it and to the
`HTMLEditor` specific post-process in it.

Differential Revision: https://phabricator.services.mozilla.com/D45301

--HG--
extra : moz-landing-system : lando
2019-09-13 03:20:04 +00:00
Masayuki Nakano
053579099d Bug 1574852 - part 106-1: Move TextEditRules::WillDeleteSelection() and TextEditRules::DeleteSelectionWithTransaction() to TextEditor and make HTMLEditor::HandleDeleteSelection() override the former r=m_kato
`TextEditor::DeleteSelectionAsSubAction()` starts to handle all
"delete selection" sub-actions (i.e., even if the instance is `HTMLEditor`).
Therefore, `TextEditRules::WillDeleteSelection()` should be renamed to
`TextEditor::HandleDeleteSelection()` and we need to make it virtual.

Differential Revision: https://phabricator.services.mozilla.com/D45300

--HG--
extra : moz-landing-system : lando
2019-09-13 02:49:43 +00:00
Masayuki Nakano
72fa9d1512 Bug 1574852 - part 105: Get rid of TextEditRules::WillSetProperty() and TextEditRules::WillRemoveProperty() r=m_kato
Oddly, they are used only by `HTMLEditor`, but implemented by `TextEditRules`.
They cancels when the editor is in plaintext mode.  So, actual things are
implemented by each caller.  This patch cleans them up too.

Differential Revision: https://phabricator.services.mozilla.com/D45299

--HG--
extra : moz-landing-system : lando
2019-09-12 09:13:00 +00:00
Masayuki Nakano
f521a40385 Bug 1574852 - part 104: Move TextEditRules::WillInsertText() to TextEditor and make HTMLEditor::WillInsertText() override it r=m_kato
And also this patch moves `TextEditRules::HandleNewLines()` and
`TextEditRules::DontEchoPassword()` to `TextEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D45298

--HG--
extra : moz-landing-system : lando
2019-09-13 02:40:09 +00:00
Masayuki Nakano
d0bf28c6cc Bug 1574852 - part 103: Move TextEditRules::WillInsertLineBreak() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45297

--HG--
extra : moz-landing-system : lando
2019-09-12 08:03:57 +00:00
Masayuki Nakano
80be9ab956 Bug 1574852 - part 102: Move TextEditRules::TruncateInsertionIfNeeded() to TextEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45296

--HG--
extra : moz-landing-system : lando
2019-09-12 07:48:29 +00:00
Masayuki Nakano
d0e7a72d94 Bug 1574852 - part 101: Move HTMLEditRules::DidDeleteSelection() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45295

--HG--
extra : moz-landing-system : lando
2019-09-12 07:27:30 +00:00
Masayuki Nakano
45ef18ee30 Bug 1574852 - part 100: Get rid of TextEditRules::DidDeleteSelection() r=m_kato
There are only 3 callers and it does simple but different 2 things.  One of
the callers is `HTMLEditRules::DidDeleteSelection()` so that if same things
are done by `TextEditor::DeleteSelectionAsSubAction()`, it does not need to
duplicate the code.  Therefore, we need to duplicate the code into
`TextEditor::DeleteSelectionAsSubAction()` and `TextEditRules::WillSetText()`.
Then, `TextEditRules::WillSetText()` can avoid accessing `Selection` since
it still grabs the modified text node.

Note that only when it's called by `TextEditRules::DidDoAction()`,
`AutoTransactionsConserveSelection` has been set.  However, neither
`DeleteNodeWithTransaction()` nor `DeleteNodeTransaction::DoTransaction()`
changes `Selection`.  Therefore, it hasn't do anything.  So, we can remove
it right now.

Differential Revision: https://phabricator.services.mozilla.com/D45294

--HG--
extra : moz-landing-system : lando
2019-09-12 06:51:26 +00:00
Masayuki Nakano
d87ff4830d Bug 1574852 - part 99: Move HTMLEditRules::WillRelativeChangeZIndex() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45293

--HG--
extra : moz-landing-system : lando
2019-09-12 06:20:49 +00:00
Masayuki Nakano
fee93a3a4d Bug 1574852 - part 98: Move HTMLEditRules::WillAbsolutePosition() and HTMLEditRules::WillRemoveAbsolutePosition() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D45292

--HG--
extra : moz-landing-system : lando
2019-09-12 05:45:13 +00:00
Masayuki Nakano
878bbf3cb8 Bug 1574852 - part 97: Move HTMLEditRules::PrepareToMakeElementAbsolutePosition() to HTMLEditor r=m_kato
Only caller of it is `WillRemoveAbsolutePosition()` and it always sets
`*aHandled` to true before calling it.  Therefore, it does not need to take
it as an argument.

Differential Revision: https://phabricator.services.mozilla.com/D45291

--HG--
extra : moz-landing-system : lando
2019-09-12 04:07:30 +00:00
Masayuki Nakano
8b9c4d3ad1 Bug 1574852 - part 96: Merge HTMLEditRules::DidAbsolutePosition() with HTMLEditRules::WillAbsolutePosition() r=m_kato
Oddly, absolute position is handled as following steps.
1. `WillAbsolutePosition()` calls `PrepareToMakeElementAbsolutePosition()`
   to consider the target element.
2. Set TopLevelEditSubActionData::mNewBlockElement to it.
3. `DidAbsolutePosition()` makes it absolute-positioned.

So that, all of them can be done in `WillAbsolutePosition()` like other
edit sub-action handling.

Differential Revision: https://phabricator.services.mozilla.com/D45290

--HG--
extra : moz-landing-system : lando
2019-09-12 01:54:28 +00:00
Masayuki Nakano
d5f8e358d2 Bug 1574852 - part 95: Move HTMLEditRules::AfterEditInner() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44799

--HG--
extra : moz-landing-system : lando
2019-09-11 10:39:38 +00:00
Masayuki Nakano
821d89d488 Bug 1574852 - part 94: Move HTMLEditRules::PinSelectionToNewBlock() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44798

--HG--
extra : moz-landing-system : lando
2019-09-11 09:44:39 +00:00
Masayuki Nakano
e3bcdb2d3c Bug 1574852 - part 93: Move HTMLEditRules::CheckInterlinePosition() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44797

--HG--
extra : moz-landing-system : lando
2019-09-11 01:07:27 +00:00
Masayuki Nakano
875a9d4d05 Bug 1574852 - part 92: Move HTMLEditRules::RemoveEmptyNodesInChangedRange() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44796

--HG--
extra : moz-landing-system : lando
2019-09-10 04:46:55 +00:00
Masayuki Nakano
9ab5c8f493 Bug 1574852 - part 91: Move HTMLEditRules::InsertBRElementToEmptyListItemsAndTableCellsInRange() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44795

--HG--
extra : moz-landing-system : lando
2019-09-10 04:32:21 +00:00
Masayuki Nakano
24f1d9a9b3 Bug 1574852 - part 90: Move HTMLEditRules::ConfirmSelectionInBody() to HTMLEditor r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D44794

--HG--
extra : moz-landing-system : lando
2019-09-10 03:52:44 +00:00