Conceptually, a repaint request that arrives in APZCCallbackHelper with
!GetScrollOffsetUpdated() is a repaint request that the APZ is sending in
response to a main-thread update it received. The purpose of the repaint
request is mainly to update the displayport margins; the scroll position
and resolution should not have changed. Therefore actively trying to set
the scroll position or resolution as a result of these repaint requests
should at best be a no-op but often triggers unnecessary clobbering of things
that are in-flight, or extra reflows. This can result in buggy behaviour.
Bug 1286179 avoided doing this for the scroll position, and this patch does
the equivalent thing for zooming.
MozReview-Commit-ID: 91RbRP0ZHBe
--HG--
extra : rebase_source : 7bb97075619f5435705d369a695d37aa1c972278
To render the nested transforms properly, we need to store the inherited scale from ancestors for children.
Then apply the inherited scale for children's bounds
MozReview-Commit-ID: KYyibUD8J2j
--HG--
extra : rebase_source : fe2aeb842af477475767d0cf22c780c36b2487f0
This patch adds a new tolerance pref, which controls how far the second touchdown
is allowed to be from the first touchdown when detecting a multi-tap gesture
such as double-tap or one-touch-pinch. This stops the one-touch-pinch code
from inadvertently triggering when the user does a tap followed by a second tap
far away from the first.
The default value for the new pref is 5x the touch-start tolerance pref. This
seems to provide a reasonable behaviour for me, although this value could
probably be tuned.
MozReview-Commit-ID: 63aAyGCbvoN
--HG--
extra : rebase_source : 36e9bd66d165c8d746ea7b5d6c33e9cf2771194a
This replaces our DrawTargetCapture hack with a similar but more powerful TextDrawTarget
hack. The old design had several limitations:
* It couldn't handle shadows
* It couldn't handle selections
* It couldn't handle font/color changes in a single text-run
* It couldn't handle decorations (underline, overline, line-through)
Mostly this was a consequence of the fact that it only modified the start and end
of the rendering algorithm, and therefore couldn't distinguish draw calls for different
parts of the text.
This new design is based on a similar principle as DrawTargetCapture, but also passes
down the TextDrawTarget in the drawing arguments, so that the drawing algorithm can
notify us of changes in phase (e.g. "now we're doing underlines"). This also lets us
directly pass data to TextDrawTarget when possible (as is done for shadows and selections).
In doing this, I also improved the logic copied from ContainsOnlyColoredGlyphs to handle
changes in font/color mid-text-run (which can happen because of font fallback).
The end result is:
* We handle all shadows natively
* We handle all selections natively
* We handle all decorations natively
* We handle font/color changes in a single text-run
* Although we still hackily intercept draw calls
* But we don't need to buffer commands, reducing total memcopies
In addition, this change integrates webrender's PushTextShadow and PushLine APIs,
which were designed for this use case. This is only done in the layerless path;
WebrenderTextLayer continues to be semantically limited, as we aren't actively
maintaining non-layers-free webrender anymore.
This also doesn't modify TextLayers, to minimize churn. In theory they can be
augmented to support the richer semantics that TextDrawTarget has, but there's
little motivation since the API is largely unused with this change.
MozReview-Commit-ID: 4IjTsSW335h
--HG--
extra : rebase_source : d69f69648ade5c7a8e6bb756f4b8ab9e2543e576
This patch takes the existing code (which allows recursively pushing the necessary
part of a clip chain) and folds it into another recursive function that
operates on the ASR chain. Now the ASR recursion is the primary one, and
clips are pushed for each ASR as needed.
This code was partly modelled after the code in
ContainerState::SetupScrollingMetadata, which also iterates over the
ASRs and clips.
MozReview-Commit-ID: 1qaFPY7Ja7
--HG--
extra : rebase_source : 623b116c293e86d063e5acfa4a01f5104719f560
This allows us to keep a single stack where we track both clip ids and
scroll ids with the correct interleaving order that they were pushed in.
MozReview-Commit-ID: DHHfR8JnnBw
--HG--
extra : rebase_source : f2f80e89a400d5b9982d138b29e534701b247072
We need to ensure the compositor thread is released but we cannot upon
freeing CompositorManagerParent to do that. This is because it needs to
live longer than the thread so that shared memory allocated with this
top level protocol can be freed after the fact. As such, just release
the thread reference after IPDL has released CompositorManagerParent.
A basic sanity check here seems to produce the correct behaviour but I'm
not at all confident that this will always do the correct thing in more
complex cases or when perspectives are involved. However this is hard to
test and get working without the testing infrastructure up and running
so I'd rather land this simple code first and then dig into the more
complex cases once we have a way to catch regressions.
MozReview-Commit-ID: E4HytiZowEn
--HG--
extra : rebase_source : c7466092298aebf66926e8e0bdf58eb4651f0f19
This patch takes the existing code (which allows recursively pushing the necessary
part of a clip chain) and folds it into another recursive function that
operates on the ASR chain. Now the ASR recursion is the primary one, and
clips are pushed for each ASR as needed.
This code was partly modelled after the code in
ContainerState::SetupScrollingMetadata, which also iterates over the
ASRs and clips.
MozReview-Commit-ID: 1qaFPY7Ja7
--HG--
extra : rebase_source : 0c1879531e77998254d2ccaf87479154b179545a
This allows us to keep a single stack where we track both clip ids and
scroll ids with the correct interleaving order that they were pushed in.
MozReview-Commit-ID: DHHfR8JnnBw
--HG--
extra : rebase_source : 1eff7698ecc724b5457bdf67a6c4a70605038184
Originally we use the nsDisplayItem::ToReferenceFrame() to get the offset. But the
function doesn't consider some style effects. We should take the top-left corner
of the display item bounds as the offset.
MozReview-Commit-ID: LiPcA0vjoD7
--HG--
extra : rebase_source : 2711ca3d1b05c3f0aae6943f959b9ab41b273200
The test helper_touch_action_regions.html uses nsDOMWindowUtils to synthesize native input events and creates some runnables to trigger the test. It expects the runnables which synthesize native input events are processed first, then the runnables to continue the test, and finally the input events are forwarded from chrome process to content process. Enabling event prioritization may change the execution order.
Wraps those runnables to synthesize native input events as priority=input and dispatches those runnables to continue the test with priority=input to make sure the execution order is as expected.
MozReview-Commit-ID: 8hkaB1FRW9T
This commit modifies AsyncPanZoomController to scroll immediately for any keyboard
scrolls when the pref, "general.smoothScroll" is disabled.
MozReview-Commit-ID: 3lfRMOCC7er
--HG--
extra : source : 9e9480d318f92811828756267c4b4fb7ea2fcf1b
When a compositor is recreated, either from a driver reset or a GPU process crash, the
focus sequence number in content persists, and when APZ is recreated, content will have
a higher sequence number.
There are two ways of handling this: either resetting all of content's focus sequence
numbers to zero to match the new focus state, or updating the new focus state to the
latest sequence number in content.
This commit does the latter by detecting when the focus state was newly created and
syncing it's sequence number to content if content is ahead.
MozReview-Commit-ID: GkIp7AWyaFw
--HG--
extra : source : b6339570bbd8576447f128359278868fb6d1d8e7
This patch ensures that we push clips in WR for each display item,
reflecting the display item's clip chain as computed in Gecko. A display
item will often share part or most of its clip chain with other display
items, so we try to reuse the corresponding WR clip ids as much as we
can instead of defining new duplicated clips.
MozReview-Commit-ID: LkBh8LIpQ4J
--HG--
extra : rebase_source : 5af1de0931f1d059e98b5c66b15988961503e114
Previously, the WebRenderBridgeParent for each content layer tree would use the
same WebRenderAPI instance as the top-level WebRenderBridgeParent for that window.
However, in order to make the namespacing changes work we now need to use a
separate WebRenderAPI instance for each WebRenderBridgeParent. The content
WebRenderAPIs are cloned from the parent one, so that they all share the same
backend, but can allocate resource IDs in distinct namespaces.
MozReview-Commit-ID: 7VTFL8F09n7
--HG--
extra : rebase_source : 2da1d03abc23bd7852e4b12fe133889bd80cad53
This was spot-tested by taking the
layout/reftests/border-radius-clipping-1.html testcase, removing the
border, and fiddling with the border-radius values. Without this patch,
the div always appears with rectangular corners but with this patch the
border-radius value is respected correctly.
MozReview-Commit-ID: 1wBFnJnYCwC
--HG--
extra : rebase_source : 542f814af9369fe712af76fc2a8c78de26c6227f
This was spot-tested by taking the
layout/reftests/border-radius-clipping-1.html testcase, removing the
border, and fiddling with the border-radius values. Without this patch,
the div always appears with rectangular corners but with this patch the
border-radius value is respected correctly.
MozReview-Commit-ID: Cu1K3rLjm0V
--HG--
extra : rebase_source : b5994faceb9dd7e52222714bdbc5b06886d26415
The test helper_touch_action_regions.html uses nsDOMWindowUtils to synthesize native input events and creates some runnables to trigger the test. It expects the runnables which synthesize native input events are processed first, then the runnables to continue the test, and finally the input events are forwarded from chrome process to content process. Enabling event prioritization may change the execution order.
Wraps those runnables to synthesize native input events as priority=input and dispatches those runnables to continue the test with priority=input to make sure the execution order is as expected.
MozReview-Commit-ID: 8hkaB1FRW9T
With DXVA2 hardware-video-decoding, the RendererOGL should have a
synchronization mechanism to prevent the flickering of video texture.
Create a SyncObject in RendererOGL to do the texture synchronization.
The WebRenderAPI also exposes the RendererOGL's SyncHandle to
WebRenderBridgeParent. Then, the WebRenderBridgeParent could pass this SyncHandle
to the video decoding module for texture synchronization.
MozReview-Commit-ID: toQ2mO5fzG
From bug 1163440, there is an additional AcquireSync() call around the swapChain::Present(). Export the KeyedMutex from SyncObjectD3D11Host for this synchronization.
MozReview-Commit-ID: 8mPs4jKj67W
The MLGDeviceD3D11, CompositorD3D11 and TextureClient use the same synchronization mechanism.
Create the new SyncObjectClient/Host types for reusing code.
Add SyncObject.cpp/h and create two new data types: SyncObjectClient and SyncObjectHost.
The SyncObjectClient is used for the TextureClient synchronization at client side.
The SyncObjectHost is used for the TextureHost synchronization in renderers such
as MLGDeviceD3D11 and CompositorD3D11.
MozReview-Commit-ID: 3l56WK1aZ15
Create the corresponding RenderTextureHost type and WR commands for DXGI texture type.
The DXGITextureHostD3D11 will use 1 or 2 image keys for non-nv12 and nv12 texture format.
The DXGIYCbCrTextureHostD3D11 is a special case. The WR uses ANGLE in windows platform,
but the ANGLE doesn't support A8 format directx texture directly. So, we use libyuv to
convert the DXGIYCbCrTextureHostD3D11 texture buffer into RGBA format buffer and use
WR::AddImage() for that image. This is a slow code path. We will refine this case later.
The whole RenderD3D11TextureHostOGL implementation is in the next patch.
MozReview-Commit-ID: F4mPCALj1OY
All WR texture related codes are move into GetWRImageKeys(), AddWRImage() and PushExternalImage().
Each texture type could generate its WR commands individually. So, this "mIsWrappingNativeHandle" flag is not used anymore.
MozReview-Commit-ID: 1TITkGRemAr
This commit adds the pref, 'apz.keyboard.passive-listeners', to allow web
content to have passive key event listeners and use keyboard APZ. When we are
allowing passive listeners, we need to dispatch the input to content and can
no longer consume the event. So we use mHandledByAPZ in nsXBLWindowKeyHandler
to determine whether we still need to do the default action, or whether it
has been done by APZ.
MozReview-Commit-ID: 2HAC6DjDyPZ
--HG--
extra : rebase_source : 77543ef3f28bdbb8ef77e984097ce75cdf333c82
This is for adding a pref that will allow web content to have key listeners
and use keyboard APZ, if they are marked passive. This commit also reworks
the function names and comments to make them more accurate.
MozReview-Commit-ID: LGDaVQOK1CS
--HG--
extra : rebase_source : a6bb4b7fff3488dea62b9114aa164814c74561a4
When WebRender creation is failed, WebRender is disabled in gecko. There is a case that WebRenderBridgeParents exist when WebRender is disabled. To handle this, gecko needs to rebuild all CompositorSessions.
There is also a problem related to gfxVars::UseWebRender on compositor thread. If e10s is enabled, but no-gpu process(default on linux and mac), gfxVars::UseWebRender change is soon notified by compositor thread tasks. If WebRender creation failure happens at 2nd WebRender creation, several WebRenderBridgeParents for 1st WebRender could exist. IPC messages from WebRenderLayerManager are normally async, then there is a chance that the WebRenderBridgeParents receive the messages after the gfxVars::UseWebRender change. Further the gfxVars::UseWebRender change in content process could be delayed than WebRenderBridgeParents, then content process does not have a way to stop sending PWebRenderBridge IPC until the change of gfxVars::UseWebRender is received. WebRenderBridgeParent related tasks handle the message, but some tasks are done based on gfxVars::UseWebRender. At this time, gfxVars::UseWebRender returned false on compositor thread, then it cause unexpected result for WebRenderBridgeParent and WebRender. To addres this inconsistent situation, WebRenderBridgeParent related tasks on compositor thread stop to use gfxVars::UseWebRender.
mLastCanvasDatas store used WebRenderCanvasData in last full
transaction. So that in next empty transaction, we can update canvas
content through mLastCanvasDatas.
MozReview-Commit-ID: 2H2m8R7Kzwf
This patch move common canvas interfaces out of layer. So I create a
base class CanvasRenderer which move interfaces from CanvasLayer.
CopyableCanvasRenderer from CopyableCanvasLayer, ClientCanvasRenderer
from ClientCanvasLayer and WebRenderCanvasRenderer from
WebRenderCanvasLayer. And finally, WebRenderCanvasRendererSync for the
non layers free mode and WebRenderCanvasRendererAsync for the layers
free mode.
Summary all changes in this patch.
* Move class CanvasLayer::Data to CanvasRenderer.h and rename it to
CanvasInitializeData. Because this class not only use by layer but also
* Move BasicCanvasLayer::UpdateSurface to
CopyableCanvasRenderer::ReadbackSurface.
* CanvasClient::Update now accepts ShareableCanvasRenderer as parameter.
not CanvasLayer.
use by layers-free mode. Move it out of layer's class makes more sense.
* Add InitializeCanvasRenderer in the canvas related classes to
initialize CanvasRenderer without involved layer.
* All canvas layer has function "CreateCanvasRendererInternal" that
initialize corresponding CanvasRenderer.
* Description of all CanvasRenderer classes:
** CanvasRenderer: Based classes.
** CopyableCanvasRenderer: Can readback canvas content to a
SourceSurface. Use by BasicCanvasLayer.
** ShareableCanvasRenderer: Provide IPC capabilities that allow sending
canvas content over IPC. This is pure virtual class because the IPC handling is
different in different LayerManager.
** ClientCanvasRenderer: Implement IPC handling for ClientLayerManager.
Use by ClientCanvasLayer.
** WebRenderCanvasRenderer: Implement IPC handling for
WebRenderLayerManager.
** WebRenderCanvasRendererSync: Use by WebRenderCanvasLayer.
** WebRenderCanvasRendererAsync: Use by layers-free mode in WebRender.
class diagram shows below:
+--------------+
|CanvasRenderer|
+-------+------+
^
|
+----------------------+
|CopyableCanvasRenderer|
+----------------------+
^
|
+-----------+-----------+
|ShareableCanvasRenderer|
+-----+-----------------+
^ ^
+-------------+ +-------+
| |
+--------------------+ +---------+-------------+
|ClientCanvasRenderer| |WebRenderCanvasRenderer|
+--------------------+ +--------+--+-----------+
^ ^
+-----------------------+ +----+
| |
+-------------+-------------+ +-------------+--------------+
|WebRenderCanvasRendererSync| |WebRenderCanvasRendererAsync|
+---------------------------+ +----------------------------+
MozReview-Commit-ID: 5hqQ19W169r
When empty transaction in layers free mode, we don't rebuild whole
display list. But the canvas content will be updated and send the
content to parent by CanvasClient. We need some mechanism just like
async video which can update the content without rebuild the dl. But
CanvasClient doesn't use ImageBridge at all. So I slightly modify
AddPipelineIdForAsyncCompositable to let it support the Compostiable
either store in ImageBridge or WebRenderBridgeParent.
MozReview-Commit-ID: 3mKv13Pgc2k
The notification is sent via GeckoContentController, PAPZCTreeManager if
necessary (to go from the GPU process to the parent process), and the
observer service.
Naturally, the notification is not sent in the case where it's browser.xml
that initiates the shutdown.
MozReview-Commit-ID: IAaSf4HiDF4
--HG--
extra : rebase_source : 80855ac7d3ae44c393dde96650b330cc737f69d6
The three main changes in this patch are:
(1) Move the code to emplace_back a new WebRenderLayerScrollData to
after the display list recursion. This is necessary so that when we
empty the temporary mLayerScrollData stack into the final mScrollData
structure things end up in the right order.
(2) Maintain a stack of ASRs as we recurse so that when we are building
a given WebRenderLayerScrollData, we don't add scroll metadatas that
are already present on its ancestors.
(3) Compute the number of descendants created for each layer scroll
data item and record it, so that we can properly reconstruct the
shape of the tree.
MozReview-Commit-ID: BSdX78AqBNZ
--HG--
extra : rebase_source : 0bb4133572d74fb756476e1c5954b17f114fe7d0
Instead of the WebRenderLayerScrollData code knowing about all the
different display item types, it makes more sense to move this logic
into the display items.
In addition to avoiding dis-encapsulating the data from nsDisplayItem subclasses,
this makes it easier to handle two specific scenarios:
(1) the case where an nsDisplayItem A subclasses another nsDisplayItem B, but A
and B have different types returned by GetType(). Previously A and B would have
to be handled explicitly in the WebRenderLayerScrollData switch statements,
which doesn't scale well if new types are added. With the new approach the
virtual function is shared down from A to B and so takes care of it. This is
particularly relevant for types like nsDisplayOwnLayer which have a number of
subclasses.
(2) the case where a display item *might* have APZ-relevant information.
In this case the type of the item alone is not sufficient to determine
if we need to create a new WebRenderLayerScrollData for it. Instead, we
need to access specific state inside the display item. This is now
handled by the UpdateScrollData function returning true when passed
nullptr arguments, and replaces the switch statement in
WebRenderLayerManager that updated forceNewLayerData.
MozReview-Commit-ID: FlfHlgSccSn
--HG--
extra : rebase_source : d1fe841724cc6020433aea31ffb5214d8a44d0a9
The messages are routed through nsITabParent, nsIWidget, and IAPZCTreeManager
(the latter possibly remoted via PAPZCTreeManager if out-of-process compositing
is used).
MozReview-Commit-ID: 1zXzLa1fqpG
--HG--
extra : rebase_source : c482816ecbaec0a889d817851ee15be186b2a49c
This involves adding a new type of AsyncPanZoomAnimation, a new APZC state,
and methods to start and stop autoscrolling.
MozReview-Commit-ID: BEYPJIR30Lw
--HG--
extra : rebase_source : 81a96fd73348853f9e1a94a9f72f7de0073cc66f
We should do SchedulePaint in nsImageFrame for layers-free mode and set
invalid flag to make sure the image will be repainted.
MozReview-Commit-ID: 2lXElZ151Qa
--HG--
extra : rebase_source : 56045f66f3b36afe8a6327b841d80073f1d038cb