зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset cacb9f3ee44d (bug 840693)
This commit is contained in:
Родитель
ab15fcd4c3
Коммит
9096110a31
|
@ -82,7 +82,6 @@
|
||||||
#include "StructuredCloneUtils.h"
|
#include "StructuredCloneUtils.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsViewportInfo.h"
|
#include "nsViewportInfo.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
|
|
||||||
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
||||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
||||||
|
@ -346,12 +345,12 @@ TabChild::Observe(nsISupports *aSubject,
|
||||||
// Calculate a really simple resolution that we probably won't
|
// Calculate a really simple resolution that we probably won't
|
||||||
// be keeping, as well as putting the scroll offset back to
|
// be keeping, as well as putting the scroll offset back to
|
||||||
// the top-left of the page.
|
// the top-left of the page.
|
||||||
mLastMetrics.mZoom = gfx::ZoomScale(1.0, 1.0);
|
mLastMetrics.mZoom = gfxSize(1.0, 1.0);
|
||||||
mLastMetrics.mViewport =
|
mLastMetrics.mViewport =
|
||||||
gfx::Rect(0, 0,
|
gfx::Rect(0, 0,
|
||||||
kDefaultViewportSize.width, kDefaultViewportSize.height);
|
kDefaultViewportSize.width, kDefaultViewportSize.height);
|
||||||
mLastMetrics.mCompositionBounds = gfx::IntRect(gfx::IntPoint(0, 0),
|
mLastMetrics.mCompositionBounds = nsIntRect(nsIntPoint(0, 0),
|
||||||
mInnerSize);
|
mInnerSize);
|
||||||
mLastMetrics.mResolution =
|
mLastMetrics.mResolution =
|
||||||
AsyncPanZoomController::CalculateResolution(mLastMetrics);
|
AsyncPanZoomController::CalculateResolution(mLastMetrics);
|
||||||
mLastMetrics.mScrollOffset = gfx::Point(0, 0);
|
mLastMetrics.mScrollOffset = gfx::Point(0, 0);
|
||||||
|
@ -591,7 +590,7 @@ TabChild::HandlePossibleViewportChange()
|
||||||
FrameMetrics metrics(mLastMetrics);
|
FrameMetrics metrics(mLastMetrics);
|
||||||
metrics.mViewport = gfx::Rect(0.0f, 0.0f, viewportW, viewportH);
|
metrics.mViewport = gfx::Rect(0.0f, 0.0f, viewportW, viewportH);
|
||||||
metrics.mScrollableRect = gfx::Rect(0.0f, 0.0f, pageWidth, pageHeight);
|
metrics.mScrollableRect = gfx::Rect(0.0f, 0.0f, pageWidth, pageHeight);
|
||||||
metrics.mCompositionBounds = gfx::IntRect(0, 0, mInnerSize.width, mInnerSize.height);
|
metrics.mCompositionBounds = nsIntRect(0, 0, mInnerSize.width, mInnerSize.height);
|
||||||
|
|
||||||
// Changing the zoom when we're not doing a first paint will get ignored
|
// Changing the zoom when we're not doing a first paint will get ignored
|
||||||
// by AsyncPanZoomController and causes a blurry flash.
|
// by AsyncPanZoomController and causes a blurry flash.
|
||||||
|
@ -599,7 +598,7 @@ TabChild::HandlePossibleViewportChange()
|
||||||
nsresult rv = utils->GetIsFirstPaint(&isFirstPaint);
|
nsresult rv = utils->GetIsFirstPaint(&isFirstPaint);
|
||||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||||
if (NS_FAILED(rv) || isFirstPaint) {
|
if (NS_FAILED(rv) || isFirstPaint) {
|
||||||
gfx::ZoomScale intrinsicScale =
|
gfxSize intrinsicScale =
|
||||||
AsyncPanZoomController::CalculateIntrinsicScale(metrics);
|
AsyncPanZoomController::CalculateIntrinsicScale(metrics);
|
||||||
// FIXME/bug 799585(?): GetViewportInfo() returns a defaultZoom of
|
// FIXME/bug 799585(?): GetViewportInfo() returns a defaultZoom of
|
||||||
// 0.0 to mean "did not calculate a zoom". In that case, we default
|
// 0.0 to mean "did not calculate a zoom". In that case, we default
|
||||||
|
@ -613,8 +612,8 @@ TabChild::HandlePossibleViewportChange()
|
||||||
defaultZoom <= viewportInfo.GetMaxZoom());
|
defaultZoom <= viewportInfo.GetMaxZoom());
|
||||||
// GetViewportInfo() returns a resolution-dependent scale factor.
|
// GetViewportInfo() returns a resolution-dependent scale factor.
|
||||||
// Convert that to a resolution-indepedent zoom.
|
// Convert that to a resolution-indepedent zoom.
|
||||||
metrics.mZoom = gfx::ZoomScale(defaultZoom / intrinsicScale.width,
|
metrics.mZoom = gfxSize(defaultZoom / intrinsicScale.width,
|
||||||
defaultZoom / intrinsicScale.height);
|
defaultZoom / intrinsicScale.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.mDisplayPort = AsyncPanZoomController::CalculatePendingDisplayPort(
|
metrics.mDisplayPort = AsyncPanZoomController::CalculatePendingDisplayPort(
|
||||||
|
@ -622,7 +621,7 @@ TabChild::HandlePossibleViewportChange()
|
||||||
// new CSS viewport, so we know that there's no velocity, acceleration, and
|
// new CSS viewport, so we know that there's no velocity, acceleration, and
|
||||||
// we have no idea how long painting will take.
|
// we have no idea how long painting will take.
|
||||||
metrics, gfx::Point(0.0f, 0.0f), gfx::Point(0.0f, 0.0f), 0.0);
|
metrics, gfx::Point(0.0f, 0.0f), gfx::Point(0.0f, 0.0f), 0.0);
|
||||||
gfx::ZoomScale resolution = AsyncPanZoomController::CalculateResolution(metrics);
|
gfxSize resolution = AsyncPanZoomController::CalculateResolution(metrics);
|
||||||
// XXX is this actually hysteresis? This calculation is not well
|
// XXX is this actually hysteresis? This calculation is not well
|
||||||
// understood. It's taken from the previous JS implementation.
|
// understood. It's taken from the previous JS implementation.
|
||||||
gfxFloat hysteresis/*?*/ =
|
gfxFloat hysteresis/*?*/ =
|
||||||
|
@ -1372,9 +1371,7 @@ TabChild::RecvShow(const nsIntSize& size)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvUpdateDimensions(const nsRect& rect,
|
TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const ScreenOrientation& orientation)
|
||||||
const nsIntSize& size,
|
|
||||||
const ScreenOrientation& orientation)
|
|
||||||
{
|
{
|
||||||
if (!mRemoteFrame) {
|
if (!mRemoteFrame) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1386,7 +1383,7 @@ TabChild::RecvUpdateDimensions(const nsRect& rect,
|
||||||
mOuterRect.height = rect.height;
|
mOuterRect.height = rect.height;
|
||||||
|
|
||||||
mOrientation = orientation;
|
mOrientation = orientation;
|
||||||
mInnerSize = gfx::ToIntSize(size);
|
mInnerSize = size;
|
||||||
mWidget->Resize(0, 0, size.width, size.height,
|
mWidget->Resize(0, 0, size.width, size.height,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
@ -1486,7 +1483,7 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
|
||||||
utils->SetScrollPositionClampingScrollPortSize(
|
utils->SetScrollPositionClampingScrollPortSize(
|
||||||
cssCompositedRect.width, cssCompositedRect.height);
|
cssCompositedRect.width, cssCompositedRect.height);
|
||||||
ScrollWindowTo(window, aFrameMetrics.mScrollOffset);
|
ScrollWindowTo(window, aFrameMetrics.mScrollOffset);
|
||||||
gfx::ZoomScale resolution = AsyncPanZoomController::CalculateResolution(
|
gfxSize resolution = AsyncPanZoomController::CalculateResolution(
|
||||||
aFrameMetrics);
|
aFrameMetrics);
|
||||||
utils->SetResolution(resolution.width, resolution.height);
|
utils->SetResolution(resolution.width, resolution.height);
|
||||||
|
|
||||||
|
|
|
@ -201,9 +201,7 @@ public:
|
||||||
const FileDescriptor& aFileDescriptor)
|
const FileDescriptor& aFileDescriptor)
|
||||||
MOZ_OVERRIDE;
|
MOZ_OVERRIDE;
|
||||||
virtual bool RecvShow(const nsIntSize& size);
|
virtual bool RecvShow(const nsIntSize& size);
|
||||||
virtual bool RecvUpdateDimensions(const nsRect& rect,
|
virtual bool RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const ScreenOrientation& orientation);
|
||||||
const nsIntSize& size,
|
|
||||||
const ScreenOrientation& orientation);
|
|
||||||
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
||||||
virtual bool RecvHandleDoubleTap(const nsIntPoint& aPoint);
|
virtual bool RecvHandleDoubleTap(const nsIntPoint& aPoint);
|
||||||
virtual bool RecvHandleSingleTap(const nsIntPoint& aPoint);
|
virtual bool RecvHandleSingleTap(const nsIntPoint& aPoint);
|
||||||
|
@ -295,7 +293,7 @@ public:
|
||||||
/** Return the DPI of the widget this TabChild draws to. */
|
/** Return the DPI of the widget this TabChild draws to. */
|
||||||
void GetDPI(float* aDPI);
|
void GetDPI(float* aDPI);
|
||||||
|
|
||||||
const gfx::ZoomScale& GetZoom() { return mLastMetrics.mZoom; }
|
gfxSize GetZoom() { return mLastMetrics.mZoom; }
|
||||||
|
|
||||||
ScreenOrientation GetOrientation() { return mOrientation; }
|
ScreenOrientation GetOrientation() { return mOrientation; }
|
||||||
|
|
||||||
|
@ -437,8 +435,8 @@ private:
|
||||||
RenderFrameChild* mRemoteFrame;
|
RenderFrameChild* mRemoteFrame;
|
||||||
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
||||||
uint32_t mChromeFlags;
|
uint32_t mChromeFlags;
|
||||||
gfx::IntRect mOuterRect;
|
nsIntRect mOuterRect;
|
||||||
gfx::IntSize mInnerSize;
|
nsIntSize mInnerSize;
|
||||||
// When we're tracking a possible tap gesture, this is the "down"
|
// When we're tracking a possible tap gesture, this is the "down"
|
||||||
// point of the touchstart.
|
// point of the touchstart.
|
||||||
nsIntPoint mGestureDownPoint;
|
nsIntPoint mGestureDownPoint;
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
#ifndef GFX_FRAMEMETRICS_H
|
#ifndef GFX_FRAMEMETRICS_H
|
||||||
#define GFX_FRAMEMETRICS_H
|
#define GFX_FRAMEMETRICS_H
|
||||||
|
|
||||||
#include "mozilla/gfx/ZoomScale.h"
|
#include "gfxPoint.h"
|
||||||
#include "mozilla/gfx/Rect.h"
|
|
||||||
#include "mozilla/gfx/Point.h"
|
|
||||||
#include "mozilla/gfx/Types.h"
|
|
||||||
#include "nsRect.h"
|
|
||||||
#include "gfxTypes.h"
|
#include "gfxTypes.h"
|
||||||
|
#include "nsRect.h"
|
||||||
|
#include "mozilla/gfx/Rect.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
@ -82,14 +80,18 @@ public:
|
||||||
return mScrollId != NULL_SCROLL_ID;
|
return mScrollId != NULL_SCROLL_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::ZoomScale LayersPixelsPerCSSPixel() const
|
gfxSize LayersPixelsPerCSSPixel() const
|
||||||
{
|
{
|
||||||
return mResolution * mDevPixelsPerCSSPixel;
|
return mResolution * mDevPixelsPerCSSPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Point GetScrollOffsetInLayerPixels() const
|
gfxPoint GetScrollOffsetInLayerPixels() const
|
||||||
{
|
{
|
||||||
return mScrollOffset * LayersPixelsPerCSSPixel();
|
return gfxPoint(
|
||||||
|
static_cast<gfx::Float>(
|
||||||
|
mScrollOffset.x * LayersPixelsPerCSSPixel().width),
|
||||||
|
static_cast<gfx::Float>(
|
||||||
|
mScrollOffset.y * LayersPixelsPerCSSPixel().height));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@ -112,7 +114,7 @@ public:
|
||||||
//
|
//
|
||||||
// This is only valid on the root layer. Nested iframes do not need this
|
// This is only valid on the root layer. Nested iframes do not need this
|
||||||
// metric as they do not have a displayport set. See bug 775452.
|
// metric as they do not have a displayport set. See bug 775452.
|
||||||
gfx::IntRect mCompositionBounds;
|
nsIntRect mCompositionBounds;
|
||||||
|
|
||||||
// |mScrollableRect|, stored in device pixels. DECPRECATED, DO NOT USE.
|
// |mScrollableRect|, stored in device pixels. DECPRECATED, DO NOT USE.
|
||||||
//
|
//
|
||||||
|
@ -123,7 +125,7 @@ public:
|
||||||
//
|
//
|
||||||
// FIXME/bug 785929: Is this really necessary? Can it not be calculated from
|
// FIXME/bug 785929: Is this really necessary? Can it not be calculated from
|
||||||
// |mScrollableRect| whenever it's needed?
|
// |mScrollableRect| whenever it's needed?
|
||||||
gfx::IntRect mContentRect;
|
nsIntRect mContentRect;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// The following metrics are all in CSS pixels. They are not in any uniform
|
// The following metrics are all in CSS pixels. They are not in any uniform
|
||||||
|
@ -214,7 +216,7 @@ public:
|
||||||
// post-multiplied into the parent's transform. Since this only happens when
|
// post-multiplied into the parent's transform. Since this only happens when
|
||||||
// we walk the layer tree, the resulting transform isn't stored here. Thus the
|
// we walk the layer tree, the resulting transform isn't stored here. Thus the
|
||||||
// resolution of parent layers is opaque to this metric.
|
// resolution of parent layers is opaque to this metric.
|
||||||
gfx::ZoomScale mResolution;
|
gfxSize mResolution;
|
||||||
|
|
||||||
// The resolution-independent "user zoom". For example, if a page
|
// The resolution-independent "user zoom". For example, if a page
|
||||||
// configures the viewport to a zoom value of 2x, then this member
|
// configures the viewport to a zoom value of 2x, then this member
|
||||||
|
@ -229,7 +231,7 @@ public:
|
||||||
//
|
//
|
||||||
// When this is not true, we're probably asynchronously sampling a
|
// When this is not true, we're probably asynchronously sampling a
|
||||||
// zoom animation for content.
|
// zoom animation for content.
|
||||||
gfx::ZoomScale mZoom;
|
gfxSize mZoom;
|
||||||
|
|
||||||
// The conversion factor between CSS pixels and device pixels for this frame.
|
// The conversion factor between CSS pixels and device pixels for this frame.
|
||||||
// This can vary based on a variety of things, such as reflowing-zoom. The
|
// This can vary based on a variety of things, such as reflowing-zoom. The
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "gfxImageSurface.h"
|
#include "gfxImageSurface.h"
|
||||||
#include "sampler.h"
|
#include "sampler.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
#include <cstdlib> // for std::abs(int/long)
|
#include <cstdlib> // for std::abs(int/long)
|
||||||
#include <cmath> // for std::abs(float/double)
|
#include <cmath> // for std::abs(float/double)
|
||||||
|
|
||||||
|
@ -262,7 +261,7 @@ BasicTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||||
static nsIntRect
|
static nsIntRect
|
||||||
RoundedTransformViewportBounds(const gfx::Rect& aViewport,
|
RoundedTransformViewportBounds(const gfx::Rect& aViewport,
|
||||||
const gfx::Point& aScrollOffset,
|
const gfx::Point& aScrollOffset,
|
||||||
const gfx::ZoomScale& aResolution,
|
const gfxSize& aResolution,
|
||||||
float aScaleX,
|
float aScaleX,
|
||||||
float aScaleY,
|
float aScaleY,
|
||||||
const gfx3DMatrix& aTransform)
|
const gfx3DMatrix& aTransform)
|
||||||
|
@ -288,7 +287,7 @@ BasicTiledThebesLayer::ComputeProgressiveUpdateRegion(BasicTiledLayerBuffer& aTi
|
||||||
const gfx3DMatrix& aTransform,
|
const gfx3DMatrix& aTransform,
|
||||||
const nsIntRect& aCompositionBounds,
|
const nsIntRect& aCompositionBounds,
|
||||||
const gfx::Point& aScrollOffset,
|
const gfx::Point& aScrollOffset,
|
||||||
const gfx::ZoomScale& aResolution,
|
const gfxSize& aResolution,
|
||||||
bool aIsRepeated)
|
bool aIsRepeated)
|
||||||
{
|
{
|
||||||
aRegionToPaint = aInvalidRegion;
|
aRegionToPaint = aInvalidRegion;
|
||||||
|
@ -417,7 +416,7 @@ BasicTiledThebesLayer::ProgressiveUpdate(BasicTiledLayerBuffer& aTiledBuffer,
|
||||||
const gfx3DMatrix& aTransform,
|
const gfx3DMatrix& aTransform,
|
||||||
const nsIntRect& aCompositionBounds,
|
const nsIntRect& aCompositionBounds,
|
||||||
const gfx::Point& aScrollOffset,
|
const gfx::Point& aScrollOffset,
|
||||||
const gfx::ZoomScale& aResolution,
|
const gfxSize& aResolution,
|
||||||
LayerManager::DrawThebesLayerCallback aCallback,
|
LayerManager::DrawThebesLayerCallback aCallback,
|
||||||
void* aCallbackData)
|
void* aCallbackData)
|
||||||
{
|
{
|
||||||
|
@ -487,11 +486,12 @@ BasicTiledThebesLayer::BeginPaint()
|
||||||
|
|
||||||
// Compute the critical display port in layer space.
|
// Compute the critical display port in layer space.
|
||||||
mPaintData.mLayerCriticalDisplayPort.SetEmpty();
|
mPaintData.mLayerCriticalDisplayPort.SetEmpty();
|
||||||
const gfxRect criticalDisplayPort(gfx::ThebesRect(
|
const gfx::Rect& criticalDisplayPort = GetParent()->GetFrameMetrics().mCriticalDisplayPort;
|
||||||
GetParent()->GetFrameMetrics().mCriticalDisplayPort));
|
|
||||||
if (!criticalDisplayPort.IsEmpty()) {
|
if (!criticalDisplayPort.IsEmpty()) {
|
||||||
gfxRect transformedCriticalDisplayPort =
|
gfxRect transformedCriticalDisplayPort =
|
||||||
mPaintData.mTransformScreenToLayer.TransformBounds(criticalDisplayPort);
|
mPaintData.mTransformScreenToLayer.TransformBounds(
|
||||||
|
gfxRect(criticalDisplayPort.x, criticalDisplayPort.y,
|
||||||
|
criticalDisplayPort.width, criticalDisplayPort.height));
|
||||||
transformedCriticalDisplayPort.RoundOut();
|
transformedCriticalDisplayPort.RoundOut();
|
||||||
mPaintData.mLayerCriticalDisplayPort = nsIntRect(transformedCriticalDisplayPort.x,
|
mPaintData.mLayerCriticalDisplayPort = nsIntRect(transformedCriticalDisplayPort.x,
|
||||||
transformedCriticalDisplayPort.y,
|
transformedCriticalDisplayPort.y,
|
||||||
|
@ -500,7 +500,7 @@ BasicTiledThebesLayer::BeginPaint()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the frame resolution.
|
// Calculate the frame resolution.
|
||||||
mPaintData.mResolution = gfx::ZoomScale();
|
mPaintData.mResolution.SizeTo(1, 1);
|
||||||
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
|
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
|
||||||
const FrameMetrics& metrics = parent->GetFrameMetrics();
|
const FrameMetrics& metrics = parent->GetFrameMetrics();
|
||||||
mPaintData.mResolution.width *= metrics.mResolution.width;
|
mPaintData.mResolution.width *= metrics.mResolution.width;
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct BasicTiledLayerPaintData {
|
||||||
gfx::Point mScrollOffset;
|
gfx::Point mScrollOffset;
|
||||||
gfx3DMatrix mTransformScreenToLayer;
|
gfx3DMatrix mTransformScreenToLayer;
|
||||||
nsIntRect mLayerCriticalDisplayPort;
|
nsIntRect mLayerCriticalDisplayPort;
|
||||||
gfx::ZoomScale mResolution;
|
gfxSize mResolution;
|
||||||
nsIntRect mCompositionBounds;
|
nsIntRect mCompositionBounds;
|
||||||
uint16_t mLowPrecisionPaintCount;
|
uint16_t mLowPrecisionPaintCount;
|
||||||
bool mPaintFinished : 1;
|
bool mPaintFinished : 1;
|
||||||
|
@ -121,8 +121,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const gfx::ZoomScale& GetFrameResolution() { return mFrameResolution; }
|
const gfxSize& GetFrameResolution() { return mFrameResolution; }
|
||||||
void SetFrameResolution(const gfx::ZoomScale& aResolution) { mFrameResolution = aResolution; }
|
void SetFrameResolution(const gfxSize& aResolution) { mFrameResolution = aResolution; }
|
||||||
|
|
||||||
bool HasFormatChanged(BasicTiledThebesLayer* aThebesLayer) const;
|
bool HasFormatChanged(BasicTiledThebesLayer* aThebesLayer) const;
|
||||||
protected:
|
protected:
|
||||||
|
@ -147,7 +147,7 @@ private:
|
||||||
BasicTiledThebesLayer* mThebesLayer;
|
BasicTiledThebesLayer* mThebesLayer;
|
||||||
LayerManager::DrawThebesLayerCallback mCallback;
|
LayerManager::DrawThebesLayerCallback mCallback;
|
||||||
void* mCallbackData;
|
void* mCallbackData;
|
||||||
gfx::ZoomScale mFrameResolution;
|
gfxSize mFrameResolution;
|
||||||
bool mLastPaintOpaque;
|
bool mLastPaintOpaque;
|
||||||
|
|
||||||
// The buffer we use when UseSinglePaintBuffer() above is true.
|
// The buffer we use when UseSinglePaintBuffer() above is true.
|
||||||
|
@ -247,7 +247,7 @@ private:
|
||||||
const gfx3DMatrix& aTransform,
|
const gfx3DMatrix& aTransform,
|
||||||
const nsIntRect& aCompositionBounds,
|
const nsIntRect& aCompositionBounds,
|
||||||
const gfx::Point& aScrollOffset,
|
const gfx::Point& aScrollOffset,
|
||||||
const gfx::ZoomScale& aResolution,
|
const gfxSize& aResolution,
|
||||||
bool aIsRepeated);
|
bool aIsRepeated);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +261,7 @@ private:
|
||||||
const gfx3DMatrix& aTransform,
|
const gfx3DMatrix& aTransform,
|
||||||
const nsIntRect& aCompositionBounds,
|
const nsIntRect& aCompositionBounds,
|
||||||
const gfx::Point& aScrollOffset,
|
const gfx::Point& aScrollOffset,
|
||||||
const gfx::ZoomScale& aResolution,
|
const gfxSize& aResolution,
|
||||||
LayerManager::DrawThebesLayerCallback aCallback,
|
LayerManager::DrawThebesLayerCallback aCallback,
|
||||||
void* aCallbackData);
|
void* aCallbackData);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "AnimationCommon.h"
|
#include "AnimationCommon.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace mozilla::css;
|
using namespace mozilla::css;
|
||||||
|
@ -193,10 +192,6 @@ AsyncPanZoomController::~AsyncPanZoomController() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AsyncPanZoomController::ScrollBy(const gfx::Point& aOffset) {
|
|
||||||
mFrameMetrics.mScrollOffset += aOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AsyncPanZoomController::Destroy()
|
AsyncPanZoomController::Destroy()
|
||||||
{
|
{
|
||||||
|
@ -212,12 +207,12 @@ AsyncPanZoomController::GetTouchStartTolerance()
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfx::Point
|
static gfx::Point
|
||||||
WidgetSpaceToCompensatedViewportSpace(const nsIntPoint& aPoint,
|
WidgetSpaceToCompensatedViewportSpace(const gfx::Point& aPoint,
|
||||||
gfxFloat aCurrentZoom)
|
gfxFloat aCurrentZoom)
|
||||||
{
|
{
|
||||||
// Transform the input point from local widget space to the content document
|
// Transform the input point from local widget space to the content document
|
||||||
// space that the user is seeing, from last composite.
|
// space that the user is seeing, from last composite.
|
||||||
gfx::Point pt(gfx::ToIntPoint(aPoint));
|
gfx::Point pt(aPoint);
|
||||||
pt = pt / aCurrentZoom;
|
pt = pt / aCurrentZoom;
|
||||||
|
|
||||||
// FIXME/bug 775451: this doesn't attempt to compensate for content transforms
|
// FIXME/bug 775451: this doesn't attempt to compensate for content transforms
|
||||||
|
@ -238,8 +233,10 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
|
||||||
{
|
{
|
||||||
MonitorAutoLock monitor(mMonitor);
|
MonitorAutoLock monitor(mMonitor);
|
||||||
currentResolution = CalculateResolution(mFrameMetrics).width;
|
currentResolution = CalculateResolution(mFrameMetrics).width;
|
||||||
currentScrollOffset = mFrameMetrics.mScrollOffset;
|
currentScrollOffset = gfx::Point(mFrameMetrics.mScrollOffset.x,
|
||||||
lastScrollOffset = mLastContentPaintMetrics.mScrollOffset;
|
mFrameMetrics.mScrollOffset.y);
|
||||||
|
lastScrollOffset = gfx::Point(mLastContentPaintMetrics.mScrollOffset.x,
|
||||||
|
mLastContentPaintMetrics.mScrollOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
|
@ -267,7 +264,8 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
|
||||||
nsIDOMTouch* touch = touches[i];
|
nsIDOMTouch* touch = touches[i];
|
||||||
if (touch) {
|
if (touch) {
|
||||||
gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
|
gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
|
||||||
touch->mRefPoint, currentResolution);
|
gfx::Point(touch->mRefPoint.x, touch->mRefPoint.y),
|
||||||
|
currentResolution);
|
||||||
touch->mRefPoint = nsIntPoint(refPoint.x, refPoint.y);
|
touch->mRefPoint = nsIntPoint(refPoint.x, refPoint.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,7 +273,8 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
|
gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
|
||||||
aOutEvent->refPoint, currentResolution);
|
gfx::Point(aOutEvent->refPoint.x, aOutEvent->refPoint.y),
|
||||||
|
currentResolution);
|
||||||
aOutEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y);
|
aOutEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -535,7 +534,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
|
||||||
}
|
}
|
||||||
|
|
||||||
SetState(PINCHING);
|
SetState(PINCHING);
|
||||||
mLastZoomFocus = gfx::ToIntPoint(aEvent.mFocusPoint);
|
mLastZoomFocus = aEvent.mFocusPoint;
|
||||||
|
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
|
@ -557,23 +556,28 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||||
MonitorAutoLock monitor(mMonitor);
|
MonitorAutoLock monitor(mMonitor);
|
||||||
|
|
||||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||||
gfx::IntPoint focusPoint(gfx::ToIntPoint(aEvent.mFocusPoint));
|
gfxFloat userZoom = mFrameMetrics.mZoom.width;
|
||||||
gfx::Point focusChange(gfx::Point(mLastZoomFocus - focusPoint) / resolution);
|
nsIntPoint focusPoint = aEvent.mFocusPoint;
|
||||||
|
gfxFloat xFocusChange = (mLastZoomFocus.x - focusPoint.x) / resolution;
|
||||||
|
gfxFloat yFocusChange = (mLastZoomFocus.y - focusPoint.y) / resolution;
|
||||||
// If displacing by the change in focus point will take us off page bounds,
|
// If displacing by the change in focus point will take us off page bounds,
|
||||||
// then reduce the displacement such that it doesn't.
|
// then reduce the displacement such that it doesn't.
|
||||||
if (mX.DisplacementWillOverscroll(focusChange.x) != Axis::OVERSCROLL_NONE) {
|
if (mX.DisplacementWillOverscroll(xFocusChange) != Axis::OVERSCROLL_NONE) {
|
||||||
focusChange.x -= mX.DisplacementWillOverscrollAmount(focusChange.x);
|
xFocusChange -= mX.DisplacementWillOverscrollAmount(xFocusChange);
|
||||||
}
|
}
|
||||||
if (mY.DisplacementWillOverscroll(focusChange.y) != Axis::OVERSCROLL_NONE) {
|
if (mY.DisplacementWillOverscroll(yFocusChange) != Axis::OVERSCROLL_NONE) {
|
||||||
focusChange.y -= mY.DisplacementWillOverscrollAmount(focusChange.y);
|
yFocusChange -= mY.DisplacementWillOverscrollAmount(yFocusChange);
|
||||||
}
|
}
|
||||||
ScrollBy(focusChange);
|
ScrollBy(gfx::Point(xFocusChange, yFocusChange));
|
||||||
|
|
||||||
// When we zoom in with focus, we can zoom too much towards the boundaries
|
// When we zoom in with focus, we can zoom too much towards the boundaries
|
||||||
// that we actually go over them. These are the needed displacements along
|
// that we actually go over them. These are the needed displacements along
|
||||||
// either axis such that we don't overscroll the boundaries when zooming.
|
// either axis such that we don't overscroll the boundaries when zooming.
|
||||||
gfx::Point neededDisplacement;
|
gfxFloat neededDisplacementX = 0, neededDisplacementY = 0;
|
||||||
gfxFloat userZoom = mFrameMetrics.mZoom.width;
|
|
||||||
|
// Only do the scaling if we won't go over 8x zoom in or out.
|
||||||
|
bool doScale = (spanRatio > 1.0 && userZoom < mMaxZoom) ||
|
||||||
|
(spanRatio < 1.0 && userZoom > mMinZoom);
|
||||||
|
|
||||||
// If this zoom will take it over 8x zoom in either direction, but it's not
|
// If this zoom will take it over 8x zoom in either direction, but it's not
|
||||||
// already there, then normalize it.
|
// already there, then normalize it.
|
||||||
|
@ -583,10 +587,6 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||||
spanRatio = userZoom / mMinZoom;
|
spanRatio = userZoom / mMinZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only do the scaling if we won't go over 8x zoom in or out.
|
|
||||||
bool doScale = (spanRatio > 1.0 && userZoom < mMaxZoom) ||
|
|
||||||
(spanRatio < 1.0 && userZoom > mMinZoom);
|
|
||||||
|
|
||||||
if (doScale) {
|
if (doScale) {
|
||||||
switch (mX.ScaleWillOverscroll(spanRatio, focusPoint.x))
|
switch (mX.ScaleWillOverscroll(spanRatio, focusPoint.x))
|
||||||
{
|
{
|
||||||
|
@ -594,7 +594,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||||
break;
|
break;
|
||||||
case Axis::OVERSCROLL_MINUS:
|
case Axis::OVERSCROLL_MINUS:
|
||||||
case Axis::OVERSCROLL_PLUS:
|
case Axis::OVERSCROLL_PLUS:
|
||||||
neededDisplacement.x = -mX.ScaleWillOverscrollAmount(spanRatio, focusPoint.x);
|
neededDisplacementX = -mX.ScaleWillOverscrollAmount(spanRatio, focusPoint.x);
|
||||||
break;
|
break;
|
||||||
case Axis::OVERSCROLL_BOTH:
|
case Axis::OVERSCROLL_BOTH:
|
||||||
// If scaling this way will make us overscroll in both directions, then
|
// If scaling this way will make us overscroll in both directions, then
|
||||||
|
@ -613,7 +613,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||||
break;
|
break;
|
||||||
case Axis::OVERSCROLL_MINUS:
|
case Axis::OVERSCROLL_MINUS:
|
||||||
case Axis::OVERSCROLL_PLUS:
|
case Axis::OVERSCROLL_PLUS:
|
||||||
neededDisplacement.y = -mY.ScaleWillOverscrollAmount(spanRatio, focusPoint.y);
|
neededDisplacementY = -mY.ScaleWillOverscrollAmount(spanRatio, focusPoint.y);
|
||||||
break;
|
break;
|
||||||
case Axis::OVERSCROLL_BOTH:
|
case Axis::OVERSCROLL_BOTH:
|
||||||
doScale = false;
|
doScale = false;
|
||||||
|
@ -624,7 +624,9 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||||
if (doScale) {
|
if (doScale) {
|
||||||
ScaleWithFocus(userZoom * spanRatio, focusPoint);
|
ScaleWithFocus(userZoom * spanRatio, focusPoint);
|
||||||
|
|
||||||
ScrollBy(neededDisplacement);
|
if (neededDisplacementX != 0 || neededDisplacementY != 0) {
|
||||||
|
ScrollBy(gfx::Point(neededDisplacementX, neededDisplacementY));
|
||||||
|
}
|
||||||
|
|
||||||
ScheduleComposite();
|
ScheduleComposite();
|
||||||
// We don't want to redraw on every scale, so don't use
|
// We don't want to redraw on every scale, so don't use
|
||||||
|
@ -656,7 +658,8 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
|
||||||
|
|
||||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||||
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
||||||
aEvent.mPoint, resolution);
|
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||||
|
resolution);
|
||||||
mGeckoContentController->HandleLongTap(nsIntPoint(NS_lround(point.x),
|
mGeckoContentController->HandleLongTap(nsIntPoint(NS_lround(point.x),
|
||||||
NS_lround(point.y)));
|
NS_lround(point.y)));
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
|
@ -674,7 +677,8 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
|
||||||
|
|
||||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||||
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
||||||
aEvent.mPoint, resolution);
|
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||||
|
resolution);
|
||||||
mGeckoContentController->HandleSingleTap(nsIntPoint(NS_lround(point.x),
|
mGeckoContentController->HandleSingleTap(nsIntPoint(NS_lround(point.x),
|
||||||
NS_lround(point.y)));
|
NS_lround(point.y)));
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
|
@ -689,7 +693,8 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
|
||||||
if (mAllowZoom) {
|
if (mAllowZoom) {
|
||||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||||
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
gfx::Point point = WidgetSpaceToCompensatedViewportSpace(
|
||||||
aEvent.mPoint, resolution);
|
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||||
|
resolution);
|
||||||
mGeckoContentController->HandleDoubleTap(nsIntPoint(NS_lround(point.x),
|
mGeckoContentController->HandleDoubleTap(nsIntPoint(NS_lround(point.x),
|
||||||
NS_lround(point.y)));
|
NS_lround(point.y)));
|
||||||
}
|
}
|
||||||
|
@ -759,15 +764,15 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
||||||
// larger swipe should move you a shorter distance.
|
// larger swipe should move you a shorter distance.
|
||||||
gfxFloat inverseResolution = 1 / CalculateResolution(mFrameMetrics).width;
|
gfxFloat inverseResolution = 1 / CalculateResolution(mFrameMetrics).width;
|
||||||
|
|
||||||
gfx::Point displacement(
|
float xDisplacement = mX.GetDisplacementForDuration(inverseResolution,
|
||||||
mX.GetDisplacementForDuration(inverseResolution, timeDelta),
|
timeDelta);
|
||||||
mY.GetDisplacementForDuration(inverseResolution, timeDelta));
|
float yDisplacement = mY.GetDisplacementForDuration(inverseResolution,
|
||||||
|
timeDelta);
|
||||||
if (fabs(displacement.x) <= EPSILON && fabs(displacement.y) <= EPSILON) {
|
if (fabs(xDisplacement) <= EPSILON && fabs(yDisplacement) <= EPSILON) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBy(displacement);
|
ScrollBy(gfx::Point(xDisplacement, yDisplacement));
|
||||||
ScheduleComposite();
|
ScheduleComposite();
|
||||||
|
|
||||||
TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
|
TimeDuration timePaintDelta = TimeStamp::Now() - mPreviousPaintStartTime;
|
||||||
|
@ -823,6 +828,14 @@ void AsyncPanZoomController::SetCompositorParent(CompositorParent* aCompositorPa
|
||||||
mCompositorParent = aCompositorParent;
|
mCompositorParent = aCompositorParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsyncPanZoomController::ScrollBy(const gfx::Point& aOffset) {
|
||||||
|
gfx::Point newOffset(mFrameMetrics.mScrollOffset.x + aOffset.x,
|
||||||
|
mFrameMetrics.mScrollOffset.y + aOffset.y);
|
||||||
|
FrameMetrics metrics(mFrameMetrics);
|
||||||
|
metrics.mScrollOffset = newOffset;
|
||||||
|
mFrameMetrics = metrics;
|
||||||
|
}
|
||||||
|
|
||||||
void AsyncPanZoomController::SetPageRect(const gfx::Rect& aCSSPageRect) {
|
void AsyncPanZoomController::SetPageRect(const gfx::Rect& aCSSPageRect) {
|
||||||
FrameMetrics metrics = mFrameMetrics;
|
FrameMetrics metrics = mFrameMetrics;
|
||||||
gfx::Rect pageSize = aCSSPageRect;
|
gfx::Rect pageSize = aCSSPageRect;
|
||||||
|
@ -833,15 +846,15 @@ void AsyncPanZoomController::SetPageRect(const gfx::Rect& aCSSPageRect) {
|
||||||
|
|
||||||
// Round the page rect so we don't get any truncation, then get the nsIntRect
|
// Round the page rect so we don't get any truncation, then get the nsIntRect
|
||||||
// from this.
|
// from this.
|
||||||
metrics.mContentRect = gfx::IntRect(pageSize.x, pageSize.y,
|
metrics.mContentRect = nsIntRect(pageSize.x, pageSize.y,
|
||||||
pageSize.width, pageSize.height);
|
pageSize.width, pageSize.height);
|
||||||
metrics.mScrollableRect = aCSSPageRect;
|
metrics.mScrollableRect = aCSSPageRect;
|
||||||
|
|
||||||
mFrameMetrics = metrics;
|
mFrameMetrics = metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncPanZoomController::ScaleWithFocus(float aZoom,
|
void AsyncPanZoomController::ScaleWithFocus(float aZoom,
|
||||||
const gfx::IntPoint& aFocus) {
|
const nsIntPoint& aFocus) {
|
||||||
float zoomFactor = aZoom / mFrameMetrics.mZoom.width;
|
float zoomFactor = aZoom / mFrameMetrics.mZoom.width;
|
||||||
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
|
||||||
|
|
||||||
|
@ -910,7 +923,7 @@ const gfx::Rect AsyncPanZoomController::CalculatePendingDisplayPort(
|
||||||
aEstimatedPaintDuration > EPSILON ? aEstimatedPaintDuration : 1.0;
|
aEstimatedPaintDuration > EPSILON ? aEstimatedPaintDuration : 1.0;
|
||||||
|
|
||||||
gfxFloat resolution = CalculateResolution(aFrameMetrics).width;
|
gfxFloat resolution = CalculateResolution(aFrameMetrics).width;
|
||||||
gfx::IntRect compositionBounds = aFrameMetrics.mCompositionBounds;
|
nsIntRect compositionBounds = aFrameMetrics.mCompositionBounds;
|
||||||
compositionBounds.ScaleInverseRoundIn(resolution);
|
compositionBounds.ScaleInverseRoundIn(resolution);
|
||||||
gfx::Rect scrollableRect = aFrameMetrics.mScrollableRect;
|
gfx::Rect scrollableRect = aFrameMetrics.mScrollableRect;
|
||||||
|
|
||||||
|
@ -984,25 +997,31 @@ const gfx::Rect AsyncPanZoomController::CalculatePendingDisplayPort(
|
||||||
return displayPort;
|
return displayPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ gfx::ZoomScale
|
/*static*/ gfxSize
|
||||||
AsyncPanZoomController::CalculateIntrinsicScale(const FrameMetrics& aMetrics)
|
AsyncPanZoomController::CalculateIntrinsicScale(const FrameMetrics& aMetrics)
|
||||||
{
|
{
|
||||||
gfx::Float intrinsicScale = gfx::Float(aMetrics.mCompositionBounds.width) /
|
gfxFloat intrinsicScale = (gfxFloat(aMetrics.mCompositionBounds.width) /
|
||||||
gfx::Float(aMetrics.mViewport.width);
|
gfxFloat(aMetrics.mViewport.width));
|
||||||
return gfx::ZoomScale(intrinsicScale, intrinsicScale);
|
return gfxSize(intrinsicScale, intrinsicScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ gfx::ZoomScale
|
/*static*/ gfxSize
|
||||||
AsyncPanZoomController::CalculateResolution(const FrameMetrics& aMetrics)
|
AsyncPanZoomController::CalculateResolution(const FrameMetrics& aMetrics)
|
||||||
{
|
{
|
||||||
return CalculateIntrinsicScale(aMetrics) * aMetrics.mZoom;
|
gfxSize intrinsicScale = CalculateIntrinsicScale(aMetrics);
|
||||||
|
gfxSize userZoom = aMetrics.mZoom;
|
||||||
|
return gfxSize(intrinsicScale.width * userZoom.width,
|
||||||
|
intrinsicScale.height * userZoom.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ gfx::Rect
|
/*static*/ gfx::Rect
|
||||||
AsyncPanZoomController::CalculateCompositedRectInCssPixels(const FrameMetrics& aMetrics)
|
AsyncPanZoomController::CalculateCompositedRectInCssPixels(const FrameMetrics& aMetrics)
|
||||||
{
|
{
|
||||||
gfx::ZoomScale resolution = CalculateResolution(aMetrics);
|
gfxSize resolution = CalculateResolution(aMetrics);
|
||||||
gfx::Rect rect(aMetrics.mCompositionBounds);
|
gfx::Rect rect(aMetrics.mCompositionBounds.x,
|
||||||
|
aMetrics.mCompositionBounds.y,
|
||||||
|
aMetrics.mCompositionBounds.width,
|
||||||
|
aMetrics.mCompositionBounds.height);
|
||||||
rect.ScaleInverseRoundIn(resolution.width, resolution.height);
|
rect.ScaleInverseRoundIn(resolution.width, resolution.height);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1103,7 @@ void AsyncPanZoomController::RequestContentRepaint() {
|
||||||
mWaitingForContentToPaint = true;
|
mWaitingForContentToPaint = true;
|
||||||
|
|
||||||
// Set the zoom back to what it was for the purpose of logic control.
|
// Set the zoom back to what it was for the purpose of logic control.
|
||||||
mFrameMetrics.mZoom = gfx::ZoomScale(actualZoom, actualZoom);
|
mFrameMetrics.mZoom = gfxSize(actualZoom, actualZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1110,12 +1129,12 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||||
const gfx3DMatrix& currentTransform = aLayer->GetTransform();
|
const gfx3DMatrix& currentTransform = aLayer->GetTransform();
|
||||||
|
|
||||||
// Scales on the root layer, on what's currently painted.
|
// Scales on the root layer, on what's currently painted.
|
||||||
gfx::ZoomScale rootScale(currentTransform.GetXScale(),
|
gfxSize rootScale(currentTransform.GetXScale(),
|
||||||
currentTransform.GetYScale());
|
currentTransform.GetYScale());
|
||||||
|
|
||||||
gfx::Point metricsScrollOffset(0, 0);
|
gfxPoint metricsScrollOffset(0, 0);
|
||||||
gfx::Point scrollOffset;
|
gfxPoint scrollOffset;
|
||||||
gfx::ZoomScale localScale;
|
gfxSize localScale;
|
||||||
const FrameMetrics& frame = aLayer->GetFrameMetrics();
|
const FrameMetrics& frame = aLayer->GetFrameMetrics();
|
||||||
{
|
{
|
||||||
MonitorAutoLock mon(mMonitor);
|
MonitorAutoLock mon(mMonitor);
|
||||||
|
@ -1139,7 +1158,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||||
gfxFloat endZoom = mEndZoomToMetrics.mZoom.width;
|
gfxFloat endZoom = mEndZoomToMetrics.mZoom.width;
|
||||||
gfxFloat sampledZoom = (endZoom * sampledPosition +
|
gfxFloat sampledZoom = (endZoom * sampledPosition +
|
||||||
startZoom * (1 - sampledPosition));
|
startZoom * (1 - sampledPosition));
|
||||||
mFrameMetrics.mZoom = gfx::ZoomScale(sampledZoom, sampledZoom);
|
mFrameMetrics.mZoom = gfxSize(sampledZoom, sampledZoom);
|
||||||
|
|
||||||
mFrameMetrics.mScrollOffset = gfx::Point(
|
mFrameMetrics.mScrollOffset = gfx::Point(
|
||||||
mEndZoomToMetrics.mScrollOffset.x * sampledPosition +
|
mEndZoomToMetrics.mScrollOffset.x * sampledPosition +
|
||||||
|
@ -1174,7 +1193,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||||
metricsScrollOffset = frame.GetScrollOffsetInLayerPixels();
|
metricsScrollOffset = frame.GetScrollOffsetInLayerPixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollOffset = mFrameMetrics.mScrollOffset;
|
scrollOffset = gfxPoint(mFrameMetrics.mScrollOffset.x, mFrameMetrics.mScrollOffset.y);
|
||||||
mCurrentAsyncScrollOffset = mFrameMetrics.mScrollOffset;
|
mCurrentAsyncScrollOffset = mFrameMetrics.mScrollOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,7 +1224,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||||
mAsyncScrollTimeout);
|
mAsyncScrollTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Point scrollCompensation(
|
gfxPoint scrollCompensation(
|
||||||
(scrollOffset / rootScale - metricsScrollOffset) * localScale);
|
(scrollOffset / rootScale - metricsScrollOffset) * localScale);
|
||||||
*aNewTransform = ViewTransform(-scrollCompensation, localScale);
|
*aNewTransform = ViewTransform(-scrollCompensation, localScale);
|
||||||
|
|
||||||
|
@ -1255,9 +1274,9 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aViewportFr
|
||||||
aViewportFrame.mCompositionBounds.height == mFrameMetrics.mCompositionBounds.height) {
|
aViewportFrame.mCompositionBounds.height == mFrameMetrics.mCompositionBounds.height) {
|
||||||
// Remote content has sync'd up to the composition geometry
|
// Remote content has sync'd up to the composition geometry
|
||||||
// change, so we can accept the viewport it's calculated.
|
// change, so we can accept the viewport it's calculated.
|
||||||
gfx::ZoomScale previousResolution = CalculateResolution(mFrameMetrics);
|
gfxSize previousResolution = CalculateResolution(mFrameMetrics);
|
||||||
mFrameMetrics.mViewport = aViewportFrame.mViewport;
|
mFrameMetrics.mViewport = aViewportFrame.mViewport;
|
||||||
gfx::ZoomScale newResolution = CalculateResolution(mFrameMetrics);
|
gfxSize newResolution = CalculateResolution(mFrameMetrics);
|
||||||
needContentRepaint |= (previousResolution != newResolution);
|
needContentRepaint |= (previousResolution != newResolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,17 +1306,18 @@ const FrameMetrics& AsyncPanZoomController::GetFrameMetrics() {
|
||||||
return mFrameMetrics;
|
return mFrameMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncPanZoomController::UpdateCompositionBounds(const gfx::IntRect& aCompositionBounds) {
|
void AsyncPanZoomController::UpdateCompositionBounds(const nsIntRect& aCompositionBounds) {
|
||||||
MonitorAutoLock mon(mMonitor);
|
MonitorAutoLock mon(mMonitor);
|
||||||
|
|
||||||
bool wasEmpty = mFrameMetrics.mCompositionBounds.IsEmpty();
|
nsIntRect oldCompositionBounds = mFrameMetrics.mCompositionBounds;
|
||||||
mFrameMetrics.mCompositionBounds = aCompositionBounds;
|
mFrameMetrics.mCompositionBounds = aCompositionBounds;
|
||||||
|
|
||||||
// If the window had 0 dimensions before, or does now, we don't want to
|
// If the window had 0 dimensions before, or does now, we don't want to
|
||||||
// repaint or update the zoom since we'll run into rendering issues and/or
|
// repaint or update the zoom since we'll run into rendering issues and/or
|
||||||
// divide-by-zero. This manifests itself as the screen flashing. If the page
|
// divide-by-zero. This manifests itself as the screen flashing. If the page
|
||||||
// has gone out of view, the buffer will be cleared elsewhere anyways.
|
// has gone out of view, the buffer will be cleared elsewhere anyways.
|
||||||
if (!aCompositionBounds.IsEmpty() && !wasEmpty) {
|
if (aCompositionBounds.width && aCompositionBounds.height &&
|
||||||
|
oldCompositionBounds.width && oldCompositionBounds.height) {
|
||||||
SetZoomAndResolution(mFrameMetrics.mZoom.width);
|
SetZoomAndResolution(mFrameMetrics.mZoom.width);
|
||||||
|
|
||||||
// Repaint on a rotation so that our new resolution gets properly updated.
|
// Repaint on a rotation so that our new resolution gets properly updated.
|
||||||
|
@ -1317,23 +1337,23 @@ void AsyncPanZoomController::DetectScrollableSubframe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||||
gfx::Rect zoomToRect(gfx::ToRect(aRect));
|
gfx::Rect zoomToRect(gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height));
|
||||||
|
|
||||||
SetState(ANIMATING_ZOOM);
|
SetState(ANIMATING_ZOOM);
|
||||||
|
|
||||||
{
|
{
|
||||||
MonitorAutoLock mon(mMonitor);
|
MonitorAutoLock mon(mMonitor);
|
||||||
|
|
||||||
gfx::IntRect compositionBounds = mFrameMetrics.mCompositionBounds;
|
nsIntRect compositionBounds = mFrameMetrics.mCompositionBounds;
|
||||||
gfx::Rect cssPageRect = mFrameMetrics.mScrollableRect;
|
gfx::Rect cssPageRect = mFrameMetrics.mScrollableRect;
|
||||||
gfx::Point scrollOffset = mFrameMetrics.mScrollOffset;
|
gfx::Point scrollOffset = mFrameMetrics.mScrollOffset;
|
||||||
gfx::ZoomScale resolution = CalculateResolution(mFrameMetrics);
|
gfxSize resolution = CalculateResolution(mFrameMetrics);
|
||||||
|
|
||||||
// If the rect is empty, treat it as a request to zoom out to the full page
|
// If the rect is empty, treat it as a request to zoom out to the full page
|
||||||
// size.
|
// size.
|
||||||
if (zoomToRect.IsEmpty()) {
|
if (zoomToRect.IsEmpty()) {
|
||||||
// composition bounds in CSS coordinates
|
// composition bounds in CSS coordinates
|
||||||
gfx::IntRect cssCompositionBounds = compositionBounds;
|
nsIntRect cssCompositionBounds = compositionBounds;
|
||||||
cssCompositionBounds.ScaleInverseRoundIn(resolution.width,
|
cssCompositionBounds.ScaleInverseRoundIn(resolution.width,
|
||||||
resolution.height);
|
resolution.height);
|
||||||
cssCompositionBounds.MoveBy(scrollOffset.x, scrollOffset.y);
|
cssCompositionBounds.MoveBy(scrollOffset.x, scrollOffset.y);
|
||||||
|
@ -1351,7 +1371,7 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||||
|
|
||||||
gfxFloat targetResolution =
|
gfxFloat targetResolution =
|
||||||
std::min(compositionBounds.width / zoomToRect.width,
|
std::min(compositionBounds.width / zoomToRect.width,
|
||||||
compositionBounds.height / zoomToRect.height);
|
compositionBounds.height / zoomToRect.height);
|
||||||
|
|
||||||
// Recalculate the zoom to rect using the new dimensions.
|
// Recalculate the zoom to rect using the new dimensions.
|
||||||
zoomToRect.width = compositionBounds.width / targetResolution;
|
zoomToRect.width = compositionBounds.width / targetResolution;
|
||||||
|
@ -1362,13 +1382,13 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||||
|
|
||||||
// Do one final recalculation to get the resolution.
|
// Do one final recalculation to get the resolution.
|
||||||
targetResolution = std::max(compositionBounds.width / zoomToRect.width,
|
targetResolution = std::max(compositionBounds.width / zoomToRect.width,
|
||||||
compositionBounds.height / zoomToRect.height);
|
compositionBounds.height / zoomToRect.height);
|
||||||
float targetZoom = float(targetResolution / resolution.width) * mFrameMetrics.mZoom.width;
|
float targetZoom = float(targetResolution / resolution.width) * mFrameMetrics.mZoom.width;
|
||||||
|
|
||||||
// If current zoom is equal to mMaxZoom,
|
// If current zoom is equal to mMaxZoom,
|
||||||
// user still double-tapping it, just zoom-out to the full page size
|
// user still double-tapping it, just zoom-out to the full page size
|
||||||
if (mFrameMetrics.mZoom.width == mMaxZoom && targetZoom >= mMaxZoom) {
|
if (mFrameMetrics.mZoom.width == mMaxZoom && targetZoom >= mMaxZoom) {
|
||||||
gfx::IntRect cssCompositionBounds = compositionBounds;
|
nsIntRect cssCompositionBounds = compositionBounds;
|
||||||
cssCompositionBounds.ScaleInverseRoundIn(resolution.width,
|
cssCompositionBounds.ScaleInverseRoundIn(resolution.width,
|
||||||
resolution.height);
|
resolution.height);
|
||||||
cssCompositionBounds.MoveBy(scrollOffset.x, scrollOffset.y);
|
cssCompositionBounds.MoveBy(scrollOffset.x, scrollOffset.y);
|
||||||
|
@ -1389,7 +1409,7 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFloat targetFinalZoom = clamped(targetZoom, mMinZoom, mMaxZoom);
|
gfxFloat targetFinalZoom = clamped(targetZoom, mMinZoom, mMaxZoom);
|
||||||
mEndZoomToMetrics.mZoom = gfx::ZoomScale(targetFinalZoom, targetFinalZoom);
|
mEndZoomToMetrics.mZoom = gfxSize(targetFinalZoom, targetFinalZoom);
|
||||||
|
|
||||||
mStartZoomToMetrics = mFrameMetrics;
|
mStartZoomToMetrics = mFrameMetrics;
|
||||||
mEndZoomToMetrics.mScrollOffset =
|
mEndZoomToMetrics.mScrollOffset =
|
||||||
|
@ -1457,7 +1477,7 @@ void AsyncPanZoomController::TimeoutTouchListeners() {
|
||||||
|
|
||||||
void AsyncPanZoomController::SetZoomAndResolution(float aZoom) {
|
void AsyncPanZoomController::SetZoomAndResolution(float aZoom) {
|
||||||
mMonitor.AssertCurrentThreadOwns();
|
mMonitor.AssertCurrentThreadOwns();
|
||||||
mFrameMetrics.mZoom = gfx::ZoomScale(aZoom, aZoom);
|
mFrameMetrics.mZoom = gfxSize(aZoom, aZoom);
|
||||||
mFrameMetrics.mResolution = CalculateResolution(mFrameMetrics);
|
mFrameMetrics.mResolution = CalculateResolution(mFrameMetrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1485,7 +1505,8 @@ void AsyncPanZoomController::SendAsyncScrollEvent() {
|
||||||
gfx::Rect contentRect;
|
gfx::Rect contentRect;
|
||||||
gfx::Size scrollableSize;
|
gfx::Size scrollableSize;
|
||||||
{
|
{
|
||||||
scrollableSize = mFrameMetrics.mScrollableRect.Size();
|
scrollableSize = gfx::Size(mFrameMetrics.mScrollableRect.width,
|
||||||
|
mFrameMetrics.mScrollableRect.height);
|
||||||
contentRect =
|
contentRect =
|
||||||
AsyncPanZoomController::CalculateCompositedRectInCssPixels(mFrameMetrics);
|
AsyncPanZoomController::CalculateCompositedRectInCssPixels(mFrameMetrics);
|
||||||
contentRect.MoveTo(mCurrentAsyncScrollOffset);
|
contentRect.MoveTo(mCurrentAsyncScrollOffset);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
* { x = 0, y = 0, width = surface.width, height = surface.height }, however
|
* { x = 0, y = 0, width = surface.width, height = surface.height }, however
|
||||||
* there is no hard requirement for this.
|
* there is no hard requirement for this.
|
||||||
*/
|
*/
|
||||||
void UpdateCompositionBounds(const gfx::IntRect& aCompositionBounds);
|
void UpdateCompositionBounds(const nsIntRect& aCompositionBounds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We are scrolling a subframe, so disable our machinery until we hit
|
* We are scrolling a subframe, so disable our machinery until we hit
|
||||||
|
@ -232,7 +232,7 @@ public:
|
||||||
* Return the scale factor needed to fit the viewport in |aMetrics|
|
* Return the scale factor needed to fit the viewport in |aMetrics|
|
||||||
* into its composition bounds.
|
* into its composition bounds.
|
||||||
*/
|
*/
|
||||||
static gfx::ZoomScale CalculateIntrinsicScale(const FrameMetrics& aMetrics);
|
static gfxSize CalculateIntrinsicScale(const FrameMetrics& aMetrics);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the resolution that content should be rendered at given
|
* Return the resolution that content should be rendered at given
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
* factor, etc. (The mResolution member of aFrameMetrics is
|
* factor, etc. (The mResolution member of aFrameMetrics is
|
||||||
* ignored.)
|
* ignored.)
|
||||||
*/
|
*/
|
||||||
static gfx::ZoomScale CalculateResolution(const FrameMetrics& aMetrics);
|
static gfxSize CalculateResolution(const FrameMetrics& aMetrics);
|
||||||
|
|
||||||
static gfx::Rect CalculateCompositedRectInCssPixels(const FrameMetrics& aMetrics);
|
static gfx::Rect CalculateCompositedRectInCssPixels(const FrameMetrics& aMetrics);
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ protected:
|
||||||
*
|
*
|
||||||
* XXX: Fix focus point calculations.
|
* XXX: Fix focus point calculations.
|
||||||
*/
|
*/
|
||||||
void ScaleWithFocus(float aScale, const gfx::IntPoint& aFocus);
|
void ScaleWithFocus(float aScale, const nsIntPoint& aFocus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a composite on the compositor thread. Wrapper for
|
* Schedules a composite on the compositor thread. Wrapper for
|
||||||
|
@ -551,7 +551,7 @@ private:
|
||||||
|
|
||||||
// Stores the previous focus point if there is a pinch gesture happening. Used
|
// Stores the previous focus point if there is a pinch gesture happening. Used
|
||||||
// to allow panning by moving multiple fingers (thus moving the focus point).
|
// to allow panning by moving multiple fingers (thus moving the focus point).
|
||||||
gfx::IntPoint mLastZoomFocus;
|
nsIntPoint mLastZoomFocus;
|
||||||
|
|
||||||
// Stores the state of panning and zooming this frame. This is protected by
|
// Stores the state of panning and zooming this frame. This is protected by
|
||||||
// |mMonitor|; that is, it should be held whenever this is updated.
|
// |mMonitor|; that is, it should be held whenever this is updated.
|
||||||
|
|
|
@ -324,7 +324,10 @@ bool Axis::ScaleWillOverscrollBothSides(float aScale) {
|
||||||
gfx::Rect cssContentRect = metrics.mScrollableRect;
|
gfx::Rect cssContentRect = metrics.mScrollableRect;
|
||||||
|
|
||||||
float currentScale = metrics.mZoom.width;
|
float currentScale = metrics.mZoom.width;
|
||||||
gfx::Rect scaledCompositionBounds(metrics.mCompositionBounds);
|
nsIntRect compositionBounds = metrics.mCompositionBounds;
|
||||||
|
gfx::Rect scaledCompositionBounds =
|
||||||
|
gfx::Rect(compositionBounds.x, compositionBounds.y,
|
||||||
|
compositionBounds.width, compositionBounds.height);
|
||||||
scaledCompositionBounds.ScaleInverseRoundIn(currentScale * aScale);
|
scaledCompositionBounds.ScaleInverseRoundIn(currentScale * aScale);
|
||||||
|
|
||||||
return GetRectLength(cssContentRect) < GetRectLength(scaledCompositionBounds);
|
return GetRectLength(cssContentRect) < GetRectLength(scaledCompositionBounds);
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "mozilla/dom/ScreenOrientation.h"
|
#include "mozilla/dom/ScreenOrientation.h"
|
||||||
#include "mozilla/AutoRestore.h"
|
#include "mozilla/AutoRestore.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
|
|
||||||
using namespace base;
|
using namespace base;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -475,7 +474,7 @@ CompositorParent::ScheduleComposition()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositorParent::SetTransformation(float aScale, gfx::IntPoint aScrollOffset)
|
CompositorParent::SetTransformation(float aScale, nsIntPoint aScrollOffset)
|
||||||
{
|
{
|
||||||
mXScale = aScale;
|
mXScale = aScale;
|
||||||
mYScale = aScale;
|
mYScale = aScale;
|
||||||
|
@ -872,8 +871,8 @@ CompositorParent::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFrame,
|
||||||
|
|
||||||
TransformFixedLayers(
|
TransformFixedLayers(
|
||||||
aLayer,
|
aLayer,
|
||||||
gfx::ThebesPoint(-treeTransform.mTranslation / treeTransform.mScale),
|
-treeTransform.mTranslation / treeTransform.mScale,
|
||||||
gfxSize(treeTransform.mScale.width, treeTransform.mScale.height));
|
treeTransform.mScale);
|
||||||
|
|
||||||
appliedTransform = true;
|
appliedTransform = true;
|
||||||
}
|
}
|
||||||
|
@ -907,8 +906,8 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||||
// as a FrameMetrics helper because it's a deprecated conversion.
|
// as a FrameMetrics helper because it's a deprecated conversion.
|
||||||
float devPixelRatioX = 1 / rootScaleX, devPixelRatioY = 1 / rootScaleY;
|
float devPixelRatioX = 1 / rootScaleX, devPixelRatioY = 1 / rootScaleY;
|
||||||
|
|
||||||
gfx::Point scrollOffsetLayersPixels(metrics.GetScrollOffsetInLayerPixels());
|
gfxPoint scrollOffsetLayersPixels(metrics.GetScrollOffsetInLayerPixels());
|
||||||
gfx::IntPoint scrollOffsetDevPixels(
|
nsIntPoint scrollOffsetDevPixels(
|
||||||
NS_lround(scrollOffsetLayersPixels.x * devPixelRatioX),
|
NS_lround(scrollOffsetLayersPixels.x * devPixelRatioX),
|
||||||
NS_lround(scrollOffsetLayersPixels.y * devPixelRatioY));
|
NS_lround(scrollOffsetLayersPixels.y * devPixelRatioY));
|
||||||
|
|
||||||
|
@ -929,7 +928,7 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||||
// Calculate the absolute display port to send to Java
|
// Calculate the absolute display port to send to Java
|
||||||
gfx::Rect displayPortLayersPixels(metrics.mCriticalDisplayPort.IsEmpty() ?
|
gfx::Rect displayPortLayersPixels(metrics.mCriticalDisplayPort.IsEmpty() ?
|
||||||
metrics.mDisplayPort : metrics.mCriticalDisplayPort);
|
metrics.mDisplayPort : metrics.mCriticalDisplayPort);
|
||||||
gfx::IntRect displayPortDevPixels(
|
nsIntRect displayPortDevPixels(
|
||||||
NS_lround(displayPortLayersPixels.x * devPixelRatioX),
|
NS_lround(displayPortLayersPixels.x * devPixelRatioX),
|
||||||
NS_lround(displayPortLayersPixels.y * devPixelRatioY),
|
NS_lround(displayPortLayersPixels.y * devPixelRatioY),
|
||||||
NS_lround(displayPortLayersPixels.width * devPixelRatioX),
|
NS_lround(displayPortLayersPixels.width * devPixelRatioX),
|
||||||
|
@ -951,16 +950,16 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||||
float tempScaleDiffX = rootScaleX * mXScale;
|
float tempScaleDiffX = rootScaleX * mXScale;
|
||||||
float tempScaleDiffY = rootScaleY * mYScale;
|
float tempScaleDiffY = rootScaleY * mYScale;
|
||||||
|
|
||||||
gfx::IntPoint metricsScrollOffset(0, 0);
|
nsIntPoint metricsScrollOffset(0, 0);
|
||||||
if (metrics.IsScrollable()) {
|
if (metrics.IsScrollable()) {
|
||||||
metricsScrollOffset = scrollOffsetDevPixels;
|
metricsScrollOffset = scrollOffsetDevPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::IntPoint scrollCompensation(
|
nsIntPoint scrollCompensation(
|
||||||
(mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
|
(mScrollOffset.x / tempScaleDiffX - metricsScrollOffset.x) * mXScale,
|
||||||
(mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
|
(mScrollOffset.y / tempScaleDiffY - metricsScrollOffset.y) * mYScale);
|
||||||
treeTransform = gfx3DMatrix(ViewTransform(gfx::Point(-scrollCompensation),
|
treeTransform = gfx3DMatrix(ViewTransform(-scrollCompensation,
|
||||||
gfx::ZoomScale(mXScale, mYScale)));
|
gfxSize(mXScale, mYScale)));
|
||||||
|
|
||||||
// If the contents can fit entirely within the widget area on a particular
|
// If the contents can fit entirely within the widget area on a particular
|
||||||
// dimenson, we need to translate and scale so that the fixed layers remain
|
// dimenson, we need to translate and scale so that the fixed layers remain
|
||||||
|
@ -1041,10 +1040,8 @@ CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositorParent::SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
CompositorParent::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom,
|
||||||
float aZoom,
|
const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect)
|
|
||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
AndroidBridge::Bridge()->SetFirstPaintViewport(aOffset, aZoom, aPageRect, aCssPageRect);
|
AndroidBridge::Bridge()->SetFirstPaintViewport(aOffset, aZoom, aPageRect, aCssPageRect);
|
||||||
|
@ -1060,11 +1057,9 @@ CompositorParent::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositorParent::SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
CompositorParent::SyncViewportInfo(const nsIntRect& aDisplayPort,
|
||||||
float aDisplayResolution,
|
float aDisplayResolution, bool aLayersUpdated,
|
||||||
bool aLayersUpdated,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY)
|
|
||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
||||||
|
|
|
@ -36,8 +36,8 @@ class LayerManager;
|
||||||
|
|
||||||
// Represents (affine) transforms that are calculated from a content view.
|
// Represents (affine) transforms that are calculated from a content view.
|
||||||
struct ViewTransform {
|
struct ViewTransform {
|
||||||
ViewTransform(gfx::Point aTranslation = gfx::Point(),
|
ViewTransform(gfxPoint aTranslation = gfxPoint(),
|
||||||
gfx::ZoomScale aScale = gfx::ZoomScale())
|
gfxSize aScale = gfxSize(1, 1))
|
||||||
: mTranslation(aTranslation)
|
: mTranslation(aTranslation)
|
||||||
, mScale(aScale)
|
, mScale(aScale)
|
||||||
{}
|
{}
|
||||||
|
@ -49,8 +49,8 @@ struct ViewTransform {
|
||||||
gfx3DMatrix::Translation(mTranslation.x, mTranslation.y, 0);
|
gfx3DMatrix::Translation(mTranslation.x, mTranslation.y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Point mTranslation;
|
gfxPoint mTranslation;
|
||||||
gfx::ZoomScale mScale;
|
gfxSize mScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompositorParent : public PCompositorParent,
|
class CompositorParent : public PCompositorParent,
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
|
|
||||||
LayerManager* GetLayerManager() { return mLayerManager; }
|
LayerManager* GetLayerManager() { return mLayerManager; }
|
||||||
|
|
||||||
void SetTransformation(float aScale, gfx::IntPoint aScrollOffset);
|
void SetTransformation(float aScale, nsIntPoint aScrollOffset);
|
||||||
void AsyncRender();
|
void AsyncRender();
|
||||||
|
|
||||||
// Can be called from any thread
|
// Can be called from any thread
|
||||||
|
@ -178,15 +178,10 @@ protected:
|
||||||
virtual void ScheduleTask(CancelableTask*, int);
|
virtual void ScheduleTask(CancelableTask*, int);
|
||||||
virtual void Composite();
|
virtual void Composite();
|
||||||
virtual void ComposeToTarget(gfxContext* aTarget);
|
virtual void ComposeToTarget(gfxContext* aTarget);
|
||||||
virtual void SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
virtual void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
float aZoom,
|
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect);
|
|
||||||
virtual void SetPageRect(const gfx::Rect& aCssPageRect);
|
virtual void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
virtual void SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
float aDisplayResolution, bool aLayersUpdated,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY);
|
|
||||||
void SetEGLSurfaceSize(int width, int height);
|
void SetEGLSurfaceSize(int width, int height);
|
||||||
// If SetPanZoomControllerForLayerTree is not set, Compositor will use
|
// If SetPanZoomControllerForLayerTree is not set, Compositor will use
|
||||||
// derived class AsyncPanZoomController transformations.
|
// derived class AsyncPanZoomController transformations.
|
||||||
|
@ -287,8 +282,8 @@ private:
|
||||||
bool mPaused;
|
bool mPaused;
|
||||||
float mXScale;
|
float mXScale;
|
||||||
float mYScale;
|
float mYScale;
|
||||||
gfx::IntPoint mScrollOffset;
|
nsIntPoint mScrollOffset;
|
||||||
gfx::IntRect mContentRect;
|
nsIntRect mContentRect;
|
||||||
|
|
||||||
// When this flag is set, the next composition will be the first for a
|
// When this flag is set, the next composition will be the first for a
|
||||||
// particular document (i.e. the document displayed on the screen will change).
|
// particular document (i.e. the document displayed on the screen will change).
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "ReusableTileStoreOGL.h"
|
#include "ReusableTileStoreOGL.h"
|
||||||
|
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
@ -292,7 +291,7 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
|
||||||
scrollableLayer = parent;
|
scrollableLayer = parent;
|
||||||
if (!parentMetrics.mDisplayPort.IsEmpty() && scrollableLayer) {
|
if (!parentMetrics.mDisplayPort.IsEmpty() && scrollableLayer) {
|
||||||
// Get the composition bounds, so as not to waste rendering time.
|
// Get the composition bounds, so as not to waste rendering time.
|
||||||
compositionBounds = gfx::ThebesRect(parentMetrics.mCompositionBounds);
|
compositionBounds = gfxRect(parentMetrics.mCompositionBounds);
|
||||||
|
|
||||||
// Calculate the scale transform applied to the root layer to determine
|
// Calculate the scale transform applied to the root layer to determine
|
||||||
// the content resolution.
|
// the content resolution.
|
||||||
|
@ -303,12 +302,12 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
|
||||||
|
|
||||||
// Get the content document bounds, in screen-space.
|
// Get the content document bounds, in screen-space.
|
||||||
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
|
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
|
||||||
const gfx::IntSize& contentSize = metrics.mContentRect.Size();
|
const nsIntSize& contentSize = metrics.mContentRect.Size();
|
||||||
gfx::Point scrollOffset =
|
gfx::Point scrollOffset =
|
||||||
gfx::Point((metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width) / scaleX,
|
gfx::Point((metrics.mScrollOffset.x * metrics.LayersPixelsPerCSSPixel().width) / scaleX,
|
||||||
(metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height) / scaleY);
|
(metrics.mScrollOffset.y * metrics.LayersPixelsPerCSSPixel().height) / scaleY);
|
||||||
const gfx::IntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
|
const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
|
||||||
gfx::IntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
|
nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
|
||||||
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
|
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
|
||||||
contentSize.width, contentSize.height);
|
contentSize.width, contentSize.height);
|
||||||
gfxRect contentBounds = scrollableLayer->GetEffectiveTransform().
|
gfxRect contentBounds = scrollableLayer->GetEffectiveTransform().
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "ImageLayers.h"
|
#include "ImageLayers.h"
|
||||||
#include "ImageContainer.h"
|
#include "ImageContainer.h"
|
||||||
#include "nsCanvasFrame.h"
|
#include "nsCanvasFrame.h"
|
||||||
#include "gfx2DGlue.h"
|
|
||||||
|
|
||||||
#include "mozilla/StandardInteger.h"
|
#include "mozilla/StandardInteger.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -651,8 +650,8 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.y),
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.y),
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.width),
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.width),
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
||||||
metrics.mContentRect = mozilla::gfx::ToIntRect(contentBounds.ScaleToNearestPixels(
|
metrics.mContentRect = contentBounds.ScaleToNearestPixels(
|
||||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel));
|
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
||||||
nsPoint scrollPosition = scrollableFrame->GetScrollPosition();
|
nsPoint scrollPosition = scrollableFrame->GetScrollPosition();
|
||||||
metrics.mScrollOffset = mozilla::gfx::Point(
|
metrics.mScrollOffset = mozilla::gfx::Point(
|
||||||
NSAppUnitsToDoublePixels(scrollPosition.x, auPerCSSPixel),
|
NSAppUnitsToDoublePixels(scrollPosition.x, auPerCSSPixel),
|
||||||
|
@ -665,8 +664,8 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.y),
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.y),
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.width),
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.width),
|
||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
||||||
metrics.mContentRect = mozilla::gfx::ToIntRect(contentBounds.ScaleToNearestPixels(
|
metrics.mContentRect = contentBounds.ScaleToNearestPixels(
|
||||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel));
|
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.mScrollId = aScrollId;
|
metrics.mScrollId = aScrollId;
|
||||||
|
@ -675,16 +674,14 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||||
if (TabChild *tc = GetTabChildFrom(presShell)) {
|
if (TabChild *tc = GetTabChildFrom(presShell)) {
|
||||||
metrics.mZoom = tc->GetZoom();
|
metrics.mZoom = tc->GetZoom();
|
||||||
}
|
}
|
||||||
metrics.mResolution = mozilla::gfx::ZoomScale(presShell->GetXResolution(), presShell->GetYResolution());
|
metrics.mResolution = gfxSize(presShell->GetXResolution(), presShell->GetYResolution());
|
||||||
|
|
||||||
metrics.mDevPixelsPerCSSPixel = auPerCSSPixel / auPerDevPixel;
|
metrics.mDevPixelsPerCSSPixel = auPerCSSPixel / auPerDevPixel;
|
||||||
|
|
||||||
metrics.mMayHaveTouchListeners = aMayHaveTouchListeners;
|
metrics.mMayHaveTouchListeners = aMayHaveTouchListeners;
|
||||||
|
|
||||||
if (nsIWidget* widget = aForFrame->GetNearestWidget()) {
|
if (nsIWidget* widget = aForFrame->GetNearestWidget()) {
|
||||||
nsIntRect bounds;
|
widget->GetBounds(metrics.mCompositionBounds);
|
||||||
widget->GetBounds(bounds);
|
|
||||||
metrics.mCompositionBounds = mozilla::gfx::ToIntRect(bounds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aRoot->SetFrameMetrics(metrics);
|
aRoot->SetFrameMetrics(metrics);
|
||||||
|
|
|
@ -166,7 +166,7 @@ ComputeShadowTreeTransform(nsIFrame* aContainerFrame,
|
||||||
nsIntPoint scrollOffset =
|
nsIntPoint scrollOffset =
|
||||||
aConfig.mScrollOffset.ToNearestPixels(auPerDevPixel);
|
aConfig.mScrollOffset.ToNearestPixels(auPerDevPixel);
|
||||||
// metricsScrollOffset is in layer coordinates.
|
// metricsScrollOffset is in layer coordinates.
|
||||||
gfx::Point metricsScrollOffset = aMetrics->GetScrollOffsetInLayerPixels();
|
gfxPoint metricsScrollOffset = aMetrics->GetScrollOffsetInLayerPixels();
|
||||||
nsIntPoint roundedMetricsScrollOffset =
|
nsIntPoint roundedMetricsScrollOffset =
|
||||||
nsIntPoint(NS_lround(metricsScrollOffset.x), NS_lround(metricsScrollOffset.y));
|
nsIntPoint(NS_lround(metricsScrollOffset.x), NS_lround(metricsScrollOffset.y));
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ RenderFrameParent::NotifyDimensionsChanged(int width, int height)
|
||||||
{
|
{
|
||||||
if (mPanZoomController) {
|
if (mPanZoomController) {
|
||||||
mPanZoomController->UpdateCompositionBounds(
|
mPanZoomController->UpdateCompositionBounds(
|
||||||
gfx::IntRect(0, 0, width, height));
|
nsIntRect(0, 0, width, height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2089,10 +2089,7 @@ AndroidBridge::IsTablet()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidBridge::SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
AndroidBridge::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
|
||||||
float aZoom,
|
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect)
|
|
||||||
{
|
{
|
||||||
AndroidGeckoLayerClient *client = mLayerClient;
|
AndroidGeckoLayerClient *client = mLayerClient;
|
||||||
if (!client)
|
if (!client)
|
||||||
|
@ -2112,10 +2109,8 @@ AndroidBridge::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidBridge::SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
float aDisplayResolution, bool aLayersUpdated,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY)
|
|
||||||
{
|
{
|
||||||
AndroidGeckoLayerClient *client = mLayerClient;
|
AndroidGeckoLayerClient *client = mLayerClient;
|
||||||
if (!client)
|
if (!client)
|
||||||
|
|
|
@ -329,15 +329,10 @@ public:
|
||||||
void EnableNetworkNotifications();
|
void EnableNetworkNotifications();
|
||||||
void DisableNetworkNotifications();
|
void DisableNetworkNotifications();
|
||||||
|
|
||||||
void SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
float aZoom,
|
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect);
|
|
||||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
void SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
float aDisplayResolution, bool aLayersUpdated,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY);
|
|
||||||
|
|
||||||
void AddPluginView(jobject view, const gfxRect& rect, bool isFullScreen);
|
void AddPluginView(jobject view, const gfxRect& rect, bool isFullScreen);
|
||||||
void RemovePluginView(jobject view, bool isFullScreen);
|
void RemovePluginView(jobject view, bool isFullScreen);
|
||||||
|
|
|
@ -711,10 +711,7 @@ AndroidProgressiveUpdateData::Init(jobject jobj)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidGeckoLayerClient::SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
AndroidGeckoLayerClient::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
|
||||||
float aZoom,
|
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
|
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
|
||||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||||
|
@ -741,11 +738,8 @@ AndroidGeckoLayerClient::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidGeckoLayerClient::SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
float aDisplayResolution,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
bool aLayersUpdated,
|
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
||||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||||
|
@ -766,7 +760,7 @@ AndroidGeckoLayerClient::SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
||||||
AndroidViewTransform viewTransform;
|
AndroidViewTransform viewTransform;
|
||||||
viewTransform.Init(viewTransformJObj);
|
viewTransform.Init(viewTransformJObj);
|
||||||
|
|
||||||
aScrollOffset = gfx::IntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
aScrollOffset = nsIntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
||||||
aScaleX = aScaleY = viewTransform.GetScale(env);
|
aScaleX = aScaleY = viewTransform.GetScale(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,15 +254,10 @@ public:
|
||||||
AndroidGeckoLayerClient() {}
|
AndroidGeckoLayerClient() {}
|
||||||
AndroidGeckoLayerClient(jobject jobj) { Init(jobj); }
|
AndroidGeckoLayerClient(jobject jobj) { Init(jobj); }
|
||||||
|
|
||||||
void SetFirstPaintViewport(const gfx::IntPoint& aOffset,
|
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
float aZoom,
|
|
||||||
const gfx::IntRect& aPageRect,
|
|
||||||
const gfx::Rect& aCssPageRect);
|
|
||||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
void SyncViewportInfo(const gfx::IntRect& aDisplayPort,
|
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
float aDisplayResolution, bool aLayersUpdated,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::IntPoint& aScrollOffset,
|
|
||||||
float& aScaleX, float& aScaleY);
|
|
||||||
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const gfx::Rect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY);
|
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const gfx::Rect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY);
|
||||||
bool CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame);
|
bool CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame);
|
||||||
bool ActivateProgram(AutoLocalJNIFrame *jniFrame);
|
bool ActivateProgram(AutoLocalJNIFrame *jniFrame);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче