And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.
So basically once after the flag is set, we should use it.
Differential Revision: https://phabricator.services.mozilla.com/D160436
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.
There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.
Differential Revision: https://phabricator.services.mozilla.com/D160435
The stuff calls PanGestureBlockState::SetNeedsToWaitForContentResponse which sets
mWaitingForContentResponse flag, but the flag will clobbered in
MaybeRequestContentResponse().
Differential Revision: https://phabricator.services.mozilla.com/D160432
This in effect reverts part of bug 1756400, so that we only do the full
per-language fontconfig substitution processing for locales that use
CJK or Arabic script. These are the locales where it is likely that
there may be custom per-language/locale font preferences that need to
be respected.
(In theory fontconfig could be set up with per-language rules even for
distinctions like 'en-US' vs 'en-GB', or 'en' vs 'fr' vs 'de', etc.,
and we will no longer respect these. But it is almost vanishingly unlikely
that separate font mappings for such distinctions will really be needed,
and the cost of doing all the lookups separately for every lang tag,
even within simple writing systems like Latin, is excessive.)
No automated tests, as this is heavily dependent on the system configuration.
Differential Revision: https://phabricator.services.mozilla.com/D162304
it started as a single method new_frame_ready with a composite parameter, to be split into two functions that end up calling the same HandleFrameOneDoc with a composite parameter so the extra function doesn't provide anything.
Differential Revision: https://phabricator.services.mozilla.com/D162299
Only transactions that contain the generate_frame flag are tracked by the pending frame and frame build counters.
This patch attempts to make this clearer with two small adjustments:
Firstly by putting the IncPendingFrameCount call right next to Transaction::GenerateFrame.
Secondly, undoing the hack in wr_notifier_wake_up. The latter is called outside of normal rendered/tracked frames and was calling HandleFrameOneDoc which decrements the rendered frame counter. To compensate it had to manually increment both counters via IncPendingFrameCount and manually decrement the built frame counter via DecPendingFrameBuildCount. Instead this patch introduces the aTrackedFrame argument so that HandleFrameOneDoc only fiddles with the counters when needed and wake_up does not have to hack around it.
Differential Revision: https://phabricator.services.mozilla.com/D162298
mSkippedComposite's purpose is to keep track of the fact that the window is not up to date because the previous composite was skipped. This informs RetrySkippedComposite that a new frame is needed to get the latest changes rendered. As soon as we successfully schedule a composite know that the latest changes are en route to be rendered so we don't need RetrySkippedComposite to push an additional frame later.
Differential Revision: https://phabricator.services.mozilla.com/D162297
The previous name could have related to any situation where a composite is needed such as when animating or receiving transactions, but the function is actually specifically about scheduling a new composite if the previous one was skipped.
Differential Revision: https://phabricator.services.mozilla.com/D162295
- Ensure that the pending frame count is decremented by HandleFrameOneDoc even after some of the rare early-outs.
- Always check TooManyPendingFrames in CompositeToTarget.
It is unclear that these will actually catch (all of) the extraneous skipped frames. If anything, the simplification will make further investigation easier.
Differential Revision: https://phabricator.services.mozilla.com/D162294
So that APZ can wait to handle the event to do overscrolling until the browser
responds that the event wasn't used for gestures.
Differential Revision: https://phabricator.services.mozilla.com/D160438
And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.
So basically once after the flag is set, we should use it.
Differential Revision: https://phabricator.services.mozilla.com/D160436
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.
There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.
Differential Revision: https://phabricator.services.mozilla.com/D160435
The stuff calls PanGestureBlockState::SetNeedsToWaitForContentResponse which sets
mWaitingForContentResponse flag, but the flag will clobbered in
MaybeRequestContentResponse().
Differential Revision: https://phabricator.services.mozilla.com/D160432
According to crash data, some devices by OPPO and realme and OnePlus seem to
crash when using Font Match API. I would like to disable it until root cause
finds.
Differential Revision: https://phabricator.services.mozilla.com/D162185
By default, BorrowSnapshot is pessimistic and forces DrawTargetWebgl to return a data snapshot on
the assumption that the snapshot might be used off thread. However, if we actually know the DrawTarget
we're going to be drawing the snapshot to, then we can check if they're both DrawTargetWebgls with
the same internal SharedContext. In that case, we can use a SourceSurfaceWebgl snapshot which can
pass through a GPU texture to the target. This requires us to plumb the DrawTarget down through
SurfaceFromElement all the way to DrawTargetWebgl to make this decision.
Differential Revision: https://phabricator.services.mozilla.com/D162176
When we fallback without recreating the GPU process, we should ensure
that the gfxVar updates have been processed before recreating the
compositor sessions. This is achieved by blocking on the sync
PGPU::SendDeviceStatus IPDL message. This additional sync message only
happens during fallback and thus should be fairly cheap.
Differential Revision: https://phabricator.services.mozilla.com/D162020
It seems like Chrome allows this and it's relatively common.
We don't have a good reason to continue blocking these profiles.
Differential Revision: https://phabricator.services.mozilla.com/D162024
APZ cannot currently scroll in directions which are overflow:hidden
(it does not know the full scroll range bounds in those directions).
Therefore, main-thread scrolling in these directions should not be
handed off to APZ.
Differential Revision: https://phabricator.services.mozilla.com/D161351
* Remove workaround for a long-fixed LLVM bug
* Remove extra flags on pixman-mmx.c
* Remove unneeded -Winline flags
* Drop SIMD exceptions for macOS
* Use correct MMX define
* Enable all SIMD optimizations for Intel builds
* Clean up platform-specific logic
* Enable aarch64 optimizations on Android & Linux
Besides removing a lot of old cruft and improving general readability, this
also re-enables MMX optimizations (the define changed upstream and wasn't
updated in moz.build to reflect that) along with unconditionally compiling
with all available Intel SIMD optimization levels. Pixman does runtime CPU
feature detection, so this should be safe. It also enables AArch64
optimizations on Android and Linux.
Depends on D161868
Differential Revision: https://phabricator.services.mozilla.com/D161869
Removes patches which are no longer being applied to our import and
updates the patches that are applied to the current upstream.
Differential Revision: https://phabricator.services.mozilla.com/D161867
This in effect reverts bug 1798036 for desktop Linux, as the fix there
was really only needed for Android, and turns out to conflict with how
the FC-based backend handles variations.
Tested locally; currently no reftest because we cannot assume presence
of an installed variable font.
Differential Revision: https://phabricator.services.mozilla.com/D161958
This adds a path vertex buffer where triangle list output from WGR is stored.
Each PathCacheEntry can potentially reference a range of vertexes in this buffer
corresponding to triangles for that entry. When this buffer is full, it gets
orphaned and clears corresponding cache entries, so that it can start anew.
Differential Revision: https://phabricator.services.mozilla.com/D161479
This adds a path vertex buffer where triangle list output from WGR is stored.
Each PathCacheEntry can potentially reference a range of vertexes in this buffer
corresponding to triangles for that entry. When this buffer is full, it gets
orphaned and clears corresponding cache entries, so that it can start anew.
Differential Revision: https://phabricator.services.mozilla.com/D161479
We are seeing a number of crashes in glShaderSource on old Mali
devices (T628, T720, and T760). It's difficult to see what the problem
is without more information, but as a shot in the dark this patch
ensures we null- terminate the source strings before passing them to
the driver.
Differential Revision: https://phabricator.services.mozilla.com/D161894
This is needed so that UnscaledFontFreeType::CreateScaledFont can later call CloneFace
if it needs to apply variation settings.
Tested locally with an emulator running Android 13; not testable in CI as the older Android
versions we have there don't use the new variable-font version of Roboto.
Differential Revision: https://phabricator.services.mozilla.com/D161762
Currently splane splitters are stored in the built scene and reallocated with every new scene.
This patch moves the responsibility of storing/recycling the plane splitters to the frame builder so that they can be reused in more cases. The scene builder only needs to track splitter indices, it doesn't use the splitter objects themselves.
Alone this patch does not make a large difference because the current version of the plane_split crate reallocates everything each frame. The next version of plane_split does a much better job of recycling allocations, and applying this patch on top of it makes a large difference.
Differential Revision: https://phabricator.services.mozilla.com/D160363
New plane_split version with much faster BSP tree.
The main source of churn is plane_split not being generic over the unit tag anymore.
Differential Revision: https://phabricator.services.mozilla.com/D160362
Add basic tests for transform notifications for pan gestures with and without
momentum pans that follow the initial pan gesture.
Differential Revision: https://phabricator.services.mozilla.com/D159565
Do not fire multiple scrollend events for one pan gesture that triggers a
momentum pan. On pan-end queue a state change event to be dispatched to
the content controller in 100ms. Note that this patch does not alter
the the internal APZC state change, but only delays the notification
dispatched to the content controller.
Differential Revision: https://phabricator.services.mozilla.com/D159540
Bug 1661147 made us correctly inherit the clip chain. We do fix up the
scroll id etc before pushing a new ASR override etc, but we didn't fix
up the clip chain ID.
Differential Revision: https://phabricator.services.mozilla.com/D161382
There was still a timing that hit the assert. When ClientWebGLContext::Event_webglcontextrestored() was called just before ClientWebGLContext::UpdateWebRenderCanvasData() the assert was failed.
Differential Revision: https://phabricator.services.mozilla.com/D161243
[Int]CoordTyped no longer inherits Units because otherwise
instances of [Int]IntPointTyped may get one Base subobject because
it inherits Units, and others because of BasePoint's Coord members,
which end up increasing the [Int]CoordTyped's objects size (since
according to the ISO C++ standard, different Base subobject are
required to have different addresses).
Differential Revision: https://phabricator.services.mozilla.com/D160713
In practice, it's only instantiated on the stack; and that's kinda important,
to reduce the likelihood that it somehow outlives the 'gfxSkipChars' instance
that it maintains a raw pointer to and is iterating over.
Differential Revision: https://phabricator.services.mozilla.com/D159922
For SWGL on ARM, we implement sqrt(N) as N * inversesqrt(N). This means we don't
properly handle zero unless we explicitly check for it. Otherwise, a NaN ends up
getting produced erroneously.
Differential Revision: https://phabricator.services.mozilla.com/D161107
It feels really ugly to do this, as the problem is a badly-designed font,
not a bug in Gecko's behavior. But given that it's a standard Windows font,
I think it's probably worth having the workaround.
Differential Revision: https://phabricator.services.mozilla.com/D160820
With this, which should not change behavior unless we were about to crash,
the testcase completes successfully (although slowly, as it's generating
an 8000-plus page PDF document).
Differential Revision: https://phabricator.services.mozilla.com/D160675
Port gradient stops to be stored in the gpu-buffer rather than
the gpu-cache. The intent is to land a small use case for the
gpu-buffer code, which will allow us to get an idea if there's any
unexpected performance or driver bugs from the new gpu-buffer code,
before making wider use of this to replace the gpu-cache.
Differential Revision: https://phabricator.services.mozilla.com/D160743
This test ensures that a y-flip works correctly along with a 90/270
degree transform and a non-square content size.
Depends on D160817
Differential Revision: https://phabricator.services.mozilla.com/D160818
Gecko uses the webrender API DisplayListBuilder.push_computed_frame()
to create a reference frame with a transform specified by a scale_from
size, an optional vertical_flip, and a rotation. This is used for
video.
This patch adds the ability to test this API from wrench yaml. An
example of a test using this capability can be found in the next patch
in this series.
Depends on D160816
Differential Revision: https://phabricator.services.mozilla.com/D160817
On Android, videos with a hard-coded rotation were being incorrectly
cropped when rendering. This is due to a buggy transform calculation
in SceneBuilder.build_reference_frame().
To apply the y-flip, we scale the height by -1, then translate the y
offset by content_size.height. However, as this video contains an 90
degree rotation, this means we actually end up translating by the
video's width rather than its height. Because the width and height are
different sizes in this video, this means the video is rendered at an
incorrect offset and is cropped. To fix this, ensure we translate by
content_size.width instead for 90 or 270 degree rotations.
Note that this only occured on Android because SurfaceTextureClient is
the only texture client type that sets the ORIGIN_BOTTOM_LEFT texture
flag, thereby causing a y-flip in this location.
Differential Revision: https://phabricator.services.mozilla.com/D160816
This patch doesn't impact behavior; it's just adding an annotation to activate
a static analysis check for various classes.
The annotation gives us some confidence that these instances are tightly scoped
to a particular function-call. This helps reduce concerns about to-what-extent
the affected classes might need to worry about the lifetimes of the objects
pointed to by their member-vars.
The specific classes I'm annotating are:
- gfxTextRunDrawCallbacks and PaintTextParams, both of which have multiple
subclasses, all of which will automatically inherit this annotation and
benefit from it.
- TextFrameIterator and CharIterator, two local utility classes in
SVGTextFrame.cpp.
Differential Revision: https://phabricator.services.mozilla.com/D160694
- Add tests for overscroll handoff from a fixed position element
- Add test for overscroll handoff from a sticky position element
Differential Revision: https://phabricator.services.mozilla.com/D148662
WebRender is a mature feature. We should start blocking it on known bad
devices over allowlisting known good devices. This may enable WebRender
in a few more obscure places than we shipped before.
Differential Revision: https://phabricator.services.mozilla.com/D160120
C++20 deprecates some operations between enums and floating point types:
https://clang.llvm.org/docs/DiagnosticsReference.html#wenum-float-conversion
dom/canvas/CanvasRenderingContext2D.cpp:4743:58 [-Wenum-float-conversion] arithmetic between enumeration type 'VideoInfo::Rotation' and floating-point type 'double'
dom/events/EventStateManager.cpp:6656:35 [-Wenum-float-conversion] comparison of floating-point type 'double' with enumeration type 'mozilla::EventStateManager::(unnamed enum at dom/events/EventStateManager.h:342:3)'
dom/events/EventStateManager.cpp:6664:35 [-Wenum-float-conversion] comparison of floating-point type 'double' with enumeration type 'mozilla::EventStateManager::(unnamed enum at dom/events/EventStateManager.h:342:3)'
gfx/thebes/gfxTextRun.cpp:2992:24 [-Wenum-float-conversion] comparison of floating-point type 'gfxFloat' (aka 'double') with enumeration type 'gfxFontGroup::(unnamed enum at gfx/thebes/gfxTextRun.h:1035:3)'
layout/generic/nsVideoFrame.cpp:59:58 [-Wenum-float-conversion] arithmetic between enumeration type 'VideoInfo::Rotation' and floating-point type 'double'
layout/painting/nsCSSRenderingBorders.cpp:2752:27 [-Wenum-float-conversion] arithmetic between enumeration type 'mozilla::Corner' and floating-point type 'double'
Differential Revision: https://phabricator.services.mozilla.com/D158867
WebRender is a mature feature. We should start blocking it on known bad
devices over allowlisting known good devices. This may enable WebRender
in a few more obscure places than we shipped before.
Differential Revision: https://phabricator.services.mozilla.com/D160120
Clip tile shaders don't output the vertex W, so that SWGL can't detect if we're trying
to render something with perspective or not. swgl_drawSpan functions then get invoked
as if no perspective was used. In this case, we need to explicitly check to see if
there is perspective, or rather, that the W value varies along the span.
Differential Revision: https://phabricator.services.mozilla.com/D160464
- Add tests for overscroll handoff from a fixed position element
- Add test for overscroll handoff from a sticky position element
Differential Revision: https://phabricator.services.mozilla.com/D148662
This lets us set up CrossProcessPaint from a TaskQueue on top of main thread.
Prior to this patch if such a TaskQueue was shut down with a pending
CrossProcessPaint in flight, we'd fail MozPromise assertions because of the
failed dispatch when resolving the CrossProcessPaint::ResolvePromise.
Differential Revision: https://phabricator.services.mozilla.com/D159603
In practice, it's only instantiated on the stack; and that's kinda important,
to reduce the likelihood that it somehow outlives the 'gfxSkipChars' instance
that it maintains a raw pointer to and is iterating over.
Differential Revision: https://phabricator.services.mozilla.com/D159922
This patch doesn't change behavior; it's just using the type system to make it
clearer that this variable never gets assigned to a null pointer. (In fact, its
value is always initialized using the address of a C++ reference, which by
definition is never null.)
Note: we can't make the mSkipChars member itself into a C++ reference here;
that would prevent gfxSkipCharsIterator instances from being reassignable
(since C++ references can't be rebound), which would be a problem since we do
in fact reassign gfxSkipCharsIterator instances in a few places. In contrast,
this patch's NotNull-pointer mSkipChars does allow itself to be reassigned,
which in turn allows gfxSkipCharsIterator to remain reassignable.
Depends on D159903
Differential Revision: https://phabricator.services.mozilla.com/D159904
This patch doesn't change behavior.
This no-arg constructor only had one inadvertent usage -- it was used to
default-initialize one of ClusterIterator's member-vars, just before we
reassign it to something else in the constructor body. (I'm fixing that here
by explicitly constructing that member-var up-front in the init list, rather
than in the constructor body.)
Depends on D159902
Differential Revision: https://phabricator.services.mozilla.com/D159903
This patch hasn't been touched in ten years and the code it affects does not
appear in the file, so I think it is old an unused.
Differential Revision: https://phabricator.services.mozilla.com/D159514
In bug 1787520 we discovered a driver bug affecting Mali-G78 devices,
and added a workaround for it - avoiding invalidating no-longer-needed
render targets at the end of each render pass. It now transpires this
bug also affects Mali-G710 GPUs, so this patch applies the same
workaround for those devices too.
Differential Revision: https://phabricator.services.mozilla.com/D159515
We use this when reading the output profiles to avoid the
performance cost of doing the color transformation using LUTs
when the output profile has them.
This will let us enable ICCv4 everywhere.
Differential Revision: https://phabricator.services.mozilla.com/D159273
Some Wayland version send such duplicate events and they could cause the
page to be stuck in overscroll if the pan gesture ends without velocity for
momentum scrolling.
Differential Revision: https://phabricator.services.mozilla.com/D159139
Once https://github.com/gfx-rs/wgpu/pull/3094 is merged, unallocated and freed handles will panic in wgpu-core so we don't have to do it here. In the mean time it will produce the wrong error but still fail safely. DestroyError::Invalid means the handle exists but is not is in an invalid state, for example if the buffer was created with invalid parameter like in this bug's test case.
Differential Revision: https://phabricator.services.mozilla.com/D159054
When building the GPUBuffer during the prepare pass, we want to be
able to refer to the UV rect (and other information) about images
and render tasks. However, we don't know this information until
after the resource cache block that occurs after prepare (waiting
for blob / glyph worker threads to complete).
Previously, we would defer these queries until batching and then
reference these via a GPU cache address in the instances, which
is complicated and inefficient (making instances larger than they
need to be).
With this change, GPUBuffer supports recording "patch" locations in
the buffer that UV rects should be added. After the render task
graph is built, the GPUBuffer can resolve and patch those locations,
meaning that batching is much simpler (and reducing the number of
indirect fetches required in vertex shaders).
Differential Revision: https://phabricator.services.mozilla.com/D159236
This patch attempts to read color primary information from platform
agnostic decoders. It doesn't use any of this information to change how
the video frame is displayed.
It also cleans up some VPX transfer characteristics, to ensure they are
actually retrieved from the codec information, when available.
Differential Revision: https://phabricator.services.mozilla.com/D156362
If an external image shows up multiple times while using a different image rendering
setting on each instance, we can erroneously call handler.lock() for each instance in
parallel, thus defaulting to the last image rendering setting supplied for all instances
in that batch.
To work around this, we get rid of the concept of having RenderTextureHosts maintain and
set the image rendering state, which results in a nice simplification. Then, when we go
to actually bind an external image inside WebRender, we set the image rendering state
at that point, so that regardless of how many instances of an external image are locked
simultaneously, we always use the correct image rendering setting for a batch.
Differential Revision: https://phabricator.services.mozilla.com/D158920
Previously, the entire delta of the touch-move event that crossed
the threshold would be dropped.
While at it, fix the transition to a TOUCHING state for the
PINCHGESTURE_FINGERLIFTED case (mStartTouch should be updated to
the position of the remaining finger).
Differential Revision: https://phabricator.services.mozilla.com/D156221
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.
Differential Revision: https://phabricator.services.mozilla.com/D157958
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.
Differential Revision: https://phabricator.services.mozilla.com/D157958
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.
Differential Revision: https://phabricator.services.mozilla.com/D157958
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.
Differential Revision: https://phabricator.services.mozilla.com/D157958
Fire scrollend events to the document and elements if
apz.scrollend.event.enabled is set. If the guarding preference is not set,
fire a chrome-only event to preserve the pre-existing behavior.
Differential Revision: https://phabricator.services.mozilla.com/D157652
This patch allows constructing a VideoFrame from the ArrayBuffer* in
I420A format, which contains the I420 data with an extra alpha channel
data.
Depends on D149584
Differential Revision: https://phabricator.services.mozilla.com/D149943
The XUL behavior in nsBox.cpp is fairly different to what the non-XUL
layout code paths do. In particular, canOverride=false means that the
min-{width,height} properties cannot go under the min widget size of the
widget, but that doesn't mean that intrinsic sizes don't affect the
final size of the widget.
This is very visible if you turn on flex emulation on Windows or macOS,
where the toolbar has an appearance that returns
width=0,height=N,canOverride=false.
With flex emulation we'd collapse the item to be zero-width, which is
not good at all.
The good thing is that this is no longer exposed to the web
(non-native-theme always returns canOverride=true), and our front-end
code doesn't seem to rely on this, so we can just remove support for
canOverride=false.
Differential Revision: https://phabricator.services.mozilla.com/D158608
Includes reftest; there's fuzz at the color transitions, when compared to a CSS-backgrounds simulation,
but in the case of "real" failure there'd be many more pixels of mismatch, and max-difference would be 255.
Differential Revision: https://phabricator.services.mozilla.com/D158579
This patch allows constructing a VideoFrame from the ArrayBuffer* in
I420A format, which contains the I420 data with an extra alpha channel
data.
Depends on D149584
Differential Revision: https://phabricator.services.mozilla.com/D149943
Includes reftest; there's fuzz at the color transitions, when compared to a CSS-backgrounds simulation,
but in the case of "real" failure there'd be many more pixels of mismatch, and max-difference would be 255.
Differential Revision: https://phabricator.services.mozilla.com/D158579
Also scale back some asserts from debug-fatal to just warnings, because
I kept hitting them during testing because of our poor surface lifetime
handling.
Differential Revision: https://phabricator.services.mozilla.com/D157993
Rather than calling TruncateGradientStops, which doesn't handle this case properly (it leaves multiple
color stops because they're at the same offset), we can just delete all but the required color directly.
Added an example of this scenario to the reftest.
Differential Revision: https://phabricator.services.mozilla.com/D158509
Wait at RenderCompositorANGLE::WaitForGPU() blocks render thread. It is not good.
Since Bug 1589718 fix, AsyncImagePipelineManager::NotifyPipelinesUpdated() works without wait at RenderCompositorANGLE::WaitForGPU(). Directly bounded texture buffers are released by using aLastCompletedFrameId.
Differential Revision: https://phabricator.services.mozilla.com/D158478