Commit Graph

336 Commits

Author SHA1 Message Date
Martin Robinson
b5d910a0ca Bug 1791759 - Add support for content-visibility: auto r=emilio
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.

Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.

This change is a reland of an earlier version that properly updates
intrinsic sizes and triggers an update of remembered size for the
purposes of contain-intrinsic-size when content relevancy changes.

Co-authored-by: Jihye Hong <jihye@igalia.com>

Differential Revision: https://phabricator.services.mozilla.com/D159693
2022-11-30 18:00:27 +00:00
Marian-Vasile Laza
3f33580c27 Backed out changeset c428c3ad7725 (bug 1791759) for causing wpt failures on auto-012.html. CLOSED TREE 2022-11-28 13:31:05 +02:00
Martin Robinson
92b6a75ea4 Bug 1791759 - Add support for content-visibility: auto r=emilio
This change adds support for `content-visibilty: auto` as well as
showing and hiding content based on the relevancy of the content as
defined in the specification. Changes to relevancy are handled by
triggering updates in a set of `content-visibility: auto` frames stored
in PresShell at the appropriate time in the document lifecycle.

Some tests are now failing due to this feature exposing the failures,
but they will be fixed in later changes.

Co-authored-by: Jihye Hong <jihye@igalia.com>

Differential Revision: https://phabricator.services.mozilla.com/D159693
2022-11-28 09:53:06 +00:00
Emilio Cobos Álvarez
29c4f202d9 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
Emilio Cobos Álvarez
e0d51dcf90 Bug 1798207 - Use shadow-including tree order to sort selection ranges. r=smaug
So that painting code doesn't get confused when trying to paint
selections that span across shadow boundaries.

Differential Revision: https://phabricator.services.mozilla.com/D160787
2022-11-11 12:21:25 +00:00
Butkovits Atila
832483e49b Backed out changeset c73d7c982726 (bug 1798207) for causing failures at Range-comparePoint.html. CLOSED TREE 2022-11-11 12:59:50 +02:00
Emilio Cobos Álvarez
0bf775069a Bug 1798207 - Use shadow-including tree order to sort selection ranges. r=smaug
So that painting code doesn't get confused when trying to paint
selections that span across shadow boundaries.

Differential Revision: https://phabricator.services.mozilla.com/D160787
2022-11-11 10:04:50 +00:00
Jan-Niklas Jaeschke
cdda0a4f7f 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
06a6e8fbec Bug 1795661 - Clean-up ScrollFrameIntoView code. r=hiro
I want to do the whole target -> container chain walk in the same
function, reason will be apparent in a second :)

Differential Revision: https://phabricator.services.mozilla.com/D159531
2022-10-18 14:18:37 +00:00
Olli Pettay
048bd344c4 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Emilio Cobos Álvarez
1c58e2a928 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
320035af5a Bug 1764679 - Make GetInterlinePosition and SetInterlinePosition work with new enum class r=smaug
It's hard to remember what the `bool` value of them means.  Therefore, there
are a lot of comment around the API users to explain what they do.  For making
it clearer and reducing the risk of specifying opposite value, they should work
with an `enum class`.

Differential Revision: https://phabricator.services.mozilla.com/D143812
2022-04-20 14:24:55 +00:00
Eitan Isaacson
68f02dc6fd 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
22aa786ab3 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
Sylvestre Ledru
35a175aa33 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Butkovits Atila
5ba8c63b8a Merge autoland to mozilla-central. a=merge 2022-01-27 23:34:33 +02:00
Emilio Cobos Álvarez
689066ccc6 Bug 1752214 - Don't use screen coordinates for the last resort autoscroll. r=tnikkel
Screen coordinates may not be quite accurate enough on Wayland, see the
blocked bug. It seems however that this should do the job and should be
simpler as well.

Differential Revision: https://phabricator.services.mozilla.com/D137069
2022-01-27 10:11:24 +00:00
Masayuki Nakano
7a52e41ff0 Bug 1741148 - part 3: Make users of nsINode::ComputeIndexOf_Deprecated() use nsINode::ComputeIndexOf() if the result is not set to int32_t nor return as int32_t r=smaug
This patch fixes only the cases if the result of `ComputeIndexOf_Deprecated()`
is used as unsigned integer with implicit or explicit cast.

Differential Revision: https://phabricator.services.mozilla.com/D131336
2021-12-09 11:55:36 +00:00
Masayuki Nakano
41d6e516dc 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
3af58be69c 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
daf79ccd1e 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
3637714825 Bug 1735446 - part 3: Make Selection use size_t and Maybe<size_t> for handling index of array of the ranges r=smaug
Since it's the standard manner of `nsTArray`.

Differential Revision: https://phabricator.services.mozilla.com/D128846
2021-12-09 06:43:48 +00:00
Masayuki Nakano
fcf15637ac Bug 1735446 - part 2: Make Selection::SetAnchorFocusRange() take size_t for range index instead of int32_t r=mbrodesser
Since `size_t` is used by `nsTArray` as its index type, and it manages the array
of ranges.

Differential Revision: https://phabricator.services.mozilla.com/D128845
2021-12-09 06:16:56 +00:00
Masayuki Nakano
afee8ce4d7 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
69f3ddd0a8 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
8eeb570d82 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
b4ce43ec95 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
c671a34e08 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
ffa5244e07 Bug 1732845 - Add nsINode::IsInDesignMode() to check whether the node is directly in design mode r=smaug
There are a lot of check of `Document`'s editable state **with** comments. This
means that it's unclear for developers that only `Document` node is editable in
design mode.

Additionally, there are some points which use composed document rather than
uncomposed document even though the raw API uses uncomposed document. Comparing
with the other browsers, checking uncomposed document is compatible behavior,
i.e., nodes in shadow trees are not editable unless `contenteditable`.

Therefore, `nsINode` should have a method to check whether it's in design mode
or not.

Note that it may be called with a node in UA widget.  Therefore, this patch
adds new checks if it's in UA widget subtree or native anonymous subtree,
checking whether it's in design mode with its host.

Differential Revision: https://phabricator.services.mozilla.com/D126764
2021-10-12 03:14:43 +00:00
Kagami Sascha Rosylight
c13d219483 Bug 1648944 - Part 1: Split select event flags into each event name r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D86700
2021-07-20 13:46:44 +00:00
Brindusan Cristian
0c4fbf4b49 Backed out 5 changesets (bug 1648944) for causing wpt failures in idlharness.window.html.
CLOSED TREE

Backed out changeset 598789cabb9f (bug 1648944)
Backed out changeset f464507bef57 (bug 1648944)
Backed out changeset fb2b9ceb7c69 (bug 1648944)
Backed out changeset a73cfada74cf (bug 1648944)
Backed out changeset 3f41877ffd14 (bug 1648944)
2021-07-20 13:29:49 +03:00
Kagami Sascha Rosylight
dff494f1a7 Bug 1648944 - Part 1: Split select event flags into each event name r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D86700
2021-07-20 08:59:47 +00:00
Kagami Sascha Rosylight
96a9b3d1e1 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
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
cc180203f9 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
645878eef7 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
c15b9875ad 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
1406700f5f 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
9b322e9f67 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
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
Kagami Sascha Rosylight
3bd6c78fdc 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
7c375a1189 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
Emilio Cobos Álvarez
79b783704d Bug 1708303 - Fix scroll-margin implementation. r=hiro
So that margin is not included in the rect for visibility calculations,
and padding and margin are accounted properly on them.

Differential Revision: https://phabricator.services.mozilla.com/D113853
2021-05-06 00:54:14 +00:00
Emilio Cobos Álvarez
79cfc09871 Bug 1701928 - Selection scrolling should not ignore scroll-{margin,padding}. r=hiro,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D110440
2021-04-02 12:14:19 +00:00
Ting-Yu Lin
5902370bb0 Bug 1696584 - Remove UnionRectEdges() and replace the callers with the equivalent UnionEdges(). r=emilio
UnionRectEdges() and UnionEdges() are equivalent, and the later has a
modern interface with a shorter name. Let's remove the former.

Differential Revision: https://phabricator.services.mozilla.com/D107315
2021-03-07 23:07:08 +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
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
Kagami Sascha Rosylight
d0222ca683 Bug 1688090 - Prefer .Throw*Error with better error messages in Selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D102671
2021-01-22 12:00:08 +00:00
Masayuki Nakano
1a6ee46590 Bug 1357365 - part 5: Make TypeInState::OnSelectionChange stop keeping link style for new inserting content when selection is changed by JS r=m_kato,edgar
This is the most important situation.  If selection is collapsed to a edge of a
link, the other browsers does not insert new content into the link.  So, from
the point of view of web developers, this cause should work exactly same as
the other browsers.

Note that the new failures in `editing/run/inserttext.html` are passed only
on Gecko.  So, the test should be updated after fixing this bug.

Differential Revision: https://phabricator.services.mozilla.com/D101004
2021-01-13 01:55:40 +00:00
Mirko Brodesser
2747a25af6 Bug 1685303: part 4) Add logging to Selection::AddRangesForSelectableNodes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101354
2021-01-11 15:03:05 +00:00