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

10073 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 34c574b18a Bug 1653485 - part 3: Rename `WSRunScanner::TextFragmentDataAtStart()` to `WSRunScanner::TextFragmentDataAtStartRef()` r=m_kato
Depends on D83920

Differential Revision: https://phabricator.services.mozilla.com/D83921
2020-07-20 09:56:24 +00:00
Masayuki Nakano 143dc7787e Bug 1653485 - part 2: Change each lvalue which is initialized with result of `*Ref()` methods in `WSRunObject.cpp` to `const Foo&` r=m_kato
Depends on D83919

Differential Revision: https://phabricator.services.mozilla.com/D83920
2020-07-20 09:41:35 +00:00
Masayuki Nakano 63f1a6f5a8 Bug 1653485 - part 1: Make `TextFragmentData::GetInvisibleLeadingWhiteSpaceRange()` and `TextFragmentData::GetInvisibleTrailingWhiteSpaceRange()` return const-reference r=m_kato
They return copy of cached `EditorDOMRange` instance.  So, they can return
const-reference rather than copy of stored data.

Differential Revision: https://phabricator.services.mozilla.com/D83919
2020-07-20 09:39:00 +00:00
Mirko Brodesser 2c374acd88 Bug 1649121: part 45) Rename `FindTargetNodeOfContextForPastedHTML`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83783
2020-07-17 08:44:38 +00:00
Mirko Brodesser 76c391b27f Bug 1649121: part 44) Factor `PreProcessContextDocumentFragmentForMerging` out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83661
2020-07-17 08:44:36 +00:00
Mirko Brodesser d8b92c4ea0 Bug 1649121: part 43) Factor `PostProcessFragmentForPastedHTMLWithoutContext` out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83660
2020-07-17 08:44:33 +00:00
Mirko Brodesser 434ad21fa9 Bug 1649121: part 42) Factor `MergeAndPostProcessFragmentsForPastedHTMLAndContext` out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83659
2020-07-17 08:44:31 +00:00
Mirko Brodesser 2edf97ca16 Bug 1649121: part 41) Add local variable for pasted HTML document fragment. r=masayuki
It's clearer and allows setting the output fragment at the end of the
method.

Differential Revision: https://phabricator.services.mozilla.com/D83658
2020-07-17 08:44:28 +00:00
Masayuki Nakano f97dcee20c Bug 1651874 - part 10: Move `GetReplaceRangeDataAtEndOfDeletionRange()` and `GetReplaceRangeDataAtStartOfDeletionRange()` to `TextFragmentData` r=m_kato
With this patch, the creation cost of `TextFragmentData` is minimized, but
`MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` can work
with the latest DOM tree information at touching start of the deleting range
even after touching end of the range.

Depends on D83228

Differential Revision: https://phabricator.services.mozilla.com/D83229
2020-07-16 16:41:00 +00:00
Masayuki Nakano 58cf70f8ca Bug 1651874 - part 9: Make `MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` correct delete range when it modifies the DOM tree at end of deleting range r=m_kato
This is what the original method should've done.  Mutation event listeners may
change the DOM tree at the first modification, but it hasn't checked whether
the range to delete or replace around start of deleting range is still valid
or not.

Depends on D83226

Differential Revision: https://phabricator.services.mozilla.com/D83228
2020-07-16 13:40:36 +00:00
Masayuki Nakano 35e5829194 Bug 1651874 - part 8: Make helper methods of `MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` return replace or delete data r=m_kato
For representing delete or replace data which have the range and replace string,
this patch creates `ReplaceRangeDataBase` class which is stack-only, has
`EditorDOMRange` or `EditorDOMRangeInTexts` as the range and has replace string
which can be empty string.

Then, `MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` should
modify the DOM tree by itself.  With the following patch, the behavior is
corrected for multiple DOM tree changes.

Depends on D83224

Differential Revision: https://phabricator.services.mozilla.com/D83226
2020-07-16 12:24:21 +00:00
Masayuki Nakano 5cd974a324 Bug 1651874 - part 7: Rename `ReplaceASCIIWhiteSpacesWithOneNBSP()` to `ReplaceTextAndRemoveEmptyTextNodes()` r=m_kato
Depends on D83223

Differential Revision: https://phabricator.services.mozilla.com/D83224
2020-07-16 05:54:41 +00:00
Masayuki Nakano 2d02a70bfb Bug 1651874 - part 6: Make the last blocks of `MakeSureToKeepVisibleStateOfWhiteSpacesAtEndOfDeletingRange()` and `MakeSureToKeepVisibleStateOfWhiteSpacesAtStartOfDeletingRange()` use early-return style r=m_kato
Depends on D83221

Differential Revision: https://phabricator.services.mozilla.com/D83223
2020-07-16 03:41:00 +00:00
Masayuki Nakano 111b0ccc2e Bug 1651874 - part 5: Make `MakeSureToKeepVisibleStateOfWhiteSpacesAtEndOfDeletingRange()` and `MakeSureToKeepVisibleStateOfWhiteSpacesAtStartOfDeletingRange()` stop collecting all data first r=m_kato
Depends on D83220

Differential Revision: https://phabricator.services.mozilla.com/D83221
2020-07-16 03:40:23 +00:00
Masayuki Nakano b48a53e99f Bug 1651874 - part 4: Get rid of check of out of range in `MakeSureToKeepVisibleStateOfWhiteSpacesAtEndOfDeletingRange()` and `MakeSureToKeepVisibleStateOfWhiteSpacesAtStartOfDeletingRange()` r=m_kato
Depends on D83219

Differential Revision: https://phabricator.services.mozilla.com/D83220
2020-07-16 02:12:26 +00:00
Masayuki Nakano affa364e8c Bug 1651874 - part 3: Remove unnecessary variables in `MakeSureToKeepVisibleStateOfWhiteSpacesAtEndOfDeletingRange()` and `MakeSureToKeepVisibleStateOfWhiteSpacesAtStartOfDeletingRange()` r=m_kato
Depends on D83218

Differential Revision: https://phabricator.services.mozilla.com/D83219
2020-07-15 15:05:37 +00:00
Masayuki Nakano f0994f25cd Bug 1651874 - part 2: Get rid of unnecessary blocks in `MakeSureToKeepVisibleStateOfWhiteSpacesAtEndOfDeletingRange()` and `MakeSureToKeepVisibleStateOfWhiteSpacesAtStartOfDeletingRange()` r=m_kato
Depends on D83217

Differential Revision: https://phabricator.services.mozilla.com/D83218
2020-07-15 15:05:12 +00:00
Masayuki Nakano 743a2e3ea9 Bug 1651874 - part 1: Duplicate the definition of `MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` r=m_kato
This patch is preparation for easier to review.

This patch duplicates the body of
`MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` and calls the
copies from new `MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()`.
The one is for handling start of deleting range, and the other is for handling
end of deleting range.

As you see, this patch and the following patches do not work because of the
duplicated code.  Perhaps, part 2 works if there is no mutation event listeners.
Part 9 works even if there is mutation event listeners which touch the DOM
tree in the worst case (when it touches both end of delete range and start of
delete range, and around the start of deleting range is modified by JS).
Finally, part 9 takes back the original performance.

Depends on D82715

Differential Revision: https://phabricator.services.mozilla.com/D83217
2020-07-15 15:04:54 +00:00
Mirko Brodesser 19dff2f032 Bug 1649121: part 40) Factor `DetermineContextLocalNameForParsingPastedHTML` out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83517
2020-07-16 11:48:07 +00:00
Mirko Brodesser c142c4747d Bug 1649121: part 39) Rename parameters and variables around `CreateDocumentFragmentAndGetParentOfPastedHTMLInContext`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83516
2020-07-16 10:07:06 +00:00
Mirko Brodesser ee40150e1c Bug 1649121: part 38) Add `CreateDocumentFragmentAndGetParentOfPastedHTMLInContext`. r=masayuki
The parameters will be renamed in the following review.

Differential Revision: https://phabricator.services.mozilla.com/D83515
2020-07-16 10:08:21 +00:00
Simon Giesecke da069e50be Bug 1652942 - Remove unnecessary includes from Element.h. r=smaug
Depends on D83114

Differential Revision: https://phabricator.services.mozilla.com/D83632
2020-07-15 14:09:01 +00:00
Masayuki Nakano 75c8215499 Bug 1649980 - part 22: Make `VisibleWhiteSpacesData` store start point and end point with `EditorDOMPoint` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82715
2020-07-14 12:54:51 +00:00
Masayuki Nakano cb58def02f Bug 1649980 - part 21: Move `BoundaryData` and `NoBreakingWhiteSpacesData` into `TextFragmentData` r=m_kato
Now, these classes are used only by `TextFragmentData` and they can be not
exposed.  Therefore, we should hide them with making them private nested
classes of `TextFragmentData`.

Differential Revision: https://phabricator.services.mozilla.com/D82714
2020-07-14 12:51:05 +00:00
Masayuki Nakano 9ef57c0e72 Bug 1649980 - part 20: Rename `WSRunObject` to `WhiteSpaceVisibilityKeeper` r=m_kato
Although the new name is long, but I have no better idea.  The class's purpose
is to keep white-space visibility around modifying DOM position.  Therefore,
I use "keeper" for the name.

Differential Revision: https://phabricator.services.mozilla.com/D82713
2020-07-14 12:40:13 +00:00
Masayuki Nakano 28151f4d79 Bug 1649980 - part 19: Make `WSRunObject` class not instantiated r=m_kato
Now, all member methods of `WSRunObject` are static.  So, it shouldn't
be able to instantiated.

Differential Revision: https://phabricator.services.mozilla.com/D82712
2020-07-14 12:21:19 +00:00
Masayuki Nakano 8695ba2c43 Bug 1649980 - part 18: Merge `WSRunObject::NormalizeWhiteSpacesAtEndOf()` to `WSRunObject::NormalizeWhiteSpacesAround()` r=m_kato
Similar to the previous patch, `WSRunObject::NormalizeWhiteSpacesAround()` is
a wrapper to create `WSRunObject` instance for calling
`NormalizeWhiteSpacesAtEndOf()`, but it does not need to be `WSRunObject`'s
instance.  Therefore, we can merge them.

Note that this renames the merged method to `NormalizeVisibleWhiteSpacesAt`.

Differential Revision: https://phabricator.services.mozilla.com/D82711
2020-07-14 12:20:10 +00:00
Masayuki Nakano 0c8108d6fb Bug 1649980 - part 17: Merge `WSRunObject::DeleteInvisibleASCIIWhiteSpacesInternal()` to `WSRunObject::DeleteInvisibleASCIIWhiteSpaces()` r=m_kato
Now, it does not need to be a `WSRunObject` instance so that its wrapper to
create `WSRunObject` instance is not necessary.

Differential Revision: https://phabricator.services.mozilla.com/D82710
2020-07-14 11:57:22 +00:00
Masayuki Nakano 6d5a2ed757 Bug 1649980 - part 16: Make `WSRunObject::DeleteWSForward()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82709
2020-07-14 11:25:13 +00:00
Masayuki Nakano 6d8ecf188f Bug 1649980 - part 15: Make `WSRunObject::DeleteWSBackward()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82708
2020-07-14 10:59:10 +00:00
Mirko Brodesser cac98dad3c Bug 1649121: part 37) Move some methods to `FragmentFromPasteCreator`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83325
2020-07-14 08:54:14 +00:00
Mirko Brodesser 0d5c14fde1 Bug 1649121: part 36) Move setting start- and end-offsets out of `FragmentFromPasteCreator`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D83324
2020-07-14 09:08:25 +00:00
Mirko Brodesser b16297fa5f Bug 1649121: part 35) Add `FragmentFromPasteCreator`. r=masayuki
First step of breaking up the complex corresponding method.

Differential Revision: https://phabricator.services.mozilla.com/D83323
2020-07-14 09:23:58 +00:00
Masayuki Nakano af86f0b72b Bug 1649980 - part 14: Make `WSRunObject::PrepareToSplitAcrossBlocksPriv()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82707
2020-07-14 10:07:41 +00:00
Razvan Maries 6269129e09 Backed out changeset 4d835cc17a7f (bug 1649121) for build bustages on HTMLEditorDataTransfer.cpp. CLOSED TREE 2020-07-14 11:14:25 +03:00
Mirko Brodesser 9aadf57d94 Bug 1649121: part 35) Add `FragmentFromPasteCreator`. r=masayuki
First step of breaking up the complex corresponding method.

Differential Revision: https://phabricator.services.mozilla.com/D83323
2020-07-14 05:13:33 +00:00
Masayuki Nakano 8018883ae8 Bug 1649980 - part 13: Make `WSRunObject::PrepareToDeleteRangePriv()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82706
2020-07-14 03:54:34 +00:00
Masayuki Nakano 2e76a2dbb5 Bug 1649980 - part 12: Make `WSRunObject::InsertBreak()` static r=m_kato
It's now can work with static helper methods and a `TextFragmentData` instance.
Therefore, this patch makes it a static method.

Note that it's always called with `nsIEditor::eNone` so that we can get rid of
the argument.

Differential Revision: https://phabricator.services.mozilla.com/D82705
2020-07-14 01:29:34 +00:00
Masayuki Nakano 89d1495bf1 Bug 1649980 - part 11: Make `WSRunObject::ReplaceASCIIWhiteSpacesWithOneNBSP()` static r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D82704
2020-07-13 15:30:51 +00:00
Masayuki Nakano 55c0146bd3 Bug 1649980 - part 10: Get rid of `WSRunScanner::mScanEndPoint` r=m_kato
Now, `mScanEndPoint` is not used.  This patch removes it and clean up the
constructors of `WSRunScanner` and `WSRunObject`.

Differential Revision: https://phabricator.services.mozilla.com/D82703
2020-07-13 14:57:38 +00:00
Masayuki Nakano 1d08048cd9 Bug 1649980 - part 9: Make `WSRunScanner::InsertText()` a static method r=m_kato
It's simpler to make `WSRunScanner::InsertText()` take insertion point.
Then, it can do its jobs with `TextFragmentData` instance(s).

Differential Revision: https://phabricator.services.mozilla.com/D82702
2020-07-13 14:25:44 +00:00
tkhan 75ea54bf01 Bug 1650919 - Adding manifest annotations for xorigin test harness. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D82763
2020-07-13 20:34:46 +00:00
Bogdan Tara 6faddf7d8f Backed out changeset 1a0f002865d3 (bug 1650919) for test_deprecated.html failures CLOSED TREE 2020-07-13 19:22:21 +03:00
tkhan e50031dfc7 Bug 1650919 - Adding manifest annotations for xorigin test harness. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D82763
2020-07-13 13:01:43 +00:00
Mirko Brodesser 530067672e Bug 1649121: part 34) Factor `FragmentParser` out. r=masayuki
First step of separating parsing more clearly from other fragment
mutations.

Differential Revision: https://phabricator.services.mozilla.com/D83046
2020-07-13 10:30:15 +00:00
Masayuki Nakano b0b71dbf13 Bug 1649980 - part 8: Make `TextFragmentData::CreateVisibleWhiteSpacesData()` cache its result and returns reference instead of copy of the instance r=m_kato
`CreateVisibleWhiteSpacesData()` is now called multiple times and maybe called
after the DOM tree is modified even though it's a bug.  Therefore, we should
make it store first result and return its reference instead.

Differential Revision: https://phabricator.services.mozilla.com/D82701
2020-07-13 10:37:12 +00:00
Masayuki Nakano ab1d1d9708 Bug 1649980 - part 7: Redesign `WSRunObject::MaybeReplaceInclusiveNextNBSPWithASCIIWhiteSpace()` r=m_kato
Same as the previous patch, it can be split to computation part and
modifying the DOM tree part.  Then, the former can be in `TextFragmentData`
and the latter can be done by the caller which is only
`WSRunObject::InsertText()`.

Depends on D82699

Differential Revision: https://phabricator.services.mozilla.com/D82700
2020-07-13 08:31:51 +00:00
Mirko Brodesser b85c0263f1 Bug 1649121: part 33) Rename `FindTargetNode` to `FindTargetNodeOfContextForPastedHTML`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D82895
2020-07-10 12:02:54 +00:00
Mirko Brodesser ad6e91b777 Bug 1649121: part 32) Rename `RemoveBodyAndHead` to `RemoveHeadChildAndStealBodyChildsChildren`. r=masayuki
More accurate, less misleading.

Differential Revision: https://phabricator.services.mozilla.com/D82894
2020-07-10 12:02:51 +00:00
Mirko Brodesser 16c2811dc8 Bug 1649121: part 31) Change `StripFormattingNodes` to `RemoveNonPreWhiteSpaceOnlyTextNodesForIgnoringInvisibleWhiteSpaces`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D82886
2020-07-10 12:02:38 +00:00