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

229 Коммитов

Автор SHA1 Сообщение Дата
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
Mirko Brodesser a060e2efd4 Bug 1634663: part 4) Declare callers of `Selection::GetRangeAt` `const` in layout code. r=masayuki
Depends on D73446

Differential Revision: https://phabricator.services.mozilla.com/D73447
2020-05-02 23:46:01 +00:00
Masayuki Nakano 11af44e544 Bug 1632726 - part 2: Remove some unused `nsISelectionController` methods r=smaug
Even in comm-central and BlueGriffon, `nsISelectionController::*ForDelete()`
are not used.  Therefore, we can remove them safely.

Differential Revision: https://phabricator.services.mozilla.com/D72296
2020-04-27 06:20:31 +00:00
Masayuki Nakano adf7a304f3 Bug 1632726 - part 1: Create utility methods to compute delete range from collapsed selection in `nsFrameSelection` r=smaug
Currently, `EditorBase::ExtendSelectionForDelete()` depends on some
`nsISelectionController` methods to compute extended range for deletion
from collapsed selection.  They are implemented by
`nsFrameSelection::MoveCaret()` and `nsFrameSelection::TakeFocus()`.
Ideally, we should split these methods for computation part and performing
part.  However, they change selection with updating other selection state,
for example, table selection state and bidi information.  Therefore, it's
impossible to split them with simple code.  However, I need to change
`EditorBase::ExtendSelectionForDelete()` just return extended range.

Therefore, this patch creates `nsFrameSelection::PeekOffsetForCaretMove()`
which has the main path in `MoveCaret()` for the `EditorBase` method.

Then, `MoveCaret()` and new `nsFrameSelection::CreateRangeExtendedToSomewhere()`
share the computation code of expanding normal selection.

Finally, this patch wraps `nsFrameSelection::CreateRangeExtendedToSomewhere()`
with new public inline methods for `EditorBase`.

The following patch will remove no-user methods of `nsISelectionController`.

Differential Revision: https://phabricator.services.mozilla.com/D72295
2020-04-30 10:05:35 +00:00
Csoregi Natalia b073baab86 Backed out 30 changesets (bug 1556556, bug 1631568) for multiple mochitest failures. CLOSED TREE
Backed out changeset edd529f7a9c5 (bug 1631568)
Backed out changeset 1cc0881e244b (bug 1631568)
Backed out changeset ed3c1e85d5e3 (bug 1556556)
Backed out changeset 38ffc6215bbf (bug 1556556)
Backed out changeset 03c2c25d8023 (bug 1556556)
Backed out changeset 9c717eb067b8 (bug 1556556)
Backed out changeset 98e26bc98b85 (bug 1556556)
Backed out changeset 05a6a581e755 (bug 1556556)
Backed out changeset 867946cf05bb (bug 1556556)
Backed out changeset 20d72a334530 (bug 1556556)
Backed out changeset 2c62e61d9054 (bug 1556556)
Backed out changeset 62a223d057d2 (bug 1556556)
Backed out changeset 2c5d55a1f0b1 (bug 1556556)
Backed out changeset 700447945b4e (bug 1556556)
Backed out changeset 93190ae4f5ff (bug 1556556)
Backed out changeset a7bd34d961bb (bug 1556556)
Backed out changeset fccd1d3c7189 (bug 1556556)
Backed out changeset 24056e47183d (bug 1556556)
Backed out changeset 204881474cc1 (bug 1556556)
Backed out changeset 387320881876 (bug 1556556)
Backed out changeset be8f5eb58460 (bug 1556556)
Backed out changeset 629c58a9166b (bug 1556556)
Backed out changeset 4312b2b5dda8 (bug 1556556)
Backed out changeset d11dbf6403a5 (bug 1556556)
Backed out changeset 95c54c023779 (bug 1556556)
Backed out changeset 80fcb7e71188 (bug 1556556)
Backed out changeset d75a4ecb0d47 (bug 1556556)
Backed out changeset 903c4de34e7a (bug 1556556)
Backed out changeset f15334a3e803 (bug 1556556)
Backed out changeset 9553e99137ea (bug 1556556)
2020-04-28 12:43:11 +03:00
Botond Ballo 2cb46cfa4b 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-04-28 01:44:43 +00:00
Masayuki Nakano 6cbea10c99 Bug 1632724 - part 1: Move common methods for handling delete selection to `EditorBase` r=m_kato
`DeleteSelection*()` are members of `TextEditor`, but they are also used by
`HTMLEditor`.  Therefore, they and pref cache members for them should be
in `EditorBase` too.

Depends on D71911

Differential Revision: https://phabricator.services.mozilla.com/D72290
2020-04-24 14:55:09 +00:00
Kristen Wright 05a7022978 Bug 1626388 - Convert dom.select_events.textcontrols.enabled to static pref r=njn
Converts dom.select_events.textcontrols.enabled to a static pref.

Differential Revision: https://phabricator.services.mozilla.com/D69614

--HG--
extra : moz-landing-system : lando
2020-04-06 23:30:18 +00:00
Mirko Brodesser e5aee55330 Bug 1626665: part 4) Reorder code in `nsFrameSelection::MoveCaret` to allow `nsPeekOffsetStruct::mDirection` to become `const`. r=hsivonen
`nsPeekOffsetStruct` contains a mixture or input and output members.
This simplifies reasoning about them.

Depends on D69573

Differential Revision: https://phabricator.services.mozilla.com/D69769

--HG--
extra : moz-landing-system : lando
2020-04-06 08:45:01 +00:00
Mirko Brodesser e7cdb1cf10 Bug 1623858: part 16) Annotate `nsFrameSelection::HandleTableSelection` with `[[nodiscard]]`. r=hsivonen
Depends on D68575

Differential Revision: https://phabricator.services.mozilla.com/D68576

--HG--
extra : moz-landing-system : lando
2020-03-30 08:35:36 +00:00
Mirko Brodesser 4c2e63fddc Bug 1623858: part 15) Remove some conditions in `nsFrameSelection::TakeFocus` which are always true. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D68575

--HG--
extra : moz-landing-system : lando
2020-03-30 08:32:42 +00:00
Mirko Brodesser 803698911f Bug 1624633: part 1) Move `Selection::mRanges` to `StyledRanges` struct. r=hsivonen
This allows methods operating on the ranges to be moved to that struct.

To see where this leads to, consider the following reviews.

Differential Revision: https://phabricator.services.mozilla.com/D68217

--HG--
extra : moz-landing-system : lando
2020-03-27 11:21:25 +00:00
Mirko Brodesser ad4d7454de Bug 1622752: annotate `Selection::ScrollIntoView` with `MOZ_CAN_RUN_SCRIPT`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D67002

--HG--
extra : moz-landing-system : lando
2020-03-16 21:04:46 +00:00
Emilio Cobos Álvarez 04828e3a4a Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ
This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

Differential Revision: https://phabricator.services.mozilla.com/D66464

--HG--
extra : moz-landing-system : lando
2020-03-19 13:18:16 +00:00