Commit graph

242 commits

Author SHA1 Message Date
Mirko Brodesser
af17c6956b Bug 1685303: part 16) Slightly simplify code in nsFrameSelection::TakeFocus and add logging. r=smaug
Depends on D101931

Differential Revision: https://phabricator.services.mozilla.com/D101932
2021-01-15 16:00:20 +00:00
Mirko Brodesser
0710c52ceb Bug 1685303: part 15) Move documentation of some methods of nsFrameSelection to the header. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101931
2021-01-15 15:53:55 +00:00
Mirko Brodesser
c0d32bffc5 Bug 1685303: part 10) Annotate nsFrameSelection::HandleClick with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101598
2021-01-14 13:24:36 +00:00
Mirko Brodesser
2f7cef4d64 Bug 1685303: part 5) Extend logging in nsFrameSelection::HandleClick. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101355
2021-01-11 15:05:25 +00:00
Mirko Brodesser
20f8199ab3 Bug 1685303: part 3) Add debug logging to nsFrameSelection::HandleClick. r=smaug
Depends on D100985

Differential Revision: https://phabricator.services.mozilla.com/D100988
2021-01-08 08:52:17 +00:00
Emilio Cobos Álvarez
a0c580e9a2 Bug 1676785 - Simplify XUL special code-path for <input> value setter. r=masayuki
This allows us to remove nsISelectionController.selectAll() and related
code too, and should not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97011
2020-12-02 12:48:41 +00:00
Mihai Alexandru Michis
89a2d40ee0 Backed out changeset 93cf5f317f98 (bug 1676785) for causing mochitest failures in test_input_value_set_preserve_undo.xhtml
CLOSED TREE
2020-12-02 14:05:18 +02:00
Emilio Cobos Álvarez
2b6c54e6c1 Bug 1676785 - Simplify XUL special code-path for <input> value setter. r=masayuki
This allows us to remove nsISelectionController.selectAll() and related
code too, and should not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97011
2020-12-02 10:44:25 +00:00
Kagami Sascha Rosylight
756976ae2b Bug 1615296 - Part 3: Fix remaining MOZ_CAN_RUN_SCRIPT warnings r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D93600
2020-10-15 19:12:47 +00:00
Kartikaya Gupta
264e82488a Bug 1670003 - Add back the scroll input methods telemetry. r=botond
This is mostly a revert of the patch in bug 1425686 that removed the old
probe, but rebased to new code locations and clang-formatted. The histogram
entry is also updated with new bug numbers and fields.

The next patch will refine some of these telemetry recording points; the patch
is split into two for easier reviewing as this part is basically what landed
originally.

Differential Revision: https://phabricator.services.mozilla.com/D92995
2020-10-10 17:41:47 +00:00
Masayuki Nakano
2fde14a338 Bug 1623918 - part 2: Mark nsINode::GetSelectionRootContent() and its root callers as MOZ_CAN_RUN_SCRIPT as far as possible r=smaug
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).

It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`.  I think that this is
reasonable.

On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code.  Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.

Differential Revision: https://phabricator.services.mozilla.com/D92730
2020-10-09 02:37:47 +00:00
Narcis Beleuzu
c163b394ef Backed out 2 changesets (bug 1623918) for crashtest failure on 1623918.html CLOSED TREE
Backed out changeset 519ca1b069e5 (bug 1623918)
Backed out changeset d8a09a5fea47 (bug 1623918)
2020-10-08 12:06:58 +03:00
Masayuki Nakano
da386ef224 Bug 1623918 - part 2: Mark nsINode::GetSelectionRootContent() and its root callers as MOZ_CAN_RUN_SCRIPT as far as possible r=smaug
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).

It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`.  I think that this is
reasonable.

On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code.  Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.

Differential Revision: https://phabricator.services.mozilla.com/D92730
2020-10-08 03:56:51 +00:00
Kagami Sascha Rosylight
11ef0ef23e Bug 1623413 - Part 2: Rename Collapse() to CollapseInLimiter() r=masayuki
Depends on D88702

Differential Revision: https://phabricator.services.mozilla.com/D88920
2020-09-03 03:45:26 +00:00
Mihai Alexandru Michis
0600dacd03 Backed out 3 changesets (bug 1623413) for causing failures in Selection_collapse.html
CLOSED TREE

Backed out changeset d3d67293f115 (bug 1623413)
Backed out changeset 75ed1b8a5c67 (bug 1623413)
Backed out changeset 0eef32d6a454 (bug 1623413)
2020-09-03 05:37:49 +03:00
Kagami Sascha Rosylight
010d7de462 Bug 1623413 - Part 2: Rename Collapse() to CollapseInLimiter() r=masayuki
Depends on D88702

Differential Revision: https://phabricator.services.mozilla.com/D88920
2020-09-02 23:42:27 +00:00
Kagami Sascha Rosylight
b6115988e8 Bug 1656041 - Part 2: Return a struct from GetFrameFromDirection r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D85317
2020-08-04 15:23:47 +00:00
Nathan Froyd
e3ebda1914 Bug 1223932 - delete guard object uses from the tree; r=jwalden
CLOSED TREE

We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Mihai Alexandru Michis
a911a108d0 Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.
CLOSED TREE
2020-07-30 18:23:21 +03:00
Nathan Froyd
bec9f9b93a Bug 1223932 - delete guard object uses from the tree; r=jwalden
We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
2020-07-30 14:22:38 +00:00
Kagami Sascha Rosylight
1afcf4d621 Bug 1630704 - Part 27: Remove nsFrame from inheritance chain r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81864
2020-07-06 22:29:42 +00:00
Kagami Sascha Rosylight
f92968ee05 Bug 1649931 - Part 3: Add nsIFrameEnumerator::Traverse() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81954
2020-07-03 00:48:59 +00:00
Kagami Sascha Rosylight
f7e99ea037 Bug 1645879 - Detect reversed direction frame when collapsing selection r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D79739
2020-06-16 11:52:49 +00:00
Kagami Sascha Rosylight
ea53f4857d Bug 1644868 - Return pointer from GetPrimaryFrameFor* r=jfkthame
Those methods have two sources to check after call: the return value and the pointer. This can be confusing as a caller may think they should check both when they don't need to. Since the two always behaves together (a valid pointer + NS_OK, or nullptr + NS_ERROR_FAILURE), this replaces the return value with the pointer.

Differential Revision: https://phabricator.services.mozilla.com/D79196
2020-06-11 10:56:11 +00:00
Kagami Sascha Rosylight
5becfc7c3d Bug 1644511 - Part 2: Make selection collapsing follow bidi.edit.caret_movement_style r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D79005
2020-06-10 21:17:51 +00:00
Jonathan Kew
501e5caa97 Bug 1642223 - Fix behavior of AdjustNormalSelection when moving back into the maintained range from before it, to avoid collapsing to the end of the range. r=mbrodesser
Differential Revision: https://phabricator.services.mozilla.com/D78545
2020-06-10 08:31:39 +00:00
Kagami Sascha Rosylight
0046c51bb0 Bug 1644511 - Part 1: Make bidi.edit.caret_movement_style a static pref r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D79004
2020-06-10 00:33:51 +00:00
Mirko Brodesser
76dbaf2f21 Bug 1635709: part 29) Factor finding first and last cell of row or column out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77825
2020-06-04 09:04:39 +00:00
Mirko Brodesser
ab2db129d7 Bug 1635709: part 28) Declare some function arguments in nsFrameSelection const. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77460
2020-06-04 09:03:47 +00:00
Mirko Brodesser
9dccdae144 Bug 1635709: part 27) clang-format previous changes in nsFrameSelection.cpp. r=masayuki
Simple application of `./mach clang-format -p
layout/generic/nsFrameSelection.cpp`. Separating this from previous
changes simplified reviewing and decreases the probability for mistakes.

Differential Revision: https://phabricator.services.mozilla.com/D77459
2020-06-02 08:43:04 +00:00
Mirko Brodesser
3b9ea20cb4 Bug 1635709: part 26) Remove some code duplication in HandleDragSelecting. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77424
2020-06-02 09:08:34 +00:00
Mirko Brodesser
3e015ac7bf Bug 1635709: part 25) const qualify arguments of GetCellLayout and GetCellIndexes. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77423
2020-06-02 08:42:49 +00:00
Mirko Brodesser
59fe54586f Bug 1635709: part 24.2) Rename childContent to aChildContent. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77254
2020-06-02 09:08:44 +00:00
Mirko Brodesser
ed1b7493ab Bug 1635709: part 24.1) Factor HandleDragSelecting and HandleMouseUpOrDown out from TableSelection::HandleSelection. r=masayuki
`HandleSelection` was too complex.

The arguments of the new methods will be renamed in a separate commit to
simplify reviewing and avoid mistakes.

Differential Revision: https://phabricator.services.mozilla.com/D77253
2020-06-02 09:05:57 +00:00
Mirko Brodesser
17a7e3429d Bug 1635709: part 23) Factor code out to IsContentInActivelyEditableTableCell. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D77004
2020-05-27 14:39:11 +00:00
Mirko Brodesser
f2aea44084 Bug 1635709: part 22) Rename local cellparent variables to inclusiveTableCellAncestor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D75565
2020-05-25 13:54:30 +00:00
Mirko Brodesser
d5b4e47993 Bug 1635709: part 21) Rename TableSelection::mCellParent to mClosestInclusiveTableCellAncestor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D75564
2020-05-25 13:54:20 +00:00
Mirko Brodesser
916b42b13c Bug 1635709: part 20) Rename GetCellParent to GetClosestInclusiveTableCellAncestor. r=masayuki
It's more accurate.

Differential Revision: https://phabricator.services.mozilla.com/D75563
2020-05-25 13:54:10 +00:00
Mirko Brodesser
21c40347c1 Bug 1635709: part 19) Clean up a little in nsFrameSelection::MoveCaret. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D75562
2020-05-25 13:53:59 +00:00
Mirko Brodesser
a07f299f9c Bug 1635709: part 13) Remove stack variable for Selection::mUserInitiated. r=masayuki
Simplifies reasoning about the code when using searchfox.

Differential Revision: https://phabricator.services.mozilla.com/D75057
2020-05-13 11:10:41 +00:00
Mirko Brodesser
d20c4961f6 Bug 1635709: part 12) Factor determining range most distant from anchor out from AutoPrepareFocusRange. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74858
2020-05-13 08:01:29 +00:00
Mirko Brodesser
3310444867 Bug 1635709: part 11) Factor removing generated ranges out from AutoPrepareFocusRange. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74857
2020-05-13 08:00:51 +00:00
Mirko Brodesser
cb2a7735a3 Bug 1635709: part 10) Factor IsAnchorRelativeOperation out from AutoPrepareFocusRange. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74856
2020-05-13 08:00:41 +00:00
Mirko Brodesser
74d02b07c6 Bug 1635709: part 9) Add DesiredCaretPos::Invalidate. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74618
2020-05-12 09:42:08 +00:00
Mirko Brodesser
943f40f25e Bug 1635709: part 8) Remove superfluously setting mIsSet in nsFrameSelection's constructor. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74617
2020-05-12 09:42:06 +00:00
Mirko Brodesser
676b66d20f Bug 1635709: part 7) Move nsFrameSelection::SetDesiredCaretPos and FetchDesiredCaretPos to DesiredCaretPos. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74616
2020-05-12 09:42:16 +00:00
Mirko Brodesser
ca24d8b332 Bug 1635709: part 6) Rename nsFrameSelection::*DesiredPos to *DesiredCaretPos. r=masayuki
`nsFrameSelection` has (too) many responsibilites, this adds some
clarification.

Differential Revision: https://phabricator.services.mozilla.com/D74615
2020-05-12 09:42:01 +00:00
Mirko Brodesser
194a3b964e Bug 1635709: part 5) Annotate Selection::ReplaceAnchorFocusRange with MOZ_CAN_RUN_SCRIPT. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D74383
2020-05-11 09:39:33 +00:00
Mirko Brodesser
193ee7189e Bug 1635709: part 1) Rename nsFrameSelection::SetCaretBidiLevel to SetCaretBidiLevelAndMaybeSchedulePaint. r=hsivonen
The old name was misleading.

Differential Revision: https://phabricator.services.mozilla.com/D74051
2020-05-06 15:26:07 +00:00
Botond Ballo
5cffd06241 Bug 1631568 - Have nsLayoutUtils::GetFrameForPoint() and GetFramesForArea() take a RelativeTo parameter. r=tnikkel
This removes the need for FrameForPointOptions::IsRelativeToLayoutViewport,
and makes sure each call site of these functions indicates whether the
input point/rect is in visual or layout coordinates.

Several call sites were passing in layout coordinates without setting the
IsRelativeToLayoutViewport flag, which this patch corrects.

Differential Revision: https://phabricator.services.mozilla.com/D71705
2020-05-05 15:24:12 +00:00