Commit Graph

28 Commits

Author SHA1 Message Date
Sylvestre Ledru
41d1d79094 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-02-15 08:15:57 +00:00
Ryan Hunt
fc7e92ad83 Bug 1520363 - Rename nsIScrollableFrame::GetAnchor() to Anchor(). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D19872

--HG--
extra : moz-landing-system : lando
2019-02-15 01:25:55 +00:00
Ryan Hunt
6bdc12be01 Bug 1519553 - Don't round scroll anchor adjustments to device pixels. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D19107

--HG--
extra : source : 7f29bb7519563e3aaafa2e484a356409ce05aab7
extra : histedit_source : 3f1c287cc5984bf896ed43cccd7533d39cda40c9
2019-02-07 20:39:49 -06:00
Ryan Hunt
585289697d Bug 1521579 - Only transform one bounding rect for text nodes when computing scroll anchoring bounding rect. r=dholbert
When visiting a text frame with many continuations, traversing ancestors to compute the
transform to the ancestor scroll frame can become very hot. This commit changes the
algorithm to translate all the text continuations to an ancestor that can then be
transformed just once.

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

--HG--
extra : moz-landing-system : lando
2019-01-30 14:42:58 +00:00
Ryan Hunt
092461a72f Bug 1521579 - Skip text frames that are continuations. r=dholbert
A continuation text frame's rect will be considered when visiting the primary
frame via 'FindScrollAnchoringBoundingRect', so we have no reason to compute
the same rect again if for some reason we have excluded the primary text frame.

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

--HG--
extra : moz-landing-system : lando
2019-01-30 14:42:28 +00:00
Ryan Hunt
3e87663a7f Bug 1518640 - Use the visual viewport for anchor node selection. r=botond
--HG--
extra : rebase_source : 0f7038a4bf6b7d2a7958177b883c7fbb4130d288
extra : intermediate-source : 97681055c88c7af478467d6c76e227d0cb916aad
extra : source : 27bbb318ecb4f44c315f87584bdeb1b239d80cef
2019-01-22 13:37:16 -06:00
Csoregi Natalia
54be80a8cf Backed out 2 changesets (bug 1518640) for reftest failures on gfx/layers/apz/test/reftest/frame-reconstruction-scroll-clamping.html. CLOSED TREE
Backed out changeset 27bbb318ecb4 (bug 1518640)
Backed out changeset 3b192e4631cc (bug 1518640)
2019-01-22 22:37:00 +02:00
Ryan Hunt
04f720e12c Bug 1518640 - Use the visual viewport for anchor node selection. r=botond
--HG--
extra : histedit_source : 44a540ddceb42939c124e51486c18856584de39a
2019-01-22 13:37:16 -06:00
Ryan Hunt
89cf3d0af8 Bug 1521278 - Allow ScrollAnchorContainer to detach anchor frame even if pref is disabled. r=dholbert
The important piece is just that we don't queue a selection for later. This code runs
for each scroll, so we'd be wasting a lot of effort to do that.

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

--HG--
extra : moz-landing-system : lando
2019-01-20 07:21:55 +00:00
Ryan Hunt
a3916a4e4e Bug 1520344 - Store last scroll anchor position in writing-mode relative coordinates. r=dholbert
This commit changes ScrollAnchorContainer to store the offset between the scroll anchoring
bounding rect start edge and the scroll-port start edge in the block axis of the scroll frame.

The logic to clamp the negative portions of scroll anchor bounding rect is also amended
to only clamp the portion that is beyond the border start edge in the block axis of the
scroll frame.

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

--HG--
extra : rebase_source : 43b5bc4ece7f90cb38e3a7186a764d9cddac90f9
extra : source : f26d953d76fcfb02a5fa46cb62e389f852592fe9
2019-01-16 15:13:12 -06:00
Ryan Hunt
c71371cf2a Bug 1518624 - Add telemetry for amount and length in pixels of scroll anchor adjustments. r=dholbert
This commit adds two new telemetry probes to collect:
 1. The amount of scroll anchoring adjustments applied
 2. The total absolute length in CSS pixels of scroll anchoring adjustments

Both of these metrics are collected on a per top-level-document basis, and
reported with other use-counters.

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

--HG--
extra : source : 43081bb8f4eac598a3103753965d5b60dfd1c3fa
extra : amend_source : 3d53dc56616f9e48799b7d8b8c11e96007d3c6eb
extra : intermediate-source : 6da6a7ff2d794c25b61858d16fe97e5f309e0f1f
2019-01-08 15:18:12 -06:00
Ryan Hunt
5c7254fba8 Bug 1519462 - Coalesce all scroll anchor adjustments to be performed after layout when flushing notifcations. r=dholbert
We currently perform anchor adjustment in three spots:
  1. If the target of RestyleManager::RecomputePosition is in a scroll anchor chain
  2. If the reflow root is in a scroll anchor chain
  3. In nsHTMLScrollFrame::DidReflow, for itself

It looks like it's possible for a scroll anchor container to be adjusted by (1)
and (2 or 3) in the same PresShell flush.

This should be okay, except that we consume mSuppressAnchorAdjustment when
performing an adjustment, and this can lead us to miss the second time that
we perform adjustments in a PresShell flush.

This commit reworks how we run anchor adjustments so that we collect all
scroll anchor containers that should be adjusted, and only perform the
adjustments once.

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

--HG--
extra : source : cbdbd08379d99f9d55f756c57d728c28331be5da
2019-01-13 00:54:05 -06:00
Ryan Hunt
90c97b5244 Bug 1518633 - Add profiler label for anchor node selection. r=mstange
--HG--
extra : rebase_source : 6dfdc469995cab0d18040f7d31b0e4f26ff4b664
2019-01-16 12:27:49 -06:00
Ryan Hunt
994713f905 Bug 1519541 - Clamp negative portions of relative scroll anchoring bounding rect. r=dholbert
The scroll anchoring bounding rect of a node can be influenced by absolutely
positioned descendants with very negative offsets. This can cause undesired
scroll adjustments, and has been seen on the web in Gmail. The spec needs to
be amended to say what to do here. Chrome currently will clamp the vertical
offset. This commit implements a stop-gap to clamp the negative portions to
fix this issue, while we do more research and spec-work.

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

--HG--
extra : rebase_source : 882ac29fca602ae398ffa74bf5747a8eeb4e9329
extra : amend_source : b6537c3626c5bae60285a4e55399b69ad52206b4
extra : source : ecc18f11431e2da2676962c82962932b4465fb38
2019-01-15 17:25:17 -06:00
Ryan Hunt
24d7fd6299 Bug 1519468 - Consistently check if a frame has content in ScrollAnchorContainer. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D16336

--HG--
extra : rebase_source : d56e93e4f8c021240cda9cb3b688b681a6a522af
extra : amend_source : 5a81506addb4ed177f990a25242bace7be9338a9
extra : source : 09a0a3c7356e9b161a7233179a087e3b137dc600
2019-01-11 12:21:09 -06:00
Ryan Hunt
deae3f5bc6 Bug 1305957 part 13 - Highlight scroll anchor when 'layout.scroll-anchoring.highlight' is enabled. r=mattwoodrow
This commit adds a debug pref that will highlight the frames that are marked as
anchor nodes. This is helpful to debug anchor selection.

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

--HG--
extra : rebase_source : 4b782de348454ad5660366814d4fe290ff2be152
extra : source : d8eef8f3e396d3a6f82607f53fc280316f184e86
2018-11-27 15:40:57 -06:00
Ryan Hunt
43b7ef66cb Bug 1305957 part 8 - Suppress scroll offset adjustment when some layout affecting properties are changed on scroll anchor or its ancestors. r=hiro
This commit implements the first half of the heuristics to detect style changes
that could lead to feedback loops with scroll anchoring. [1]

When these style changes are made, a suppression flag is added to the anchor
container to ignore any adjustments that would be made at the next layout flush
and to invalidate the anchor at that time.

[1] https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers

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

--HG--
extra : rebase_source : db0bf373e51325b7ef537c4c245ede4b4219d0d7
extra : source : d9445a5f3458b560fbdb7aee5faabb5a7a9327f3
2018-11-27 15:38:43 -06:00
Ryan Hunt
43e96a0c82 Bug 1305957 part 7 - Adjust scroll offset to match change in relative position of scroll anchor after reflow. r=hiro,dbaron
This commit implements anchor offset adjustment. When the position of a frame
that is an anchor is changed during reflow, we notify the anchor container. The
anchor container will then post a reflow callback.

Then when reflow is completed, the anchor container will perform a scroll to
keep the anchor node in the same relative position.

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

--HG--
extra : rebase_source : 9d40a5d5b73777d0da3799f162eeb85bb8e6d8f0
extra : source : d9052f7b34d9857863b66d64797f8b0b82504bec
2018-12-21 10:26:10 -06:00
Ryan Hunt
c7b7401684 Bug 1305957 part 6 - Select scroll anchors when flushing notifications in PresShell. r=hiro
This commit adds a mechanism for scroll anchor containers to request an anchor
node selection at a future time. Currently this is before styling so that anchor
adjustment suppression will have current anchor nodes.

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

--HG--
extra : rebase_source : 7af2dcc7953e446eb993625fa7ff32aa5a141eab
extra : source : e7124fecb7215769a5404c5f2268bbe715162393
2018-11-27 15:32:47 -06:00
Ryan Hunt
47ee617d1e Bug 1305957 part 5 - Add implementation of scroll anchor selection and invalidation. r=hiro,dbaron,dholbert
This commit implements candidate selection for a scroll frame using a frame tree
traversal. It roughly tries to follow the algorithm given in the scroll
anchoring draft specification, adapted to operate on the frame tree [1].

Some details, such as not selecting an anchor if the user hasn't scrolled are
not currently in the specification but will be to match Blink's implementation.

Once a scroll anchor has been selected, we maintain a bit on it and its ancestor
frame's states. This is used in a later commit to detect changes to position
during a reflow so the scroll frame can perform an adjustment.

A scroll anchor will be invalidated when the user scrolls the frame or the
scroll anchor is destroyed. Later commits will add logic to drive selection and
invalidation appropriately.

[1] https://drafts.csswg.org/css-scroll-anchoring/#anchor-node-selection

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

--HG--
extra : rebase_source : e05ba48662aafef5957322def33ddc5d93f3ca5a
extra : source : bdb766faa8679386bf4e9740781262ea4bb36544
2018-11-27 15:45:16 -06:00
Ryan Hunt
91f41f3a0a Bug 1305957 part 4 - Add basic ScrollAnchorContainer implementation. r=hiro
This commit adds a barebones class called 'ScrollAnchorContainer' that will
contain most of the logic for scroll anchoring. It is owned as a member of
ScrollFrameHelper, and has the same lifetime.

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

--HG--
extra : rebase_source : 41f6f7691af60401f18f98a89f1878cfad2e74d3
extra : source : 3033401ef320414ef5f489c53526d015c38a89d7
2018-11-27 15:18:03 -06:00
Bogdan Tara
6d78d1e2c9 Backed out 15 changesets (bug 1305957) for ASAN failures CLOSED TREE
Backed out changeset 4d5eb85d3155 (bug 1305957)
Backed out changeset 51c86d025ecb (bug 1305957)
Backed out changeset d8eef8f3e396 (bug 1305957)
Backed out changeset 950bf6ad1ef2 (bug 1305957)
Backed out changeset b4cb2cbebdb6 (bug 1305957)
Backed out changeset bfca5019a9cc (bug 1305957)
Backed out changeset e76b842c7b7f (bug 1305957)
Backed out changeset d9445a5f3458 (bug 1305957)
Backed out changeset d9052f7b34d9 (bug 1305957)
Backed out changeset e7124fecb721 (bug 1305957)
Backed out changeset bdb766faa867 (bug 1305957)
Backed out changeset 3033401ef320 (bug 1305957)
Backed out changeset 6b96050386f6 (bug 1305957)
Backed out changeset c66c00f73296 (bug 1305957)
Backed out changeset 6bd0bdab93cb (bug 1305957)
2019-01-10 18:49:22 +02:00
Ryan Hunt
e54839acce Bug 1305957 part 13 - Highlight scroll anchor when 'layout.scroll-anchoring.highlight' is enabled. r=mattwoodrow
This commit adds a debug pref that will highlight the frames that are marked as
anchor nodes. This is helpful to debug anchor selection.

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

--HG--
extra : rebase_source : 61109b3d967f0e4f8e5a260a71fecc01ebf22c73
extra : histedit_source : d2275fdb4edc3d7f6b006c8c7ab24fca1223998d
2018-11-27 15:40:57 -06:00
Ryan Hunt
bb67558065 Bug 1305957 part 8 - Suppress scroll offset adjustment when some layout affecting properties are changed on scroll anchor or its ancestors. r=hiro
This commit implements the first half of the heuristics to detect style changes
that could lead to feedback loops with scroll anchoring. [1]

When these style changes are made, a suppression flag is added to the anchor
container to ignore any adjustments that would be made at the next layout flush
and to invalidate the anchor at that time.

[1] https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers

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

--HG--
extra : rebase_source : 7919443bdad49ce3623e5b082decb4f5c4a54158
extra : histedit_source : a2283cc31060103ef0929ae11624b45f95113810
2018-11-27 15:38:43 -06:00
Ryan Hunt
a2c95c01f0 Bug 1305957 part 7 - Adjust scroll offset to match change in relative position of scroll anchor after reflow. r=hiro,dbaron
This commit implements anchor offset adjustment. When the position of a frame
that is an anchor is changed during reflow, we notify the anchor container. The
anchor container will then post a reflow callback.

Then when reflow is completed, the anchor container will perform a scroll to
keep the anchor node in the same relative position.

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

--HG--
extra : rebase_source : 44797fcf6585d5912f83baea90a8e554f39618b5
extra : histedit_source : c4354ba8aac99e0d083f40b515369db6a95f997d
2018-12-21 10:26:10 -06:00
Ryan Hunt
8976d6f7f7 Bug 1305957 part 6 - Select scroll anchors when flushing notifications in PresShell. r=hiro
This commit adds a mechanism for scroll anchor containers to request an anchor
node selection at a future time. Currently this is before styling so that anchor
adjustment suppression will have current anchor nodes.

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

--HG--
extra : rebase_source : ba621678b697847e59203444d7b6b0e737742675
extra : histedit_source : b0c6f8642a01bd8ded312d0fa27eecd55c4422a9
2018-11-27 15:32:47 -06:00
Ryan Hunt
a67a2f7b0b Bug 1305957 part 5 - Add implementation of scroll anchor selection and invalidation. r=hiro,dbaron,dholbert
This commit implements candidate selection for a scroll frame using a frame tree
traversal. It roughly tries to follow the algorithm given in the scroll
anchoring draft specification, adapted to operate on the frame tree [1].

Some details, such as not selecting an anchor if the user hasn't scrolled are
not currently in the specification but will be to match Blink's implementation.

Once a scroll anchor has been selected, we maintain a bit on it and its ancestor
frame's states. This is used in a later commit to detect changes to position
during a reflow so the scroll frame can perform an adjustment.

A scroll anchor will be invalidated when the user scrolls the frame or the
scroll anchor is destroyed. Later commits will add logic to drive selection and
invalidation appropriately.

[1] https://drafts.csswg.org/css-scroll-anchoring/#anchor-node-selection

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

--HG--
extra : rebase_source : 02ace6a966dd1c4bd42b7472501d05c412d6deb8
extra : histedit_source : 84bed6b2d13a308f4aea91c631b8792df293c76a
2018-11-27 15:45:16 -06:00
Ryan Hunt
18d5058194 Bug 1305957 part 4 - Add basic ScrollAnchorContainer implementation. r=hiro
This commit adds a barebones class called 'ScrollAnchorContainer' that will
contain most of the logic for scroll anchoring. It is owned as a member of
ScrollFrameHelper, and has the same lifetime.

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

--HG--
extra : rebase_source : 4d58b51aa6b893392d7c152d27750ebda059f784
extra : histedit_source : 9a2841931c47c4358e15d2fa6514ed347e3d0dad
2018-11-27 15:18:03 -06:00