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

10483 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 0c4f51fb31 Bug 1627175 - part 57: Move `HTMLEditor::GetBetterInsertionPointFor()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115166
2021-05-17 08:56:26 +00:00
Masayuki Nakano 30a75921ad Bug 1627175 - part 56: Move `HTMLEditor::GetGoodCaretPointFor()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115165
2021-05-17 08:44:24 +00:00
Masayuki Nakano b6ea40871b Bug 1627175 - part 55: Move `HTMLEditor::IsEmptyInlineNode()` and `HTMLEditor::IsEmptyOneHardLine()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115164
2021-05-17 08:38:55 +00:00
Masayuki Nakano 249be2b40e Bug 1627175 - part 54: Merge `HTMLEditor::Get(First|Last)EditableLeaf()` into `HTMLEditUtils::Get(First|Last)LeafContent()` r=m_kato
The different points are, whether it checks in a given element or not, and
whether it ignores non-editable content.  Therefore, this patch adds new
`LeafNodeType` and new ancestor limiter argument.

The new flag is not handled in the other methods which take `LeafNodeType`
because there is no test.

Differential Revision: https://phabricator.services.mozilla.com/D115123
2021-05-17 08:01:38 +00:00
Masayuki Nakano d6eec3ae11 Bug 1627175 - part 53: Rename `HTMLEditUtils::GetFirstLeafChild()` and `HTMLEditUtils::GetLastLeafChild()` r=m_kato
They may return a descendant, and now `HTMLEditUtils` has some methods whose
name ends with `Child` and they scan only direct children of given node.
So, we should rename these methods for avoiding misunderstanding.

Differential Revision: https://phabricator.services.mozilla.com/D115122
2021-05-17 08:01:37 +00:00
Masayuki Nakano 83505534d9 Bug 1627175 - part 52: Move `HTMLEditor::IsLastEditableChild()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115121
2021-05-17 07:42:40 +00:00
Masayuki Nakano f852818779 Bug 1627175 - part 51: Move `HTMLEditor::IsFirstEditableChild()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115120
2021-05-17 07:28:43 +00:00
Masayuki Nakano cecdac0aa5 Bug 1627175 - part 50: Move `HTMLEditor::GetFirstEditableChild()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115119
2021-05-17 07:08:39 +00:00
Masayuki Nakano 228c4e9b85 Bug 1627175 - part 49: Move `HTMLEditor::GetLastEditableChild()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115118
2021-05-17 05:44:34 +00:00
Masayuki Nakano 91727d78a7 Bug 1627175 - part 48: Get rid of `HTMLEditUtils::GetFirstEditableLeafContent()` due to unused r=m_kato
I realized that it's used only by the dead path because the only caller,
`EditorBase::BeginningOfDocument()` is overridden by `HTMLEditor` and
is never called.

Differential Revision: https://phabricator.services.mozilla.com/D115117
2021-05-17 05:37:24 +00:00
Masayuki Nakano c2b6acf141 Bug 1627175 - part 47: Move `HTMLEditor::GetNextHTMLSibling()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115116
2021-05-17 05:25:04 +00:00
Masayuki Nakano 1d94e91f3f Bug 1627175 - part 46: Move `HTMLEditor::GetPriorHTMLSibling()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D115115
2021-05-17 03:05:13 +00:00
Masayuki Nakano e2a6a7ae0b Bug 1627175 - part 45: Add helper methods which test found `<br>` element visibility to `WSRunScanner` and `WSScanResult` r=m_kato
This must make the callers of `HTMLEditUtils::IsVisibleBRElement()` and
`HTMLEditUtils::IsInvisibleBRElement()` easier to read.

Depends on D114933

Differential Revision: https://phabricator.services.mozilla.com/D114934
2021-05-13 13:44:04 +00:00
Masayuki Nakano b9607b64d3 Bug 1627175 - part 44: Add `HTMLEditUtils::IsInvisibleBRElement()` for avoiding a mistake r=m_kato
When I review patches, sometimes I saw wrong usage of `!IsVisibleBRElement()`.
It means that it's an invisible <br> element **or** non-<br> element node,
but developers may think it checks whether it's an invisible `<br>` element
or not without checking the specifying content is a <br> element.

For avoiding this, there should be `IsInvisibleBRElement()` too.

Depends on D114932

Differential Revision: https://phabricator.services.mozilla.com/D114933
2021-05-13 06:46:24 +00:00
Masayuki Nakano 6c9c8af840 Bug 1627175 - part 43: Move `HTMLEditor::IsVisibleBRElement()` to `HTMLEditUtils::IsVisibleBRElement()` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D114932
2021-05-13 06:02:34 +00:00
Makoto Kato 6c788dbaf0 Bug 1708670 - nsIEditor.pasteTransferable won't insert image/png if nsITransaferable uses nsIInputStream. r=masayuki
editor.pastedTransferable cannot insert image/png when using nsITransaferable.

Although pastedTransferable stores DataTransfer in stack, when mime type is
image/png, DataTransfer fetches all data in
DataTransferItem::FillInExternalData then stores it as `KIND_FILE`.
It means that nsIInputStream in nsITransferable is already EOF.

So we should use InsertFromDataTransfer when internal data moves to
DataTransfer.

Differential Revision: https://phabricator.services.mozilla.com/D114702
2021-05-11 09:47:09 +00:00
Matt Woodrow a6d0dff2b5 Bug 1707513 - Add 'drawSnapshot' mode to reftest harness, and annotate all current failures. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D114188
2021-05-10 00:28:01 +00:00
Alexandru Michis 4b2cad43d1 Backed out 2 changesets (bug 1707513) for causing reftest failures in partial-prerender-expansion-with-resolution-1.html
Backed out changeset f9bdd1b929f2 (bug 1707513)
Backed out changeset b76d28f3a159 (bug 1707513)
2021-05-08 22:13:23 +03:00
Matt Woodrow a77dc2167d Bug 1707513 - Add 'drawSnapshot' mode to reftest harness, and annotate all current failures. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D114188
2021-05-08 05:52:19 +00:00
Masayuki Nakano 812ed2fc52 Bug 1707630 - part 3: Make `EditorBase::CreateNodeWithTransaction()` return error if failed r=m_kato
Depends on D113473

Differential Revision: https://phabricator.services.mozilla.com/D113474
2021-04-28 03:33:26 +00:00
Masayuki Nakano 39b71b059e Bug 1707630 - part 2: Make `HTMLEditor::PrepareToInsertBRElement()` return error if failed r=m_kato
Depends on D113472

Differential Revision: https://phabricator.services.mozilla.com/D113473
2021-04-28 03:33:26 +00:00
Masayuki Nakano 867fd9ab9a Bug 1707630 - part 1: Make `HTMLEditor::InsertBREelementWithTransaction()` return error when it fails r=m_kato
The testcase hits the assertion because `CreateNodeTransaction::DoTransaction()`
returns error, but it's not handled by `HandledInsertParagraphInParagraph()`
so that we should make `InsertBRElementWithTransaction()` and its callees
should return error if they meet unexpected cases.

Depends on D113471

Differential Revision: https://phabricator.services.mozilla.com/D113472
2021-04-28 03:33:25 +00:00
Masayuki Nakano a6ae919f0e Bug 1707630 - Fix the crash with a one line fix r=m_kato
For making it's upliftable, this patch just fixes the crash with a one line fix.

Depends on D113282

Differential Revision: https://phabricator.services.mozilla.com/D113471
2021-04-28 03:33:25 +00:00
Masayuki Nakano ebf2dd010f Bug 1627175 - part 42: Get rid of `HTMLEditor::GetNextEditableHTMLNode()` and `HTMLEditor::GetPreviousEditableHTMLNode()` r=m_kato
This changes the logic of `HTMLEditor::GetFirstEditableLeaf()` and
`HTMLEditor::GetLastEditableLeaf()`, but it shouldn't change actual behavior
because the case is that the first/last child of `aNode` is not in editing
host but editable.

Differential Revision: https://phabricator.services.mozilla.com/D113282
2021-04-27 23:45:49 +00:00
Masayuki Nakano 655c27c32b Bug 1627175 - part 41: Get rid of `HTMLEditor::GetNextEditableHTMLNodeInBlock()` and `HTMLEditor::GetPreviousEditableHTMLNodeInBlock()` r=m_kato
Depends on D113280

Differential Revision: https://phabricator.services.mozilla.com/D113281
2021-04-27 21:13:43 +00:00
Masayuki Nakano 5f2961c2f7 Bug 1627175 - part 40: Get rid of `HTMLEditor::GetNextHTMLElementOrText()` and `HTMLEditor::GetPreviousHTMLElementOrText()` and their internal methods r=m_kato
Depends on D113279

Differential Revision: https://phabricator.services.mozilla.com/D113280
2021-04-27 14:03:17 +00:00
Masayuki Nakano 0187400c5b Bug 1627175 - part 39: Get rid of `HTMLEditor::GetNextHTMLElementOrTextInBlock()` and `HTMLEditor::GetPreviousHTMLElementOrTextInBlock()` r=m_kato
Depends on D113242

Differential Revision: https://phabricator.services.mozilla.com/D113279
2021-04-27 11:56:34 +00:00
Masayuki Nakano 3aef835f6c Bug 1627175 - part 38: Move `EditorBase::GetNextContent()` and `EditorBase::GetPreviousContent()` to `HTMLEditUtils` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D113242
2021-04-27 11:17:44 +00:00
Masayuki Nakano 7da0836039 Bug 1627175 - part 37: Get rid of editor type argument from `EditorBase::GetNextContent()` and `EditorBase::GetPreviousContent()` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D113241
2021-04-27 11:17:43 +00:00
Masayuki Nakano 267025f6e5 Bug 1627175 - part 36: Make `EditorBase::CreateTransactionForCollapsedRange()` use `EditorBase::GetNextContent()` and `EditorBase::GetPreviousContent()` only when it's an `HTMLEditor` r=m_kato
If the editor instance is a `TextEditor`, the root element has to be
anonymous `<div>` element and it has only one text node when it has non-empty
value.  Therefore, if it's in `TextEditor`, the method does not need to use
the complicated APIs for finding a text node from the anonymous `<div>` element
or padding `<br>` element since it can adjust the given point into the text
node without such API.

Differential Revision: https://phabricator.services.mozilla.com/D113240
2021-04-27 11:17:43 +00:00
Masayuki Nakano 4e78552ddb Bug 1627175 - part 35: Move `EditorBase::GetFirstEditableNode()` into `HTMLEditUtils` r=m_kato
Only the user is `EditorBase::BeginningOfDocument()` which is used by both
`TextEditor` and `HTMLEditor`.  However, if it's a `TextEditor`, expected
result is only the first text node only when there is one.  Therefore, we can
move it into `HTMLEditUtils` and make `EditorBase::BeginningOfDocument()`
find the text node by it self.  Then, we can get rid of using
`EditorBase::GetEditorType()` in this case.

Differential Revision: https://phabricator.services.mozilla.com/D113239
2021-04-27 11:17:43 +00:00
Masayuki Nakano 1b0d3e96c4 Bug 1627175 - part 34: Make `EditorBase::GetNextContent()` and `EditorBase::GetPreviousContent()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D113238
2021-04-27 11:17:42 +00:00
Masayuki Nakano 4debffd39d Bug 1627175 - part 33: Make `EditorBase::FindNode()` and `EditorBase::FindNextLeafNode()` static r=m_kato
They are instance members of `EditorBase` only for referring editor type and
editing host.  Therefore, we can make them static with making them take
editor type and ancestor limiter as arguments.

Depends on D113236

Differential Revision: https://phabricator.services.mozilla.com/D113237
2021-04-27 11:17:42 +00:00
Masayuki Nakano 3cfc86a155 Bug 1627175 - part 32: Get rid of `EditorBase::GetNextNodeInBlock()` and `EditorBase::GetPreviousNodeInBlock()` r=m_kato
Depends on D113235

Differential Revision: https://phabricator.services.mozilla.com/D113236
2021-04-27 11:17:41 +00:00
Masayuki Nakano 1cc0a524f6 Bug 1627175 - part 31: Get rid of `EditorBase::GetNextEditableNode()` and `EditorBase::GetPreviousEditableNode()` r=m_kato
Depends on D113234

Differential Revision: https://phabricator.services.mozilla.com/D113235
2021-04-27 11:17:41 +00:00
Masayuki Nakano eb26e869e5 Bug 1627175 - part 30: Get rid of `EditorBase::GetNextEditableNodeInBlock()` and `EditorBase::GetPreviousEditableNodeInBlock()` r=m_kato
Depends on D113233

Differential Revision: https://phabricator.services.mozilla.com/D113234
2021-04-27 11:17:41 +00:00
Masayuki Nakano 3f701eb0f4 Bug 1627175 - part 29: Get rid of `EditorBase::GetNextElementOrTextInBlock()` and `EditorBase::GetPreviousElementOrTextInBlock()` r=m_kato
Depends on D113232

Differential Revision: https://phabricator.services.mozilla.com/D113233
2021-04-27 11:17:40 +00:00
Masayuki Nakano 4a928f25f7 Bug 1627175 - part 28: Get rid of `EditorBase::GetNextElementOrText()` and `EditorBase::GetPreviousElementOrText()` r=m_kato
Depends on D113231

Differential Revision: https://phabricator.services.mozilla.com/D113232
2021-04-27 11:17:40 +00:00
Masayuki Nakano 7a2d02c10f Bug 1627175 - part 27: Get rid of `EditorBase::GetNextNode()` and `EditorBase::GetPreviousNode()` r=m_kato
Depends on D113230

Differential Revision: https://phabricator.services.mozilla.com/D113231
2021-04-27 11:17:39 +00:00
Masayuki Nakano 82aa5b8992 Bug 1627175 - part 26: Rename `EditorBase::Get*NodeInternal()` to `Get*Content()` r=m_kato
The following patches will get rid of inline wrapper methods of them.
Therefore, they shouldn't be called as "internal".  And they return
`nsIContent*` instead of `nsINode*` so, `Get*Content()` is better name for
them.

Depends on D113229

Differential Revision: https://phabricator.services.mozilla.com/D113230
2021-04-27 11:17:39 +00:00
Masayuki Nakano a525512d98 Bug 1627175 - part 25: Rename `WalkTreeOption::FindAnyDataNode` to `WalkTreeOption::IgnoreDataNodeExceptText` r=m_kato
So, the meaning is reverted of this action.  But with this change, the scanner
methods scans any nodes by default.  This is simpler to understand from the
callers.

Depends on D113228

Differential Revision: https://phabricator.services.mozilla.com/D113229
2021-04-27 11:17:39 +00:00
Masayuki Nakano 8eb9f61b5e Bug 1627175 - part 24: Make `EditorBase::FindNode` and `EditorBase::Get*NodeInternal()` take an `EnumSet` instead of multiple `bool` arguments r=m_kato
Before moving them from `EditorBase`, they should take only one option argument
whose type is an `EnumSet` class.

Note that I wanted to name each option for optional behavior, but
`FindAnyDataNode` requires to revert the its meaning  (I.e., only with this
patch, `true` should be set an option).  Therefore, the following patch renames
it.

Differential Revision: https://phabricator.services.mozilla.com/D113228
2021-04-27 11:17:38 +00:00
Masayuki Nakano dc502df61b Bug 1703561 - Make `HTMLEditor` not allow to modify content nodes in `<select>` element r=m_kato
Like the other browsers, we shouldn't allow to user modify content in
`<select>` element.  Note that this case won't occur with moving caret
with input devices.  This occurs only with Selection API.

FYI: Chrome deletes `<select>` element if children of it are selected,
but it's odd behavior since user don't see where is selected visually
and may cause unexpected data loss (i.e., deleting `<select>` element).

Perhaps, we should investigate the behavior in other replaced elements
like `<textarea>` etc in follow up bugs.

Depends on D112513

Differential Revision: https://phabricator.services.mozilla.com/D112517
2021-04-20 12:07:15 +00:00
Masayuki Nakano d39859eba7 Bug 1627175 - part 23: Move `HTMLEditor::IsEmptyNode()` into `HTMLEditUtils` with making it take `EnumSet` instead of `bool` arguments r=m_kato
It's hard to understand each caller of `HTMLEditor::IsEmptyNode()` tries to
check with multiple `bool` arguments.  Therefore, they should be replaced
with an `EnumSet`.

Note that only the first argument is reverted the meaning.  Therefore, if
it's omitted or `false`, `EmptyCheckOption::TreatSingleBRElementAsVisible`
is specified explicitly.  Otherwise, i.e., `true`, nothing should be
specified.

Differential Revision: https://phabricator.services.mozilla.com/D112513
2021-04-20 12:02:17 +00:00
Masayuki Nakano 1ce7f565ac Bug 1627175 - part 22: Get rid of `HTMLEditor::IsEmptyTextNode()` r=m_kato
It returns true only when it's a text node, but the text is empty.
However, `HTMLEditUtils::IsVisibleTextNode()` is used in
`HTMLEditor::IsEmptyNodeImpl()`.  So, we replace it with directly using
`HTMLEditUtils::IsVisibleTextNode()`.

Depends on D112511

Differential Revision: https://phabricator.services.mozilla.com/D112512
2021-04-20 02:00:15 +00:00
Masayuki Nakano 96ee002082 Bug 1627175 - part 21: Move `HTMLEditor::IsInVisibleTextFrames()` to `HTMLEditUtils` r=m_kato
Depends on D112510

Differential Revision: https://phabricator.services.mozilla.com/D112511
2021-04-20 00:41:25 +00:00
Masayuki Nakano fd48bf5244 Bug 1627175 - part 20: Move `HTMLEditor::IsEmptyTextNode()` to `HTMLEditUtils` r=m_kato
Now, it does not depend on `HTMLEditor`.  So, we can move it into the
`HTMLEditUtils`.

Depends on D112509

Differential Revision: https://phabricator.services.mozilla.com/D112510
2021-04-20 00:41:24 +00:00
Masayuki Nakano 91572af027 Bug 1705598 - part 8: Make `WSRunScanner::AutoInclusiveAncestorBlockElementsJoiner()` take editing host instead of `HTMLEditor` r=m_kato
Depends on D112508

Differential Revision: https://phabricator.services.mozilla.com/D112509
2021-04-19 23:25:47 +00:00
Masayuki Nakano 16c03a3b47 Bug 1705598 - part 7: Make `WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries()` take editing host instead of `HTMLEditor` r=m_kato
Depends on D112507

Differential Revision: https://phabricator.services.mozilla.com/D112508
2021-04-19 23:25:47 +00:00
Masayuki Nakano 7c39f920b9 Bug 1705598 - part 6: Make `WSRunScanner::GetRangesForDeletingAtomicContent()` take editing host instead of `HTMLEditor` r=m_kato
Depends on D112506

Differential Revision: https://phabricator.services.mozilla.com/D112507
2021-04-19 23:25:46 +00:00