Bug 1311030 - Remove more code unused since the deletion of JPZ. r=snorp

MozReview-Commit-ID: 1p8aWShTrQf

--HG--
extra : rebase_source : 49d83e86dc9c2b38c7486a04bd7e830d165c34db
This commit is contained in:
Kartikaya Gupta 2016-10-18 12:34:25 -04:00
Родитель 4dfb466667
Коммит d9a7400119
9 изменённых файлов: 2 добавлений и 408 удалений

Просмотреть файл

@ -96,58 +96,6 @@ LayerManager::GetRootScrollableLayerId()
FrameMetrics::NULL_SCROLL_ID;
}
void
LayerManager::GetRootScrollableLayers(nsTArray<Layer*>& aArray)
{
if (!mRoot) {
return;
}
FrameMetrics::ViewID rootScrollableId = GetRootScrollableLayerId();
if (rootScrollableId == FrameMetrics::NULL_SCROLL_ID) {
aArray.AppendElement(mRoot);
return;
}
nsTArray<Layer*> queue = { mRoot };
while (queue.Length()) {
Layer* layer = queue[0];
queue.RemoveElementAt(0);
if (LayerMetricsWrapper::TopmostScrollableMetrics(layer).GetScrollId() == rootScrollableId) {
aArray.AppendElement(layer);
continue;
}
for (Layer* child = layer->GetFirstChild(); child; child = child->GetNextSibling()) {
queue.AppendElement(child);
}
}
}
void
LayerManager::GetScrollableLayers(nsTArray<Layer*>& aArray)
{
if (!mRoot) {
return;
}
nsTArray<Layer*> queue = { mRoot };
while (!queue.IsEmpty()) {
Layer* layer = queue.LastElement();
queue.RemoveElementAt(queue.Length() - 1);
if (layer->HasScrollableFrameMetrics()) {
aArray.AppendElement(layer);
continue;
}
for (Layer* child = layer->GetFirstChild(); child; child = child->GetNextSibling()) {
queue.AppendElement(child);
}
}
}
LayerMetricsWrapper
LayerManager::GetRootContentLayer()
{

Просмотреть файл

@ -338,22 +338,6 @@ public:
*/
FrameMetrics::ViewID GetRootScrollableLayerId();
/**
* Does a breadth-first search from the root layer to find the first
* scrollable layer, and returns all the layers that have that ViewID
* as the first scrollable metrics in their ancestor chain. If no
* scrollable layers are found it just returns the root of the tree if
* there is one.
*/
void GetRootScrollableLayers(nsTArray<Layer*>& aArray);
/**
* Returns a list of all descendant layers for which
* GetFrameMetrics().IsScrollable() is true and that
* do not already have an ancestor in the return list.
*/
void GetScrollableLayers(nsTArray<Layer*>& aArray);
/**
* Returns a LayerMetricsWrapper containing the Root
* Content Documents layer.

Просмотреть файл

@ -1369,129 +1369,6 @@ AsyncCompositionManager::ApplyAsyncTransformToScrollbar(Layer* aLayer)
}
}
void
AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
{
FrameMetrics metrics = LayerMetricsWrapper::TopmostScrollableMetrics(aLayer);
if (!metrics.IsScrollable()) {
// On Fennec it's possible that the there is no scrollable layer in the
// tree, and this function just gets called with the root layer. In that
// case TopmostScrollableMetrics will return an empty FrameMetrics but we
// still want to use the actual non-scrollable metrics from the layer.
metrics = LayerMetricsWrapper::BottommostMetrics(aLayer);
}
// We must apply the resolution scale before a pan/zoom transform, so we call
// GetTransform here.
LayerToParentLayerMatrix4x4 oldTransform = aLayer->GetTransformTyped() *
AsyncTransformMatrix();
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
if (mIsFirstPaint) {
mContentRect = metrics.GetScrollableRect();
SetFirstPaintViewport(scrollOffsetLayerPixels,
geckoZoom,
mContentRect);
mIsFirstPaint = false;
} else if (!metrics.GetScrollableRect().IsEqualEdges(mContentRect)) {
mContentRect = metrics.GetScrollableRect();
SetPageRect(mContentRect);
}
// We synchronise the viewport information with Java after sending the above
// notifications, so that Java can take these into account in its response.
// Calculate the absolute display port to send to Java
LayerIntRect displayPort = RoundedToInt(
(metrics.GetCriticalDisplayPort().IsEmpty()
? metrics.GetDisplayPort()
: metrics.GetCriticalDisplayPort()
) * geckoZoom);
displayPort += scrollOffsetLayerPixels;
ScreenMargin fixedLayerMargins(0, 0, 0, 0);
// Ideally we would initialize userZoom to AsyncPanZoomController::CalculateResolution(metrics)
// but this causes a reftest-ipc test to fail (see bug 883646 comment 27). The reason for this
// appears to be that metrics.mZoom is poorly initialized in some scenarios. In these scenarios,
// however, we can assume there is no async zooming in progress and so the following statement
// works fine.
CSSToParentLayerScale userZoom(metrics.GetDevPixelsPerCSSPixel()
// This function only applies to the root scrollable frame,
// for which we can assume that x and y scales are equal.
* metrics.GetCumulativeResolution().ToScaleFactor()
* LayerToParentLayerScale(1));
ParentLayerRect userRect(metrics.GetScrollOffset() * userZoom,
metrics.GetCompositionBounds().Size());
SyncViewportInfo(displayPort, geckoZoom, mLayersUpdated, mPaintSyncId,
userRect, userZoom, fixedLayerMargins);
mLayersUpdated = false;
mPaintSyncId = 0;
// Handle transformations for asynchronous panning and zooming. We determine the
// zoom used by Gecko from the transformation set on the root layer, and we
// determine the scroll offset used by Gecko from the frame metrics of the
// primary scrollable layer. We compare this to the user zoom and scroll
// offset in the view transform we obtained from Java in order to compute the
// transformation we need to apply.
ParentLayerPoint geckoScroll(0, 0);
if (metrics.IsScrollable()) {
geckoScroll = metrics.GetScrollOffset() * userZoom;
}
LayerToParentLayerScale asyncZoom = userZoom / metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
ParentLayerPoint translation = userRect.TopLeft() - geckoScroll;
AsyncTransformComponentMatrix treeTransform = AsyncTransform(asyncZoom, -translation);
// Apply the tree transform on top of GetLocalTransform() here (rather than
// GetTransform()) in case the OMTA code in SampleAnimations already set a
// shadow transform; in that case we want to apply ours on top of that one
// rather than clobber it.
SetShadowTransform(aLayer, aLayer->GetLocalTransformTyped() * treeTransform);
// Make sure that overscroll and under-zoom are represented in the old
// transform so that fixed position content moves and scales accordingly.
// These calculations will effectively scale and offset fixed position layers
// in screen space when the compensatory transform is performed in
// AlignFixedAndStickyLayers.
ParentLayerRect contentScreenRect = mContentRect * userZoom;
Point3D overscrollTranslation;
if (userRect.x < contentScreenRect.x) {
overscrollTranslation.x = contentScreenRect.x - userRect.x;
} else if (userRect.XMost() > contentScreenRect.XMost()) {
overscrollTranslation.x = contentScreenRect.XMost() - userRect.XMost();
}
if (userRect.y < contentScreenRect.y) {
overscrollTranslation.y = contentScreenRect.y - userRect.y;
} else if (userRect.YMost() > contentScreenRect.YMost()) {
overscrollTranslation.y = contentScreenRect.YMost() - userRect.YMost();
}
oldTransform.PreTranslate(overscrollTranslation.x,
overscrollTranslation.y,
overscrollTranslation.z);
gfx::Size underZoomScale(1.0f, 1.0f);
if (mContentRect.width * userZoom.scale < metrics.GetCompositionBounds().width) {
underZoomScale.width = (mContentRect.width * userZoom.scale) /
metrics.GetCompositionBounds().width;
}
if (mContentRect.height * userZoom.scale < metrics.GetCompositionBounds().height) {
underZoomScale.height = (mContentRect.height * userZoom.scale) /
metrics.GetCompositionBounds().height;
}
oldTransform.PreScale(underZoomScale.width, underZoomScale.height, 1);
// Make sure fixed position layers don't move away from their anchor points
// when we're asynchronously panning or zooming
AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
aLayer->GetLocalTransformTyped(),
fixedLayerMargins, nullptr);
ExpandRootClipRect(aLayer, fixedLayerMargins);
}
void
AsyncCompositionManager::GetFrameUniformity(FrameUniformityData* aOutData)
{
@ -1548,19 +1425,6 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame,
MoveScrollbarForLayerMargin(root, mRootScrollableId, mFixedLayerMargins);
}
#endif
} else {
AutoTArray<Layer*,1> scrollableLayers;
#ifdef MOZ_WIDGET_ANDROID
mLayerManager->GetRootScrollableLayers(scrollableLayers);
#else
mLayerManager->GetScrollableLayers(scrollableLayers);
#endif
for (uint32_t i = 0; i < scrollableLayers.Length(); i++) {
if (scrollableLayers[i]) {
TransformScrollableLayer(scrollableLayers[i]);
}
}
}
// Advance APZ animations to the next expected vsync timestamp, if we can
@ -1603,40 +1467,6 @@ AsyncCompositionManager::SetFirstPaintViewport(const LayerIntPoint& aOffset,
#endif
}
void
AsyncCompositionManager::SetPageRect(const CSSRect& aCssPageRect)
{
#ifdef MOZ_WIDGET_ANDROID
widget::AndroidCompositorWidget* widget =
mLayerManager->GetCompositor()->GetWidget()->AsAndroid();
if (!widget) {
return;
}
widget->SetPageRect(aCssPageRect);
#endif
}
void
AsyncCompositionManager::SyncViewportInfo(const LayerIntRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aLayersUpdated,
int32_t aPaintSyncId,
ParentLayerRect& aScrollRect,
CSSToParentLayerScale& aScale,
ScreenMargin& aFixedLayerMargins)
{
#ifdef MOZ_WIDGET_ANDROID
widget::AndroidCompositorWidget* widget =
mLayerManager->GetCompositor()->GetWidget()->AsAndroid();
if (!widget) {
return;
}
widget->SyncViewportInfo(
aDisplayPort, aDisplayResolution, aLayersUpdated, aPaintSyncId,
aScrollRect, aScale, aFixedLayerMargins);
#endif
}
void
AsyncCompositionManager::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
const CSSToParentLayerScale& aZoom,

Просмотреть файл

@ -135,7 +135,6 @@ public:
typedef std::map<Layer*, ClipParts> ClipPartsCache;
private:
void TransformScrollableLayer(Layer* aLayer);
// Return true if an AsyncPanZoomController content transform was
// applied for |aLayer|. |*aOutFoundRoot| is set to true on Android only, if
// one of the metrics on one of the layers was determined to be the "root"
@ -152,14 +151,6 @@ private:
void SetFirstPaintViewport(const LayerIntPoint& aOffset,
const CSSToLayerScale& aZoom,
const CSSRect& aCssPageRect);
void SetPageRect(const CSSRect& aCssPageRect);
void SyncViewportInfo(const LayerIntRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aLayersUpdated,
int32_t aPaintSyncId,
ParentLayerRect& aScrollRect,
CSSToParentLayerScale& aScale,
ScreenMargin& aFixedLayerMargins);
void SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
const CSSToParentLayerScale& aZoom,
const CSSRect& aCssPageRect,

Просмотреть файл

@ -254,27 +254,6 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
GeckoAppShell.notifyObservers("Window:Resize", json);
}
/** Sets the current page rect. You must hold the monitor while calling this. */
private void setPageRect(RectF rect, RectF cssRect) {
// Since the "rect" is always just a multiple of "cssRect" we don't need to
// check both; this function assumes that both "rect" and "cssRect" are relative
// the zoom factor in mViewportMetrics.
if (mViewportMetrics.getCssPageRect().equals(cssRect))
return;
mViewportMetrics = mViewportMetrics.setPageRect(rect, cssRect);
// Page size is owned by the layer client, so no need to notify it of
// this change.
mView.post(new Runnable() {
@Override
public void run() {
mView.requestRender();
}
});
}
/**
* The different types of Viewport messages handled. All viewport events
* expect a display-port to be returned, but can handle one not being
@ -298,8 +277,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
/** The compositor invokes this function just before compositing a frame where the document
* is different from the document composited on the last frame. In these cases, the viewport
* information we have in Java is no longer valid and needs to be replaced with the new
* viewport information provided. setPageRect will never be invoked on the same frame that
* this function is invoked on; and this function will always be called prior to syncViewportInfo.
* viewport information provided.
*/
@WrapForJNI
public void setFirstPaintViewport(float offsetX, float offsetY, float zoom,
@ -330,22 +308,6 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
mContentDocumentIsDisplayed = true;
}
/** The compositor invokes this function whenever it determines that the page rect
* has changed (based on the information it gets from layout). If setFirstPaintViewport
* is invoked on a frame, then this function will not be. For any given frame, this
* function will be invoked before syncViewportInfo.
*/
@WrapForJNI
public void setPageRect(float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
synchronized (getLock()) {
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
float ourZoom = getViewportMetrics().zoomFactor;
setPageRect(RectUtils.scale(cssPageRect, ourZoom), cssPageRect);
// Here the page size of the document has changed, but the document being displayed
// is still the same. Therefore, we don't need to send anything to browser.js;
}
}
/** The compositor invokes this function on every frame to figure out what part of the
* page to display, and to inform Java of the current display port. Since it is called
* on every frame, it needs to be ultra-fast.
@ -354,8 +316,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* every time we're called. NOTE: we might be able to return a ImmutableViewportMetrics
* which would avoid the copy into mCurrentViewTransform.
*/
@WrapForJNI
public ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution, boolean layersUpdated,
private ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution, boolean layersUpdated,
int paintSyncId) {
// getViewportMetrics is thread safe so we don't need to synchronize.
// We save the viewport metrics here, so we later use it later in

Просмотреть файл

@ -25,51 +25,6 @@ AndroidCompositorWidget::SetFirstPaintViewport(const LayerIntPoint& aOffset,
aCssPageRect.y, aCssPageRect.XMost(), aCssPageRect.YMost());
}
void
AndroidCompositorWidget::SetPageRect(const CSSRect& aCssPageRect)
{
auto layerClient = static_cast<nsWindow*>(RealWidget())->GetLayerClient();
if (!layerClient) {
return;
}
layerClient->SetPageRect(aCssPageRect.x, aCssPageRect.y,
aCssPageRect.XMost(), aCssPageRect.YMost());
}
void
AndroidCompositorWidget::SyncViewportInfo(const LayerIntRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aLayersUpdated,
int32_t aPaintSyncId,
ParentLayerRect& aScrollRect,
CSSToParentLayerScale& aScale,
ScreenMargin& aFixedLayerMargins)
{
auto layerClient = static_cast<nsWindow*>(RealWidget())->GetLayerClient();
if (!layerClient) {
return;
}
java::ViewTransform::LocalRef viewTransform = layerClient->SyncViewportInfo(
aDisplayPort.x, aDisplayPort.y, aDisplayPort.width,
aDisplayPort.height, aDisplayResolution.scale, aLayersUpdated,
aPaintSyncId);
MOZ_ASSERT(viewTransform, "No view transform object!");
aScrollRect = ParentLayerRect(
viewTransform->X(), viewTransform->Y(),
viewTransform->Width(), viewTransform->Height());
aScale.scale = viewTransform->Scale();
aFixedLayerMargins.top = viewTransform->FixedLayerMarginTop();
aFixedLayerMargins.right = viewTransform->FixedLayerMarginRight();
aFixedLayerMargins.bottom = viewTransform->FixedLayerMarginBottom();
aFixedLayerMargins.left = viewTransform->FixedLayerMarginLeft();
}
void
AndroidCompositorWidget::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
const CSSToParentLayerScale& aZoom,

Просмотреть файл

@ -28,16 +28,6 @@ public:
const CSSToLayerScale& aZoom,
const CSSRect& aCssPageRect);
void SetPageRect(const CSSRect& aCssPageRect);
void SyncViewportInfo(const LayerIntRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aLayersUpdated,
int32_t aPaintSyncId,
ParentLayerRect& aScrollRect,
CSSToParentLayerScale& aScale,
ScreenMargin& aFixedLayerMargins);
void SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
const CSSToParentLayerScale& aZoom,
const CSSRect& aCssPageRect,

Просмотреть файл

@ -1135,14 +1135,6 @@ auto GeckoLayerClient::SetFirstPaintViewport(float a0, float a1, float a2, float
return mozilla::jni::Method<SetFirstPaintViewport_t>::Call(GeckoLayerClient::mCtx, nullptr, a0, a1, a2, a3, a4, a5, a6);
}
constexpr char GeckoLayerClient::SetPageRect_t::name[];
constexpr char GeckoLayerClient::SetPageRect_t::signature[];
auto GeckoLayerClient::SetPageRect(float a0, float a1, float a2, float a3) const -> void
{
return mozilla::jni::Method<SetPageRect_t>::Call(GeckoLayerClient::mCtx, nullptr, a0, a1, a2, a3);
}
constexpr char GeckoLayerClient::SyncFrameMetrics_t::name[];
constexpr char GeckoLayerClient::SyncFrameMetrics_t::signature[];
@ -1151,14 +1143,6 @@ auto GeckoLayerClient::SyncFrameMetrics(float a0, float a1, float a2, float a3,
return mozilla::jni::Method<SyncFrameMetrics_t>::Call(GeckoLayerClient::mCtx, nullptr, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
}
constexpr char GeckoLayerClient::SyncViewportInfo_t::name[];
constexpr char GeckoLayerClient::SyncViewportInfo_t::signature[];
auto GeckoLayerClient::SyncViewportInfo(int32_t a0, int32_t a1, int32_t a2, int32_t a3, float a4, bool a5, int32_t a6) const -> mozilla::jni::Object::LocalRef
{
return mozilla::jni::Method<SyncViewportInfo_t>::Call(GeckoLayerClient::mCtx, nullptr, a0, a1, a2, a3, a4, a5, a6);
}
constexpr char GeckoLayerClient::SynthesizeNativeMouseEvent_t::name[];
constexpr char GeckoLayerClient::SynthesizeNativeMouseEvent_t::signature[];

Просмотреть файл

@ -3622,29 +3622,6 @@ public:
auto SetFirstPaintViewport(float, float, float, float, float, float, float) const -> void;
struct SetPageRect_t {
typedef GeckoLayerClient Owner;
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
float,
float,
float,
float> Args;
static constexpr char name[] = "setPageRect";
static constexpr char signature[] =
"(FFFF)V";
static const bool isStatic = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
static const mozilla::jni::CallingThread callingThread =
mozilla::jni::CallingThread::ANY;
static const mozilla::jni::DispatchTarget dispatchTarget =
mozilla::jni::DispatchTarget::CURRENT;
};
auto SetPageRect(float, float, float, float) const -> void;
struct SyncFrameMetrics_t {
typedef GeckoLayerClient Owner;
typedef mozilla::jni::Object::LocalRef ReturnType;
@ -3678,32 +3655,6 @@ public:
auto SyncFrameMetrics(float, float, float, float, float, float, float, int32_t, int32_t, int32_t, int32_t, float, bool, int32_t) const -> mozilla::jni::Object::LocalRef;
struct SyncViewportInfo_t {
typedef GeckoLayerClient Owner;
typedef mozilla::jni::Object::LocalRef ReturnType;
typedef mozilla::jni::Object::Param SetterType;
typedef mozilla::jni::Args<
int32_t,
int32_t,
int32_t,
int32_t,
float,
bool,
int32_t> Args;
static constexpr char name[] = "syncViewportInfo";
static constexpr char signature[] =
"(IIIIFZI)Lorg/mozilla/gecko/gfx/ViewTransform;";
static const bool isStatic = false;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
static const mozilla::jni::CallingThread callingThread =
mozilla::jni::CallingThread::ANY;
static const mozilla::jni::DispatchTarget dispatchTarget =
mozilla::jni::DispatchTarget::CURRENT;
};
auto SyncViewportInfo(int32_t, int32_t, int32_t, int32_t, float, bool, int32_t) const -> mozilla::jni::Object::LocalRef;
struct SynthesizeNativeMouseEvent_t {
typedef GeckoLayerClient Owner;
typedef void ReturnType;