Commit Graph
184 Commits
Author SHA1 Message Date
Nika Layzell 8cb61f45af Bug 2020817 - Part 3: Allow .get on nsTLiteralString, r=xpcom-reviewers,layout-reviewers,emilio
This was originally removed due to bug 1341513. Unfortunately this method can
still have occasional value in places which call use a macro which declares a
`nsLiteral[C]String`. This changes some of those callers over & re-adds the
`.get()`.

Differential Revision: https://phabricator.services.mozilla.com/D286157
2026-03-25 08:23:01 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
denvercoder21 48db755925 Bug 1880375 - Use fixed viewport accounted for dynmamic toolbar height for fixed position elements r=hiro,layout-reviewers,geckoview-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D269773
2026-01-28 11:52:04 +00:00
Emilio Cobos Álvarez ba0e228d4f Bug 2000639 - Remove nsViewManager. r=jwatt
After the previous patches, nsViewManager is basically a backpointer to
its pres shell.

Remove it and just make PresShell manage the root view directly. After
this is done, we can decide what to do about nsView (which is itself
little more than a widget listener that forwards to pres shell right
now).

This technically starts listening to mParentWidget slightly later (on
pres shell creation), but I think that's ok.

Differential Revision: https://phabricator.services.mozilla.com/D272890
2025-11-28 10:48:18 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Emilio Cobos Álvarez 7341ea75ac Bug 1967139 - Add some missing includes. 2025-05-19 13:53:20 +00:00
Hiroyuki Ikezoe 00782a4f37 Bug 1937785 - Remove nsPresContext::mKeyboardHeight and introduce MobileViewportManager::mPendingKeyboardHeight. r=botond
There's a race condition where the keyboard height change notification
has arrived but nsDocumentViewer size change hasn't yet arrived.

MobileViewportManager::mPendingKeyboardHeight is introduced to fix the race.

Differential Revision: https://phabricator.services.mozilla.com/D234262
2025-01-22 20:49:57 +00:00
Stanca Serban 7203de77bc Backed out 6 changesets (bug 1937785) for causing Android reftests failures in retained-dl-async-scrolled-1.html. CLOSED TREE
Backed out changeset ca4ff44a38f3 (bug 1937785)
Backed out changeset 9ea29b89cbf5 (bug 1937785)
Backed out changeset 0e95190b1c76 (bug 1937785)
Backed out changeset 7f3f99057dbe (bug 1937785)
Backed out changeset cb38950d4787 (bug 1937785)
Backed out changeset 9e61d106beb8 (bug 1937785)
2025-01-21 14:28:05 +02:00
Hiroyuki Ikezoe 5b51ae9cf1 Bug 1937785 - Remove nsPresContext::mKeyboardHeight and introduce MobileViewportManager::mPendingKeyboardHeight. r=botond
There's a race condition where the keyboard height change notification
has arrived but nsDocumentViewer size change hasn't yet arrived.

MobileViewportManager::mPendingKeyboardHeight is introduced to fix the race.

Differential Revision: https://phabricator.services.mozilla.com/D234262
2025-01-21 06:49:56 +00:00
longsonr 843d861ed7 Bug 1929338 - convert more mozilla:clamped to std:clamp r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D228069
2024-11-05 18:52:41 +00:00
Botond Ballo 698cf54cff Bug 1915051 - Early-exit UpdateResolutionForViewportSizeChange in fullscreen mode. r=hiro
Depends on D221391

Differential Revision: https://phabricator.services.mozilla.com/D221392
2024-09-08 21:37:19 +00:00
Hiroyuki Ikezoe 2514cafdee Bug 1768527 - Set the initial visible area with MobileViewportManager. r=emilio,botond
On mobile environments, specifically web contents without meta viewport tags get
rendered on 980px width device (i.e. desktop mode), thus using the document
viewer size directly for the pres context's visible area would result a resize event.
Using MobileViewportManager avoids the resize event.

Differential Revision: https://phabricator.services.mozilla.com/D220976
2024-09-05 04:36:29 +00:00
Botond Ballo 78ed77b254 Bug 1889017 - Use the up-to-date CSS viewport size in ComputeIntrinsicResolution(). r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D216903
2024-08-27 00:28:20 +00:00
Botond Ballo 0b5cedcc79 Bug 1889017 - MobileViewportManager logging improvements. r=hiro
The log statement in ComputeIntrinsicScale() was quite noisy because one
of its callers was called on every paint. The patch moves it to the
non-noisy call sites, and details whether the intrinsic scale is being
computed based on the viewport size or content size.

Also add a couple of new log statements.

Differential Revision: https://phabricator.services.mozilla.com/D216902
2024-08-27 00:28:19 +00:00
Hiroyuki Ikezoe d31fdcd32d Bug 1831649 - Tweak the visual viewport size for resizes-visual and overlays-content modes. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D204168
2024-08-06 07:46:22 +00:00
Hiroyuki Ikezoe f792c5db5c Bug 1831649 - Expand the display size used as input to mobile viewport sizing to include the software keyboard area in overlays-content and resizes-visual mode. r=emilio,botond
So that even if the chrome window gets resized by the software keyboard, the
contents can be laid out as if there's no software keyboard for overlays-content
and resizes-visual modes.

Also use the exapanded size (we call it "layout display size") for all call sites of
MobileViewportManager::DisplaySize().

Differential Revision: https://phabricator.services.mozilla.com/D204167
2024-08-06 07:46:22 +00:00
Stanca Serban b74d1bcd26 Backed out 12 changesets (bug 1831649) for causing multiple failures.
Backed out changeset 501dc3134ae1 (bug 1831649)
Backed out changeset 21235ab42839 (bug 1831649)
Backed out changeset 279fdf36aac1 (bug 1831649)
Backed out changeset 17fb50534fae (bug 1831649)
Backed out changeset b2718b2f730d (bug 1831649)
Backed out changeset a05aa1c75ece (bug 1831649)
Backed out changeset becfb23cd6b4 (bug 1831649)
Backed out changeset 2d0e7e662530 (bug 1831649)
Backed out changeset 22538f7bdc88 (bug 1831649)
Backed out changeset 4ddecb37950f (bug 1831649)
Backed out changeset 1e6ed8b78e8f (bug 1831649)
Backed out changeset 6e96a1a01c24 (bug 1831649)
2024-07-18 06:13:43 +03:00
Hiroyuki Ikezoe 9adb1132b0 Bug 1831649 - Tweak the visual viewport size for resizes-visual and overlays-content modes. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D204168
2024-07-18 00:31:13 +00:00
Hiroyuki Ikezoe e862f419dd Bug 1831649 - Expand the display size used as input to mobile viewport sizing to include the software keyboard area in overlays-content and resizes-visual mode. r=emilio,botond
So that even if the chrome window gets resized by the software keyboard, the
contents can be laid out as if there's no software keyboard for overlays-content
and resizes-visual modes.

Also use the exapanded size (we call it "layout display size") for all call sites of
MobileViewportManager::DisplaySize().

Differential Revision: https://phabricator.services.mozilla.com/D204167
2024-07-18 00:31:12 +00:00
Hiroyuki Ikezoe 6a38d98937 Bug 1862140 - Update mVisualViewportSizeUpdatedByDynamicToolbar whenever the visual viewport size is changed. r=botond
When the dynamic toolbar is collapsed, the viewport frame size for
`position: fixed` elements is
`MobileViewportManager::mVisualViewportSizeUpdatedByDynamicToolbar`.
But the variable wasn't updated when the visual viewport size is changed by the
software keyboard.

Differential Revision: https://phabricator.services.mozilla.com/D198112
2024-01-11 00:39:16 +00:00
Jonathan Watt aa67eb0d46 Bug 1865995 p5. Rename GetContentViewerSize to match nsIDocumentViewer's new name. r=emilio,geckoview-reviewers,owlish
Includes the methods on:
 - nsIDOMWindowUtils
 - nsLayoutUtils
 - MVMContext

Differential Revision: https://phabricator.services.mozilla.com/D194339
2023-11-23 21:35:20 +00:00
Andi-Bogdan Postelnicu 011e3fc2d9 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 11:35:33 +00:00
Stanca Serban 98c675ed3f Backed out 7 changesets (bug 1660405) for causing bustages on Linux x64 opt. CLOSED TREE
Backed out changeset ad1a5f59214f (bug 1660405)
Backed out changeset a39e95f0aafe (bug 1660405)
Backed out changeset 48629ee0d70d (bug 1660405)
Backed out changeset 8419b99aab60 (bug 1660405)
Backed out changeset 535cc12c8bed (bug 1660405)
Backed out changeset e27052da4927 (bug 1660405)
Backed out changeset 11b0f9cf8091 (bug 1660405)
2023-03-22 13:05:53 +02:00
Andi-Bogdan Postelnicu 5e0156c1e4 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 09:27:56 +00:00
Botond Ballo 2024ab821e Bug 1803740 - Add logging to explain why MobileViewportManager didn't perform shrink-to-fit. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D167894
2023-01-26 02:34:33 +00:00
Daniel Holbert 0af301d73d Bug 1730741 part 1: Export MobileViewportManager's LazyLogModule in a more structured way. r=botond
Before this patch, PresShell.cpp tries to reuse a LazyLogModule that's defined
in MobileViewportManager.cpp, which isn't actually declared in any header.  This
prevents the build from linking, unless we're lucky enough to have these two
source files concatenated together via our unified build.

This patch promotes this LazyLogModule to be an actual static member-var on the
MobileViewportManager class, so that it can be exported and used externally in
a more structured way.  This makes it consistent with the very-similar
"PresShell::gLog" member-variable.

Differential Revision: https://phabricator.services.mozilla.com/D125600
2021-09-15 18:48:16 +00:00
Hiroyuki Ikezoe 323db6cb76 Bug 1718012 - Call UpdateSizesBeforeReflow only for resize reflow cases and set MobileViewportManager::mMobileViewportSize even if mDisplaySize hasn't been changed in UpdateSizesBeforeReflow. r=tnikkel
In the case of reflowing caused by full zoom changes, the mDisplaySize isn't
changed, whereas mMobileViewportSize should be changed.

Differential Revision: https://phabricator.services.mozilla.com/D120190
2021-08-02 21:27:19 +00:00
Dorel Luca e89c7aab2c Backed out changeset 21ac9225dd4b (bug 1718012) for WPT failures in css/css-values/viewport-units-css2-001.html. CLOSED TREE 2021-07-29 01:00:39 +03:00
Hiroyuki Ikezoe bc40ee3416 Bug 1718012 - Call UpdateSizesBeforeReflow only for resize reflow cases and set MobileViewportManager::mMobileViewportSize even if mDisplaySize hasn't been changed in UpdateSizesBeforeReflow. r=tnikkel
In the case of reflowing caused by full zoom changes, the mDisplaySize isn't
changed, whereas mMobileViewportSize should be changed.

Differential Revision: https://phabricator.services.mozilla.com/D120190
2021-07-28 21:04:31 +00:00
Sandor Molnar 22fc22bcc2 Backed out changeset 1b29d7a6d15c (bug 1718012) for causing crashtest failures. CLOSED TREE 2021-07-28 09:24:58 +03:00
Hiroyuki Ikezoe dfb3366c36 Bug 1718012 - Call UpdateSizesBeforeReflow only for resize reflow cases and set MobileViewportManager::mMobileViewportSize even if mDisplaySize hasn't been changed in UpdateSizesBeforeReflow. r=tnikkel
In the case of reflowing caused by full zoom changes, the mDisplaySize isn't
changed, whereas mMobileViewportSize should be changed.

Differential Revision: https://phabricator.services.mozilla.com/D120190
2021-07-28 05:02:30 +00:00
Emilio Cobos Álvarez 5c92ba7247 Bug 1696717 - Ignore viewport meta in fullscreen. r=botond
This seems to match Chrome, and makes our fullscreen implementation more
consistent between desktop and mobile.

Do you know how to best test this? This repros in RDM, but all
fullscreen tests seem disabled on Android...

Differential Revision: https://phabricator.services.mozilla.com/D107365
2021-03-09 03:28:02 +00:00
Hiroyuki Ikezoe fcaede7cb9 Bug 1663000 - Send the composition size without the dynamic toolbar height to the compositor. r=botond
Also add AsyncPanZoomController::CanScrollDownwardsWithDynamicToolbar to tell
whether the root APZC is scrollable or there is room covered by the dynamic
toolbar so that we can tell GeckoView to move the dynamic toolbar in such cases.

Differential Revision: https://phabricator.services.mozilla.com/D93914
2020-11-04 03:16:04 +00:00
Kartikaya Gupta d0dee34b9b Bug 1671217 - Ensure we clear mIsFirstPaint in the visual-viewport-only MVM case. r=tnikkel
There should be no user-visible correctness change here, just doing less
unnecessary work.

Differential Revision: https://phabricator.services.mozilla.com/D93540
2020-10-14 19:26:27 +00:00
Kartikaya Gupta 163eebadcf Bug 1667863 - Replace AppendToString of SizeTyped with ostream usage. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D91655
2020-09-29 11:54:33 +00:00
Razvan Maries 9cd99353fc Backed out changeset b5d0e150491e (bug 1661544) for perma failures on HTMLBody-ScrollArea_quirksmode.html. 2020-09-12 09:48:34 +03:00
Botond Ballo 8c28bf105c Bug 1661544 - Ensure initial viewport is computed before reporting innerWidth. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D88947
2020-09-09 21:14:31 +00:00
Hiroyuki Ikezoe e1cc862d00 Bug 1652190 - Don't expand the composition size including the dynamic toolbar height if the root content is not scrollable. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D83601
2020-07-21 02:53:09 +00:00
Simon Giesecke a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Kartikaya Gupta 65f8b63a7f Bug 1647034 - Change how the visual viewport is updated to eliminate spurious reflows. r=tnikkel
There's two code changes in this patch:

- The update to the visual viewport that was happening just before positioning
  the fixed items gets moved to happen after determining the scrollbars for
  the root scrollframe. This moves it a little bit earlier, to basically the
  earliest point at which the visual viewport can actually be computed, since
  it depends on the presence of the root scrollframe's scrollbars.

  More importantly, this change sets the visual viewport without checking to
  see if one was already set, as the old code did. This means every reflow
  of the root scrollframe on a presShell with an MVM will now have a visual
  viewport set. Previously the visual viewport would only get set for the first
  time when the MVM got a load or first-paint event, and then would get updated
  for subsequent reflows. The net effect here is that the visual viewport is
  set earlier, and this can sometimes eliminate extra reflows from after the
  load event, because everything is already in a consistent state.

- The NotifyResizeReflow call to MVM is replaced by a NotifyReflow call that
  runs before every reflow, instead of just on resizes. Note that the
  NotifyReflow also doesn't update the visual viewport like NotifyResizeReflow
  used to do, because that is taken care of by the above-mentioned code change
  to set the visual viewport.

  This is desirable because there are things that run during reflow that attempt
  to read the display size from the MVM, and they were getting a zero size
  for reflows that happened before the first resize or load/first-paint events.
  Now they get a valid display size on every reflow, and so again this allows
  fewer overall reflows as the code converges to a stable state faster.

Together these changes ensure that every reflow has access to up-to-date
properties (display size, mobile viewport size, visual viewport size) from the
MVM. This eliminates unnecessary reflows because of out-of-order computations
based on stale values and such. Therefore the number of reflows goes down,
which is reflected by the changes to the crashtest assertion counts.

Differential Revision: https://phabricator.services.mozilla.com/D81375
2020-06-29 18:39:57 +00:00
Kartikaya Gupta e250158506 Bug 1648305 - Use the scrollable rect size for first-paint intrinsic scale calculation. r=hiro
When meta-viewport support is enabled, the call to UpdateResolutionForFirstPaint
from RefreshViewportSize is followed by a call to ShrinkToDispalySizeIfNeeded,
which calls UpdateResolutionForContentSizeChange and uses the scrollable rect
size for the intrinsic scale computation. So the intrinsic scale computation
in UpdateResolutionForFirstPaint causes a transient state where the resolution
and visual viewport size is wrong. It is corrected immediately after, but
changing the visual viewport size like that ends up marking frames dirty for
reflow. Avoiding the transient state avoids those reflows, which is a nice
optimization.

Differential Revision: https://phabricator.services.mozilla.com/D80996
2020-06-25 08:41:24 +00:00
Kartikaya Gupta 4c38b4c3bf Bug 1648193 - Additional minor cleanup. r=hiro
Instead of having callers compute the cssToDev and pass it to the zoom/
resolution conversion functions, we can just do it in those functions directly.

Differential Revision: https://phabricator.services.mozilla.com/D80939
2020-06-24 23:48:51 +00:00
Kartikaya Gupta 9eeacbea9b Bug 1648193 - Split UpdateResolution into three different functions. r=hiro
This is a hard diff to read but fundamentally a pretty simple patch. The old
UpdateResolution function had a giant if condition in the middle conditioned
on the update type. Inside the ViewportSize branch there was a further nested
if conditioned on mIsFirstPaint. The function got split into three, with each
new function holding one of the three main blocks of code, along with a copy
of the stuff before and after the if condition. And then I simplified each
function individually to remove unnecessary variables, add some early-exits
and reduce nesting levels, etc.

Depends on D80937

Differential Revision: https://phabricator.services.mozilla.com/D80938
2020-06-24 23:45:00 +00:00
Kartikaya Gupta 74fe096892 Bug 1648193 - Stop passing things to MVM that it already knows how to compute. r=hiro
This removes the two parameters to ShrinkToDisplaySizeIfNeeded and corresponding
parameters passed to UpdateResolution. The call site in nsGfxScrollFrame
gets the arguments from the MVM itself, so it seems silly to be getting things
from the MVM just to pass it back in. The other call sites are already in theMVM.
This change might be slightly less efficient because it re-computes the viewport
info when the caller might already have it but this isn't a hot code path so
I'm not too concerned.

Differential Revision: https://phabricator.services.mozilla.com/D80937
2020-06-24 22:22:17 +00:00
Kartikaya Gupta 2742cb1743 Bug 1644271 - Enable setting the visual viewport size for VisualViewportOnly-type MVM instances. r=tnikkel
Depends on D80090

Differential Revision: https://phabricator.services.mozilla.com/D80091
2020-06-21 20:48:28 +00:00
Kartikaya Gupta 79c7c2a79a Bug 1644271 - Block some codepaths that try to use a zero display size. r=tnikkel
This fixes a number of scroll-anchoring WPT tests that otherwise fail with the
final patch in this patchset. This patch also fixes a pre-existing failure on
Android, so we remove the corresponding failure annotation here.  The guard
being added already exists on some of the codepaths leading to this function,
and is used to short-circuit other bits of code. However, there are still some
codepaths that end up in this function with a zero display size, and it's better
to leave the visual viewport unset in the presShell than to set it to a zero
size.

Depends on D80086

Differential Revision: https://phabricator.services.mozilla.com/D80087
2020-06-21 20:48:37 +00:00
Razvan Maries e11758116a Backed out 6 changesets (bug 1644271) for perma failures on browser_bug1170531.js.
Backed out changeset 9d4e746c732d (bug 1644271)
Backed out changeset 681a48643a84 (bug 1644271)
Backed out changeset 3cf3176c45d4 (bug 1644271)
Backed out changeset efaddcd67a33 (bug 1644271)
Backed out changeset 03aaac05c759 (bug 1644271)
Backed out changeset a780f5111efa (bug 1644271)
2020-06-21 23:44:04 +03:00
Kartikaya Gupta dba5f7077c Bug 1644271 - Enable setting the visual viewport size for VisualViewportOnly-type MVM instances. r=tnikkel
Depends on D80090

Differential Revision: https://phabricator.services.mozilla.com/D80091
2020-06-18 09:21:36 +00:00
Kartikaya Gupta d4627f52c1 Bug 1644271 - Block some codepaths that try to use a zero display size. r=tnikkel
This fixes a number of scroll-anchoring WPT tests that otherwise fail with the
final patch in this patchset. This patch also fixes a pre-existing failure on
Android, so we remove the corresponding failure annotation here.  The guard
being added already exists on some of the codepaths leading to this function,
and is used to short-circuit other bits of code. However, there are still some
codepaths that end up in this function with a zero display size, and it's better
to leave the visual viewport unset in the presShell than to set it to a zero
size.

Depends on D80086

Differential Revision: https://phabricator.services.mozilla.com/D80087
2020-06-18 11:20:55 +00:00
Kartikaya Gupta d5d460ae92 Bug 1646385 - Ensure we recompute the visual viewport size when the root scrollframe's scrollbars get added or removed. r=tnikkel
There are two parts here. One is the "backstop" in the scrollframe's
ReflowFinished callback, that recomputes the visual viewport size if layout
scrollbars are being used in the root scrollframe. This ensures that the
visual viewport gets resized properly after a reflow, possibly at the expense
of a second reflow to reposition fixed-pos items.

There is also an update to the visual viewport during the reflow itself, after
we have reflowed the in-flow contents (including the root scrollframe) but
before we reflow the fixed-pos items. This allows us to avoid the second reflow
by using the new visual viewport for positioning the fixed-pos items correctly.
This early reflow also skips marking things for a second reflow.

This patch fixes a problem described in bug 1644271 comment 2, among other
things. Specifically, it ensures that when the scrollbar properties (e.g.
maxpos, minpos) are computed, they are computed using an up-to-date visual
viewport size. The up-to-date visual viewport size correctly excludes the space
taken up by non-overlay scrollbars, which wasn't happening without this patch.

Depends on D80039

Differential Revision: https://phabricator.services.mozilla.com/D80040
2020-06-18 22:30:00 +00:00