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

7668 Коммитов

Автор SHA1 Сообщение Дата
Andreea Pavel c538244252 Bug 1777060 - disable test_caret_move_in_vertical_content.html on android debug r=intermittent-reviewers,MasterWayZ DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D157917
2022-09-22 11:38:35 +00:00
Masayuki Nakano fc89971ea6 Bug 1789967 - part 4: Make `HTMLEditor::SelectAllInternal` work without selection range r=m_kato
It may be called even when there is no selection range and focused element.
However, it assumes that there is a selection range, and an editable element
has focus.  Therefore, now, if there is an editing host and user tries to
do "Select All" without clicking somewhere before doing it, "Select All" does
nothing.

Differential Revision: https://phabricator.services.mozilla.com/D157409
2022-09-22 06:27:38 +00:00
Masayuki Nakano a353ab7e90 Bug 1789967 - part 3: Make `HTMLEditor::CollapseSelectionToEndOfLastLeafNodeOfDocument` and `HTMLEditor::InitEditorContentAndSelection` do nothing if the document is partially editable r=m_kato
They and their callees work with the result of `GetRoot()` which is the document
element or the body element.  If the body is not editable, `Selection` should
not be updated in non-editable region nor `<br>` elements should not be
inserted in both non-focused editable elements and non-editable elements.
Therefore, they should run only when the document element or the `<body>`
element is editable.

To keep testing crashtests as reported, this patch makes tests which have
`contenteditable` except `<html>` and `<body>` initialize `Selection` as
what we've done.  And clean up the tests for helping to port them to WPT
in the future (bug 1725850).

Differential Revision: https://phabricator.services.mozilla.com/D157408
2022-09-22 06:27:37 +00:00
Masayuki Nakano 2f0ed118ae Bug 1789967 - part 2: Make `TextEditor` and `HTMLEditor` implement `EditorBase::CollapseSelectionToEndOfLastLeafNode` by themselves r=m_kato
It does different thing for `TextEditor` and `HTMLEditor`, and used almost
internally.  Therefore, it should be implemented in the sub classes and
we should name them better.

Differential Revision: https://phabricator.services.mozilla.com/D157407
2022-09-22 06:17:36 +00:00
Masayuki Nakano f1dd8bf3b5 Bug 1789967 - part 1: Make `TextEditor` and `HTMLEditor` implement `EditorBase::InitEditorContentAndSelection` by themselves r=m_kato
The method is enough simple, and uses bad cast from point of view of OOP.
Therefore, this patch make the sub classes implement the method only for each.

Differential Revision: https://phabricator.services.mozilla.com/D157406
2022-09-22 06:06:54 +00:00
Jan-Niklas Jaeschke 4265f72859 Bug 1777925: Replaced MutationObserver array container type with linked list. r=smaug
Deletion of mutation observers from a list resulted in O(n^2) behavior and could lead to massive freezes.
This is resolved by using a LinkedList instead, reducing complexity to O(n).

A safely iterable doubly linked list was implemented based on `mozilla::DoublyLinkedList`,
allowing to insert and remove elements while iterating the list.

Due to the nature of `mozilla::DoublyLinkedList`, every Mutation Observer now inherits `mozilla::DoublyLinkedListElement<T>`.
This implies that a Mutation Observer can only be part of one DoublyLinkedList.
This conflicts with some Mutation Observers, which are being added to multiple `nsINode`s.
To continue supporting this, new MutationObserver base classes `nsMultiMutationObserver` and `nsStubMultiMutationObserver` are introduced,
which create `MutationObserverWrapper` objects each time they are added to a `nsINode`.
The wrapper objects forward every call to the actual observer.

Differential Revision: https://phabricator.services.mozilla.com/D157031
2022-09-21 11:31:44 +00:00
Iulian Moraru 6af4d42518 Backed out changeset 555d2ca16477 (bug 1789967) as per dev request. CLOSED TREE 2022-09-21 06:48:30 +03:00
Masayuki Nakano f3ce7840c7 Bug 1789967 - part 1: Make `TextEditor` and `HTMLEditor` implement `EditorBase::InitEditorContentAndSelection` by themselves r=m_kato CLOSED TREE
The method is enough simple, and uses bad cast from point of view of OOP.
Therefore, this patch make the sub classes implement the method only for each.

Differential Revision: https://phabricator.services.mozilla.com/D157406
2022-09-21 00:20:26 +00:00
Iulian Moraru 52da19beca Backed out 2 changesets (bug 1789967) for causing wd failures on content_editable.py. CLOSED TREE
Backed out changeset f2f431ee78a3 (bug 1789967)
Backed out changeset edac234f1eba (bug 1789967)
2022-09-21 04:40:46 +03:00
Masayuki Nakano 7f5b2e7242 Bug 1789967 - part 2: Make `TextEditor` and `HTMLEditor` implement `EditorBase::CollapseSelectionToEndOfLastLeafNode` by themselves r=m_kato
It does different thing for `TextEditor` and `HTMLEditor`, and used almost
internally.  Therefore, it should be implemented in the sub classes and
we should name them better.

Differential Revision: https://phabricator.services.mozilla.com/D157407
2022-09-21 00:38:23 +00:00
Masayuki Nakano 7f5a748878 Bug 1789967 - part 1: Make `TextEditor` and `HTMLEditor` implement `EditorBase::InitEditorContentAndSelection` by themselves r=m_kato
The method is enough simple, and uses bad cast from point of view of OOP.
Therefore, this patch make the sub classes implement the method only for each.

Differential Revision: https://phabricator.services.mozilla.com/D157406
2022-09-21 00:20:26 +00:00
Masayuki Nakano 5a7f7ccb64 Bug 1788840 - Make `HTMLEditor::HandleCSSIndentAroundRanges` stop referring moved `EditorDOMPoint` r=m_kato
Unfortunately, the result is really different from the other browsers.
E.g., when `execCommand("indent")` at `<div>abc<br>{}<br></div>`, Gecko inserts
a `<div>` and set its `margin-left`.  However, Chrome splits parent `<div>`
element and wrap the `<div>` which contains the caret in new `<blockquote>`.
Therefore, this does not contain new WPT.

Depends on D157404

Differential Revision: https://phabricator.services.mozilla.com/D157405
2022-09-16 02:09:16 +00:00
Magnus Melin a4024058a5 Bug 1790725 - Allow useCss for mail editor. r=masayuki
After this change, it's possible to set the pref, or use editor.document.execCommand("styleWithCSS", false, "true") to enable css in mail compose.

Differential Revision: https://phabricator.services.mozilla.com/D157276
2022-09-14 10:27:39 +00:00
Masayuki Nakano b6c7be1c68 Bug 1789344 - Make `SelectionState::DidMoveNode` track DOM points having pointed the moved content correctly r=m_kato
When selection is `abc<b>[def</b>]ghi`, `insertParagraph` command will delete
the `<b>` element first, then, `Selection` becomes `abc{}ghi`.  Then,
`HTMLEditor::InsertParagraphSeparatorAsSubAction` wraps all of the line in
the default paragraph, `<div>`, with
`HTMLEditor::FormatBlockContainerWithTransaction` (although this is incompatible
behavior with the other browsers).  At this time, new `<div>` is inserted before
the first text node and then, move the text nodes into the new `<div>`.

However, `RangeUpdater::DidMoveNode` just slides the offsets if containers of
registered DOM points are the ex-parent of the moving nodes.  Therefore, the
tracked selection range in `HTMLEditor::FormatBlockContainerWithTransaction`
become `<div></div>abc{}def`, then, `<div>abcdef</div>{}`, but the expected
behavior is of course, `<div>abc{}def</div>`, then, split the new `<div>`.

So the problem is, `DidMoveNode` assumes that DOM points won't point the moving
content node.  If the node is pointed, it should keep pointing in the new
parent.

Note that the expectations of new tests are based on Chrome, therefore, the
new known failures are incompatible with Chrome.

Differential Revision: https://phabricator.services.mozilla.com/D156798
2022-09-12 23:53:37 +00:00
Masayuki Nakano 2d65dbd85c Bug 1789345 - Make `editor/libeditor/test_bug1318312.html` easier to read r=m_kato
It's hard to know how some tests failed in test_bug1318312.html.  Therefore,
this patch makes the selection range comparison easier to read, and add
description to explain what was doing at the failure.

Differential Revision: https://phabricator.services.mozilla.com/D156526
2022-09-07 01:06:47 +00:00
Makoto Kato fa04356be7 Bug 1787680 - Part 2. Don't create CSSEditUtils instance. r=masayuki
We can change all methods in `CSSEditUtils` to static method if we add
`HTMLEditor` parameter.

Differential Revision: https://phabricator.services.mozilla.com/D155976
2022-09-01 04:33:36 +00:00
Makoto Kato 4d903283b4 Bug 1787680 - Part 1. Move mIsCSSPrefChecked to HTMLEditor. r=masayuki
`CSSEditUtils::IsCSSPrefChecked` is used in HTMLEditor only, so we can move
`mIsCSSPrefChecked` to HTMLEditor.

Differential Revision: https://phabricator.services.mozilla.com/D155975
2022-09-01 04:33:36 +00:00
Mark Banner 4f95e6b415 Bug 1786197 - Turn on ESLint rule for prefer-boolean-length-check for editor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D155169
2022-08-26 13:39:36 +00:00
Masayuki Nakano 64fe7ed79d Bug 1784192 - part 10: Make `PendingStyles::GetTypeInState()` return an `enum class` instead of taking 2 bool out parameters r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D155319
2022-08-26 03:31:26 +00:00
Masayuki Nakano 8bbdf5e967 Bug 1784192 - part 9: Rename `TypeInState` to `PendingStyles` r=m_kato
Additionally,
* `PropItem` -> `PendingStyle`
* `StyleCache` -> `PendingStyleCache`
* `AutoStyleCacheArray` -> `AutoPendingStyleCacheArray`

And finally, `PendingStyle` (formally `PropItem`) is changed to `class` and
its members are encapsuled.

Differential Revision: https://phabricator.services.mozilla.com/D155318
2022-08-26 03:31:26 +00:00
Masayuki Nakano ef559e105f Bug 1784192 - part 8: Make scanner methods of `TypeInState` return `Maybe<size_t>` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D155317
2022-08-26 03:25:19 +00:00
Masayuki Nakano bfb3d1f8c6 Bug 1784192 - part 7: Rename `TypeInState::ClearProp` and related methods r=m_kato
For consistency with the previous patch, we should rename them too.  Then, we're
getting rid of unclear word "Prop" from the public methods.

Differential Revision: https://phabricator.services.mozilla.com/D155316
2022-08-26 03:25:19 +00:00
Masayuki Nakano 165e90f341 Bug 1784192 - part 6: Rename `TypeInState::SetProp` and `TypeInState::TakeSetProperty` r=m_kato
I usually retry to understand what they mean.  Therefore, I'd like to give new
names for them (and rename `TypeInState` class in a following patch).

Differential Revision: https://phabricator.services.mozilla.com/D155315
2022-08-26 03:20:14 +00:00
Masayuki Nakano a94d4ffd46 Bug 1784192 - part 5: Make `TypeInState` manage `PropItem` instances with `UniquePtr` r=m_kato
It's ugly to manage them as raw pointer especially when deleting the instances.
We should make it use `UniquePtr`.

Differential Revision: https://phabricator.services.mozilla.com/D155314
2022-08-26 03:20:14 +00:00
Masayuki Nakano cf8abe2061 Bug 1784192 - part 4: Change `PropItem::mSpecifiedStyle` to a constant r=m_kato
Only the value member needs to be updated when setting the prop multiple times.
Therefore, we cannot change all members to constants.

Differential Revision: https://phabricator.services.mozilla.com/D155313
2022-08-26 03:10:32 +00:00
Masayuki Nakano 100af2494d Bug 1784192 - part 3: Change other members of `PropItem` r=m_kato
According to the debug, its value can be CSS property value if in the CSS mode.
For making the value meaning easier to understand, this renames it to
mAttributeValueOrCSSValue.

Differential Revision: https://phabricator.services.mozilla.com/D155312
2022-08-26 03:10:31 +00:00
Masayuki Nakano 491bc57b81 Bug 1784192 - part 2: Change `PropItem::attr` to a strong pointer r=m_kato
It's currently no problem to manage it with a raw pointer because it may be
set to a dynamic atom only when `nsIHTMLEditor.insertLinkAroundSelection` is
called with unknown attribute, but comm-central uses it only with `href`
attribute.

I think that we should change the API just to take `href` value in the future,
but for now, it should be `RefPtr<nsAtom>`.

Differential Revision: https://phabricator.services.mozilla.com/D155311
2022-08-26 03:10:31 +00:00
Masayuki Nakano 66c9f821f0 Bug 1784192 - part 1: Change `PropItem::tag` to `nsStaticAtom*` r=m_kato
It's always a pointer to `nsStaticAtom` instance or `nullptr`.  Therefore,
it can be `nsStaticAtom*` and we can make its users treat `nsStaticAtom`
instead of `nsAtom`.

Additionally, this patch changes some pointer parameters to references if
they are never `nullptr`.

Differential Revision: https://phabricator.services.mozilla.com/D155310
2022-08-26 03:10:30 +00:00
Masayuki Nakano 76c16ceefc Bug 1785801 - Make `RangeUpdater::SelAdjJoinNodes` take the ex-offset of right node r=m_kato
In bug 1739524, I misunderstood the meaning of `aOffset` of `SelAdjJoinNodes`.

After joining 2 nodes, and a point points right node which will have ex-left
node content, the point needs to point ex-start of the right node to keep
next insertion point as-is.  Therefore, it's not useful with new join nodes
direction, it needs to know the ex-offset of the right node.

Differential Revision: https://phabricator.services.mozilla.com/D155438
2022-08-26 01:50:07 +00:00
Masayuki Nakano 94b817dc98 Bug 1785311 - Make `EditorBase::InsertTextIntoTextNodeWithTransaction` update insertion point after executing the transaction r=m_kato
Before the fix of bug 1758420, `TextComposition`'s text node and offset in it
are updated at creating `CompositionTransaction`.  However, it's now put off
until getting the mutations.  Therefore, it always unsets `pointToInsert` at
first time of the composition and fails to notify the listeners.

This patch makes it retrieve the result after calling `DoTransactionInternal`
and handle the post processing with the new point.

Differential Revision: https://phabricator.services.mozilla.com/D155052
2022-08-22 23:56:36 +00:00
Masayuki Nakano ff67736d1c Bug 1781994 - part 12: Make `HTMLEditor::SetCSSBackgroundColorWithTransaction` use similar approach as `SetInlinePropertiesAsSubAction` etc r=m_kato
It's a Gecko specific feature, and it sets background color of parent block
elements of selection ranges.  This does similar things to
`SetInlinePropertiesAsSubAction`, but still refers `Selection` directly and
uses `AutoSelectionRestorer`.  For consistency between similar methods, this
patch makes it use `AutoRangeArray`.

Depends on D154353

Differential Revision: https://phabricator.services.mozilla.com/D154354
2022-08-16 01:17:46 +00:00
Masayuki Nakano 0f6bbf324c Bug 1781994 - part 11: Clean up `HTMLEditor::RelativeFontChange` r=m_kato
It should use `AutoRangeArray` to stop using `AutoSelectionRestorer`.

Depends on D154352

Differential Revision: https://phabricator.services.mozilla.com/D154353
2022-08-16 01:17:45 +00:00
Masayuki Nakano d1c4c5d8e2 Bug 1781994 - part 10: Make `HTMLEditor::RelativeFontChangeOnNode` and `HTMLEditor::RelativeFontChangeHelper` stop touching `Selection` directly r=m_kato
They are renamed to `SetFontSizeWithBigOrSmallElement` and
`SetFontSizeOfFontElementChildren`.

Depends on D154351

Differential Revision: https://phabricator.services.mozilla.com/D154352
2022-08-16 01:09:31 +00:00
Masayuki Nakano 3327432a6a Bug 1781994 - part 9: Make `HTMLEditor::RelativeFontChangeOnNode` and `HTMLEditor::RelativeFontChangeHelper` use `FontSize` r=m_kato
`HTMLEditor::RelativeFontChange()` and its helpers are based on
`SetInlinePropertiesAsSubAction()` and its helpers.  Therefore, they may have
similar problem to switch join/split direction.  Therefore, this and the
following patches clean them up too.

Depends on D154350

Differential Revision: https://phabricator.services.mozilla.com/D154351
2022-08-16 01:01:06 +00:00
Masayuki Nakano 648f892bde Bug 1781994 - part 8: Make `HTMLEditor::SetInlinePropertyAsSubAction` handle multiple styles once r=m_kato
Depends on D154349

Differential Revision: https://phabricator.services.mozilla.com/D154350
2022-08-16 01:01:05 +00:00
Masayuki Nakano d6991deecb Bug 1781994 - part 7: Make `HTMLEditor::RemoveInlinePropertyAsSubAction` handle multiple styles once r=m_kato
I think that `HTMLEditor::SetInlinePropertyAsSubAction` and
`HTMLEditor::RemoveInlinePropertyAsSubAction` should not be called multiple
times in one edit action.  Therefore, I'd like to make them take multiple
styles once.  Then, we could collect all targets before touching the DOM tree
in the future.

Depends on D154348

Differential Revision: https://phabricator.services.mozilla.com/D154349
2022-08-16 00:55:06 +00:00
Masayuki Nakano da11385641 Bug 1781994 - part 6: Make `HTMLEditor::SetInlinePropertyInternal` use `AutoRangeArray` r=m_kato
Depends on D154347

Differential Revision: https://phabricator.services.mozilla.com/D154348
2022-08-16 00:38:30 +00:00
Masayuki Nakano 9d26dd1005 Bug 1781994 - part 5: Make `HTMLEditor::RemoveInlinePropertyAsSubAction` handle correct text node after splitting a text to any direction r=m_kato
This is a pre-fix for bug 1735608.  Currently, the loop assumes that collected
nodes are always right node, but it'll be changed, therefore, it creates
new array for the follow up loops handle expected nodes.

Depends on D154346

Differential Revision: https://phabricator.services.mozilla.com/D154347
2022-08-16 00:31:45 +00:00
Masayuki Nakano 181da530ee Bug 1781994 - part 4: Make `HTMLEditor::RemoveInlinePropertyInternal` use `AutoRangeArray` r=m_kato
I'd like to get rid of `AutoSelectionRangeArray` and `AutoRestoreSelection`,
and I'd like to make it stop touching `Selection` while it is removing style
of each content nodes in the range.  Therefore, this patch rewrites it with
`AutoRangeArray`.  Then, we can reduce the indent level of the nested `for`
loops.

Note that it creates `AutoEditSubActionNotifier`, so it's a sub-edit action
handler.  Therefore, this patch renames it.

Depends on D154345

Differential Revision: https://phabricator.services.mozilla.com/D154346
2022-08-16 00:26:05 +00:00
Masayuki Nakano 55250ca5e0 Bug 1781994 - part 3: Make `HTMLEditor::SetInlinePropertyOnTextNode` stop touching `Selection` directly r=m_kato
Depends on D154344

Differential Revision: https://phabricator.services.mozilla.com/D154345
2022-08-16 00:13:40 +00:00
Masayuki Nakano fcecac970b Bug 1781994 - part 2: Make `HTMLEditor::SplitAncestorStyledInlineElementsAtRangeEdges` stop touching `Selection` directly r=m_kato
Depends on D154343

Differential Revision: https://phabricator.services.mozilla.com/D154344
2022-08-16 00:08:07 +00:00
Masayuki Nakano 9f9cd9e318 Bug 1781994 - part 1: Make `HTMLEditor::SplitAncestorStyledInlineElementsAt` and `HTMLEditor::ClearStyleAt` stop touching `Selection` directly r=m_kato
I've already made a caller of `HTMLEditor::ClearStyleAt`,
`HTMLEditor::CreateStyleForInsertText`, in bug 1770877, so this fixes a bug of
the patch.

`HTMLEditor::ClearStyleAt` is still updates `Selection` only in some cases.
And one of the caller has not handle the `Selection` update.  Therefore, once
it completely stop touching `Selection`, `ComputeEditingHost` will fail and
the other paths update `Selection`, so it should do it too.  (Without the
change, `test_dragdrop.html` fails.)

Finally, we don't need `EditResult` anymore because we have
`Result<EditorDOMPoint, nsresult>`.

Differential Revision: https://phabricator.services.mozilla.com/D154343
2022-08-16 00:02:25 +00:00
Masayuki Nakano 64e700332c Bug 1783402 - part 3: Make result of unsafe getter methods of `EditorDOMPointBase` templated r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D153842
2022-08-09 01:43:24 +00:00
Masayuki Nakano fe4e77e324 Bug 1783402 - part 2: Make result of safe getter methods of `EditorDOMPointBase` templated r=m_kato
Similar to the previous patch, and for consistency between editor helper
classes, we should make result of getter methods of `EditorDOMPointBase` too.

Differential Revision: https://phabricator.services.mozilla.com/D153841
2022-08-09 01:43:24 +00:00
Masayuki Nakano 2c1d4805a6 Bug 1783402 - part 1: Make result of the getter methods of `SplitRangeOffFromNodeResult` templated r=m_kato
We'll need the version to return `dom::Text*` in coming patches for bug 1735608.
For avoiding the class to have a lot of getters, we should make result of the
getters templated.

Differential Revision: https://phabricator.services.mozilla.com/D153840
2022-08-09 01:43:23 +00:00
Masayuki Nakano d636f57443 Bug 1783393 - Get rid of the constructor of `SplitRangeOffFromNodeResult` which takes 2 `SplitNodeResult`s r=m_kato
`GetLeftContent()` etc is explained as:
> This may return nullptr if the method didn't split at start edge of the node.

On the other hand, `SplitNodeResult::GetPreviousContent()` and
`SplitNodeResult::GetNextContent()` returns previous or next content node
of split point when the split is not performed, but not in error.

Therefore, it should check `SplitNodeResult::DidSplit()` instead of
`SplitNodeResult::isOk()`.

However, there is another problem.  The constructor cannot specify the order
of the 2 splits.  Therefore, it's hard to maintain the constructor.
Fortunately, there is only one user, so we can make the user create the
result with another constructor.

Differential Revision: https://phabricator.services.mozilla.com/D153838
2022-08-08 09:06:24 +00:00
Masayuki Nakano 982149f4f1 Bug 1782874 - part 2: Make `HTMLEditor::RemoveEmptyNodesIn` remove end container of the range if empty r=m_kato
If splitting node creates new right node instead of new left node,
`TopLevelEditSubActionData::mChangedRange` ends by start of the right node.
However, `RemoveEmptyNodesIn` uses `PostContentIterator` which collects DOM
nodes whose "end tag" appear in the range.  Therefore, for cleaning up new
empty right nodes correctly, we need to extend the range to contain the node.

Additionally, it removes unexpected element which is editable but shouldn't be
removed from the DOM tree.  Therefore, this patch adds new check such as
`HTMLEditUtils::IsRemovalNode()`.

Finally, this patch adds a check whether the editor is a mail editor or not
at considering whether a node is a "mail-cite" because `contenteditable` in
web apps do not need special handling for such Gecko-specific element.

Differential Revision: https://phabricator.services.mozilla.com/D153834
2022-08-08 08:22:44 +00:00
Masayuki Nakano 8b7fb928d3 Bug 1782628 - Make `HTMLEditor::HandleInsertBRElement` create caret position before moving its container r=m_kato
The test oddly passes without the fix in `HandleInsertBRElement`.  I guess that
post-processing in `HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal()`
handles `Selection`, and anyway the insertion point of the following
`insertText` is wrong.  It seems that we don't need to uplift this.

Differential Revision: https://phabricator.services.mozilla.com/D153832
2022-08-08 01:54:47 +00:00
Masayuki Nakano bea9bf4233 Bug 1782852 - part 1: Get rid of unused editor commands in the wild r=smaug
`increaseFontSize`, `decreaseFontSize`, `gethtml`, `heading` and `readonly`
commands were disabled for a year in all channels, but no regression reports
have been filed.  Therefore, we can delete the commands and the telemetry
probes.

Note that `cmd_getContents` command which is the internal command of `gethtml`
is not used in comm-central too.  Therefore, this patch deletes the command
handler, `nsClipboardGetContentsCommand`, and `Command::GetHTML` too.

Differential Revision: https://phabricator.services.mozilla.com/D153720
2022-08-05 02:55:22 +00:00
Masayuki Nakano eddeebefce Bug 1775381 - Move `AutoRangeArray` from `EditorUtils.h` to its own header and cpp file r=m_kato
Depends on D152982

Differential Revision: https://phabricator.services.mozilla.com/D153063
2022-08-04 05:39:16 +00:00