Commit Graph

151 Commits

Author SHA1 Message Date
Cathie Chen
ddcb98e4d9 Bug 1668136 - Set visible the content relevancy of an element with content-visibility:auto if its descendant is called scrollIntoView, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D186943
2023-11-01 12:01:51 +00:00
Natalia Csoregi
b066a3427a Backed out changeset aa66fda02aac (bug 1668136) for causing failures on content-visibility. CLOSED TREE 2023-10-31 06:49:20 +02:00
Cathie Chen
a25f8bba63 Bug 1668136 - Set visible the content relevancy of an element with content-visibility:auto if its descendant is called scrollIntoView, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D186943
2023-10-31 01:38:16 +00:00
CanadaHonk
aa654b839c Bug 1622090 - Implement loading=lazy for <iframe> r=emilio
Initial implementation for <iframe loading=lazy>

Also cleaned up some image lazy loading to be generalised
(sharing an intersection observer and some enums/funcs in Element).

Unimplemented details:
 - Window load should not wait for in view lazy loading iframes.
   Unplanned for this patch and ship for now.
   (Chromium fail, WebKit pass)

We also pass some other WPTs other engines do not too already too.
Also added a WPT to ensure using parse-time base URI for lazy -> eager iframes.

Differential Revision: https://phabricator.services.mozilla.com/D190662
2023-10-18 14:13:29 +00:00
Emilio Cobos Álvarez
21b343ce87 Bug 1855836 - Make empty threshold list behavior match other browsers. r=smaug
Technically a broken test, but given other browsers' behavior and that
having no thresholds is useless, I don't think this edge-case is worth
fighting about.

See https://github.com/w3c/IntersectionObserver/pull/516 for the spec
change.

Differential Revision: https://phabricator.services.mozilla.com/D189764
2023-10-03 14:35:30 +00:00
Cathie Chen
a1e0f79083 Bug 1820265 - content-visibility: use overflow clip edge instead of bounding box as the intersecting rect, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184253
2023-09-11 23:42:37 +00:00
Emilio Cobos Álvarez
12547c0c1c Bug 1847929 - Don't throttle zero-size in-viewport OOP iframes. r=smaug
Use edge-inclusive intersection like IntersectionObserver, to make
zero-size iframes that are in the viewport considered visible. This is
consistent with how we treat zero-sized in-process iframes.

Differential Revision: https://phabricator.services.mozilla.com/D185808
2023-08-10 09:30:02 +00:00
Martin Robinson
8f25440f6e Bug 1807251 - Small cleanup of fix for nested content-visibility: auto elements r=emilio
This change removes an unused member that was accidentally preserved
from an earlier version of the fix and also makes the argument to
`DOMIntersectionObserver::Update` a reference since it can never be null
and the method was not asserting that it wasn't.

Differential Revision: https://phabricator.services.mozilla.com/D167356
2023-01-20 11:04:45 +00:00
Martin Robinson
bf79ef9611 Bug 1807251 - content-visibility should not block IntersectionObserver which control content relevancy r=emilio
IntersectionObserver is used to decide whether content is relevant for
the purposes of `content-visibility: auto`. Content hidden by this
property normally blocks IntersectionObserver, but it should not block
the observer which controls content relevancy.

Differential Revision: https://phabricator.services.mozilla.com/D167193
2023-01-19 17:14:46 +00:00
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
b63597150e Bug 1795815 - Fix cursor intersection detection on OOP iframes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D159783
2022-10-20 10:16:58 +00:00
Martin Robinson
d6b19e86ff Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D157306
2022-09-15 20:32:27 +00:00
Norisz Fay
59f059dd2d Backed out changeset c3780baf6f24 (bug 1789255) for causing build bustages CLOSED TREE 2022-09-15 21:14:04 +03:00
Martin Robinson
a7d2990285 Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D157306
2022-09-15 17:56:42 +00:00
Sandor Molnar
12e1fb9746 Backed out changeset 3a5759eabb42 (bug 1789255) for causing wpt failures in netwerk/protocol/http/Http2Session.cpp CLOSED TREE 2022-09-14 02:01:36 +03:00
Martin Robinson
00e3cff6d7 Bug 1789255: Anonymous children of elements with content-visibility should not be skipped for layout r=emilio
Some anonymous children are important for properly sizing their parents
even when those parents hide content with `content-visibility`. This is
shown by regressions in the proper layout of some form elements with
`content-visibility`.

This change introduces a more conservative approach for avoiding layout
of hidden content. Instead of leaving all children dirty during reflow,
reflow anonymous frames (and nsComboboxDisplayFrame, a specialized kind
of anonymous frame). This change means that frames may only lay out some
of their children, so it must introduce some more changes to assumptions
during line layout.

In addition, this change renames `content-visibility` related methods in
nsIFrame in order to make it more obvious what they do.

Differential Revision: https://phabricator.services.mozilla.com/D156473
2022-09-13 20:01:35 +00:00
Sean Feng
27b1c54544 Bug 1750034 - Remove lazyload telemetry related code r=emilio
We have decided to use 600px in all directions, there's no need
to keep the telemetry stuff around.

Differential Revision: https://phabricator.services.mozilla.com/D155879
2022-08-30 16:00:11 +00:00
Emilio Cobos Álvarez
76ed3cad16 Bug 1785186 - Use zero threshold for lazyload observer. r=hiro
This matches WebKit, and the spec:

  https://html.spec.whatwg.org/#lazy-load-intersection-observer

Blink has very weird behavior where it treats a zero-area intersection
in this particular case with an intersectionRatio of one:
https://bugs.chromium.org/p/chromium/issues/detail?id=1356250

Which causes them to load the image even though they have a
numeric_limits::min threshold.

So this works in Chromium by chance, but should work per spec.

Differential Revision: https://phabricator.services.mozilla.com/D155501
2022-08-25 02:34:37 +00:00
Emilio Cobos Álvarez
b69fa6464e Bug 1772083 - Downgrade an assertion for now while we try to find STR. r=smaug
The only URLs in the crash reports are internal networks, so it's not
clear to me how it can happen. But given it can, handle it gracefully.

Differential Revision: https://phabricator.services.mozilla.com/D147856
2022-06-01 14:03:04 +00:00
Emilio Cobos Álvarez
31e4efa801 Bug 1730284 - Use whether the embedder element intersects the viewport to decide whether to throttle in-process iframes. r=smaug
This is more likely to be understandable by developers, matches other
browsers more closely (see bug comments), and seems more in-line with
what we do for OOP iframes.

Add a pref to not do this throttling at all (which would match Chrome),
though this is probably good enough for now.

Differential Revision: https://phabricator.services.mozilla.com/D146574
2022-05-26 15:45:01 +00:00
Emilio Cobos Álvarez
657914334f Bug 1730284 - Factor out some IntersectionObserver code. r=smaug,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D146573
2022-05-25 20:45:55 +00:00
Noemi Erli
7c6784310f Backed out 2 changesets (bug 1730284) for causing devtools,web-platform and mochitest failures CLOSED TREE
Backed out changeset 98834b863104 (bug 1730284)
Backed out changeset 1ec157459e8c (bug 1730284)
2022-05-25 22:51:20 +03:00
Emilio Cobos Álvarez
bd6f693097 Bug 1730284 - Factor out some IntersectionObserver code. r=smaug,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D146573
2022-05-25 17:54:22 +00:00
Emilio Cobos Álvarez
ec93df4236 Bug 1770729 - Fix IntersectionObserver overflow: clip on zero-sized elements. r=jwatt
I realized my fix in bug 1769512 (using IsEmpty()) wasn't quite correct
in this case, because IntersectionObserver preserves edge-inclusive
intersections.

Differential Revision: https://phabricator.services.mozilla.com/D147078
2022-05-23 13:52:48 +00:00
Emilio Cobos Álvarez
a7bd900b89 Bug 1769512 - Apply overflow: clip to IntersectionObserver. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D146433
2022-05-23 07:21:43 +00:00
Martin Robinson
89ce051128 Bug 1766265 - Content hidden by content-visibility should not trigger intersection observers r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D144584
2022-04-26 08:40:26 +00:00
David Shin
3bc7313e07 Bug 1755770 - Ensure TextRenderedRun::GetRunUserSpaceRect casts float to int without invoking Undefined Behavior r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D142223
2022-03-28 21:07:58 +00:00
Emilio Cobos Álvarez
16bdd386b6 Bug 1760965 - Remove IntersectionObserver prefs that have been enabled by default for a long time. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D141830
2022-03-23 09:59:13 +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
Emilio Cobos Álvarez
5481ccb748 Bug 1754579 - Don't keep so much alive when returning DOMRects & co. r=smaug
We keep the parent alive for wrapping. It's unnecessary to keep alive
the individual element / range / etc. Pass the relevant global /
document.

Differential Revision: https://phabricator.services.mozilla.com/D138357
2022-02-10 00:38:45 +00:00
Emilio Cobos Álvarez
946ca76d93 Bug 1724719- Ensure IntersectionObserver.observe is O(1), not O(targetCount). r=smaug
And that IntersectionObserver.unobserve is O(targetCount) worst case,
not O(2*targetCount).

Differential Revision: https://phabricator.services.mozilla.com/D122119
2021-08-09 16:10:07 +00:00
Hiroyuki Ikezoe
aa7268d6c1 Bug 1700245 - Replace IsAncestorFrameCrossDoc with IsAncestorFrameCrossDocInProcess in DOMIntersectionObserver::Update. r=emilio
Our IntersectionObserver has been working in OOP iframe since bug 1599795.

Differential Revision: https://phabricator.services.mozilla.com/D117500
2021-06-13 22:02:22 +00:00
Emilio Cobos Álvarez
b7f648be74 Bug 1709577 - Check list of available images before deciding to defer a lazy load. r=edgar
As per https://html.spec.whatwg.org/#updating-the-image-data step 6.

Differential Revision: https://phabricator.services.mozilla.com/D114353
2021-05-07 13:56:33 +00:00
Dorel Luca
3eacfad31f Backed out 2 changesets (bug 1709577) for WPT Failures in /html/semantics/embedded-content/the-img-element/image-loading-lazy-base-url.html. CLOSED TREE
Backed out changeset ceed6d7fca1c (bug 1709577)
Backed out changeset bb44c14b754f (bug 1709577)
2021-05-07 16:46:48 +03:00
Emilio Cobos Álvarez
6302e3acc0 Bug 1709577 - Check list of available images before deciding to defer a lazy load. r=edgar
As per https://html.spec.whatwg.org/#updating-the-image-data step 6.

Differential Revision: https://phabricator.services.mozilla.com/D114353
2021-05-07 11:44:15 +00:00
Sandor Molnar
c7dc20560e Backed out 2 changesets (bug 1709577) for causing wpt failures. CLOSED TREE
Backed out changeset 0da1dba1749c (bug 1709577)
Backed out changeset bab974107b3b (bug 1709577)
2021-05-07 05:34:43 +03:00
Emilio Cobos Álvarez
62bc311075 Bug 1709577 - Check list of available images before deciding to defer a lazy load. r=edgar
As per https://html.spec.whatwg.org/#updating-the-image-data step 6.

Differential Revision: https://phabricator.services.mozilla.com/D114353
2021-05-07 00:11:06 +00:00
Edgar Chen
1bb16b15ba Bug 1709200 - Rename nsContentUtils::GetRootDocument to GetInProcessSubtreeRootDocument; r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D114177
2021-05-05 09:42:20 +00:00
Daniel Holbert
e49e7b9ab2 Bug 1699853: Use "InProcess" version of GetCrossDocParentFrame() in DOMIntersectionObserver.cpp. r=emilio
This patch doesn't change behavior; it's just switching us between two
functions that do the same thing. (One is literally a trivial wrapper for the
other.)

We're using the new "InProcess" version of this API as a way of annotating
callsites that have been vetted as behaving properly in out-of-process iframes.

These two callsites in DOMIntersectionObserver.cpp are part of an algorithm
that was already modernized to work with fission in bug 1599795.  In a
fission-enabled scenario: when we end up with null `containerFrame` due to
hitting an oop-iframe boundary, we should end up handling things properly via
our subsequent application of the passed-in `aRemoteDocumentVisibleRect` arg.

Differential Revision: https://phabricator.services.mozilla.com/D109169
2021-03-19 23:58:30 +00:00
Emilio Cobos Álvarez
49bdf16db5 Bug 941356 - Fix start offset of transformed drag images. r=botond
I'm not sure whether we should deal with ancestor scales and such. There
seemed to be a discussion about that in D77436 but dealing with
partially-3d-transformed content sounds like a massive pain. For now
this fixes the start point, which is a progression.

Differential Revision: https://phabricator.services.mozilla.com/D106896
2021-03-04 10:56:22 +00:00
Emilio Cobos Álvarez
28b6ccc4e5 Bug 1682915 - Deal with root == target in intersection observer code. r=dholbert
The "compute the intersection" algorithm could deal with this case
easily (right now it doesn't), but the spec doesn't, so let's match the
spec and Safari lacking a compelling use case for this.

Chrome doesn't send a notification in this case, which is definitely
wrong.

Differential Revision: https://phabricator.services.mozilla.com/D104386
2021-02-11 14:08:06 +00:00
Sean Feng
461677cdfb Bug 1687358 - Implement telemetry probes to determine the best possible threshold for <lazyload> r=emilio
This patch implements five telemetry probes to help us learn how
lazyload thresholds perform in the wild.

Differential Revision: https://phabricator.services.mozilla.com/D102845
2021-01-29 17:03:25 +00:00
Bogdan Tara
cea3638c90 Backed out changeset a77ccd1c1659 (bug 1687358) for browser_lazyload_telemetry.js failures CLOSED TREE 2021-01-27 02:46:06 +02:00
Sean Feng
2b4f1850d6 Bug 1687358 - Implement telemetry probes to determine the best possible threshold for <lazyload> r=emilio
This patch implements five telemetry probes to help us learn how
lazyload thresholds perform in the wild.

Differential Revision: https://phabricator.services.mozilla.com/D102845
2021-01-26 21:54:33 +00:00
Emilio Cobos Álvarez
4b14f559c4 Bug 1686386 - Make DOMIntersectionObserver check docgroup rather than principal base domain. r=mstange
This is similar effectively, and should be more correct and faster, as per:

  https://github.com/w3c/IntersectionObserver/issues/161#issuecomment-492539452

Differential Revision: https://phabricator.services.mozilla.com/D101636
2021-01-14 14:31:46 +00:00
Emilio Cobos Álvarez
fe2b95e111 Bug 1682003 - Avoid UTF-8 -> UTF-16 conversion during CSSOM serialization. r=heycam
This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).

It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).

Differential Revision: https://phabricator.services.mozilla.com/D99590
2020-12-17 14:04:35 +00:00
Simon Giesecke
eae3689379 Bug 1673931 - Avoid including Document.h from header files. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95046

Depends on D95045
2020-11-23 16:07:43 +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