Commit graph

283 commits

Author SHA1 Message Date
Jan-Niklas Jaeschke
fa75d3a60f Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-27 11:42:18 +00:00
Sandor Molnar
4c4d29b581 Backed out changeset d7f27aa40260 (bug 1803355) for causing win build bustage. 2023-01-24 18:07:50 +02:00
Jan-Niklas Jaeschke
1b3bff372b Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 11:46:28 +00:00
Sandor Molnar
a610ef723a Backed out changeset 54771a1963b6 (bug 1803355) for causing win build bustage. CLOSED TREE 2023-01-24 12:17:49 +02:00
Jan-Niklas Jaeschke
99eb703228 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-24 07:36:13 +00:00
Noemi Erli
aec839cbc8 Backed out changeset 759d4948ed8b (bug 1803355) for causing build bustages CLOSED TREE 2023-01-22 05:03:04 +02:00
Jan-Niklas Jaeschke
0a52844148 Bug 1803355: Basic implementation of Custom Highlight API. r=edgar,emilio
Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++.

Added `::highlight(foo)` pseudo element to CSS engine.

Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections.

Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`.

Differential Revision: https://phabricator.services.mozilla.com/D164203
2023-01-22 02:04:43 +00:00
Otto Länd
1df40cc794 Bug 1805931, 1805931: apply code formatting via Lando
# ignore-this-changeset
2022-12-15 19:51:16 +00:00
Andrew McCreight
ce28c41da0 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +00:00
Emilio Cobos Álvarez
486040e135 Bug 1801094 - Clean-up a bit WhereToScroll. r=layout-reviewers,credential-management-reviewers,sgalich,dshin
This doesn't change behavior, but clarifies a bit the naming to match
the scrollIntoView() API. Also makes the name generic (rather than
Top/Left/etc), since for scrollIntoView we want to make the axes be
logical.

That will be done in bug 1789464 (probably via an extra ScrollFlag).

Differential Revision: https://phabricator.services.mozilla.com/D162286
2022-11-18 10:02:23 +00:00
Jan-Niklas Jaeschke
67840fe563 Bug 1783641: Deleting a selected word deletes surrounding whitespace on MacOS. r=masayuki
Native behaviour on MacOS dictates one whitespace being removed after double-clicking a word and pressing delete.
This behaviour is achieved by saving the information that the selection is created by doubleclick to the `nsFrameSelection`
and using it in the `DeleteRangeTransaction`, where the range is extended by one whitespace character before or after the range.

Differential Revision: https://phabricator.services.mozilla.com/D159613
2022-10-25 07:00:26 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Masayuki Nakano
684a30f93f Bug 1771448 - part 4: Rename HTMLEditor::GetActiveEditingHost to ComputeEditingHost r=m_kato
It's currently computes the corresponding editing host from the focus node of
`Selection` with climbing up the DOM tree.  So, it does not just return a stored
element.  Therefore, some callers use it multiple times.  For avoiding it, we
should rename it to explain that it computes the editing host.

Note that I think that we should make it takes a node to compute editing host
without `Selection` for solving the case of no selection ranges.  Therefore,
I don't like to include more information into the name.

Differential Revision: https://phabricator.services.mozilla.com/D147504
2022-05-31 03:41:01 +00:00
Emilio Cobos Álvarez
2b166b644f Bug 1760609 - Treat line movement on Linux/macOS like Windows. r=masayuki
All platforms seem to behave similarly now. Definitely not like we do
without this patch.

Please sanity-check in case I've missed something but I indeed haven't
seen any current version of other text editing software that behaves
like we do...

Remove some expectAssertions from the test that shouldn't be relevant
anymore.

Differential Revision: https://phabricator.services.mozilla.com/D141635
2022-03-22 11:24:03 +00:00
Eitan Isaacson
d4418e9378 Bug 1713050 - P1: Add granularity to selection change notification. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D139745
2022-03-16 05:56:25 +00:00
Masayuki Nakano
45ba6f356a Bug 1753508 - Add logger of selection batch r=smaug
This was required for debugging the bug.

Differential Revision: https://phabricator.services.mozilla.com/D139350
2022-03-11 02:24:24 +00:00
Masayuki Nakano
9adbf59c05 Bug 1740853 - part 3: Redesign nsContentUtils::ComparePoints_Fix*() as taking int64_t for the offset r=smaug
For reducing the legacy behavior emulator of `nsContentUtils::ComparePoints`
and make it simpler, this patch makes it take `int64_t` as the offset.
Additionally, it's named "ComparePoints_AllowNegativeOffsets`.

Differential Revision: https://phabricator.services.mozilla.com/D132549
2021-12-09 17:06:18 +00:00
Masayuki Nakano
f2baf0d9ab Bug 1741148 - part 1: Rename nsINode::ComputeIndexOf to ComputeIndexOf_Deprecated r=smaug
It's hard to fix some callers.  Therefore, in this bug, we should fix only
simple cases.  Therefore, we should rename existing API first.

Differential Revision: https://phabricator.services.mozilla.com/D131334
2021-12-09 08:32:30 +00:00
Masayuki Nakano
c19aa5aaa5 Bug 1740853 - part 1: Make nsContentUtils::ComparePoints take uint32_t for offset in DOM nodes r=smaug
They are defined as "unsigned long" by the standards.  So we should use
`uint32_t` rather than `int32_t` with the methods.  However, layout code
uses `int32_t` a lot for representing the offset.  Therefore, this patch
adds `*_FixOffset1` etc for the cases which cannot fix easily in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D131110
2021-12-09 07:51:45 +00:00
Masayuki Nakano
82e2013683 Bug 1735446 - part 4: Make Selection::GetRangeAt() take uint32_t instead of int32_t r=smaug
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
2021-12-09 07:35:09 +00:00
Masayuki Nakano
8213a63459 Bug 1735446 - part 1: Make Selection use uint32_t for handling offset in DOM nodes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D128844
2021-12-09 00:45:19 +00:00
Greg Tatum
ec908112f4 Bug 1738057 - Split out BidiEmbeddingLevel into its own file; r=platform-i18n-reviewers,dminor
This should speed up re-compile times, as mozilla/intl/Bidi.h will only
be included in a few places.

Differential Revision: https://phabricator.services.mozilla.com/D129662
2021-11-16 15:11:58 +00:00
Greg Tatum
ee2694c97d Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-20 14:01:21 +00:00
Butkovits Atila
01c5e2aed8 Backed out 3 changesets (bug 1719546) for causing SM bustages at Bidi.h. CLOSED TREE
Backed out changeset c4d6ffc7e445 (bug 1719546)
Backed out changeset a1f7ed6c4251 (bug 1719546)
Backed out changeset e69fc596f2c3 (bug 1719546)
2021-10-19 21:09:47 +03:00
Greg Tatum
f250d90114 Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-19 16:55:36 +00:00
Masayuki Nakano
347bc5719a 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
66ab2e605c Bug 1717552 - Remove dom.select_events.enabled r=masayuki,smaug
Differential Revision: https://phabricator.services.mozilla.com/D118639
2021-06-24 12:30:35 +00:00
Kagami Sascha Rosylight
5bce02c01c Bug 1717435 - Enable selectionchange listener without dom.select_events.textcontrols.enabled r=masayuki
`select` event is now fired from selectionchange listener and thus the listener should be enabled regardless of the flag.

Differential Revision: https://phabricator.services.mozilla.com/D118400
2021-06-22 00:08:56 +00:00
Kagami Sascha Rosylight
55dbc99e55 Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 23:54:06 +00:00
Butkovits Atila
53cb932555 Backed out changeset aa6c7477c4d2 (bug 1713491) for causing build bustages on nsIFrame.cpp. CLOSED TREE 2021-06-12 00:12:06 +03:00
Kagami Sascha Rosylight
9d0b659349 Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 18:53:28 +00:00
Dorel Luca
e1f4d9bb38 Backed out changeset 17e7b969b830 (bug 1713491) for Linux build bustage in gecko/dom/events/ContentEventHandler.cpp. CLOSED TREE 2021-06-11 17:52:10 +03:00
Kagami Sascha Rosylight
74760a9a0e Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 11:37:11 +00:00
Kagami Sascha Rosylight
9a794d46fa 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
Kagami Sascha Rosylight
41fc1feef9 Bug 1714640 - Add AdjustFrameForLineStart call in Selection::ScrollIntoView r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117009
2021-06-08 16:21:36 +00:00
Kartikaya Gupta
0cd36f6974 Bug 1694847 - Remove the expired SCROLL_INPUT_METHODS telemetry probe. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D116320
2021-05-31 21:36:35 +00:00
Kagami Sascha Rosylight
717d5d2aa5 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
e0304db4c3 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
Mirko Brodesser
1ea34c359f Bug 1688832: part 9) Change argument of nsFrameSelection::TakeFocus from pointer to reference. r=smaug
Simplification.

Differential Revision: https://phabricator.services.mozilla.com/D103772
2021-02-02 16:16:22 +00:00
Mirko Brodesser
4b75da3596 Bug 1688832: part 8) Declare nsFrameSelection::TakeFocus [[nodiscard]]. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103616
2021-02-03 08:56:53 +00:00
nirmay
55420bffb0 Bug 1677643 - Replace nsIScrollableFrame::{HORIZONTAL, VERTICAL} with ScrollDirections. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D102087
2021-01-21 17:45:19 +00:00
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