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

586 Коммитов

Автор SHA1 Сообщение Дата
Makoto Kato 0a0fc918b8 Bug 1663638 - Don't use edit transaction for editing UI. r=masayuki
Although we use CSS property for Inline table editing UI, we use edit
transaction for it unfortunately. When hiding this UI, since removing
element doesn't use edit transaction, transaction will be canceled before
showing this UI.

It is unnecessary to use edit transaction for UI, so we shouldn't use it.

Differential Revision: https://phabricator.services.mozilla.com/D90056
2020-09-14 05:10:08 +00:00
Masayuki Nakano e09be3fb17 Bug 1664109 - Fix `!=` operator of `EditorDOMRangeBase` r=m_kato
This is causes taking back bugs in
`WSRunScanner::GetNewInvisibleLeadingWhiteSpaceRangeIfSplittingAt()` and
`WSRunScanner::GetNewInvisibleTrailingWhiteSpaceRangeIfSplittingAt()`  (I.e.,
they were fixed by bug 1647556).  Therefore, this removes the odd `if` blocks
which are pointed with `XXX` comment for avoiding "regressions" (without them,
some WPTs for `InputEvents.getTargetRanges()` become failure).

Depends on D89582

Differential Revision: https://phabricator.services.mozilla.com/D89869
2020-09-16 02:17:33 +00:00
Masayuki Nakano d060d644d6 Bug 1663797 - Make delete handler of `HTMLEditor` not try to join `<html>`, `<head>` and `<body>` r=m_kato
It'll fail to join them when its utility methods actually join them.
However, it should be considered earlier timing because the preparation
DOM tree changes before joining them causes creating odd tree (see the
removed cases of the test).  Therefore, we should make them stop handling
deletion before modifying the DOM tree.

Depends on D89579

Differential Revision: https://phabricator.services.mozilla.com/D89580
2020-09-15 07:33:58 +00:00
Timothy Nikkel 30f528e804 Bug 1664446. Properly wait to make sure any potential scroll events get fired in several tests. r=kats
Doing rAF rAF flushApzRepaints is not enough to make sure that any potential scroll events are sent to content. The reason is that if the apz repaint request causes us to do scrolling on the main thread then the scrolling will be finished after flushApzRepaints, and the scroll event will be pending, but it's not sent until the next refresh driver tick. So we need to do at least one rAF after flushApzRepaints.

Differential Revision: https://phabricator.services.mozilla.com/D90035
2020-09-13 20:21:11 +00:00
Timothy Nikkel 3fa3a926a6 Bug 1664446. Disable zoom to focus input for mochitests in editor/libeditor/tests/. r=botond
I think the scrolls that zoom to focus input causes are giving us scroll events that we don't expect. I don't think there is a better way around this.

Differential Revision: https://phabricator.services.mozilla.com/D89993
2020-09-11 23:30:26 +00:00
Timothy Nikkel fa760298a9 Bug 1664446. Increase fuzz in editor/libeditor/tests/test_selection_move_commands.html slightly. r=botond
Disabling zoom to focused input seems to have slightly changed how much fuzz we get when comparing scroll position.

Differential Revision: https://phabricator.services.mozilla.com/D90005
2020-09-12 01:24:23 +00:00
Timothy Nikkel 86ef6eea77 Bug 1663537. Fix various tests for desktop zooming scrollbars. r=kats
The test fixes all fell into the follow categories:

A) The test uses requestAnimationFrame to wait one frame and expects scrolling to be complete. With the desktop zooming scrollbars in order for the scrolling to show up on the main thread we need to send the scroll request to the compositor and then hear back from it via an apz repaint request (apz callback helper). Waiting on requestAnimationFrame will complete the first part, but not necessarily the second part. The fix is to wait for a scroll event.

B) Switching tests to wait for scroll events exposes another problem: the test can do things that cause a scroll in order to setup the test (and that may not be obvious that it causes a scroll) before actually proceeding to do the test and do something that causes a scroll and then checks for the scroll change of the second thing. Waiting for a requestAnimationFrame would include both those scrolls without desktop zooming scrollbars, but if we wait for a scroll event we will get the scroll event for the first thing which we are not interested in. So we need to make sure scroll events are cleared out before waiting for any scroll events. We do this by waiting two requestAnimationFrame's and waiting for apz to be flushed. We also use this when a test does something and it wants to test that scrolling is not performed.

The main thing that causes scrolling that may not be obvious: calling node.focus(). With stacks like:

from test_scroll_per_page.html

```
#01: mozilla::ScrollFrameHelper::CompleteAsyncScroll(nsRect const&, mozilla::ScrollOrigin) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x47d6cc0]
#02: mozilla::ScrollFrameHelper::ScrollToWithOrigin(nsPoint, mozilla::ScrollMode, mozilla::ScrollOrigin, nsRect const*, nsIScrollbarMediator::ScrollSnapMode) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x47d7732]
#03: mozilla::layout::ScrollAnchorContainer::ApplyAdjustments() [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4742913]
#04: mozilla::PresShell::FlushPendingScrollAnchorAdjustments() [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4650069]
#05: mozilla::PresShell::ProcessReflowCommands(bool) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x465742b]
#06: mozilla::PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4656af8]
#07: mozilla::dom::Document::FlushPendingNotifications(mozilla::ChangesToFlush) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1a87d3c]
#08: mozilla::PresShell::ScrollContentIntoView(nsIContent*, mozilla::ScrollAxis, mozilla::ScrollAxis, mozilla::ScrollFlags) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4652b96]
#09: nsFocusManager::ScrollIntoView(mozilla::PresShell*, nsIContent*, unsigned int) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1bedd1c]
#10: nsFocusManager::Focus(nsPIDOMWindowOuter*, mozilla::dom::Element*, unsigned int, bool, bool, bool, bool, bool, nsIContent*) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be6be0]
#11: nsFocusManager::SetFocusInner(mozilla::dom::Element*, int, bool, bool) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be212f]
#12: nsFocusManager::SetFocus(mozilla::dom::Element*, unsigned int) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be32ba]
#13: mozilla::dom::Element::Focus(mozilla::dom::FocusOptions const&, mozilla::dom::CallerType, mozilla::ErrorResult&) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1aaf283]
#14: mozilla::dom::HTMLElement_Binding::focus(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x2d65f3b]
```

from editor/libeditor/tests/test_bug549262.html

```
#01: mozilla::ScrollFrameHelper::CompleteAsyncScroll(nsRect const&, mozilla::ScrollOrigin) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x47d6cc0]
#02: mozilla::ScrollFrameHelper::ScrollToWithOrigin(nsPoint, mozilla::ScrollMode, mozilla::ScrollOrigin, nsRect const*, nsIScrollbarMediator::ScrollSnapMode) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x47d7732]
#03: mozilla::PresShell::ScrollFrameRectIntoView(nsIFrame*, nsRect const&, mozilla::ScrollAxis, mozilla::ScrollAxis, mozilla::ScrollFlags) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x46541bc]
#04: mozilla::PresShell::DoScrollContentIntoView() [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4653776]
#05: mozilla::PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4656b11]
#06: mozilla::dom::Document::FlushPendingNotifications(mozilla::ChangesToFlush) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1a87d3c]
#07: mozilla::PresShell::ScrollContentIntoView(nsIContent*, mozilla::ScrollAxis, mozilla::ScrollAxis, mozilla::ScrollFlags) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x4652b96]
#08: nsFocusManager::ScrollIntoView(mozilla::PresShell*, nsIContent*, unsigned int) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1bedd1c]
#09: nsFocusManager::Focus(nsPIDOMWindowOuter*, mozilla::dom::Element*, unsigned int, bool, bool, bool, bool, bool, nsIContent*) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be6be0]
#10: nsFocusManager::SetFocusInner(mozilla::dom::Element*, int, bool, bool) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be212f]
#11: nsFocusManager::SetFocus(mozilla::dom::Element*, unsigned int) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1be32ba]
#12: mozilla::dom::Element::Focus(mozilla::dom::FocusOptions const&, mozilla::dom::CallerType, mozilla::ErrorResult&) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x1aaf283]
#13: mozilla::dom::HTMLElement_Binding::focus(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) [/Users/tim/ffopt2/src/obj-x86_64-apple-darwin19.6.0/toolkit/library/build/XUL + 0x2d65f3b]
```

C) Several tests use nsIDOMWindowUtils advanceTimeAndRefresh/restoreNormalRefresh and expect scrolling to be done after a call to advanceTimeAndRefresh. This is basically A), advanceTimeAndRefresh does a refresh driver tick but doesn't allow a repaint request to come back to the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D89403
2020-09-11 10:45:28 +00:00
Kagami Sascha Rosylight eb9d5c9792 Bug 1623764 - Part 5: Prevent test failure by subpixel difference r=emilio
The failures already have been there: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3d6cc94f2db7a2e55f41405ef0575102637e0633&selectedTaskRun=ZUj4QROIQo6nGympvvqvjA.0

... but they only fail inside a job "geckoview-test-verify" and the job even does not always runs the test. It makes hard to track the initial failure, so this patch just allows subpixel difference.

Differential Revision: https://phabricator.services.mozilla.com/D86486
2020-09-09 23:45:45 +00:00
Kagami Sascha Rosylight a9222dc61e Bug 1623764 - Part 4: Stop at hard linebreaks when eat_space_to_next_word r=emilio,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85923
2020-09-09 23:45:37 +00:00
Masayuki Nakano 8bb9ef510a Bug 1663601 - Make `RangeBoundaryBase::GetNextSiblingOfChildAtOffset()` check whether `mRef` is nullptr or not r=mbrodesser
`RangeBoundaryBase` stores a previous sibling of child node at offset with
`mRef`.  Therefore, even if the callers check whether its instance points a
child node, `mRef` may be `nullptr` when it points first child of its container.
So, `GetNextSiblingOfChildAtOffset()` needs to handle the case.

This patch adds the crash case test into
`test_dom_input_event_on_htmleditor.html` because of a basic behavior.
For now, this patch adds 2 chunks which are coded with using same style as
previous ones.  However, the test should be redesigned later for making
non-dependency of each chunk guaranteed.  (The new chunks are completely
independent from previously running tests.)

Differential Revision: https://phabricator.services.mozilla.com/D89440
2020-09-09 11:19:04 +00:00
Masayuki Nakano f1c2353722 Bug 1658702 - part 7: Make `AutoDeleteRangesHandler::ComputeRangesToDelete()` compute text deletion range from a collapsed range r=m_kato
Just for computing the deletion range, we can use new path for the Blink-compat
white-space normalizer.

This patch corresponds to:
* https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/editor/libeditor/HTMLEditSubActionHandler.cpp#3278-3284
* https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/editor/libeditor/HTMLEditSubActionHandler.cpp#3298-3344
* https://searchfox.org/mozilla-central/rev/ce21a13035623c1d349980057d09000e70669802/editor/libeditor/HTMLEditSubActionHandler.cpp#3422-3455

Differential Revision: https://phabricator.services.mozilla.com/D88941
2020-09-04 11:30:52 +00:00
Aaron Klotz 14408edb59 Bug 1662313: Add a wait on a selectionchange event to test_resizers_resizing_elements to prevent race condition in test; r=masayuki DONTBUILD
Wait for `selectionchange` to ensure that input events have been processed
before verifying a target's bounds.

Differential Revision: https://phabricator.services.mozilla.com/D88936
2020-09-01 04:46:04 +00:00
Masayuki Nakano 06407fa939 Bug 1658702 - part 4: Make `AutoDeleteRangesHandler::ComputeRangesToDelete()` extend collapsed ranges for deleting adjacent character or word or the line r=m_kato
This patch adding computation code corresponding to:
https://searchfox.org/mozilla-central/rev/27932d4e6ebd2f4b8519865dad864c72176e4e3b/editor/libeditor/HTMLEditSubActionHandler.cpp#3157-3185

For `beforeinput` event listeners, `AutoSetTemporaryAncestorLimiter` is not
enough since when `beforeinput` event listeners modifies `Selection`, the
ancestor limit is not set when it has a job.  Perhaps, we should make editor
stop using focus/blur event listener and makes `nsFocusManager` notifies
editor of them synchronously before dispatching the events.  But it's not
scope of this bug at least.

Differential Revision: https://phabricator.services.mozilla.com/D88379
2020-09-01 02:04:02 +00:00
Mirko Brodesser 355bcdd416 Bug 1652557: remove failure expectation for "test_resizers_resizing_elements.html" when xorigin iframes and fission are enabled. r=hsivonen
Fixed by bug 1653160.

Differential Revision: https://phabricator.services.mozilla.com/D88563
2020-08-28 09:59:39 +00:00
Masayuki Nakano 19c23d725f Bug 1659276 - Make `AutoPlaceholderBatch` choose whether do or do not `ScrollSelectionIntoView` r=m_kato
The root cause of this bug is a bug of async `ScrollSelectionIntoView` that
is what it won't be canceled even if web app changes scroll position with
any API.  Fixing it is really risky and this bug affects an existing website.
Therefore, this patch makes the constructors of `AutoPlaceholderBatch` take
whether do or do not `ScrollSelectionIntoView` when it's destructed.  And
makes `HTMLEditor::SetInlinePropertyAsAction()` not request
`ScrollSelectionIntoView` for taking back the traditional behavior.

Note that this patch does not make it an optional argument because it's hard to
guess that it'll run `ScrollSelectionIntoView` automatically.

Differential Revision: https://phabricator.services.mozilla.com/D87819
2020-08-24 06:39:50 +00:00
Mirko Brodesser 21078a7903 Bug 1652557: don't skip test_bug767684.html when xorigin iframes and fission are enabled. r=masayuki
The test failed neither locally nor on try, hence enabling it again.

Differential Revision: https://phabricator.services.mozilla.com/D86706
2020-08-12 02:02:49 +00:00
Edgar Chen ad6affb211 Bug 1658176 - Make mochitest tests with xorigin and fission enabled report assertion properly; r=kmag DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D86516
2020-08-10 20:48:13 +00:00
Dorel Luca c243829674 Backed out 5 changesets (bug 1623764) for WPT failures in /editing/run/forwarddelete.html. CLOSED TREE
Backed out changeset 838b1a256f25 (bug 1623764)
Backed out changeset 00911e3c92c3 (bug 1623764)
Backed out changeset 5f7d278953d7 (bug 1623764)
Backed out changeset 0059379a3c29 (bug 1623764)
Backed out changeset 6e3a9276ec41 (bug 1623764)
2020-08-10 09:07:48 +03:00
Kagami Sascha Rosylight a371405cd9 Bug 1623764 - Part 5: Prevent test failure by subpixel difference r=emilio
The failures already have been there: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3d6cc94f2db7a2e55f41405ef0575102637e0633&selectedTaskRun=ZUj4QROIQo6nGympvvqvjA.0

... but they only fail inside a job "geckoview-test-verify" and the job even does not always runs the test. It makes hard to track the initial failure, so this patch just allows subpixel difference.

Differential Revision: https://phabricator.services.mozilla.com/D86486
2020-08-10 01:46:26 +00:00
Kagami Sascha Rosylight ddbb369d71 Bug 1623764 - Part 4: Stop at hard linebreaks when eat_space_to_next_word r=emilio,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85923
2020-08-09 12:58:27 +00:00
Cosmin Sabou 1fd1260b5e Backed out 4 changesets (bug 1623764) for mochitest failures on test_movement_by_characters.html. CLOSED TREE
Backed out changeset f927522d89bc (bug 1623764)
Backed out changeset c100eb8ae430 (bug 1623764)
Backed out changeset 1147ded16458 (bug 1623764)
Backed out changeset 7af572ec5edf (bug 1623764)
2020-08-06 08:09:42 +03:00
Kagami Sascha Rosylight 0f2d254487 Bug 1623764 - Part 4: Stop at hard linebreaks when eat_space_to_next_word r=emilio,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85923
2020-08-06 01:18:52 +00:00
Masayuki Nakano 2323c386e9 Bug 1655389 - part 1: Move `HTMLEditor::HandleDeleteCollapsedSelectionAtCurrentBlockBoundary()` into `AutoBlockElementJoiner` r=m_kato
Same as the patch for bug 1655391, this patch splits the method to 2 parts.
One is to consider content nodes to join or a `<br>` element to delete instead.

Note that this patch changes the behavior a little.  That is, when the other
block is not editable, it throws an exception here:
https://searchfox.org/mozilla-central/rev/56bb74ea8e04bdac57c33cbe9b54d889b9262ade/editor/libeditor/HTMLEditSubActionHandler.cpp#3124

But it should just cancel the edit action.  Therefore, some tests in
BrowserScope are fixed by this patch.  I.e., result of DOM tree in the
situation isn't changed, but stops throwing unnecessary exception.

Differential Revision: https://phabricator.services.mozilla.com/D85569
2020-08-04 11:42:55 +00:00
Sonia Singla 34ac1b2de3 Bug 1656292 - Enable remaining ESLint rules on editor/libeditor/tests/*.xhtml files. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D85450
2020-07-31 23:58:46 +00:00
Masayuki Nakano 515b4fb502 Bug 1644313 - part 6: Make `HTMLEditor::HandleDeleteAroundCollapsedSelection()` cancel the deletion if caret position is not editable r=m_kato
The previous patch changed target of white-space normalization.  That caused
`editor/libeditor/tests/test_bug1425997.html` starting to failed with new
exception.  What happens in the test is, selection is collapsed into comment
node (I think that this behavior is also a bug though) after second
`document.execCommand("delete")`, and then, failed to delete anything
and throws the exception.  For fixing this issue, the most simple approach is
make `HTMLEditor::HandleDeleteAroundCollapsedSelection()` stop handling
deletion when caret position is not editable.  So, unfortunately, this
patch changes traditional path too.

Depends on D84948

Differential Revision: https://phabricator.services.mozilla.com/D84949
2020-07-29 17:20:01 +00:00
Masayuki Nakano dbb0ffdb8d Bug 1644313 - part 4: Make `WSRunScanner::GetRangeInTextNodesTo*From()` available with non-white-space characters r=m_kato
The difference between `HTMLEditor::HandleDeleteCollapsedSelectionAtTextNode()`
and `HTMLEditor::HandleDeleteCollapsedSelectionAtWhiteSpace()` is whether
it treats surrogate pair or not.  And it's easy to handle it in `WSRunScanner`.
Therefore, they can handle all deletion in a text node.

Some new failures are caused by that we normalize preceding white-spaces of
deletion range but Blink does not to it.  These failures will be fixed by
part 5.

Depends on D84946

Differential Revision: https://phabricator.services.mozilla.com/D84947
2020-07-29 22:13:46 +00:00
Masayuki Nakano e8940879ba Bug 1644313 - part 3: Make `HTMLEditor::HandleDeleteTextAroundCollapsedSelection()` call `HTMLEditor::DeleteTextAndNormalizeSurroundingWhiteSpaces()` with `TreatEmptyTextNodes::RemoveAllEmptyInlineAncestors` r=m_kato
When it calls `DeleteTextAndNormalizeSurroundingWhiteSpaces()`, we need to
remove empty text nodes and newly empty inline ancestors.  Currently, empty
nodes are removed by `HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal()`:
https://searchfox.org/mozilla-central/rev/25d491b7924493b5d4bedc07841a1cd92f271100/editor/libeditor/HTMLEditSubActionHandler.cpp#510
But we should stop using this in this case for reducing transactions.

Depends on D84945

Differential Revision: https://phabricator.services.mozilla.com/D84946
2020-07-29 12:19:07 +00:00
tkhan 8e2aaafc76 Bug 1655424 - Add skip-if annotation for xorigin and fission timeout, r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D85030
2020-07-28 13:42:36 +00:00
tkhan e67129e6ad Bug 1655017 - Update xorigin and fission mochitest annotations, r=intermittent-reviewers,gbrown
Differential Revision: https://phabricator.services.mozilla.com/D84860
2020-07-27 01:16:21 +00:00
tkhan e778811453 Bug 1653400 - Add xorigin and fission annotations, r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D84006
2020-07-23 18:05:05 +00:00
Kashav Madan ae956c4eef Bug 1653674 - Unskip passing fission tests, r=kmag
It's possible that some of these are still failing intermittently. We can't
really know without first unskipping them.

https://github.com/annygakh/audit-tests

Differential Revision: https://phabricator.services.mozilla.com/D84017
2020-07-21 15:42:48 +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
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
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
Kris Maglione 9d78661f88 Bug 1649221: Update ChromeUtils.generateQI callers to pass strings. r=mccr8,remote-protocol-reviewers,marionette-reviewers,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,preferences-reviewers,agi,whimboo,Bebe,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D81594
2020-07-10 23:58:28 +00:00
Masayuki Nakano 444700f8d1 Bug 1649980 - part 2: Move `WSRunScanner::GetEditableBlockParentOrTopmotEditableInlineContent()` to `HTMLEditUtils` r=m_kato
Depends on D82693

Differential Revision: https://phabricator.services.mozilla.com/D82694
2020-07-10 12:38:56 +00:00
Masayuki Nakano c28c0b9359 Bug 1647556 - part 4: Rewrite `WSRunObject::Scrub()` r=m_kato
`Scrub()` does remove leading white-spaces and trailing white-spaces if
there is.  So, it does not require `WSFragment` anymore.

Differential Revision: https://phabricator.services.mozilla.com/D82275
2020-07-07 16:21:50 +00:00
tkhan 6ccabd4784 Bug 1602668 - M(1) manifest and test changes. r=kmag,karlt,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D70362
2020-06-22 19:09:49 +00:00
Masayuki Nakano e51cdb3ca3 Bug 1642594 - part 5: Implement first version of new white-space normalizer which simulates Blink's one r=m_kato
This patch tries to implement Blink-compat white-space normalizer for
`HTMLEditor`.

It's difficult to list up our traditional white-space normalization rules
because `WSRunObject` touches white space sequence only when there is not
acceptable case, e.g., an ASCII white-spaces will be adjacent to another
one, and replaces only unacceptable white-space only.  Therefore, whether
white-space sequence may start with either an ASCII white-space or an NBSP.
On the other hand, Blink and WebKit makes white-space sequence always
starts with an NBSP or an ASCII white-space (unfortunately, they behave
differently!).  So, for web-compat, we should simulate Blink's behavior
because either behavior is reasonable but Blink have more market share.

This patch simply adds new white-space normalization path for the new one,
and it's switchable with a pref, and still disabled by default.

The other reason why we should do this is, our traditional white-space
normalizer touches the DOM a lot of times per edit action, and the timing
is both before and after touches the DOM tree.  Therefore, it's difficult
to compute actual deleting range for `InputEvent.getTargetRanges()` and
touching a lot of times causes running mutation event listeners a lot and
creates a lot of transaction class instances.  So, new one have a lot of
merits:

1. Improve web-compat
2. Improve the peformance
3. Improve the security
4. Improve the footprint (but this is now worse then traditional one)
5. Simplify the implementation

The new normalizer is mostly implemented with only 3 `HTMLEditor` methods.

One is `HTMLEditor::DeleteTextAndNormalizeSurroundingWhiteSpaces()`.  This is
semi-public method for the edit action handlers.  This takes a range with
2 `EditorDOMPoinInText` to delete the range simply.  This also replaces
surrounding white-space sequence if necessary.  For inserting text case,
this method also handles only white-space normalization when it's called
with collapsed range, i.e., same `EditorDOMPointInText`.  This tries to use
`RepaceTextWithTransaction()` as far as possible to reduce creation cost of
transaction classes and the footprint.

Another one is `HTMLEditor::ExtendRangeToDeleteWithNormalizingWhiteSpaces()`.
This tries to extend the given range to normalize surrounding white-spaces.
This is currently not optimized for footprint because this may include
white-spaces which do not need to be replaced.  This optimization should be
done before shipping, but for now, enabling `InputEvent.getTargetRanges()` in
Nightly channel is more important.  So that it should be done in a follow-up
bug.

The other is `HTMLEditor::GenerateWhitepaceSequence()`.  This creates
normalized white-space sequence with surrounding character information.
For keeping this method simple as far as possible, we shouldn't optimize
the range of generation even in follow-ups.

Finally, the white-space sequence is not tested in mochitests, so that we
can enable this new normalizer when we run mochitests under
`editor/libeditor/tests`.  However, WPT has some tests.  We should keep
them running with current normalizer for checking regression.  Instead,
we should enable the pref only for the new WPT added by the previous patch.

Depends on D78655

Differential Revision: https://phabricator.services.mozilla.com/D78656
2020-06-15 07:37:56 +00:00
Kagami Sascha Rosylight c883340a3b Bug 1643495 - Revert contextmenu change in test_bug417418 r=masayuki
This change was only needed when the previous version of the patch for Bug 1632425 wanted to move things into contextmenu event handler. This patch reverts the change as 1) the suggested behavior never landed and 2) opening context menu in a test can cause conflict with other tests.

Differential Revision: https://phabricator.services.mozilla.com/D78673
2020-06-08 23:35:53 +00:00
Masayuki Nakano 72a41b4a70 Bug 1636855 - Disallow to paste longer text than `maxlength` value except in Nightly channel and early Beta r=emilio
Fix of bug 1320229 allowed to paste longer text than `maxlength` attribute of
`<input>` and `<textarea>` because it was thought that the longer text causes
"too long" invalidate state, makes users notified and prevent to submit
form data.

However, according to Bug 1636855 comment 7 (*1), it breaks a major enterprise
web app, SAP, at least because it sends form data without checking validity of
each form data and discards invalid data on server side silently.

According to bug 1636855 comment 24 (*2), one of new behavior's fault is
on Gecko side too.  The style of `<input>` element or `<textarea>` element
which has too long text after pasting is changed when it loses focus.
Therefore, users can post the data before they know pasted data is too
long if sending the form data with `Enter` key or something immediately
after pasting (i.e., without moving focus) web apps handle it by themselves.

On the other hand, the original bug report, bug 1320229, should be solved in
the future especially in password field because users may register password
which is cut by `maxlength` silently and they don't use builtin password
manager, only the pasted password is saved, and then, they won't be able to
login as the account.  This is really long standing issue of the web forms.
An article (*3) warned this to web developers in 2011.  Therefore, we should
keep going advance for solving this issue at least in Nightly channel to get
more feedback from testers and web developers.

1 https://bugzilla.mozilla.org/show_bug.cgi?id=1636855#c7
2 https://bugzilla.mozilla.org/show_bug.cgi?id=1636855#c24
3 https://www.christophermanning.org/writing/dont-use-maxlength-on-password-inputs

Differential Revision: https://phabricator.services.mozilla.com/D78613
2020-06-07 21:29:48 +00:00
Bogdan Tara 86d1eef7a6 Backed out changeset 6e99a3e6c77b (bug 1642588) for test_bug1642588.html failures CLOSED TREE 2020-06-06 02:45:52 +03:00
Kagami Sascha Rosylight e29858d3ad Bug 1642588 - Make Triple click only select within editing host r=masayuki,emilio
Differential Revision: https://phabricator.services.mozilla.com/D78315
2020-06-05 22:45:30 +00:00
Bogdan Tara 1ba73a9900 Backed out changeset 094a2fc0fc50 (bug 1642588) for test_bug1642588.html failures CLOSED TREE 2020-06-05 21:50:36 +03:00
Kagami Sascha Rosylight d02396bd67 Bug 1642588 - Make Triple click only select within editing host r=masayuki,emilio
Differential Revision: https://phabricator.services.mozilla.com/D78315
2020-06-05 13:41:26 +00:00
Kagami Sascha Rosylight 45b185573f Bug 1632425 - Part 3: Triple click to select anchors r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77683
2020-06-03 23:47:55 +00:00
Masayuki Nakano 30d14b828d Bug 1639161 - part 2: Make `WSRunObject` use `HTMLEditor::ReplaceTextWithTransaction()` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D76079
2020-05-21 08:22:20 +00:00
Masayuki Nakano 58e73430fb Bug 1639161 - part 1: Create `ReplaceTextTransaction` class r=m_kato
Currently, when `HTMLEditor` replaces text in a text node, `HTMLEditor`
creates a set of `DeleteTextTransaction` and `InsertTextTransaction`.
However, this has bad impact for footprint and causes the callers messy.

This patch creates `ReplaceTextTransaction` instead and
`HTMLEditor::ReplaceTextWithTransaction()` as its wrapper.  Unfortunately,
this becomes not calling `nsIEditActionListener::DidDeleteText()`, however,
this is not used by mozilla-central, comm-central nor BlueGriffon.  IIRC,
it was not removed for some legacy addons of Thunderbird.  Therefore, it
must be okay to remove it.

Differential Revision: https://phabricator.services.mozilla.com/D76078
2020-05-21 02:30:09 +00:00