зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 947337) for build test errors
Backed out changeset 6ade48b8b9d7 (bug 947337) Backed out changeset f3095f92e1c3 (bug 947337) Backed out changeset 5becc07d9dac (bug 947337)
This commit is contained in:
Родитель
718a5e6d91
Коммит
2949cae437
|
@ -874,7 +874,7 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& a
|
|||
/* This function sets the aTransformToApzcOut and aTransformToGeckoOut out-parameters
|
||||
to some useful transformations that input events may need applied. This is best
|
||||
illustrated with an example. Consider a chain of layers, L, M, N, O, P, Q, R. Layer L
|
||||
is the layer that corresponds to the argument |aApzc|, and layer R is the root
|
||||
is the layer that corresponds to the returned APZC instance, and layer R is the root
|
||||
of the layer tree. Layer M is the parent of L, N is the parent of M, and so on.
|
||||
When layer L is displayed to the screen by the compositor, the set of transforms that
|
||||
are applied to L are (in order from top to bottom):
|
||||
|
@ -912,15 +912,8 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& a
|
|||
Next, if we want user inputs sent to gecko for event-dispatching, we will need to strip
|
||||
out all of the async transforms that are involved in this chain. This is because async
|
||||
transforms are stored only in the compositor and gecko does not account for them when
|
||||
doing display-list-based hit-testing for event dispatching.
|
||||
Furthermore, because these input events are processed by Gecko in a FIFO queue that
|
||||
includes other things (specifically paint requests), it is possible that by time the
|
||||
input event reaches gecko, it will have painted something else. Therefore, we need to
|
||||
apply another transform to the input events to account for the possible disparity between
|
||||
what we know gecko last painted and the last paint request we sent to gecko. Let this
|
||||
transform be represented by LD, MD, ... RD.
|
||||
Therefore, given a user input in screen space, the following transforms need to be applied
|
||||
(in order from top to bottom):
|
||||
doing display-list-based hit-testing for event dispatching. Therefore, given a user input
|
||||
in screen space, the following transforms need to be applied (in order from top to bottom):
|
||||
RC.Inverse()
|
||||
RN.Inverse()
|
||||
RT.Inverse()
|
||||
|
@ -931,36 +924,28 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& a
|
|||
LC.Inverse()
|
||||
LN.Inverse()
|
||||
LT.Inverse()
|
||||
LD
|
||||
LC
|
||||
MD
|
||||
MC
|
||||
...
|
||||
RD
|
||||
RC
|
||||
This sequence can be simplified and refactored to the following:
|
||||
aTransformToApzcOut
|
||||
LT.Inverse()
|
||||
LD
|
||||
LC
|
||||
MD
|
||||
MC
|
||||
...
|
||||
RD
|
||||
RC
|
||||
Since aTransformToApzcOut is already one of the out-parameters, we set aTransformToGeckoOut
|
||||
to the remaining transforms (LT.Inverse() * LD * ... * RC), so that the caller code can
|
||||
to the remaining transforms (LT.Inverse() * LC * ... * RC), so that the caller code can
|
||||
combine it with aTransformToApzcOut to get the final transform required in this case.
|
||||
|
||||
Note that for many of these layers, there will be no AsyncPanZoomController attached, and
|
||||
so the async transform will be the identity transform. So, in the example above, if layers
|
||||
L and P have APZC instances attached, MT, MN, MD, NT, NN, ND, OT, ON, OD, QT, QN, QD, RT,
|
||||
RN and RD will be identity transforms.
|
||||
L and P have APZC instances attached, MT, MN, NT, NN, OT, ON, QT, QN, RT and RN will be
|
||||
identity transforms.
|
||||
Additionally, for space-saving purposes, each APZC instance stores its layer's individual
|
||||
CSS transform and the accumulation of CSS transforms to its parent APZC. So the APZC for
|
||||
layer L would store LC and (MC * NC * OC), and the layer P would store PC and (QC * RC).
|
||||
The APZC instances track the last dispatched paint request and so are able to calculate LD and
|
||||
PD using those internally stored values.
|
||||
The APZCs also obviously have LT, LN, PT, and PN, so all of the above transformation combinations
|
||||
required can be generated.
|
||||
*/
|
||||
|
@ -987,8 +972,8 @@ APZCTreeManager::GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix&
|
|||
|
||||
// aTransformToApzcOut is initialized to OC.Inverse() * NC.Inverse() * MC.Inverse() * LC.Inverse() * LN.Inverse()
|
||||
aTransformToApzcOut = ancestorUntransform * aApzc->GetCSSTransform().Inverse() * nontransientAsyncTransform.Inverse();
|
||||
// aTransformToGeckoOut is initialized to LT.Inverse() * LD * LC * MC * NC * OC
|
||||
aTransformToGeckoOut = transientAsyncUntransform * aApzc->GetTransformToLastDispatchedPaint() * aApzc->GetCSSTransform() * aApzc->GetAncestorTransform();
|
||||
// aTransformToGeckoOut is initialized to LT.Inverse() * LC * MC * NC * OC
|
||||
aTransformToGeckoOut = transientAsyncUntransform * aApzc->GetCSSTransform() * aApzc->GetAncestorTransform();
|
||||
|
||||
for (AsyncPanZoomController* parent = aApzc->GetParent(); parent; parent = parent->GetParent()) {
|
||||
// ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P
|
||||
|
@ -1000,12 +985,12 @@ APZCTreeManager::GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix&
|
|||
|
||||
// aTransformToApzcOut is RC.Inverse() * QC.Inverse() * PC.Inverse() * PA.Inverse() * OC.Inverse() * NC.Inverse() * MC.Inverse() * LC.Inverse() * LN.Inverse()
|
||||
aTransformToApzcOut = untransformSinceLastApzc * aTransformToApzcOut;
|
||||
// aTransformToGeckoOut is LT.Inverse() * LD * LC * MC * NC * OC * PD * PC * QC * RC
|
||||
aTransformToGeckoOut = aTransformToGeckoOut * parent->GetTransformToLastDispatchedPaint() * parent->GetCSSTransform() * parent->GetAncestorTransform();
|
||||
// aTransformToGeckoOut is LT.Inverse() * LC * MC * NC * OC * PC * QC * RC
|
||||
aTransformToGeckoOut = aTransformToGeckoOut * parent->GetCSSTransform() * parent->GetAncestorTransform();
|
||||
|
||||
// The above values for aTransformToApzcOut and aTransformToGeckoOut when parent == P match
|
||||
// the required output as explained in the comment above this method. Note that any missing
|
||||
// terms are guaranteed to be identity transforms.
|
||||
// the required output as explained in the comment above GetTargetAPZC. Note that any missing terms
|
||||
// are async transforms that are guaranteed to be identity transforms.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1331,12 +1331,8 @@ void AsyncPanZoomController::ScheduleComposite() {
|
|||
}
|
||||
|
||||
void AsyncPanZoomController::RequestContentRepaint() {
|
||||
RequestContentRepaint(mFrameMetrics);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics) {
|
||||
aFrameMetrics.mDisplayPort =
|
||||
CalculatePendingDisplayPort(aFrameMetrics,
|
||||
mFrameMetrics.mDisplayPort =
|
||||
CalculatePendingDisplayPort(mFrameMetrics,
|
||||
GetVelocityVector(),
|
||||
GetAccelerationVector(),
|
||||
mPaintThrottler.AverageDuration().ToSeconds());
|
||||
|
@ -1345,37 +1341,32 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
|
|||
// request since it's a pointless paint.
|
||||
CSSRect oldDisplayPort = mLastPaintRequestMetrics.mDisplayPort
|
||||
+ mLastPaintRequestMetrics.mScrollOffset;
|
||||
CSSRect newDisplayPort = aFrameMetrics.mDisplayPort
|
||||
+ aFrameMetrics.mScrollOffset;
|
||||
CSSRect newDisplayPort = mFrameMetrics.mDisplayPort
|
||||
+ mFrameMetrics.mScrollOffset;
|
||||
|
||||
if (fabsf(oldDisplayPort.x - newDisplayPort.x) < EPSILON &&
|
||||
fabsf(oldDisplayPort.y - newDisplayPort.y) < EPSILON &&
|
||||
fabsf(oldDisplayPort.width - newDisplayPort.width) < EPSILON &&
|
||||
fabsf(oldDisplayPort.height - newDisplayPort.height) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.mScrollOffset.x -
|
||||
aFrameMetrics.mScrollOffset.x) < EPSILON &&
|
||||
mFrameMetrics.mScrollOffset.x) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.mScrollOffset.y -
|
||||
aFrameMetrics.mScrollOffset.y) < EPSILON &&
|
||||
aFrameMetrics.mZoom == mLastPaintRequestMetrics.mZoom &&
|
||||
fabsf(aFrameMetrics.mViewport.width - mLastPaintRequestMetrics.mViewport.width) < EPSILON &&
|
||||
fabsf(aFrameMetrics.mViewport.height - mLastPaintRequestMetrics.mViewport.height) < EPSILON) {
|
||||
mFrameMetrics.mScrollOffset.y) < EPSILON &&
|
||||
mFrameMetrics.mZoom == mLastPaintRequestMetrics.mZoom &&
|
||||
fabsf(mFrameMetrics.mViewport.width - mLastPaintRequestMetrics.mViewport.width) < EPSILON &&
|
||||
fabsf(mFrameMetrics.mViewport.height - mLastPaintRequestMetrics.mViewport.height) < EPSILON) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendAsyncScrollEvent();
|
||||
mPaintThrottler.PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this,
|
||||
&AsyncPanZoomController::DispatchRepaintRequest,
|
||||
aFrameMetrics),
|
||||
GetFrameTime());
|
||||
|
||||
aFrameMetrics.mPresShellId = mLastContentPaintMetrics.mPresShellId;
|
||||
mLastPaintRequestMetrics = aFrameMetrics;
|
||||
ScheduleContentRepaint(mFrameMetrics);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics) {
|
||||
AsyncPanZoomController::ScheduleContentRepaint(FrameMetrics &aFrameMetrics) {
|
||||
// This message is compressed, so fire whether or not we already have a paint
|
||||
// queued up. We need to know whether or not a paint was requested anyways,
|
||||
// for the purposes of content calling window.scrollTo().
|
||||
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (controller) {
|
||||
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
|
||||
|
@ -1383,9 +1374,15 @@ AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics
|
|||
LogRendertraceRect(GetGuid(), "requested displayport", "yellow",
|
||||
aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset);
|
||||
|
||||
controller->RequestContentRepaint(aFrameMetrics);
|
||||
mLastDispatchedPaintMetrics = aFrameMetrics;
|
||||
mPaintThrottler.PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(controller.get(),
|
||||
&GeckoContentController::RequestContentRepaint,
|
||||
aFrameMetrics),
|
||||
GetFrameTime());
|
||||
}
|
||||
aFrameMetrics.mPresShellId = mLastContentPaintMetrics.mPresShellId;
|
||||
mLastPaintRequestMetrics = aFrameMetrics;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1526,14 +1523,6 @@ gfx3DMatrix AsyncPanZoomController::GetNontransientAsyncTransform() {
|
|||
1.0f);
|
||||
}
|
||||
|
||||
gfx3DMatrix AsyncPanZoomController::GetTransformToLastDispatchedPaint() {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
CSSPoint scrollChange = mLastContentPaintMetrics.mScrollOffset - mLastDispatchedPaintMetrics.mScrollOffset;
|
||||
float zoomChange = mLastContentPaintMetrics.mZoom.scale / mLastDispatchedPaintMetrics.mZoom.scale;
|
||||
return gfx3DMatrix::Translation(scrollChange.x, scrollChange.y, 0) *
|
||||
gfx3DMatrix::ScalingMatrix(zoomChange, zoomChange, 1);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
|
@ -1561,18 +1550,15 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
}
|
||||
|
||||
if (aIsFirstPaint || isDefault) {
|
||||
// Initialize our internal state to something sane when the content
|
||||
// that was just painted is something we knew nothing about previously
|
||||
mPaintThrottler.ClearHistory();
|
||||
mPaintThrottler.SetMaxDurations(gNumPaintDurationSamples);
|
||||
|
||||
mX.CancelTouch();
|
||||
mY.CancelTouch();
|
||||
SetState(NOTHING);
|
||||
|
||||
mFrameMetrics = aLayerMetrics;
|
||||
mLastDispatchedPaintMetrics = aLayerMetrics;
|
||||
ShareCompositorFrameMetrics();
|
||||
SetState(NOTHING);
|
||||
} else {
|
||||
// If we're not taking the aLayerMetrics wholesale we still need to pull
|
||||
// in some things into our local mFrameMetrics because these things are
|
||||
|
@ -1702,7 +1688,7 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
|
|||
|
||||
// Schedule a repaint now, so the new displayport will be painted before the
|
||||
// animation finishes.
|
||||
RequestContentRepaint(endZoomToMetrics);
|
||||
ScheduleContentRepaint(endZoomToMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -222,15 +222,6 @@ public:
|
|||
*/
|
||||
gfx3DMatrix GetNontransientAsyncTransform();
|
||||
|
||||
/**
|
||||
* Returns the transform to take something from the coordinate space of the
|
||||
* last thing we know gecko painted, to the coordinate space of the last thing
|
||||
* we asked gecko to paint. In cases where that last request has not yet been
|
||||
* processed, this is needed to transform input events properly into a space
|
||||
* gecko will understand.
|
||||
*/
|
||||
gfx3DMatrix GetTransformToLastDispatchedPaint();
|
||||
|
||||
/**
|
||||
* Recalculates the displayport. Ideally, this should paint an area bigger
|
||||
* than the composite-to dimensions so that when you scroll down, you don't
|
||||
|
@ -491,12 +482,7 @@ protected:
|
|||
* Tell the paint throttler to request a content repaint with the given
|
||||
* metrics. (Helper function used by RequestContentRepaint.)
|
||||
*/
|
||||
void RequestContentRepaint(FrameMetrics& aFrameMetrics);
|
||||
|
||||
/**
|
||||
* Actually send the next pending paint request to gecko.
|
||||
*/
|
||||
void DispatchRepaintRequest(const FrameMetrics& aFrameMetrics);
|
||||
void ScheduleContentRepaint(FrameMetrics &aFrameMetrics);
|
||||
|
||||
/**
|
||||
* Advances a fling by an interpolated amount based on the passed in |aDelta|.
|
||||
|
@ -647,11 +633,6 @@ private:
|
|||
// that we're not requesting a paint of the same thing that's already drawn.
|
||||
// If we don't do this check, we don't get a ShadowLayersUpdated back.
|
||||
FrameMetrics mLastPaintRequestMetrics;
|
||||
// The last metrics that we actually sent to Gecko. This allows us to transform
|
||||
// inputs into a coordinate space that Gecko knows about. This assumes the pipe
|
||||
// through which input events and repaint requests are sent to Gecko operates
|
||||
// in a FIFO manner.
|
||||
FrameMetrics mLastDispatchedPaintMetrics;
|
||||
|
||||
nsTArray<MultiTouchInput> mTouchQueue;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче