Commit Graph

193 Commits

Author SHA1 Message Date
Masayuki Nakano
780fbf11f8 Bug 1714914 - Make editor classes treat offset in parent node as uint32_t r=m_kato
It should be treated as `uint32_t` since DOM API does so.  However, there are
some exceptions:

* Result of `nsINode::ComputeIndexOf()`
* Result of `nsAString` methods

They return `-1` as not found, and anyway, they cannot treat large integer
than `INT32_MAX`.  Therefore, this patch does not touch around them.

Differential Revision: https://phabricator.services.mozilla.com/D118933
2021-06-30 07:07:28 +00:00
Kagami Sascha Rosylight
7fe1ff4e91 Bug 1677253 - Part 1: Fire select event from SelectionChangeEventDispatcher r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D101245
2021-06-21 00:58:35 +00:00
Ryan VanderMeulen
4c53d4eb06 Backed out 3 changesets (bug 1677253) because it depends on bug 1713334 which was backed out.
Backed out changeset 3d30a54409a7 (bug 1677253)
Backed out changeset 1c385b21e0e5 (bug 1677253)
Backed out changeset eb6001404a57 (bug 1677253)
2021-06-17 11:38:53 -04:00
Kagami Sascha Rosylight
362dd7af5e Bug 1677253 - Part 1: Fire select event from SelectionChangeEventDispatcher r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D101245
2021-06-16 11:13:14 +00:00
Kagami Sascha Rosylight
a2c61d2bfe Bug 1715819 - Select the text node if exists in TextEditor::SelectEntireDocument r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117444
2021-06-12 11:04:51 +00:00
Kagami Sascha Rosylight
6d0a641e94 Bug 1715882 - Return void from Selection::Clear and ::NotifySelectionListeners r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117469
2021-06-11 09:10:35 +00:00
Mirko Brodesser
5a086edb40 Bug 1708422: part 15) Update documentation of Selection::GetRangesForInterval. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D114334
2021-05-20 09:03:29 +00:00
Mirko Brodesser
68b60e1257 Bug 1700051: part 49) Add some documentation to Selection::GetRangesForInterval. r=smaug
Depends on D113654

Differential Revision: https://phabricator.services.mozilla.com/D113655
2021-04-29 09:40:54 +00:00
Masayuki Nakano
04ff975886 Bug 1703144 - Get rid of MOZ_KnownLive for EditorBase::SelectionRefPtr() r=m_kato
The lifetime of it is guaranteed by `AutoEditActionDataSetter` which grabs
`Selection` until it's destroyed, and it's a stack only class and created
at first step of all public method calls.  Therefore, we can mark it as
`MOZ_KNOWN_LIVE` and we can change it returning reference of `Selection`
instead of reference of `RefPtr<Selection>`.

Differential Revision: https://phabricator.services.mozilla.com/D110896
2021-04-08 01:31:54 +00:00
Kagami Sascha Rosylight
7057dbdc56 Bug 1671768 - Part 4: Use MOZ_CAN_RUN_SCRIPT for Selection::RemoveAllRanges r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103780
2021-02-03 21:52:48 +00:00
Kagami Sascha Rosylight
0dba2fb895 Bug 1671768 - Part 3: Use MOZ_CAN_RUN_SCRIPT for Selection::SelectAllChildren r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103779
2021-02-03 21:52:22 +00:00
Kagami Sascha Rosylight
abd7bb8cea Bug 1671768 - Part 2: Use MOZ_CAN_RUN_SCRIPT for Selection::Extend r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103778
2021-02-03 21:52:15 +00:00
Kagami Sascha Rosylight
0c2cd22bb4 Bug 1671768 - Part 1: Use MOZ_CAN_RUN_SCRIPT for Selection::StyledRanges::MaybeFocusCommonEditingHost r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103777
2021-02-03 21:52:02 +00:00
Razvan Maries
84efa2f4e4 Backed out 3 changesets (bug 1677253) for multiple perma failures. CLOSED TREE
Backed out changeset 01b34d4be08c (bug 1677253)
Backed out changeset aabba45e0b43 (bug 1677253)
Backed out changeset 171689d8d386 (bug 1677253)
2021-01-12 17:18:04 +02:00
Kagami Sascha Rosylight
7c2ba9e256 Bug 1677253 - Part 2: Detect direction change in SelectionChangeEventDispatcher r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D101246
2021-01-12 02:01:00 +00:00
Kagami Sascha Rosylight
949c6feb7f Bug 1680167 - Part 3: MOZ_CAN_RUN_SCRIPT_BOUNDARY in dom/base r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D98626
2020-12-03 22:08:36 +00:00
Simon Giesecke
46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Kagami Sascha Rosylight
a1f57cb34e Bug 1669996 - Do not expose chromeonly nodes via Selection API r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D93258
2020-10-15 20:49:47 +00:00
Kagami Sascha Rosylight
be1d9a20b9 Bug 1615296 - Part 1: Remove MOZ_CAN_RUN_SCRIPT_BOUNDARY from Selection::Collapse r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D93598
2020-10-16 22:22:48 +00:00
Narcis Beleuzu
6eb37d4f16 Backed out changeset b85cbc2a47a6 (bug 1669996) for mochitest failure on test_queryCaretRect.html CLOSED TREE 2020-10-13 12:23:51 +03:00
Kagami Sascha Rosylight
a666965a69 Bug 1669996 - Do not expose chromeonly nodes via Selection API r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D93258
2020-10-13 07:30:04 +00:00
Kagami Sascha Rosylight
a20339adb5 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
Kagami Sascha Rosylight
a3c3191e52 Bug 1623413 - Part 1: Skip selection point check when called from JS r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D88702
2020-09-03 11:55:22 +00:00
Mihai Alexandru Michis
d775b8dd6d 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
3eab64fd31 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
96b5aec4f8 Bug 1623413 - Part 1: Skip selection point check when called from JS r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D88702
2020-09-01 09:28:26 +00:00
Sylvestre Ledru
3bfad1106a Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D85678
2020-08-02 15:29:15 +00:00
Nathan Froyd
1a5e36fc8f 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
367903d750 Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.
CLOSED TREE
2020-07-30 18:23:21 +03:00
Nathan Froyd
05fe6be54b 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
Emilio Cobos Álvarez
47634b1c9e Bug 1653011 - Simplify and make WeakPtr<Derived> usable and compact. r=froydnj,sg,geckoview-reviewers,jgilbert,kvark,snorp
Having two classes in the inheritance chain inherit from SupportsWeakPtr
now won't compile, but you can use WeakPtr<Derived> when any base class
inherits from SupportsWeakPtr.

Differential Revision: https://phabricator.services.mozilla.com/D83674
2020-07-23 14:51:46 +00:00
Simon Giesecke
96e854f802 Bug 1652022 - Remove unnecessary includes from WritingModes.h. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D83113
2020-07-15 13:56:31 +00:00
Kagami Sascha Rosylight
b31045dcce Bug 1645003 - Return pointer from GetPrimaryOrCaretFrameForNodeOffset and its deps r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D80063
2020-06-18 10:26:47 +00:00
Kagami Sascha Rosylight
fbef1cfbce 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
Mirko Brodesser
1076612b0a 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
8e89c90fd7 Bug 1635709: part 4) Transform Selection::DoAutoScroll to AutoScroller::DoAutoScroll. r=masayuki
Allows defriending `AutoScroller` from `Selection` and removes the
direct dependency of `AutoScroller` to `Selection`.

Differential Revision: https://phabricator.services.mozilla.com/D74382
2020-05-11 09:38:00 +00:00
Mirko Brodesser
452167f1cb Bug 1635709: part 3) Add unit to Selection::StartAutoScrollTimer's delay argument. r=hsivonen
Depends on D74052

Differential Revision: https://phabricator.services.mozilla.com/D74053
2020-05-06 15:24:59 +00:00
Mirko Brodesser
b64246284b Bug 1633448: part 10) Add StyledRanges::Clear. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D73433
2020-05-04 10:11:13 +00:00
Mirko Brodesser
65811d5374 Bug 1633448: part 9) Add StyledRanges::Length. r=hsivonen
Another step towards privatizing `StyledRanges::mRanges`.

Differential Revision: https://phabricator.services.mozilla.com/D73432
2020-05-04 10:11:13 +00:00
Mirko Brodesser
246d5bac87 Bug 1633448: part 8) Add StyledRanges::RemoveCollapsedRanges. r=hsivonen
Another step towards privatizing `StyledRanges::mRanges`.

Depends on D73430

Differential Revision: https://phabricator.services.mozilla.com/D73431
2020-05-04 10:11:13 +00:00
Mirko Brodesser
e6e5c6c7ce Bug 1633448: part 7) Add StyledRanges::UnregisterSelection. r=hsivonen
One step closer towards privatizing `StyledRanges::mRanges`.

Depends on D73234

Differential Revision: https://phabricator.services.mozilla.com/D73430
2020-05-04 10:11:13 +00:00
Mirko Brodesser
18aaa242c9 Bug 1633448: part 6) Change IsUserSelectionNotCollapsed to IsUserSelectionCollapsed. r=hsivonen
Removes unnecessary double negations.

Differential Revision: https://phabricator.services.mozilla.com/D73234
2020-05-04 10:11:13 +00:00
Mirko Brodesser
fa59f55384 Bug 1633448: part 5) Rename AreUserSelectedRangesNonEmpty to IsUserSelectionNotCollapsed. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D73233
2020-05-04 10:11:12 +00:00
Mirko Brodesser
9b36b46be4 Bug 1633448: part 4) Annotate Selection::SetAnchorFocusToRange with MOZ_CAN_RUN_SCRIPT. r=smaug
Depends on D72803

Differential Revision: https://phabricator.services.mozilla.com/D72804
2020-04-28 16:15:52 +00:00
Mirko Brodesser
8c086b4091 Bug 1633448: part 3) Annotate Selection::AddRangesForUserSelectableNodes with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D72803
2020-04-28 16:15:31 +00:00
Mirko Brodesser
67f895532d Bug 1633448: part 1) Move Selection::SubtractRange to StyledRanges. r=smaug
`StyledRanges should have as few dependencies to `Selection` as
possible.

Differential Revision: https://phabricator.services.mozilla.com/D72688
2020-04-27 19:26:25 +00:00
Mirko Brodesser
4883ada17c Bug 1623858: part 26) Annotate MaybeAddRangeAndTruncateOverlaps with MOZ_CAN_RUN_SCRIPT. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D69179
2020-04-01 11:42:16 +00:00
Mirko Brodesser
774ebb0fa4 Bug 1623858: part 25) Factor AreUserSelectedRangesNonEmpty out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D68962
2020-03-31 13:59:09 +00:00
Mirko Brodesser
20e62ac6ce Bug 1623858: part 22) Move focusing common editing host to Selection::StyledRanges. r=masayuki
Simplifies understanding `Selection::NotifySelectionListeners`.

Differential Revision: https://phabricator.services.mozilla.com/D68809
2020-03-31 08:21:39 +00:00
Mirko Brodesser
fc7afc5dda Bug 1623858: part 20) Assert Selection::NotifyAutoCopy is only called for eNormal Selections. r=hsivonen
Depends on D68579

Differential Revision: https://phabricator.services.mozilla.com/D68580
2020-03-30 08:48:16 +00:00