зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 8 changesets (bug 716403) for frequent Android mochitest-8 failures on a CLOSED TREE.
This commit is contained in:
Родитель
ecebddee9d
Коммит
3fe58cf9ea
|
@ -2916,32 +2916,6 @@ nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aH
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMWindowUtils::SetContentDocumentFixedPositionMargins(float aTop, float aRight,
|
|
||||||
float aBottom, float aLeft)
|
|
||||||
{
|
|
||||||
if (!nsContentUtils::IsCallerChrome()) {
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(aTop >= 0.0f && aRight >= 0.0f && aBottom >= 0.0f && aLeft >= 0.0f)) {
|
|
||||||
return NS_ERROR_ILLEGAL_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIPresShell* presShell = GetPresShell();
|
|
||||||
if (!presShell) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsMargin margins(nsPresContext::CSSPixelsToAppUnits(aLeft),
|
|
||||||
nsPresContext::CSSPixelsToAppUnits(aTop),
|
|
||||||
nsPresContext::CSSPixelsToAppUnits(aRight),
|
|
||||||
nsPresContext::CSSPixelsToAppUnits(aBottom));
|
|
||||||
presShell->SetContentDocumentFixedPositionMargins(margins);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||||
const nsAString& aNewOrigin)
|
const nsAString& aNewOrigin)
|
||||||
|
|
|
@ -41,7 +41,7 @@ interface nsIDOMClientRect;
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
interface nsIDOMEventTarget;
|
interface nsIDOMEventTarget;
|
||||||
|
|
||||||
[scriptable, uuid(69b7d908-c8e4-4416-94cf-4fdbe7a80441)]
|
[scriptable, uuid(9ab64e24-7f8d-11e2-9a5f-a24379957a39)]
|
||||||
interface nsIDOMWindowUtils : nsISupports {
|
interface nsIDOMWindowUtils : nsISupports {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1288,19 +1288,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||||
*/
|
*/
|
||||||
void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
|
void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set margins for the layout of fixed position elements in the content
|
|
||||||
* document. These are used on mobile, where the viewable area can be
|
|
||||||
* temporarily obscured by the browser chrome. In this situation, we're ok
|
|
||||||
* with scrollable page content being obscured, but fixed position content
|
|
||||||
* cannot be revealed without removing the obscuring chrome, so we use these
|
|
||||||
* margins so that it can remain visible.
|
|
||||||
*
|
|
||||||
* The caller of this method must have chrome privileges.
|
|
||||||
*/
|
|
||||||
void setContentDocumentFixedPositionMargins(in float aTop, in float aRight,
|
|
||||||
in float aBottom, in float aLeft);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent this window (and any child windows) from displaying any further
|
* Prevent this window (and any child windows) from displaying any further
|
||||||
* dialogs (e.g. window.alert()).
|
* dialogs (e.g. window.alert()).
|
||||||
|
|
|
@ -18,7 +18,6 @@ struct Margin :
|
||||||
typedef BaseMargin<Float, Margin> Super;
|
typedef BaseMargin<Float, Margin> Super;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
Margin() : Super(0, 0, 0, 0) {}
|
|
||||||
Margin(const Margin& aMargin) : Super(aMargin) {}
|
Margin(const Margin& aMargin) : Super(aMargin) {}
|
||||||
Margin(Float aLeft, Float aTop, Float aRight, Float aBottom)
|
Margin(Float aLeft, Float aTop, Float aRight, Float aBottom)
|
||||||
: Super(aLeft, aTop, aRight, aBottom) {}
|
: Super(aLeft, aTop, aRight, aBottom) {}
|
||||||
|
|
|
@ -320,7 +320,6 @@ Layer::Layer(LayerManager* aManager, void* aImplData) :
|
||||||
mUseClipRect(false),
|
mUseClipRect(false),
|
||||||
mUseTileSourceRect(false),
|
mUseTileSourceRect(false),
|
||||||
mIsFixedPosition(false),
|
mIsFixedPosition(false),
|
||||||
mMargins(0, 0, 0, 0),
|
|
||||||
mDebugColorIndex(0),
|
mDebugColorIndex(0),
|
||||||
mAnimationGeneration(0)
|
mAnimationGeneration(0)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -844,16 +844,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetFixedPositionAnchor(const gfxPoint& aAnchor) { mAnchor = aAnchor; }
|
void SetFixedPositionAnchor(const gfxPoint& aAnchor) { mAnchor = aAnchor; }
|
||||||
|
|
||||||
/**
|
|
||||||
* CONSTRUCTION PHASE ONLY
|
|
||||||
* If a layer represents a fixed position element or elements that are on
|
|
||||||
* a document that has had fixed position element margins set on it, these
|
|
||||||
* will be mirrored here. This allows for asynchronous animation of the
|
|
||||||
* margins by reconciling the difference between this value and a value that
|
|
||||||
* is updated more frequently.
|
|
||||||
*/
|
|
||||||
void SetFixedPositionMargins(const gfx::Margin& aMargins) { mMargins = aMargins; }
|
|
||||||
|
|
||||||
// These getters can be used anytime.
|
// These getters can be used anytime.
|
||||||
float GetOpacity() { return mOpacity; }
|
float GetOpacity() { return mOpacity; }
|
||||||
const nsIntRect* GetClipRect() { return mUseClipRect ? &mClipRect : nullptr; }
|
const nsIntRect* GetClipRect() { return mUseClipRect ? &mClipRect : nullptr; }
|
||||||
|
@ -870,7 +860,6 @@ public:
|
||||||
float GetPostYScale() { return mPostYScale; }
|
float GetPostYScale() { return mPostYScale; }
|
||||||
bool GetIsFixedPosition() { return mIsFixedPosition; }
|
bool GetIsFixedPosition() { return mIsFixedPosition; }
|
||||||
gfxPoint GetFixedPositionAnchor() { return mAnchor; }
|
gfxPoint GetFixedPositionAnchor() { return mAnchor; }
|
||||||
const gfx::Margin& GetFixedPositionMargins() { return mMargins; }
|
|
||||||
Layer* GetMaskLayer() { return mMaskLayer; }
|
Layer* GetMaskLayer() { return mMaskLayer; }
|
||||||
|
|
||||||
// Note that all lengths in animation data are either in CSS pixels or app
|
// Note that all lengths in animation data are either in CSS pixels or app
|
||||||
|
@ -1219,7 +1208,6 @@ protected:
|
||||||
bool mUseTileSourceRect;
|
bool mUseTileSourceRect;
|
||||||
bool mIsFixedPosition;
|
bool mIsFixedPosition;
|
||||||
gfxPoint mAnchor;
|
gfxPoint mAnchor;
|
||||||
gfx::Margin mMargins;
|
|
||||||
DebugOnly<uint32_t> mDebugColorIndex;
|
DebugOnly<uint32_t> mDebugColorIndex;
|
||||||
// If this layer is used for OMTA, then this counter is used to ensure we
|
// If this layer is used for OMTA, then this counter is used to ensure we
|
||||||
// stay in sync with the animation manager
|
// stay in sync with the animation manager
|
||||||
|
|
|
@ -640,8 +640,7 @@ Translate2D(gfx3DMatrix& aTransform, const gfxPoint& aOffset)
|
||||||
void
|
void
|
||||||
CompositorParent::TransformFixedLayers(Layer* aLayer,
|
CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||||
const gfxPoint& aTranslation,
|
const gfxPoint& aTranslation,
|
||||||
const gfxSize& aScaleDiff,
|
const gfxSize& aScaleDiff)
|
||||||
const gfx::Margin& aFixedLayerMargins)
|
|
||||||
{
|
{
|
||||||
if (aLayer->GetIsFixedPosition() &&
|
if (aLayer->GetIsFixedPosition() &&
|
||||||
!aLayer->GetParent()->GetIsFixedPosition()) {
|
!aLayer->GetParent()->GetIsFixedPosition()) {
|
||||||
|
@ -651,26 +650,6 @@ CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||||
const gfxPoint& anchor = aLayer->GetFixedPositionAnchor();
|
const gfxPoint& anchor = aLayer->GetFixedPositionAnchor();
|
||||||
gfxPoint translation(aTranslation - (anchor - anchor / aScaleDiff));
|
gfxPoint translation(aTranslation - (anchor - anchor / aScaleDiff));
|
||||||
|
|
||||||
// Offset this translation by the fixed layer margins, depending on what
|
|
||||||
// side of the viewport the layer is anchored to, reconciling the
|
|
||||||
// difference between the current fixed layer margins and the Gecko-side
|
|
||||||
// fixed layer margins.
|
|
||||||
// aFixedLayerMargins are the margins we expect to be at at the current
|
|
||||||
// time, obtained via SyncViewportInfo, and fixedMargins are the margins
|
|
||||||
// that were used during layout.
|
|
||||||
const gfx::Margin& fixedMargins = aLayer->GetFixedPositionMargins();
|
|
||||||
if (anchor.x > 0) {
|
|
||||||
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
|
|
||||||
} else {
|
|
||||||
translation.x += aFixedLayerMargins.left - fixedMargins.left;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchor.y > 0) {
|
|
||||||
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
|
|
||||||
} else {
|
|
||||||
translation.y += aFixedLayerMargins.top - fixedMargins.top;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The transform already takes the resolution scale into account. Since we
|
// The transform already takes the resolution scale into account. Since we
|
||||||
// will apply the resolution scale again when computing the effective
|
// will apply the resolution scale again when computing the effective
|
||||||
// transform, we must apply the inverse resolution scale here.
|
// transform, we must apply the inverse resolution scale here.
|
||||||
|
@ -697,7 +676,7 @@ CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||||
|
|
||||||
for (Layer* child = aLayer->GetFirstChild();
|
for (Layer* child = aLayer->GetFirstChild();
|
||||||
child; child = child->GetNextSibling()) {
|
child; child = child->GetNextSibling()) {
|
||||||
TransformFixedLayers(child, aTranslation, aScaleDiff, aFixedLayerMargins);
|
TransformFixedLayers(child, aTranslation, aScaleDiff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,12 +869,10 @@ CompositorParent::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFrame,
|
||||||
1);
|
1);
|
||||||
shadow->SetShadowTransform(transform);
|
shadow->SetShadowTransform(transform);
|
||||||
|
|
||||||
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
|
|
||||||
TransformFixedLayers(
|
TransformFixedLayers(
|
||||||
aLayer,
|
aLayer,
|
||||||
-treeTransform.mTranslation / treeTransform.mScale,
|
-treeTransform.mTranslation / treeTransform.mScale,
|
||||||
treeTransform.mScale,
|
treeTransform.mScale);
|
||||||
fixedLayerMargins);
|
|
||||||
|
|
||||||
appliedTransform = true;
|
appliedTransform = true;
|
||||||
}
|
}
|
||||||
|
@ -960,9 +937,8 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||||
displayPortDevPixels.x += scrollOffsetDevPixels.x;
|
displayPortDevPixels.x += scrollOffsetDevPixels.x;
|
||||||
displayPortDevPixels.y += scrollOffsetDevPixels.y;
|
displayPortDevPixels.y += scrollOffsetDevPixels.y;
|
||||||
|
|
||||||
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
|
|
||||||
SyncViewportInfo(displayPortDevPixels, 1/rootScaleX, mLayersUpdated,
|
SyncViewportInfo(displayPortDevPixels, 1/rootScaleX, mLayersUpdated,
|
||||||
mScrollOffset, mXScale, mYScale, fixedLayerMargins);
|
mScrollOffset, mXScale, mYScale);
|
||||||
mLayersUpdated = false;
|
mLayersUpdated = false;
|
||||||
|
|
||||||
// Handle transformations for asynchronous panning and zooming. We determine the
|
// Handle transformations for asynchronous panning and zooming. We determine the
|
||||||
|
@ -1019,7 +995,7 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||||
1.0f/container->GetPostYScale(),
|
1.0f/container->GetPostYScale(),
|
||||||
1);
|
1);
|
||||||
shadow->SetShadowTransform(computedTransform);
|
shadow->SetShadowTransform(computedTransform);
|
||||||
TransformFixedLayers(aLayer, offset, scaleDiff, fixedLayerMargins);
|
TransformFixedLayers(aLayer, offset, scaleDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1083,12 +1059,11 @@ CompositorParent::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
void
|
void
|
||||||
CompositorParent::SyncViewportInfo(const nsIntRect& aDisplayPort,
|
CompositorParent::SyncViewportInfo(const nsIntRect& aDisplayPort,
|
||||||
float aDisplayResolution, bool aLayersUpdated,
|
float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
gfx::Margin& aFixedLayerMargins)
|
|
||||||
{
|
{
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
||||||
aScrollOffset, aScaleX, aScaleY, aFixedLayerMargins);
|
aScrollOffset, aScaleX, aScaleY);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,8 +181,7 @@ protected:
|
||||||
virtual void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
virtual void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
virtual void SetPageRect(const gfx::Rect& aCssPageRect);
|
virtual void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::Margin& aFixedLayerMargins);
|
|
||||||
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.
|
||||||
|
@ -262,8 +261,7 @@ private:
|
||||||
*/
|
*/
|
||||||
void TransformFixedLayers(Layer* aLayer,
|
void TransformFixedLayers(Layer* aLayer,
|
||||||
const gfxPoint& aTranslation,
|
const gfxPoint& aTranslation,
|
||||||
const gfxSize& aScaleDiff,
|
const gfxSize& aScaleDiff);
|
||||||
const gfx::Margin& aFixedLayerMargins);
|
|
||||||
|
|
||||||
virtual PGrallocBufferParent* AllocPGrallocBuffer(
|
virtual PGrallocBufferParent* AllocPGrallocBuffer(
|
||||||
const gfxIntSize&, const uint32_t&, const uint32_t&,
|
const gfxIntSize&, const uint32_t&, const uint32_t&,
|
||||||
|
|
|
@ -26,7 +26,6 @@ using mozilla::TimeStamp;
|
||||||
using mozilla::ScreenRotation;
|
using mozilla::ScreenRotation;
|
||||||
using nsCSSProperty;
|
using nsCSSProperty;
|
||||||
using mozilla::dom::ScreenOrientation;
|
using mozilla::dom::ScreenOrientation;
|
||||||
using mozilla::gfx::Margin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The layers protocol is spoken between thread contexts that manage
|
* The layers protocol is spoken between thread contexts that manage
|
||||||
|
@ -186,7 +185,6 @@ struct CommonLayerAttributes {
|
||||||
nsIntRect clipRect;
|
nsIntRect clipRect;
|
||||||
bool isFixedPosition;
|
bool isFixedPosition;
|
||||||
gfxPoint fixedPositionAnchor;
|
gfxPoint fixedPositionAnchor;
|
||||||
Margin fixedPositionMargin;
|
|
||||||
nullable PLayer maskLayer;
|
nullable PLayer maskLayer;
|
||||||
// Animated colors will only honored for ColorLayers.
|
// Animated colors will only honored for ColorLayers.
|
||||||
Animation[] animations;
|
Animation[] animations;
|
||||||
|
|
|
@ -344,7 +344,6 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
||||||
*mutant->GetClipRect() : nsIntRect());
|
*mutant->GetClipRect() : nsIntRect());
|
||||||
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
||||||
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
||||||
common.fixedPositionMargin() = mutant->GetFixedPositionMargins();
|
|
||||||
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
||||||
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -248,7 +248,6 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||||
layer->SetPostScale(common.postXScale(), common.postYScale());
|
layer->SetPostScale(common.postXScale(), common.postYScale());
|
||||||
layer->SetIsFixedPosition(common.isFixedPosition());
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
||||||
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
||||||
layer->SetFixedPositionMargins(common.fixedPositionMargin());
|
|
||||||
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
||||||
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -836,28 +836,6 @@ struct ParamTraits<mozilla::gfx::Rect>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
|
||||||
struct ParamTraits<mozilla::gfx::Margin>
|
|
||||||
{
|
|
||||||
typedef mozilla::gfx::Margin paramType;
|
|
||||||
|
|
||||||
static void Write(Message* msg, const paramType& param)
|
|
||||||
{
|
|
||||||
WriteParam(msg, param.left);
|
|
||||||
WriteParam(msg, param.top);
|
|
||||||
WriteParam(msg, param.right);
|
|
||||||
WriteParam(msg, param.bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
||||||
{
|
|
||||||
return (ReadParam(msg, iter, &result->left) &&
|
|
||||||
ReadParam(msg, iter, &result->top) &&
|
|
||||||
ReadParam(msg, iter, &result->right) &&
|
|
||||||
ReadParam(msg, iter, &result->bottom));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct ParamTraits<nsRect>
|
struct ParamTraits<nsRect>
|
||||||
{
|
{
|
||||||
|
|
|
@ -2978,19 +2978,6 @@ nsDisplayFixedPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
layer->SetFixedPositionAnchor(anchor);
|
layer->SetFixedPositionAnchor(anchor);
|
||||||
|
|
||||||
// Also make sure the layer is aware of any fixed position margins that have
|
|
||||||
// been set.
|
|
||||||
nsMargin fixedMargins = presContext->PresShell()->GetContentDocumentFixedPositionMargins();
|
|
||||||
mozilla::gfx::Margin fixedLayerMargins(NSAppUnitsToFloatPixels(fixedMargins.left, factor) *
|
|
||||||
aContainerParameters.mXScale,
|
|
||||||
NSAppUnitsToFloatPixels(fixedMargins.top, factor) *
|
|
||||||
aContainerParameters.mYScale,
|
|
||||||
NSAppUnitsToFloatPixels(fixedMargins.right, factor) *
|
|
||||||
aContainerParameters.mXScale,
|
|
||||||
NSAppUnitsToFloatPixels(fixedMargins.bottom, factor) *
|
|
||||||
aContainerParameters.mYScale);
|
|
||||||
layer->SetFixedPositionMargins(fixedLayerMargins);
|
|
||||||
|
|
||||||
return layer.forget();
|
return layer.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,10 +121,10 @@ typedef struct CapturingContentInfo {
|
||||||
nsIContent* mContent;
|
nsIContent* mContent;
|
||||||
} CapturingContentInfo;
|
} CapturingContentInfo;
|
||||||
|
|
||||||
// bf539e0a-c314-4ea7-ba7c-ebd34e8a4065
|
// 835b3946-1a4f-4132-b3ce-2e2e8be377c8
|
||||||
#define NS_IPRESSHELL_IID \
|
#define NS_IPRESSHELL_IID \
|
||||||
{ 0xbf539e0a, 0xc314, 0x4ea7, \
|
{ 0x835b3946, 0x1a4f, 0x4132, \
|
||||||
{ 0xba, 0x7c, 0xeb, 0xd3, 0x4e, 0x8a, 0x40, 0x65 } }
|
{ 0xb3, 0xce, 0x2e, 0x2e, 0x8b, 0xe3, 0x77, 0xc8 } }
|
||||||
|
|
||||||
// debug VerifyReflow flags
|
// debug VerifyReflow flags
|
||||||
#define VERIFY_REFLOW_ON 0x01
|
#define VERIFY_REFLOW_ON 0x01
|
||||||
|
@ -498,11 +498,6 @@ public:
|
||||||
IntrinsicDirty aIntrinsicDirty,
|
IntrinsicDirty aIntrinsicDirty,
|
||||||
nsFrameState aBitToAdd) = 0;
|
nsFrameState aBitToAdd) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Calls FrameNeedsReflow on all fixed position children of the root frame.
|
|
||||||
*/
|
|
||||||
virtual void ReflowFixedPositionChildren(IntrinsicDirty aIntrinsicDirty);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the presshell that the given frame's reflow was interrupted. This
|
* Tell the presshell that the given frame's reflow was interrupted. This
|
||||||
* will mark as having dirty children a path from the given frame (inclusive)
|
* will mark as having dirty children a path from the given frame (inclusive)
|
||||||
|
@ -1386,11 +1381,6 @@ public:
|
||||||
return mScrollPositionClampingScrollPortSize;
|
return mScrollPositionClampingScrollPortSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetContentDocumentFixedPositionMargins(const nsMargin& aMargins);
|
|
||||||
const nsMargin& GetContentDocumentFixedPositionMargins() {
|
|
||||||
return mContentDocumentFixedPositionMargins;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void WindowSizeMoveDone() = 0;
|
virtual void WindowSizeMoveDone() = 0;
|
||||||
virtual void SysColorChanged() = 0;
|
virtual void SysColorChanged() = 0;
|
||||||
virtual void ThemeChanged() = 0;
|
virtual void ThemeChanged() = 0;
|
||||||
|
@ -1438,12 +1428,6 @@ protected:
|
||||||
|
|
||||||
nsSize mScrollPositionClampingScrollPortSize;
|
nsSize mScrollPositionClampingScrollPortSize;
|
||||||
|
|
||||||
// This margin is intended to be used when laying out fixed position children
|
|
||||||
// on this PresShell's viewport frame. See the documentation of
|
|
||||||
// nsIDOMWindowUtils.setContentDocumentFixedPositionMargins for details of
|
|
||||||
// their use.
|
|
||||||
nsMargin mContentDocumentFixedPositionMargins;
|
|
||||||
|
|
||||||
// A list of weak frames. This is a pointer to the last item in the list.
|
// A list of weak frames. This is a pointer to the last item in the list.
|
||||||
nsWeakFrame* mWeakFrames;
|
nsWeakFrame* mWeakFrames;
|
||||||
|
|
||||||
|
|
|
@ -9429,18 +9429,6 @@ PresShell::SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
/* clear = */false);
|
/* clear = */false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsIPresShell::ReflowFixedPositionChildren(IntrinsicDirty aIntrinsicDirty)
|
|
||||||
{
|
|
||||||
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
|
||||||
if (rootFrame) {
|
|
||||||
const nsFrameList& childList = rootFrame->GetChildList(nsIFrame::kFixedList);
|
|
||||||
for (nsFrameList::Enumerator e(childList); !e.AtEnd(); e.Next()) {
|
|
||||||
FrameNeedsReflow(e.get(), aIntrinsicDirty, NS_FRAME_IS_DIRTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
|
nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
|
||||||
{
|
{
|
||||||
|
@ -9451,22 +9439,18 @@ nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aH
|
||||||
mScrollPositionClampingScrollPortSize.width = aWidth;
|
mScrollPositionClampingScrollPortSize.width = aWidth;
|
||||||
mScrollPositionClampingScrollPortSize.height = aHeight;
|
mScrollPositionClampingScrollPortSize.height = aHeight;
|
||||||
|
|
||||||
ReflowFixedPositionChildren(eResize);
|
// Reflow fixed position children.
|
||||||
|
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
||||||
|
if (rootFrame) {
|
||||||
|
const nsFrameList& childList = rootFrame->GetChildList(nsIFrame::kFixedList);
|
||||||
|
for (nsIFrame* child = childList.FirstChild(); child;
|
||||||
|
child = child->GetNextSibling()) {
|
||||||
|
FrameNeedsReflow(child, eResize, NS_FRAME_IS_DIRTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsIPresShell::SetContentDocumentFixedPositionMargins(const nsMargin& aMargins)
|
|
||||||
{
|
|
||||||
if (mContentDocumentFixedPositionMargins == aMargins) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mContentDocumentFixedPositionMargins = aMargins;
|
|
||||||
|
|
||||||
ReflowFixedPositionChildren(eResize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PresShell::SetupFontInflation()
|
PresShell::SetupFontInflation()
|
||||||
{
|
{
|
||||||
|
|
|
@ -366,17 +366,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
// Get the border values
|
// Get the border values
|
||||||
nsMargin border = aReflowState.mStyleBorder->GetComputedBorder();
|
const nsMargin& border = aReflowState.mStyleBorder->GetComputedBorder();
|
||||||
|
|
||||||
// Respect fixed position margins.
|
|
||||||
if (aDelegatingFrame->GetAbsoluteListID() == nsIFrame::kFixedList) {
|
|
||||||
const nsMargin& fixedMargins = aPresContext->PresShell()->
|
|
||||||
GetContentDocumentFixedPositionMargins();
|
|
||||||
|
|
||||||
border += fixedMargins;
|
|
||||||
aContainingBlockWidth -= fixedMargins.left + fixedMargins.right;
|
|
||||||
aContainingBlockHeight -= fixedMargins.top + fixedMargins.bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
nscoord availWidth = aContainingBlockWidth;
|
nscoord availWidth = aContainingBlockWidth;
|
||||||
if (availWidth == -1) {
|
if (availWidth == -1) {
|
||||||
|
|
|
@ -677,9 +677,6 @@ pref("memory.free_dirty_pages", true);
|
||||||
|
|
||||||
pref("layout.imagevisibility.enabled", false);
|
pref("layout.imagevisibility.enabled", false);
|
||||||
|
|
||||||
// Disable the dynamic toolbar
|
|
||||||
pref("browser.chrome.dynamictoolbar", false);
|
|
||||||
|
|
||||||
#ifdef MOZ_PKG_SPECIAL
|
#ifdef MOZ_PKG_SPECIAL
|
||||||
// Disable webgl on ARMv6 because running the reftests takes
|
// Disable webgl on ARMv6 because running the reftests takes
|
||||||
// too long for some reason (bug 843738)
|
// too long for some reason (bug 843738)
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.mozilla.gecko;
|
||||||
import org.mozilla.gecko.db.BrowserContract.Combined;
|
import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||||
import org.mozilla.gecko.db.BrowserDB;
|
import org.mozilla.gecko.db.BrowserDB;
|
||||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
|
||||||
import org.mozilla.gecko.util.UiAsyncTask;
|
import org.mozilla.gecko.util.UiAsyncTask;
|
||||||
import org.mozilla.gecko.util.GeckoBackgroundThread;
|
import org.mozilla.gecko.util.GeckoBackgroundThread;
|
||||||
|
|
||||||
|
@ -42,7 +41,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -55,8 +53,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
PropertyAnimator.PropertyAnimationListener {
|
PropertyAnimator.PropertyAnimationListener {
|
||||||
private static final String LOGTAG = "GeckoBrowserApp";
|
private static final String LOGTAG = "GeckoBrowserApp";
|
||||||
|
|
||||||
private static final String PREF_CHROME_DYNAMICTOOLBAR = "browser.chrome.dynamictoolbar";
|
|
||||||
|
|
||||||
public static BrowserToolbar mBrowserToolbar;
|
public static BrowserToolbar mBrowserToolbar;
|
||||||
private AboutHomeContent mAboutHomeContent;
|
private AboutHomeContent mAboutHomeContent;
|
||||||
private Boolean mAboutHomeShowing = null;
|
private Boolean mAboutHomeShowing = null;
|
||||||
|
@ -91,14 +87,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
// We'll ask for feedback after the user launches the app this many times.
|
// We'll ask for feedback after the user launches the app this many times.
|
||||||
private static final int FEEDBACK_LAUNCH_COUNT = 15;
|
private static final int FEEDBACK_LAUNCH_COUNT = 15;
|
||||||
|
|
||||||
// Variables used for scrolling the toolbar on/off the page.
|
|
||||||
private static final int TOOLBAR_ONLOAD_HIDE_DELAY = 2000;
|
|
||||||
private boolean mDynamicToolbarEnabled = false;
|
|
||||||
private View mToolbarSpacer = null;
|
|
||||||
private float mLastTouchY = 0.0f;
|
|
||||||
private float mToolbarSubpixelAccumulation = 0.0f;
|
|
||||||
private boolean mToolbarLocked = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
|
@ -109,17 +97,10 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
// fall through
|
// fall through
|
||||||
case SELECTED:
|
case SELECTED:
|
||||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||||
if ("about:home".equals(tab.getURL())) {
|
if ("about:home".equals(tab.getURL()))
|
||||||
showAboutHome();
|
showAboutHome();
|
||||||
|
else
|
||||||
if (mDynamicToolbarEnabled) {
|
|
||||||
// Show the toolbar immediately.
|
|
||||||
mBrowserToolbar.animateVisibility(true, 0);
|
|
||||||
mToolbarLocked = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hideAboutHome();
|
hideAboutHome();
|
||||||
}
|
|
||||||
|
|
||||||
// Dismiss any SiteIdentity Popup
|
// Dismiss any SiteIdentity Popup
|
||||||
SiteIdentityPopup.getInstance().dismiss();
|
SiteIdentityPopup.getInstance().dismiss();
|
||||||
|
@ -138,27 +119,9 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case START:
|
|
||||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
|
|
||||||
if (mDynamicToolbarEnabled) {
|
|
||||||
// Show the toolbar.
|
|
||||||
mBrowserToolbar.animateVisibility(true, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOAD_ERROR:
|
case LOAD_ERROR:
|
||||||
|
case START:
|
||||||
case STOP:
|
case STOP:
|
||||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
|
||||||
if (!mAboutHomeShowing) {
|
|
||||||
if (mDynamicToolbarEnabled) {
|
|
||||||
// Hide the toolbar after a delay.
|
|
||||||
mBrowserToolbar.animateVisibility(false, TOOLBAR_ONLOAD_HIDE_DELAY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// fall through
|
|
||||||
case MENU_UPDATED:
|
case MENU_UPDATED:
|
||||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
@ -186,105 +149,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
updateAboutHomeTopSites();
|
updateAboutHomeTopSites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
|
||||||
if (!mDynamicToolbarEnabled) {
|
|
||||||
return super.onInterceptTouchEvent(view, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
int action = event.getActionMasked();
|
|
||||||
int pointerCount = event.getPointerCount();
|
|
||||||
|
|
||||||
// Whenever there are no pointers left on the screen, tell the page
|
|
||||||
// to clamp the viewport on fixed layer margin changes. This lets the
|
|
||||||
// toolbar scrolling off the top of the page make the page scroll up
|
|
||||||
// if it'd cause the page to go into overscroll, but only when there
|
|
||||||
// are no pointers held down.
|
|
||||||
mLayerView.getLayerClient().setClampOnFixedLayerMarginsChange(
|
|
||||||
pointerCount == 0 || action == MotionEvent.ACTION_CANCEL ||
|
|
||||||
action == MotionEvent.ACTION_UP);
|
|
||||||
|
|
||||||
View toolbarView = mBrowserToolbar.getLayout();
|
|
||||||
if (action == MotionEvent.ACTION_DOWN ||
|
|
||||||
action == MotionEvent.ACTION_POINTER_DOWN) {
|
|
||||||
if (pointerCount == 1) {
|
|
||||||
mToolbarLocked = false;
|
|
||||||
mToolbarSubpixelAccumulation = 0.0f;
|
|
||||||
mLastTouchY = event.getY();
|
|
||||||
return super.onInterceptTouchEvent(view, event);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Lock the toolbar until we're back down to one pointer.
|
|
||||||
mToolbarLocked = true;
|
|
||||||
|
|
||||||
// Animate the toolbar to the fully on/off position.
|
|
||||||
mBrowserToolbar.animateVisibility(
|
|
||||||
toolbarView.getScrollY() > toolbarView.getHeight() / 2 ?
|
|
||||||
false : true, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If more than one pointer has been tracked, let the event pass
|
|
||||||
// through and be handled by the PanZoomController for zooming.
|
|
||||||
if (pointerCount > 1) {
|
|
||||||
return super.onInterceptTouchEvent(view, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a pointer has been lifted so that there's only one pointer left,
|
|
||||||
// unlock the toolbar and track that remaining pointer.
|
|
||||||
if (pointerCount == 1 && action == MotionEvent.ACTION_POINTER_UP) {
|
|
||||||
mLastTouchY = event.getY(1 - event.getActionIndex());
|
|
||||||
mToolbarLocked = false;
|
|
||||||
return super.onInterceptTouchEvent(view, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't bother doing anything with the events if we're loading -
|
|
||||||
// the toolbar will be permanently visible in this case.
|
|
||||||
float eventY = event.getY();
|
|
||||||
if (Tabs.getInstance().getSelectedTab().getState() != Tab.STATE_LOADING) {
|
|
||||||
int toolbarHeight = toolbarView.getHeight();
|
|
||||||
if (action == MotionEvent.ACTION_MOVE && !mToolbarLocked) {
|
|
||||||
// Cancel any ongoing animation before we start moving the toolbar.
|
|
||||||
mBrowserToolbar.cancelVisibilityAnimation();
|
|
||||||
|
|
||||||
// Move the toolbar by the amount the touch event has moved,
|
|
||||||
// clamping to fully visible or fully hidden.
|
|
||||||
float deltaY = mLastTouchY - eventY;
|
|
||||||
|
|
||||||
// Don't let the toolbar scroll off the top if it's just exposing
|
|
||||||
// overscroll area.
|
|
||||||
ImmutableViewportMetrics metrics =
|
|
||||||
mLayerView.getLayerClient().getViewportMetrics();
|
|
||||||
float toolbarMaxY = Math.min(toolbarHeight,
|
|
||||||
Math.max(0, toolbarHeight - (metrics.pageRectTop -
|
|
||||||
metrics.viewportRectTop)));
|
|
||||||
|
|
||||||
int toolbarY = toolbarView.getScrollY();
|
|
||||||
float newToolbarYf = Math.max(0, Math.min(toolbarMaxY,
|
|
||||||
toolbarY + deltaY + mToolbarSubpixelAccumulation));
|
|
||||||
int newToolbarY = Math.round(newToolbarYf);
|
|
||||||
mToolbarSubpixelAccumulation = (newToolbarYf - newToolbarY);
|
|
||||||
|
|
||||||
toolbarView.scrollTo(0, newToolbarY);
|
|
||||||
|
|
||||||
// Reset tracking when the toolbar is fully visible or hidden.
|
|
||||||
if (newToolbarY == 0 || newToolbarY == toolbarHeight) {
|
|
||||||
mLastTouchY = eventY;
|
|
||||||
}
|
|
||||||
} else if (action == MotionEvent.ACTION_UP ||
|
|
||||||
action == MotionEvent.ACTION_CANCEL) {
|
|
||||||
// Animate the toolbar to fully on or off, depending on how much
|
|
||||||
// of it is hidden.
|
|
||||||
mBrowserToolbar.animateVisibility(
|
|
||||||
toolbarView.getScrollY() > toolbarHeight / 2 ? false : true, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the last recorded y position.
|
|
||||||
mLastTouchY = eventY;
|
|
||||||
|
|
||||||
return super.onInterceptTouchEvent(view, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleReaderAdded(boolean success, final String title, final String url) {
|
void handleReaderAdded(boolean success, final String title, final String url) {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
showToast(R.string.reading_list_failed, Toast.LENGTH_SHORT);
|
showToast(R.string.reading_list_failed, Toast.LENGTH_SHORT);
|
||||||
|
@ -329,10 +193,8 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mToolbarSpacer = findViewById(R.id.toolbar_spacer);
|
|
||||||
|
|
||||||
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
|
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
|
||||||
mMainLayout.addView(actionBar, 2);
|
mMainLayout.addView(actionBar, 0);
|
||||||
|
|
||||||
((GeckoApp.MainLayout) mMainLayout).setOnInterceptTouchListener(new HideTabsTouchListener());
|
((GeckoApp.MainLayout) mMainLayout).setOnInterceptTouchListener(new HideTabsTouchListener());
|
||||||
|
|
||||||
|
@ -355,33 +217,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
|
|
||||||
Distribution.init(this, getPackageResourcePath());
|
Distribution.init(this, getPackageResourcePath());
|
||||||
JavaAddonManager.getInstance().init(getApplicationContext());
|
JavaAddonManager.getInstance().init(getApplicationContext());
|
||||||
|
|
||||||
// Load the dynamic toolbar pref
|
|
||||||
PrefsHelper.getPref(PREF_CHROME_DYNAMICTOOLBAR, new PrefsHelper.PrefHandlerBase() {
|
|
||||||
@Override
|
|
||||||
public void prefValue(String pref, boolean value) {
|
|
||||||
if (value == mDynamicToolbarEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mDynamicToolbarEnabled = value;
|
|
||||||
|
|
||||||
mMainHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!mDynamicToolbarEnabled) {
|
|
||||||
// Immediately show the toolbar when disabling the dynamic
|
|
||||||
// toolbar.
|
|
||||||
mBrowserToolbar.cancelVisibilityAnimation();
|
|
||||||
mBrowserToolbar.getLayout().scrollTo(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh the margins to reset the padding on the spacer and
|
|
||||||
// make sure that Gecko is in sync.
|
|
||||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -421,7 +256,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
|
|
||||||
mBrowserToolbar.updateBackButton(false);
|
mBrowserToolbar.updateBackButton(false);
|
||||||
mBrowserToolbar.updateForwardButton(false);
|
mBrowserToolbar.updateForwardButton(false);
|
||||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
|
||||||
|
|
||||||
mDoorHangerPopup.setAnchor(mBrowserToolbar.mFavicon);
|
mDoorHangerPopup.setAnchor(mBrowserToolbar.mFavicon);
|
||||||
|
|
||||||
|
@ -444,29 +278,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToolbarHeight(int aHeight, int aVisibleHeight) {
|
|
||||||
if (!mDynamicToolbarEnabled || Boolean.TRUE.equals(mAboutHomeShowing)) {
|
|
||||||
// Use aVisibleHeight here so that when the dynamic toolbar is
|
|
||||||
// enabled, the padding will animate with the toolbar becoming
|
|
||||||
// visible.
|
|
||||||
mToolbarSpacer.setPadding(0, aVisibleHeight, 0, 0);
|
|
||||||
aHeight = aVisibleHeight = 0;
|
|
||||||
} else {
|
|
||||||
mToolbarSpacer.setPadding(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the current UI, this is the only place we have need of
|
|
||||||
// viewport margins (to stop the toolbar from obscuring fixed-pos
|
|
||||||
// content).
|
|
||||||
GeckoAppShell.sendEventToGecko(
|
|
||||||
GeckoEvent.createBroadcastEvent("Viewport:FixedMarginsChanged",
|
|
||||||
"{ \"top\" : " + aHeight + ", \"right\" : 0, \"bottom\" : 0, \"left\" : 0 }"));
|
|
||||||
|
|
||||||
if (mLayerView != null) {
|
|
||||||
mLayerView.getLayerClient().setFixedLayerMargins(0, aVisibleHeight, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void toggleChrome(final boolean aShow) {
|
void toggleChrome(final boolean aShow) {
|
||||||
mMainHandler.post(new Runnable() {
|
mMainHandler.post(new Runnable() {
|
||||||
|
@ -921,9 +732,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
mAboutHomeShowing = true;
|
mAboutHomeShowing = true;
|
||||||
Runnable r = new AboutHomeRunnable(true);
|
Runnable r = new AboutHomeRunnable(true);
|
||||||
mMainHandler.postAtFrontOfQueue(r);
|
mMainHandler.postAtFrontOfQueue(r);
|
||||||
|
|
||||||
// Refresh margins to possibly remove the toolbar padding
|
|
||||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideAboutHome() {
|
private void hideAboutHome() {
|
||||||
|
@ -936,9 +744,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
mAboutHomeShowing = false;
|
mAboutHomeShowing = false;
|
||||||
Runnable r = new AboutHomeRunnable(false);
|
Runnable r = new AboutHomeRunnable(false);
|
||||||
mMainHandler.postAtFrontOfQueue(r);
|
mMainHandler.postAtFrontOfQueue(r);
|
||||||
|
|
||||||
// Refresh margins to possibly restore the toolbar padding
|
|
||||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AboutHomeRunnable implements Runnable {
|
private class AboutHomeRunnable implements Runnable {
|
||||||
|
|
|
@ -41,9 +41,6 @@ import android.widget.ViewSwitcher;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
|
||||||
|
|
||||||
public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
Tabs.OnTabsChangedListener,
|
Tabs.OnTabsChangedListener,
|
||||||
|
@ -108,23 +105,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
private int mCount;
|
private int mCount;
|
||||||
private int mFaviconSize;
|
private int mFaviconSize;
|
||||||
|
|
||||||
private PropertyAnimator mVisibilityAnimator;
|
|
||||||
private TimerTask mDelayedVisibilityTask;
|
|
||||||
|
|
||||||
private enum ToolbarVisibility {
|
|
||||||
VISIBLE,
|
|
||||||
HIDDEN,
|
|
||||||
INCONSISTENT
|
|
||||||
};
|
|
||||||
private ToolbarVisibility mVisibility;
|
|
||||||
|
|
||||||
private static final int TABS_CONTRACTED = 1;
|
private static final int TABS_CONTRACTED = 1;
|
||||||
private static final int TABS_EXPANDED = 2;
|
private static final int TABS_EXPANDED = 2;
|
||||||
|
|
||||||
private static final int FORWARD_ANIMATION_DURATION = 450;
|
private static final int FORWARD_ANIMATION_DURATION = 450;
|
||||||
|
|
||||||
private static final int VISIBILITY_ANIMATION_DURATION = 250;
|
|
||||||
|
|
||||||
public BrowserToolbar(BrowserApp activity) {
|
public BrowserToolbar(BrowserApp activity) {
|
||||||
// BrowserToolbar is attached to BrowserApp only.
|
// BrowserToolbar is attached to BrowserApp only.
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
|
@ -133,8 +118,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
sActionItems = new ArrayList<View>();
|
sActionItems = new ArrayList<View>();
|
||||||
Tabs.registerOnTabsChangedListener(this);
|
Tabs.registerOnTabsChangedListener(this);
|
||||||
mAnimateSiteSecurity = true;
|
mAnimateSiteSecurity = true;
|
||||||
|
|
||||||
mVisibility = ToolbarVisibility.INCONSISTENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void from(LinearLayout layout) {
|
public void from(LinearLayout layout) {
|
||||||
|
@ -482,67 +465,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canToolbarHide() {
|
|
||||||
// Forbid the toolbar from hiding if hiding the toolbar would cause
|
|
||||||
// the page to go into overscroll.
|
|
||||||
ImmutableViewportMetrics metrics = GeckoApp.mAppContext.getLayerView().
|
|
||||||
getLayerClient().getViewportMetrics();
|
|
||||||
return (metrics.getPageHeight() >= metrics.getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startVisibilityAnimation() {
|
|
||||||
// Only start the animation if we're showing the toolbar, or it's ok
|
|
||||||
// to hide it.
|
|
||||||
if (mVisibility == ToolbarVisibility.VISIBLE ||
|
|
||||||
canToolbarHide()) {
|
|
||||||
mVisibilityAnimator.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void animateVisibility(boolean show, long delay) {
|
|
||||||
// Do nothing if there's a delayed animation pending that does the
|
|
||||||
// same thing and this request also has a delay.
|
|
||||||
if (mVisibility != ToolbarVisibility.INCONSISTENT &&
|
|
||||||
((delay > 0) == (mDelayedVisibilityTask != null)) &&
|
|
||||||
(show == isVisible())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelVisibilityAnimation();
|
|
||||||
mVisibility = show ? ToolbarVisibility.VISIBLE : ToolbarVisibility.HIDDEN;
|
|
||||||
|
|
||||||
mVisibilityAnimator = new PropertyAnimator(VISIBILITY_ANIMATION_DURATION);
|
|
||||||
mVisibilityAnimator.attach(mLayout, PropertyAnimator.Property.SCROLL_Y,
|
|
||||||
show ? 0 : mLayout.getHeight());
|
|
||||||
if (delay > 0) {
|
|
||||||
mDelayedVisibilityTask = new TimerTask() {
|
|
||||||
public void run() {
|
|
||||||
startVisibilityAnimation();
|
|
||||||
mDelayedVisibilityTask = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mLayout.postDelayed(mDelayedVisibilityTask, delay);
|
|
||||||
} else {
|
|
||||||
startVisibilityAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancelVisibilityAnimation() {
|
|
||||||
mVisibility = ToolbarVisibility.INCONSISTENT;
|
|
||||||
if (mDelayedVisibilityTask != null) {
|
|
||||||
mLayout.removeCallbacks(mDelayedVisibilityTask);
|
|
||||||
mDelayedVisibilityTask = null;
|
|
||||||
}
|
|
||||||
if (mVisibilityAnimator != null) {
|
|
||||||
mVisibilityAnimator.stop(false);
|
|
||||||
mVisibilityAnimator = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVisible() {
|
|
||||||
return mVisibility == ToolbarVisibility.VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animation animation) {
|
public void onAnimationStart(Animation animation) {
|
||||||
if (animation.equals(mLockFadeIn)) {
|
if (animation.equals(mLockFadeIn)) {
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
package org.mozilla.gecko;
|
|
||||||
|
|
||||||
import org.mozilla.gecko.gfx.LayerView;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
public class BrowserToolbarLayout extends LinearLayout {
|
|
||||||
private static final String LOGTAG = "GeckoToolbarLayout";
|
|
||||||
|
|
||||||
public BrowserToolbarLayout(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
|
||||||
// If the motion event has occured below the toolbar (due to the scroll
|
|
||||||
// offset), let it pass through to the page.
|
|
||||||
if (event != null && event.getY() > getHeight() - getScrollY()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onTouchEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
|
||||||
super.onScrollChanged(l, t, oldl, oldt);
|
|
||||||
|
|
||||||
if (t != oldt) {
|
|
||||||
refreshMargins();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
||||||
super.onSizeChanged(w, h, oldw, oldh);
|
|
||||||
|
|
||||||
if (h != oldh) {
|
|
||||||
refreshMargins();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshMargins() {
|
|
||||||
int height = getHeight();
|
|
||||||
int visibleHeight = height - getScrollY();
|
|
||||||
((BrowserApp)GeckoApp.mAppContext).setToolbarHeight(height, visibleHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -111,8 +111,7 @@ abstract public class GeckoApp
|
||||||
extends GeckoActivity
|
extends GeckoActivity
|
||||||
implements GeckoEventListener, SensorEventListener, LocationListener,
|
implements GeckoEventListener, SensorEventListener, LocationListener,
|
||||||
Tabs.OnTabsChangedListener, GeckoEventResponder,
|
Tabs.OnTabsChangedListener, GeckoEventResponder,
|
||||||
GeckoMenu.Callback, GeckoMenu.MenuPresenter,
|
GeckoMenu.Callback, GeckoMenu.MenuPresenter
|
||||||
OnInterceptTouchListener
|
|
||||||
{
|
{
|
||||||
private static final String LOGTAG = "GeckoApp";
|
private static final String LOGTAG = "GeckoApp";
|
||||||
|
|
||||||
|
@ -150,7 +149,7 @@ abstract public class GeckoApp
|
||||||
static public final int RESTORE_CRASH = 2;
|
static public final int RESTORE_CRASH = 2;
|
||||||
|
|
||||||
StartupMode mStartupMode = null;
|
StartupMode mStartupMode = null;
|
||||||
protected RelativeLayout mMainLayout;
|
protected LinearLayout mMainLayout;
|
||||||
protected RelativeLayout mGeckoLayout;
|
protected RelativeLayout mGeckoLayout;
|
||||||
public View getView() { return mGeckoLayout; }
|
public View getView() { return mGeckoLayout; }
|
||||||
public SurfaceView cameraView;
|
public SurfaceView cameraView;
|
||||||
|
@ -187,8 +186,6 @@ abstract public class GeckoApp
|
||||||
|
|
||||||
private String mPrivateBrowsingSession;
|
private String mPrivateBrowsingSession;
|
||||||
|
|
||||||
private PointF mInitialTouchPoint = null;
|
|
||||||
|
|
||||||
private static Boolean sIsLargeTablet = null;
|
private static Boolean sIsLargeTablet = null;
|
||||||
private static Boolean sIsSmallTablet = null;
|
private static Boolean sIsSmallTablet = null;
|
||||||
|
|
||||||
|
@ -1398,7 +1395,7 @@ abstract public class GeckoApp
|
||||||
|
|
||||||
// setup gecko layout
|
// setup gecko layout
|
||||||
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
|
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
|
||||||
mMainLayout = (RelativeLayout) findViewById(R.id.main_layout);
|
mMainLayout = (LinearLayout) findViewById(R.id.main_layout);
|
||||||
|
|
||||||
// setup tabs panel
|
// setup tabs panel
|
||||||
mTabsPanel = (TabsPanel) findViewById(R.id.tabs_panel);
|
mTabsPanel = (TabsPanel) findViewById(R.id.tabs_panel);
|
||||||
|
@ -2435,41 +2432,42 @@ abstract public class GeckoApp
|
||||||
protected void connectGeckoLayerClient() {
|
protected void connectGeckoLayerClient() {
|
||||||
mLayerView.getLayerClient().notifyGeckoReady();
|
mLayerView.getLayerClient().notifyGeckoReady();
|
||||||
|
|
||||||
mLayerView.setTouchIntercepter(this);
|
mLayerView.setTouchIntercepter(new OnInterceptTouchListener() {
|
||||||
}
|
private PointF initialPoint = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
|
||||||
if (event == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
int action = event.getActionMasked();
|
|
||||||
PointF point = new PointF(event.getX(), event.getY());
|
|
||||||
if (action == MotionEvent.ACTION_DOWN) {
|
|
||||||
mInitialTouchPoint = point;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mInitialTouchPoint != null && action == MotionEvent.ACTION_MOVE) {
|
|
||||||
if (PointUtils.subtract(point, mInitialTouchPoint).length() <
|
|
||||||
PanZoomController.PAN_THRESHOLD) {
|
|
||||||
// Don't send the touchmove event if if the users finger hasn't moved far.
|
|
||||||
// Necessary for Google Maps to work correctly. See bug 771099.
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
mInitialTouchPoint = null;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event));
|
@Override
|
||||||
return true;
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
|
if (event == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
int action = event.getAction();
|
||||||
|
PointF point = new PointF(event.getX(), event.getY());
|
||||||
|
if ((action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
|
||||||
|
initialPoint = point;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initialPoint != null && (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE) {
|
||||||
|
if (PointUtils.subtract(point, initialPoint).length() < PanZoomController.PAN_THRESHOLD) {
|
||||||
|
// Don't send the touchmove event if if the users finger hasn't move far
|
||||||
|
// Necessary for Google Maps to work correctlly. See bug 771099.
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
initialPoint = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MainLayout extends RelativeLayout {
|
public static class MainLayout extends LinearLayout {
|
||||||
private OnInterceptTouchListener mOnInterceptTouchListener;
|
private OnInterceptTouchListener mOnInterceptTouchListener;
|
||||||
|
|
||||||
public MainLayout(Context context, AttributeSet attrs) {
|
public MainLayout(Context context, AttributeSet attrs) {
|
||||||
|
|
|
@ -548,10 +548,6 @@ public class GeckoEvent {
|
||||||
sb.append("{ \"x\" : ").append(metrics.viewportRectLeft)
|
sb.append("{ \"x\" : ").append(metrics.viewportRectLeft)
|
||||||
.append(", \"y\" : ").append(metrics.viewportRectTop)
|
.append(", \"y\" : ").append(metrics.viewportRectTop)
|
||||||
.append(", \"zoom\" : ").append(metrics.zoomFactor)
|
.append(", \"zoom\" : ").append(metrics.zoomFactor)
|
||||||
.append(", \"fixedMarginLeft\" : ").append(metrics.fixedLayerMarginLeft)
|
|
||||||
.append(", \"fixedMarginTop\" : ").append(metrics.fixedLayerMarginTop)
|
|
||||||
.append(", \"fixedMarginRight\" : ").append(metrics.fixedLayerMarginRight)
|
|
||||||
.append(", \"fixedMarginBottom\" : ").append(metrics.fixedLayerMarginBottom)
|
|
||||||
.append(", \"displayPort\" :").append(displayPort.toJSON())
|
.append(", \"displayPort\" :").append(displayPort.toJSON())
|
||||||
.append('}');
|
.append('}');
|
||||||
event.mCharactersExtra = sb.toString();
|
event.mCharactersExtra = sb.toString();
|
||||||
|
|
|
@ -59,7 +59,6 @@ FENNEC_JAVA_FILES = \
|
||||||
BrowserApp.java \
|
BrowserApp.java \
|
||||||
BrowserToolbar.java \
|
BrowserToolbar.java \
|
||||||
BrowserToolbarBackground.java \
|
BrowserToolbarBackground.java \
|
||||||
BrowserToolbarLayout.java \
|
|
||||||
CameraImageResultHandler.java \
|
CameraImageResultHandler.java \
|
||||||
CameraVideoResultHandler.java \
|
CameraVideoResultHandler.java \
|
||||||
CanvasDelegate.java \
|
CanvasDelegate.java \
|
||||||
|
|
|
@ -141,18 +141,12 @@ public class PropertyAnimator implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
/**
|
|
||||||
* Stop the animation, optionally snapping to the end position.
|
|
||||||
* onPropertyAnimationEnd is only called when snapping to the end position.
|
|
||||||
*/
|
|
||||||
public void stop(boolean snapToEndPosition) {
|
|
||||||
mFramePoster.cancelAnimationFrame();
|
mFramePoster.cancelAnimationFrame();
|
||||||
|
|
||||||
// Make sure to snap to the end position.
|
// Make sure to snap to the end position.
|
||||||
for (ElementHolder element : mElementsList) {
|
for (ElementHolder element : mElementsList) {
|
||||||
if (snapToEndPosition)
|
invalidate(element, element.to);
|
||||||
invalidate(element, element.to);
|
|
||||||
|
|
||||||
if (shouldEnableHardwareLayer(element))
|
if (shouldEnableHardwareLayer(element))
|
||||||
element.view.setLayerType(View.LAYER_TYPE_NONE, null);
|
element.view.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||||
|
@ -163,16 +157,11 @@ public class PropertyAnimator implements Runnable {
|
||||||
mElementsList.clear();
|
mElementsList.clear();
|
||||||
|
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
if (snapToEndPosition)
|
mListener.onPropertyAnimationEnd();
|
||||||
mListener.onPropertyAnimationEnd();
|
|
||||||
mListener = null;
|
mListener = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
stop(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean shouldEnableHardwareLayer(ElementHolder element) {
|
private boolean shouldEnableHardwareLayer(ElementHolder element) {
|
||||||
if (!mUseHardwareLayer)
|
if (!mUseHardwareLayer)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.mozilla.gecko.util.FloatUtils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -91,8 +90,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
private final PanZoomController mPanZoomController;
|
private final PanZoomController mPanZoomController;
|
||||||
private LayerView mView;
|
private LayerView mView;
|
||||||
|
|
||||||
private boolean mClampOnMarginChange;
|
|
||||||
|
|
||||||
public GeckoLayerClient(Context context, LayerView view, EventDispatcher eventDispatcher) {
|
public GeckoLayerClient(Context context, LayerView view, EventDispatcher eventDispatcher) {
|
||||||
// we can fill these in with dummy values because they are always written
|
// we can fill these in with dummy values because they are always written
|
||||||
// to before being read
|
// to before being read
|
||||||
|
@ -107,7 +104,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
mProgressiveUpdateDisplayPort = new DisplayPortMetrics();
|
mProgressiveUpdateDisplayPort = new DisplayPortMetrics();
|
||||||
mLastProgressiveUpdateWasLowPrecision = false;
|
mLastProgressiveUpdateWasLowPrecision = false;
|
||||||
mProgressiveUpdateWasInDanger = false;
|
mProgressiveUpdateWasInDanger = false;
|
||||||
mClampOnMarginChange = true;
|
|
||||||
|
|
||||||
mForceRedraw = true;
|
mForceRedraw = true;
|
||||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||||
|
@ -261,20 +257,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
ImmutableViewportMetrics metrics = getViewportMetrics();
|
ImmutableViewportMetrics metrics = getViewportMetrics();
|
||||||
ImmutableViewportMetrics clampedMetrics = metrics.clamp();
|
ImmutableViewportMetrics clampedMetrics = metrics.clamp();
|
||||||
|
|
||||||
// See if we need to alter the fixed margins - Fixed margins would
|
|
||||||
// otherwise be set even when the document is in overscroll and they're
|
|
||||||
// unnecessary.
|
|
||||||
if ((metrics.fixedLayerMarginLeft > 0 && metrics.viewportRectLeft < metrics.pageRectLeft) ||
|
|
||||||
(metrics.fixedLayerMarginTop > 0 && metrics.viewportRectTop < metrics.pageRectTop) ||
|
|
||||||
(metrics.fixedLayerMarginRight > 0 && metrics.viewportRectRight > metrics.pageRectRight) ||
|
|
||||||
(metrics.fixedLayerMarginBottom > 0 && metrics.viewportRectBottom > metrics.pageRectBottom)) {
|
|
||||||
clampedMetrics = clampedMetrics.setFixedLayerMargins(
|
|
||||||
Math.max(0, metrics.fixedLayerMarginLeft + Math.min(0, metrics.viewportRectLeft - metrics.pageRectLeft)),
|
|
||||||
Math.max(0, metrics.fixedLayerMarginTop + Math.min(0, metrics.viewportRectTop - metrics.pageRectTop)),
|
|
||||||
Math.max(0, metrics.fixedLayerMarginRight + Math.min(0, (metrics.pageRectRight - metrics.viewportRectRight))),
|
|
||||||
Math.max(0, metrics.fixedLayerMarginBottom + Math.min(0, (metrics.pageRectBottom - metrics.viewportRectBottom))));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (displayPort == null) {
|
if (displayPort == null) {
|
||||||
displayPort = DisplayPortCalculator.calculate(metrics, mPanZoomController.getVelocityVector());
|
displayPort = DisplayPortCalculator.calculate(metrics, mPanZoomController.getVelocityVector());
|
||||||
}
|
}
|
||||||
|
@ -321,8 +303,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
default:
|
default:
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
// Keep the old viewport size
|
// Keep the old viewport size
|
||||||
metrics = messageMetrics.setViewportSize(oldMetrics.getWidth(), oldMetrics.getHeight())
|
metrics = messageMetrics.setViewportSize(oldMetrics.getWidth(), oldMetrics.getHeight());
|
||||||
.setFixedLayerMarginsFrom(oldMetrics);
|
|
||||||
if (!oldMetrics.fuzzyEquals(metrics)) {
|
if (!oldMetrics.fuzzyEquals(metrics)) {
|
||||||
abortPanZoomAnimation();
|
abortPanZoomAnimation();
|
||||||
}
|
}
|
||||||
|
@ -365,36 +346,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets margins on fixed-position layers, to be used when compositing.
|
|
||||||
* Must be called on the UI thread!
|
|
||||||
*/
|
|
||||||
public void setFixedLayerMargins(float left, float top, float right, float bottom) {
|
|
||||||
ImmutableViewportMetrics oldMetrics = getViewportMetrics();
|
|
||||||
if (oldMetrics.fixedLayerMarginLeft == left &&
|
|
||||||
oldMetrics.fixedLayerMarginTop == top &&
|
|
||||||
oldMetrics.fixedLayerMarginRight == right &&
|
|
||||||
oldMetrics.fixedLayerMarginBottom == bottom) {
|
|
||||||
// Do nothing if the margins haven't changed.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImmutableViewportMetrics newMetrics = oldMetrics.setFixedLayerMargins(left, top, right, bottom);
|
|
||||||
|
|
||||||
if (mClampOnMarginChange) {
|
|
||||||
newMetrics = newMetrics.clampWithMargins();
|
|
||||||
}
|
|
||||||
|
|
||||||
mForceRedraw = true;
|
|
||||||
setViewportMetrics(newMetrics, true);
|
|
||||||
|
|
||||||
mView.requestRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClampOnFixedLayerMarginsChange(boolean aClamp) {
|
|
||||||
mClampOnMarginChange = aClamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is called on the Gecko thread to determine if we're still interested
|
// This is called on the Gecko thread to determine if we're still interested
|
||||||
// in the update of this display-port to continue. We can return true here
|
// in the update of this display-port to continue. We can return true here
|
||||||
// to abort the current update and continue with any subsequent ones. This
|
// to abort the current update and continue with any subsequent ones. This
|
||||||
|
@ -506,15 +457,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
float pageLeft, float pageTop, float pageRight, float pageBottom,
|
float pageLeft, float pageTop, float pageRight, float pageBottom,
|
||||||
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
|
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
ImmutableViewportMetrics currentMetrics = getViewportMetrics();
|
final ImmutableViewportMetrics newMetrics = getViewportMetrics()
|
||||||
|
|
||||||
// If we're meant to be scrolled to the top, take into account any
|
|
||||||
// margin set on the pan zoom controller.
|
|
||||||
if (offsetY == 0) {
|
|
||||||
offsetY = -currentMetrics.fixedLayerMarginTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ImmutableViewportMetrics newMetrics = currentMetrics
|
|
||||||
.setViewportOrigin(offsetX, offsetY)
|
.setViewportOrigin(offsetX, offsetY)
|
||||||
.setZoomFactor(zoom)
|
.setZoomFactor(zoom)
|
||||||
.setPageRect(new RectF(pageLeft, pageTop, pageRight, pageBottom),
|
.setPageRect(new RectF(pageLeft, pageTop, pageRight, pageBottom),
|
||||||
|
@ -594,20 +537,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
mCurrentViewTransform.y = mFrameMetrics.viewportRectTop;
|
mCurrentViewTransform.y = mFrameMetrics.viewportRectTop;
|
||||||
mCurrentViewTransform.scale = mFrameMetrics.zoomFactor;
|
mCurrentViewTransform.scale = mFrameMetrics.zoomFactor;
|
||||||
|
|
||||||
// Adjust the fixed layer margins so that overscroll subtracts from them.
|
|
||||||
mCurrentViewTransform.fixedLayerMarginLeft =
|
|
||||||
Math.max(0, mFrameMetrics.fixedLayerMarginLeft +
|
|
||||||
Math.min(0, mFrameMetrics.viewportRectLeft - mFrameMetrics.pageRectLeft));
|
|
||||||
mCurrentViewTransform.fixedLayerMarginTop =
|
|
||||||
Math.max(0, mFrameMetrics.fixedLayerMarginTop +
|
|
||||||
Math.min(0, mFrameMetrics.viewportRectTop - mFrameMetrics.pageRectTop));
|
|
||||||
mCurrentViewTransform.fixedLayerMarginRight =
|
|
||||||
Math.max(0, mFrameMetrics.fixedLayerMarginRight +
|
|
||||||
Math.min(0, (mFrameMetrics.pageRectRight - mFrameMetrics.viewportRectRight)));
|
|
||||||
mCurrentViewTransform.fixedLayerMarginBottom =
|
|
||||||
Math.max(0, mFrameMetrics.fixedLayerMarginBottom +
|
|
||||||
Math.min(0, (mFrameMetrics.pageRectBottom - mFrameMetrics.viewportRectBottom)));
|
|
||||||
|
|
||||||
mRootLayer.setPositionAndResolution(x, y, x + width, y + height, resolution);
|
mRootLayer.setPositionAndResolution(x, y, x + width, y + height, resolution);
|
||||||
|
|
||||||
if (layersUpdated && mRecordDrawTimes) {
|
if (layersUpdated && mRecordDrawTimes) {
|
||||||
|
@ -744,7 +673,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ImmutableViewportMetrics m = mViewportMetrics;
|
ImmutableViewportMetrics m = mViewportMetrics;
|
||||||
BrowserApp.mBrowserToolbar.setShadowVisibility(m.viewportRectTop >= m.pageRectTop - m.fixedLayerMarginTop);
|
BrowserApp.mBrowserToolbar.setShadowVisibility(m.viewportRectTop >= m.pageRectTop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,6 @@ public class ImmutableViewportMetrics {
|
||||||
public final float viewportRectTop;
|
public final float viewportRectTop;
|
||||||
public final float viewportRectRight;
|
public final float viewportRectRight;
|
||||||
public final float viewportRectBottom;
|
public final float viewportRectBottom;
|
||||||
public final float fixedLayerMarginLeft;
|
|
||||||
public final float fixedLayerMarginTop;
|
|
||||||
public final float fixedLayerMarginRight;
|
|
||||||
public final float fixedLayerMarginBottom;
|
|
||||||
public final float zoomFactor;
|
public final float zoomFactor;
|
||||||
|
|
||||||
public ImmutableViewportMetrics(DisplayMetrics metrics) {
|
public ImmutableViewportMetrics(DisplayMetrics metrics) {
|
||||||
|
@ -43,7 +39,6 @@ public class ImmutableViewportMetrics {
|
||||||
viewportRectTop = pageRectTop = cssPageRectTop = 0;
|
viewportRectTop = pageRectTop = cssPageRectTop = 0;
|
||||||
viewportRectRight = pageRectRight = cssPageRectRight = metrics.widthPixels;
|
viewportRectRight = pageRectRight = cssPageRectRight = metrics.widthPixels;
|
||||||
viewportRectBottom = pageRectBottom = cssPageRectBottom = metrics.heightPixels;
|
viewportRectBottom = pageRectBottom = cssPageRectBottom = metrics.heightPixels;
|
||||||
fixedLayerMarginLeft = fixedLayerMarginTop = fixedLayerMarginRight = fixedLayerMarginBottom = 0;
|
|
||||||
zoomFactor = 1.0f;
|
zoomFactor = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,21 +47,6 @@ public class ImmutableViewportMetrics {
|
||||||
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
||||||
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
||||||
float aViewportRectBottom, float aZoomFactor)
|
float aViewportRectBottom, float aZoomFactor)
|
||||||
{
|
|
||||||
this(aPageRectLeft, aPageRectTop,
|
|
||||||
aPageRectRight, aPageRectBottom, aCssPageRectLeft,
|
|
||||||
aCssPageRectTop, aCssPageRectRight, aCssPageRectBottom,
|
|
||||||
aViewportRectLeft, aViewportRectTop, aViewportRectRight,
|
|
||||||
aViewportRectBottom, 0.0f, 0.0f, 0.0f, 0.0f, aZoomFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
|
|
||||||
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
|
|
||||||
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
|
||||||
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
|
||||||
float aViewportRectBottom, float aFixedLayerMarginLeft,
|
|
||||||
float aFixedLayerMarginTop, float aFixedLayerMarginRight,
|
|
||||||
float aFixedLayerMarginBottom, float aZoomFactor)
|
|
||||||
{
|
{
|
||||||
pageRectLeft = aPageRectLeft;
|
pageRectLeft = aPageRectLeft;
|
||||||
pageRectTop = aPageRectTop;
|
pageRectTop = aPageRectTop;
|
||||||
|
@ -80,10 +60,6 @@ public class ImmutableViewportMetrics {
|
||||||
viewportRectTop = aViewportRectTop;
|
viewportRectTop = aViewportRectTop;
|
||||||
viewportRectRight = aViewportRectRight;
|
viewportRectRight = aViewportRectRight;
|
||||||
viewportRectBottom = aViewportRectBottom;
|
viewportRectBottom = aViewportRectBottom;
|
||||||
fixedLayerMarginLeft = aFixedLayerMarginLeft;
|
|
||||||
fixedLayerMarginTop = aFixedLayerMarginTop;
|
|
||||||
fixedLayerMarginRight = aFixedLayerMarginRight;
|
|
||||||
fixedLayerMarginBottom = aFixedLayerMarginBottom;
|
|
||||||
zoomFactor = aZoomFactor;
|
zoomFactor = aZoomFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +125,6 @@ public class ImmutableViewportMetrics {
|
||||||
FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
|
FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
|
||||||
FloatUtils.interpolate(viewportRectRight, to.viewportRectRight, t),
|
FloatUtils.interpolate(viewportRectRight, to.viewportRectRight, t),
|
||||||
FloatUtils.interpolate(viewportRectBottom, to.viewportRectBottom, t),
|
FloatUtils.interpolate(viewportRectBottom, to.viewportRectBottom, t),
|
||||||
FloatUtils.interpolate(fixedLayerMarginLeft, to.fixedLayerMarginLeft, t),
|
|
||||||
FloatUtils.interpolate(fixedLayerMarginTop, to.fixedLayerMarginTop, t),
|
|
||||||
FloatUtils.interpolate(fixedLayerMarginRight, to.fixedLayerMarginRight, t),
|
|
||||||
FloatUtils.interpolate(fixedLayerMarginBottom, to.fixedLayerMarginBottom, t),
|
|
||||||
FloatUtils.interpolate(zoomFactor, to.zoomFactor, t));
|
FloatUtils.interpolate(zoomFactor, to.zoomFactor, t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +133,6 @@ public class ImmutableViewportMetrics {
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectLeft + width, viewportRectTop + height,
|
viewportRectLeft, viewportRectTop, viewportRectLeft + width, viewportRectTop + height,
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
zoomFactor);
|
zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +141,6 @@ public class ImmutableViewportMetrics {
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
newOriginX, newOriginY, newOriginX + getWidth(), newOriginY + getHeight(),
|
newOriginX, newOriginY, newOriginX + getWidth(), newOriginY + getHeight(),
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
zoomFactor);
|
zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +149,6 @@ public class ImmutableViewportMetrics {
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
newZoomFactor);
|
newZoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,25 +161,9 @@ public class ImmutableViewportMetrics {
|
||||||
pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
|
pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
|
||||||
cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
|
cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
zoomFactor);
|
zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableViewportMetrics setFixedLayerMargins(float left, float top, float right, float bottom) {
|
|
||||||
return new ImmutableViewportMetrics(
|
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
|
||||||
left, top, right, bottom, zoomFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImmutableViewportMetrics setFixedLayerMarginsFrom(ImmutableViewportMetrics fromMetrics) {
|
|
||||||
return setFixedLayerMargins(fromMetrics.fixedLayerMarginLeft,
|
|
||||||
fromMetrics.fixedLayerMarginTop,
|
|
||||||
fromMetrics.fixedLayerMarginRight,
|
|
||||||
fromMetrics.fixedLayerMarginBottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This will set the zoom factor and re-scale page-size and viewport offset
|
/* This will set the zoom factor and re-scale page-size and viewport offset
|
||||||
* accordingly. The given focus will remain at the same point on the screen
|
* accordingly. The given focus will remain at the same point on the screen
|
||||||
* after scaling.
|
* after scaling.
|
||||||
|
@ -232,51 +185,35 @@ public class ImmutableViewportMetrics {
|
||||||
newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
|
newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
origin.x, origin.y, origin.x + getWidth(), origin.y + getHeight(),
|
origin.x, origin.y, origin.x + getWidth(), origin.y + getHeight(),
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
newZoomFactor);
|
newZoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Clamps the viewport to remain within the page rect. */
|
/** Clamps the viewport to remain within the page rect. */
|
||||||
private ImmutableViewportMetrics clamp(float marginLeft, float marginTop,
|
public ImmutableViewportMetrics clamp() {
|
||||||
float marginRight, float marginBottom) {
|
|
||||||
RectF newViewport = getViewport();
|
RectF newViewport = getViewport();
|
||||||
|
|
||||||
// The viewport bounds ought to never exceed the page bounds.
|
// The viewport bounds ought to never exceed the page bounds.
|
||||||
if (newViewport.right > pageRectRight + marginRight)
|
if (newViewport.right > pageRectRight)
|
||||||
newViewport.offset((pageRectRight + marginRight) - newViewport.right, 0);
|
newViewport.offset(pageRectRight - newViewport.right, 0);
|
||||||
if (newViewport.left < pageRectLeft - marginLeft)
|
if (newViewport.left < pageRectLeft)
|
||||||
newViewport.offset((pageRectLeft - marginLeft) - newViewport.left, 0);
|
newViewport.offset(pageRectLeft - newViewport.left, 0);
|
||||||
|
|
||||||
if (newViewport.bottom > pageRectBottom + marginBottom)
|
if (newViewport.bottom > pageRectBottom)
|
||||||
newViewport.offset(0, (pageRectBottom + marginBottom) - newViewport.bottom);
|
newViewport.offset(0, pageRectBottom - newViewport.bottom);
|
||||||
if (newViewport.top < pageRectTop - marginTop)
|
if (newViewport.top < pageRectTop)
|
||||||
newViewport.offset(0, (pageRectTop - marginTop) - newViewport.top);
|
newViewport.offset(0, pageRectTop - newViewport.top);
|
||||||
|
|
||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
newViewport.left, newViewport.top, newViewport.right, newViewport.bottom,
|
newViewport.left, newViewport.top, newViewport.right, newViewport.bottom,
|
||||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
|
||||||
zoomFactor);
|
zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableViewportMetrics clamp() {
|
|
||||||
return clamp(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImmutableViewportMetrics clampWithMargins() {
|
|
||||||
return clamp(fixedLayerMarginLeft, fixedLayerMarginTop,
|
|
||||||
fixedLayerMarginRight, fixedLayerMarginBottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean fuzzyEquals(ImmutableViewportMetrics other) {
|
public boolean fuzzyEquals(ImmutableViewportMetrics other) {
|
||||||
// Don't bother checking the pageRectXXX values because they are a product
|
// Don't bother checking the pageRectXXX values because they are a product
|
||||||
// of the cssPageRectXXX values and the zoomFactor, except with more rounding
|
// of the cssPageRectXXX values and the zoomFactor, except with more rounding
|
||||||
// error. Checking those is both inefficient and can lead to false negatives.
|
// error. Checking those is both inefficient and can lead to false negatives.
|
||||||
//
|
|
||||||
// This doesn't return false if the fixed layer margins differ as none
|
|
||||||
// of the users of this function are interested in the margins in that
|
|
||||||
// way.
|
|
||||||
return FloatUtils.fuzzyEquals(cssPageRectLeft, other.cssPageRectLeft)
|
return FloatUtils.fuzzyEquals(cssPageRectLeft, other.cssPageRectLeft)
|
||||||
&& FloatUtils.fuzzyEquals(cssPageRectTop, other.cssPageRectTop)
|
&& FloatUtils.fuzzyEquals(cssPageRectTop, other.cssPageRectTop)
|
||||||
&& FloatUtils.fuzzyEquals(cssPageRectRight, other.cssPageRectRight)
|
&& FloatUtils.fuzzyEquals(cssPageRectRight, other.cssPageRectRight)
|
||||||
|
@ -294,8 +231,6 @@ public class ImmutableViewportMetrics {
|
||||||
+ viewportRectRight + "," + viewportRectBottom + ") p=(" + pageRectLeft + ","
|
+ viewportRectRight + "," + viewportRectBottom + ") p=(" + pageRectLeft + ","
|
||||||
+ pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
|
+ pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
|
||||||
+ cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
|
+ cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
|
||||||
+ cssPageRectBottom + ") m=(" + fixedLayerMarginLeft + ","
|
+ cssPageRectBottom + ") z=" + zoomFactor;
|
||||||
+ fixedLayerMarginTop + "," + fixedLayerMarginRight + ","
|
|
||||||
+ fixedLayerMarginBottom + ") z=" + zoomFactor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -829,21 +829,15 @@ class JavaPanZoomController
|
||||||
|
|
||||||
// Ensure minZoomFactor keeps the page at least as big as the viewport.
|
// Ensure minZoomFactor keeps the page at least as big as the viewport.
|
||||||
if (pageRect.width() > 0) {
|
if (pageRect.width() > 0) {
|
||||||
float pageWidth = pageRect.width() +
|
float scaleFactor = viewport.width() / pageRect.width();
|
||||||
viewportMetrics.fixedLayerMarginLeft +
|
|
||||||
viewportMetrics.fixedLayerMarginRight;
|
|
||||||
float scaleFactor = viewport.width() / pageWidth;
|
|
||||||
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||||
if (viewport.width() > pageWidth)
|
if (viewport.width() > pageRect.width())
|
||||||
focusX = 0.0f;
|
focusX = 0.0f;
|
||||||
}
|
}
|
||||||
if (pageRect.height() > 0) {
|
if (pageRect.height() > 0) {
|
||||||
float pageHeight = pageRect.height() +
|
float scaleFactor = viewport.height() / pageRect.height();
|
||||||
viewportMetrics.fixedLayerMarginTop +
|
|
||||||
viewportMetrics.fixedLayerMarginBottom;
|
|
||||||
float scaleFactor = viewport.height() / pageHeight;
|
|
||||||
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||||
if (viewport.height() > pageHeight)
|
if (viewport.height() > pageRect.height())
|
||||||
focusY = 0.0f;
|
focusY = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +857,7 @@ class JavaPanZoomController
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we pan to the right origin. */
|
/* Now we pan to the right origin. */
|
||||||
viewportMetrics = viewportMetrics.clampWithMargins();
|
viewportMetrics = viewportMetrics.clamp();
|
||||||
|
|
||||||
return viewportMetrics;
|
return viewportMetrics;
|
||||||
}
|
}
|
||||||
|
@ -875,15 +869,9 @@ class JavaPanZoomController
|
||||||
@Override
|
@Override
|
||||||
protected float getViewportLength() { return getMetrics().getWidth(); }
|
protected float getViewportLength() { return getMetrics().getWidth(); }
|
||||||
@Override
|
@Override
|
||||||
protected float getPageStart() {
|
protected float getPageStart() { return getMetrics().pageRectLeft; }
|
||||||
ImmutableViewportMetrics metrics = getMetrics();
|
|
||||||
return metrics.pageRectLeft - metrics.fixedLayerMarginLeft;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected float getPageLength() {
|
protected float getPageLength() { return getMetrics().getPageWidth(); }
|
||||||
ImmutableViewportMetrics metrics = getMetrics();
|
|
||||||
return metrics.getPageWidth() + metrics.fixedLayerMarginLeft + metrics.fixedLayerMarginRight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AxisY extends Axis {
|
private class AxisY extends Axis {
|
||||||
|
@ -893,15 +881,9 @@ class JavaPanZoomController
|
||||||
@Override
|
@Override
|
||||||
protected float getViewportLength() { return getMetrics().getHeight(); }
|
protected float getViewportLength() { return getMetrics().getHeight(); }
|
||||||
@Override
|
@Override
|
||||||
protected float getPageStart() {
|
protected float getPageStart() { return getMetrics().pageRectTop; }
|
||||||
ImmutableViewportMetrics metrics = getMetrics();
|
|
||||||
return metrics.pageRectTop - metrics.fixedLayerMarginTop;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected float getPageLength() {
|
protected float getPageLength() { return getMetrics().getPageHeight(); }
|
||||||
ImmutableViewportMetrics metrics = getMetrics();
|
|
||||||
return metrics.getPageHeight() + metrics.fixedLayerMarginTop + metrics.fixedLayerMarginBottom;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -9,19 +9,11 @@ public class ViewTransform {
|
||||||
public float x;
|
public float x;
|
||||||
public float y;
|
public float y;
|
||||||
public float scale;
|
public float scale;
|
||||||
public float fixedLayerMarginLeft;
|
|
||||||
public float fixedLayerMarginTop;
|
|
||||||
public float fixedLayerMarginRight;
|
|
||||||
public float fixedLayerMarginBottom;
|
|
||||||
|
|
||||||
public ViewTransform(float inX, float inY, float inScale) {
|
public ViewTransform(float inX, float inY, float inScale) {
|
||||||
x = inX;
|
x = inX;
|
||||||
y = inY;
|
y = inY;
|
||||||
scale = inScale;
|
scale = inScale;
|
||||||
fixedLayerMarginLeft = 0;
|
|
||||||
fixedLayerMarginTop = 0;
|
|
||||||
fixedLayerMarginRight = 0;
|
|
||||||
fixedLayerMarginBottom = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar">
|
style="@style/BrowserToolbar">
|
||||||
|
@ -165,4 +165,4 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar">
|
style="@style/BrowserToolbar">
|
||||||
|
@ -173,4 +173,4 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar">
|
style="@style/BrowserToolbar">
|
||||||
|
@ -179,4 +179,4 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar">
|
style="@style/BrowserToolbar">
|
||||||
|
@ -163,4 +163,4 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@"
|
||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar">
|
style="@style/BrowserToolbar">
|
||||||
|
@ -172,4 +172,4 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -20,15 +20,10 @@
|
||||||
|
|
||||||
<!-- BrowserToolbar will be added dynamically -->
|
<!-- BrowserToolbar will be added dynamically -->
|
||||||
|
|
||||||
<FrameLayout android:id="@+id/toolbar_spacer"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
|
|
||||||
<RelativeLayout android:id="@+id/gecko_layout"
|
<RelativeLayout android:id="@+id/gecko_layout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:layout_below="@+id/toolbar_spacer">
|
|
||||||
|
|
||||||
<include layout="@layout/shared_ui_components"/>
|
<include layout="@layout/shared_ui_components"/>
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,6 @@ var BrowserApp = {
|
||||||
Services.obs.addObserver(this, "FullScreen:Exit", false);
|
Services.obs.addObserver(this, "FullScreen:Exit", false);
|
||||||
Services.obs.addObserver(this, "Viewport:Change", false);
|
Services.obs.addObserver(this, "Viewport:Change", false);
|
||||||
Services.obs.addObserver(this, "Viewport:Flush", false);
|
Services.obs.addObserver(this, "Viewport:Flush", false);
|
||||||
Services.obs.addObserver(this, "Viewport:FixedMarginsChanged", false);
|
|
||||||
Services.obs.addObserver(this, "Passwords:Init", false);
|
Services.obs.addObserver(this, "Passwords:Init", false);
|
||||||
Services.obs.addObserver(this, "FormHistory:Init", false);
|
Services.obs.addObserver(this, "FormHistory:Init", false);
|
||||||
Services.obs.addObserver(this, "ToggleProfiling", false);
|
Services.obs.addObserver(this, "ToggleProfiling", false);
|
||||||
|
@ -1253,10 +1252,6 @@ var BrowserApp = {
|
||||||
sendMessageToJava({ type: "Telemetry:Gather" });
|
sendMessageToJava({ type: "Telemetry:Gather" });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Viewport:FixedMarginsChanged":
|
|
||||||
gViewportMargins = JSON.parse(aData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dump('BrowserApp.observe: unexpected topic "' + aTopic + '"\n');
|
dump('BrowserApp.observe: unexpected topic "' + aTopic + '"\n');
|
||||||
break;
|
break;
|
||||||
|
@ -2786,12 +2781,6 @@ nsBrowserAccess.prototype = {
|
||||||
let gScreenWidth = 1;
|
let gScreenWidth = 1;
|
||||||
let gScreenHeight = 1;
|
let gScreenHeight = 1;
|
||||||
|
|
||||||
// The margins that should be applied to the viewport for fixed position
|
|
||||||
// children. This is used to avoid browser chrome permanently obscuring
|
|
||||||
// fixed position content, and also to make sure window-sized pages take
|
|
||||||
// into account said browser chrome.
|
|
||||||
let gViewportMargins = { top: 0, right: 0, bottom: 0, left: 0};
|
|
||||||
|
|
||||||
function Tab(aURL, aParams) {
|
function Tab(aURL, aParams) {
|
||||||
this.browser = null;
|
this.browser = null;
|
||||||
this.id = 0;
|
this.id = 0;
|
||||||
|
@ -2799,14 +2788,7 @@ function Tab(aURL, aParams) {
|
||||||
this.showProgress = true;
|
this.showProgress = true;
|
||||||
this._zoom = 1.0;
|
this._zoom = 1.0;
|
||||||
this._drawZoom = 1.0;
|
this._drawZoom = 1.0;
|
||||||
this._fixedMarginLeft = 0;
|
|
||||||
this._fixedMarginTop = 0;
|
|
||||||
this._fixedMarginRight = 0;
|
|
||||||
this._fixedMarginBottom = 0;
|
|
||||||
this.userScrollPos = { x: 0, y: 0 };
|
this.userScrollPos = { x: 0, y: 0 };
|
||||||
this.viewportExcludesHorizontalMargins = true;
|
|
||||||
this.viewportExcludesVerticalMargins = true;
|
|
||||||
this.updatingViewportForPageSizeChange = false;
|
|
||||||
this.contentDocumentIsDisplayed = true;
|
this.contentDocumentIsDisplayed = true;
|
||||||
this.pluginDoorhangerTimeout = null;
|
this.pluginDoorhangerTimeout = null;
|
||||||
this.shouldShowPluginDoorhanger = true;
|
this.shouldShowPluginDoorhanger = true;
|
||||||
|
@ -3275,34 +3257,15 @@ Tab.prototype = {
|
||||||
setScrollClampingSize: function(zoom) {
|
setScrollClampingSize: function(zoom) {
|
||||||
let viewportWidth = gScreenWidth / zoom;
|
let viewportWidth = gScreenWidth / zoom;
|
||||||
let viewportHeight = gScreenHeight / zoom;
|
let viewportHeight = gScreenHeight / zoom;
|
||||||
let screenWidth = gScreenWidth;
|
|
||||||
let screenHeight = gScreenHeight;
|
|
||||||
|
|
||||||
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument,
|
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument,
|
||||||
viewportWidth, viewportHeight);
|
viewportWidth, viewportHeight);
|
||||||
|
|
||||||
// Check if the page would fit into either of the viewport dimensions minus
|
|
||||||
// the margins and shrink the screen size accordingly so that the aspect
|
|
||||||
// ratio calculation below works correctly in these situations.
|
|
||||||
// We take away the margin size over two to account for rounding errors,
|
|
||||||
// as the browser size set in updateViewportSize doesn't allow for any
|
|
||||||
// size between these two values (and thus anything between them is
|
|
||||||
// attributable to rounding error).
|
|
||||||
if ((pageHeight * zoom) < gScreenHeight - (gViewportMargins.top + gViewportMargins.bottom) / 2) {
|
|
||||||
screenHeight = gScreenHeight - gViewportMargins.top - gViewportMargins.bottom;
|
|
||||||
viewportHeight = screenHeight / zoom;
|
|
||||||
}
|
|
||||||
if ((pageWidth * zoom) < gScreenWidth - (gViewportMargins.left + gViewportMargins.right) / 2) {
|
|
||||||
screenWidth = gScreenWidth - gViewportMargins.left - gViewportMargins.right;
|
|
||||||
viewportWidth = screenWidth / zoom;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the aspect ratio of the screen is maintained when setting
|
// Make sure the aspect ratio of the screen is maintained when setting
|
||||||
// the clamping scroll-port size.
|
// the clamping scroll-port size.
|
||||||
let factor = Math.min(viewportWidth / screenWidth, pageWidth / screenWidth,
|
let factor = Math.min(viewportWidth / gScreenWidth, pageWidth / gScreenWidth,
|
||||||
viewportHeight / screenHeight, pageHeight / screenHeight);
|
viewportHeight / gScreenHeight, pageHeight / gScreenHeight);
|
||||||
let scrollPortWidth = Math.min(screenWidth * factor, pageWidth * zoom);
|
let scrollPortWidth = gScreenWidth * factor;
|
||||||
let scrollPortHeight = Math.min(screenHeight * factor, pageHeight * zoom);
|
let scrollPortHeight = gScreenHeight * factor;
|
||||||
|
|
||||||
let win = this.browser.contentWindow;
|
let win = this.browser.contentWindow;
|
||||||
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).
|
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).
|
||||||
|
@ -3339,19 +3302,6 @@ Tab.prototype = {
|
||||||
if (aViewport.displayPort)
|
if (aViewport.displayPort)
|
||||||
this.setDisplayPort(aViewport.displayPort);
|
this.setDisplayPort(aViewport.displayPort);
|
||||||
|
|
||||||
// Store fixed margins for later retrieval in getViewport.
|
|
||||||
this._fixedMarginLeft = aViewport.fixedMarginLeft;
|
|
||||||
this._fixedMarginTop = aViewport.fixedMarginTop;
|
|
||||||
this._fixedMarginRight = aViewport.fixedMarginRight;
|
|
||||||
this._fixedMarginBottom = aViewport.fixedMarginBottom;
|
|
||||||
|
|
||||||
let dwi = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
|
||||||
dwi.setContentDocumentFixedPositionMargins(
|
|
||||||
aViewport.fixedMarginTop / aViewport.zoom,
|
|
||||||
aViewport.fixedMarginRight / aViewport.zoom,
|
|
||||||
aViewport.fixedMarginBottom / aViewport.zoom,
|
|
||||||
aViewport.fixedMarginLeft / aViewport.zoom);
|
|
||||||
|
|
||||||
Services.obs.notifyObservers(null, "after-viewport-change", "");
|
Services.obs.notifyObservers(null, "after-viewport-change", "");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3375,27 +3325,20 @@ Tab.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getViewport: function() {
|
getViewport: function() {
|
||||||
let screenW = gScreenWidth - gViewportMargins.left - gViewportMargins.right;
|
|
||||||
let screenH = gScreenHeight - gViewportMargins.top - gViewportMargins.bottom;
|
|
||||||
|
|
||||||
let viewport = {
|
let viewport = {
|
||||||
width: screenW,
|
width: gScreenWidth,
|
||||||
height: screenH,
|
height: gScreenHeight,
|
||||||
cssWidth: screenW / this._zoom,
|
cssWidth: gScreenWidth / this._zoom,
|
||||||
cssHeight: screenH / this._zoom,
|
cssHeight: gScreenHeight / this._zoom,
|
||||||
pageLeft: 0,
|
pageLeft: 0,
|
||||||
pageTop: 0,
|
pageTop: 0,
|
||||||
pageRight: screenW,
|
pageRight: gScreenWidth,
|
||||||
pageBottom: screenH,
|
pageBottom: gScreenHeight,
|
||||||
// We make up matching css page dimensions
|
// We make up matching css page dimensions
|
||||||
cssPageLeft: 0,
|
cssPageLeft: 0,
|
||||||
cssPageTop: 0,
|
cssPageTop: 0,
|
||||||
cssPageRight: screenW / this._zoom,
|
cssPageRight: gScreenWidth / this._zoom,
|
||||||
cssPageBottom: screenH / this._zoom,
|
cssPageBottom: gScreenHeight / this._zoom,
|
||||||
fixedMarginLeft: this._fixedMarginLeft,
|
|
||||||
fixedMarginTop: this._fixedMarginTop,
|
|
||||||
fixedMarginRight: this._fixedMarginRight,
|
|
||||||
fixedMarginBottom: this._fixedMarginBottom,
|
|
||||||
zoom: this._zoom,
|
zoom: this._zoom,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3445,20 +3388,6 @@ Tab.prototype = {
|
||||||
let displayPort = getBridge().getDisplayPort(aPageSizeUpdate, BrowserApp.isBrowserContentDocumentDisplayed(), this.id, viewport);
|
let displayPort = getBridge().getDisplayPort(aPageSizeUpdate, BrowserApp.isBrowserContentDocumentDisplayed(), this.id, viewport);
|
||||||
if (displayPort != null)
|
if (displayPort != null)
|
||||||
this.setDisplayPort(displayPort);
|
this.setDisplayPort(displayPort);
|
||||||
|
|
||||||
// If the page size has changed so that it might or might not fit on the
|
|
||||||
// screen with the margins included, run updateViewportSize to resize the
|
|
||||||
// browser accordingly. The -1 is to account for rounding errors.
|
|
||||||
if (!this.updatingViewportForPageSizeChange) {
|
|
||||||
this.updatingViewportForPageSizeChange = true;
|
|
||||||
if (((viewport.pageBottom - viewport.pageTop <= gScreenHeight - 1) !=
|
|
||||||
this.viewportExcludesVerticalMargins) ||
|
|
||||||
((viewport.pageRight - viewport.pageLeft <= gScreenWidth - 1) !=
|
|
||||||
this.viewportExcludesHorizontalMargins)) {
|
|
||||||
this.updateViewportSize(gScreenWidth);
|
|
||||||
}
|
|
||||||
this.updatingViewportForPageSizeChange = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
|
@ -3885,11 +3814,9 @@ Tab.prototype = {
|
||||||
if (!browser)
|
if (!browser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let screenW = gScreenWidth - gViewportMargins.left - gViewportMargins.right;
|
let screenW = gScreenWidth;
|
||||||
let screenH = gScreenHeight - gViewportMargins.top - gViewportMargins.bottom;
|
let screenH = gScreenHeight;
|
||||||
let viewportW, viewportH;
|
let viewportW, viewportH;
|
||||||
this.viewportExcludesHorizontalMargins = true;
|
|
||||||
this.viewportExcludesVerticalMargins = true;
|
|
||||||
|
|
||||||
let metadata = this.metadata;
|
let metadata = this.metadata;
|
||||||
if (metadata.autoSize) {
|
if (metadata.autoSize) {
|
||||||
|
@ -3944,21 +3871,7 @@ Tab.prototype = {
|
||||||
// this may get run during a Viewport:Change message while the document
|
// this may get run during a Viewport:Change message while the document
|
||||||
// has not yet loaded, so need to guard against a null document.
|
// has not yet loaded, so need to guard against a null document.
|
||||||
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument, viewportW, viewportH);
|
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument, viewportW, viewportH);
|
||||||
|
minScale = gScreenWidth / pageWidth;
|
||||||
minScale = screenW / pageWidth;
|
|
||||||
|
|
||||||
// In the situation the page size exceeds the screen size minus the
|
|
||||||
// viewport margins on either axis, lengthen the viewport on the
|
|
||||||
// corresponding axis to include the margins.
|
|
||||||
// The +1 is to account for rounding errors.
|
|
||||||
if (pageWidth * this._zoom >= screenW + 1) {
|
|
||||||
screenW = gScreenWidth;
|
|
||||||
this.viewportExcludesHorizontalMargins = false;
|
|
||||||
}
|
|
||||||
if (pageHeight * this._zoom >= screenH + 1) {
|
|
||||||
screenH = gScreenHeight;
|
|
||||||
this.viewportExcludesVerticalMargins = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
minScale = this.clampZoom(minScale);
|
minScale = this.clampZoom(minScale);
|
||||||
viewportH = Math.max(viewportH, screenH / minScale);
|
viewportH = Math.max(viewportH, screenH / minScale);
|
||||||
|
|
|
@ -2110,15 +2110,13 @@ AndroidBridge::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
gfx::Margin& aFixedLayerMargins)
|
|
||||||
{
|
{
|
||||||
AndroidGeckoLayerClient *client = mLayerClient;
|
AndroidGeckoLayerClient *client = mLayerClient;
|
||||||
if (!client)
|
if (!client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated, aScrollOffset, aScaleX, aScaleY);
|
||||||
aScrollOffset, aScaleX, aScaleY, aFixedLayerMargins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidBridge::AndroidBridge()
|
AndroidBridge::AndroidBridge()
|
||||||
|
|
|
@ -332,8 +332,7 @@ public:
|
||||||
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::Margin& aFixedLayerMargins);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -100,10 +100,6 @@ jclass AndroidViewTransform::jViewTransformClass = 0;
|
||||||
jfieldID AndroidViewTransform::jXField = 0;
|
jfieldID AndroidViewTransform::jXField = 0;
|
||||||
jfieldID AndroidViewTransform::jYField = 0;
|
jfieldID AndroidViewTransform::jYField = 0;
|
||||||
jfieldID AndroidViewTransform::jScaleField = 0;
|
jfieldID AndroidViewTransform::jScaleField = 0;
|
||||||
jfieldID AndroidViewTransform::jFixedLayerMarginLeft = 0;
|
|
||||||
jfieldID AndroidViewTransform::jFixedLayerMarginTop = 0;
|
|
||||||
jfieldID AndroidViewTransform::jFixedLayerMarginRight = 0;
|
|
||||||
jfieldID AndroidViewTransform::jFixedLayerMarginBottom = 0;
|
|
||||||
|
|
||||||
jclass AndroidProgressiveUpdateData::jProgressiveUpdateDataClass = 0;
|
jclass AndroidProgressiveUpdateData::jProgressiveUpdateDataClass = 0;
|
||||||
jfieldID AndroidProgressiveUpdateData::jXField = 0;
|
jfieldID AndroidProgressiveUpdateData::jXField = 0;
|
||||||
|
@ -369,10 +365,6 @@ AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||||
jXField = getField("x", "F");
|
jXField = getField("x", "F");
|
||||||
jYField = getField("y", "F");
|
jYField = getField("y", "F");
|
||||||
jScaleField = getField("scale", "F");
|
jScaleField = getField("scale", "F");
|
||||||
jFixedLayerMarginLeft = getField("fixedLayerMarginLeft", "F");
|
|
||||||
jFixedLayerMarginTop = getField("fixedLayerMarginTop", "F");
|
|
||||||
jFixedLayerMarginRight = getField("fixedLayerMarginRight", "F");
|
|
||||||
jFixedLayerMarginBottom = getField("fixedLayerMarginBottom", "F");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -747,8 +739,7 @@ AndroidGeckoLayerClient::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||||
|
|
||||||
void
|
void
|
||||||
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||||
gfx::Margin& aFixedLayerMargins)
|
|
||||||
{
|
{
|
||||||
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
|
||||||
|
@ -771,7 +762,6 @@ AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float a
|
||||||
|
|
||||||
aScrollOffset = nsIntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
aScrollOffset = nsIntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
|
||||||
aScaleX = aScaleY = viewTransform.GetScale(env);
|
aScaleX = aScaleY = viewTransform.GetScale(env);
|
||||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1006,18 +996,6 @@ AndroidViewTransform::GetScale(JNIEnv *env)
|
||||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
AndroidViewTransform::GetFixedLayerMargins(JNIEnv *env, gfx::Margin &aFixedLayerMargins)
|
|
||||||
{
|
|
||||||
if (!env)
|
|
||||||
return;
|
|
||||||
|
|
||||||
aFixedLayerMargins.left = env->GetFloatField(wrapped_obj, jFixedLayerMarginLeft);
|
|
||||||
aFixedLayerMargins.top = env->GetFloatField(wrapped_obj, jFixedLayerMarginTop);
|
|
||||||
aFixedLayerMargins.right = env->GetFloatField(wrapped_obj, jFixedLayerMarginRight);
|
|
||||||
aFixedLayerMargins.bottom = env->GetFloatField(wrapped_obj, jFixedLayerMarginBottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
float
|
||||||
AndroidProgressiveUpdateData::GetX(JNIEnv *env)
|
AndroidProgressiveUpdateData::GetX(JNIEnv *env)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,17 +191,12 @@ public:
|
||||||
float GetX(JNIEnv *env);
|
float GetX(JNIEnv *env);
|
||||||
float GetY(JNIEnv *env);
|
float GetY(JNIEnv *env);
|
||||||
float GetScale(JNIEnv *env);
|
float GetScale(JNIEnv *env);
|
||||||
void GetFixedLayerMargins(JNIEnv *env, gfx::Margin &aFixedLayerMargins);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static jclass jViewTransformClass;
|
static jclass jViewTransformClass;
|
||||||
static jfieldID jXField;
|
static jfieldID jXField;
|
||||||
static jfieldID jYField;
|
static jfieldID jYField;
|
||||||
static jfieldID jScaleField;
|
static jfieldID jScaleField;
|
||||||
static jfieldID jFixedLayerMarginLeft;
|
|
||||||
static jfieldID jFixedLayerMarginTop;
|
|
||||||
static jfieldID jFixedLayerMarginRight;
|
|
||||||
static jfieldID jFixedLayerMarginBottom;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidProgressiveUpdateData : public WrappedJavaObject {
|
class AndroidProgressiveUpdateData : public WrappedJavaObject {
|
||||||
|
@ -262,8 +257,7 @@ public:
|
||||||
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||||
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||||
gfx::Margin& aFixedLayerMargins);
|
|
||||||
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);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче