mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Backed out 9 changesets (bug 716403) for Android 4.0 robocop bustage on a CLOSED TREE.
This commit is contained in:
parent
7c06d22e35
commit
e67ae46cb3
@ -2937,32 +2937,6 @@ nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aH
|
||||
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(aTop),
|
||||
nsPresContext::CSSPixelsToAppUnits(aRight),
|
||||
nsPresContext::CSSPixelsToAppUnits(aBottom),
|
||||
nsPresContext::CSSPixelsToAppUnits(aLeft));
|
||||
presShell->SetContentDocumentFixedPositionMargins(margins);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||
const nsAString& aNewOrigin)
|
||||
|
@ -41,7 +41,7 @@ interface nsIDOMClientRect;
|
||||
interface nsIURI;
|
||||
interface nsIDOMEventTarget;
|
||||
|
||||
[scriptable, uuid(69b7d908-c8e4-4416-94cf-4fdbe7a80441)]
|
||||
[scriptable, uuid(9ab64e24-7f8d-11e2-9a5f-a24379957a39)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -1288,19 +1288,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
*/
|
||||
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
|
||||
* dialogs (e.g. window.alert()).
|
||||
|
@ -34,7 +34,7 @@ function hitEventLoop(aFunc, aTimes)
|
||||
if (--aTimes) {
|
||||
setTimeout(hitEventLoop, 0, aFunc, aTimes);
|
||||
} else {
|
||||
setTimeout(aFunc, 100);
|
||||
setTimeout(aFunc, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ struct Margin :
|
||||
typedef BaseMargin<Float, Margin> Super;
|
||||
|
||||
// Constructors
|
||||
Margin() : Super(0, 0, 0, 0) {}
|
||||
Margin(const Margin& aMargin) : Super(aMargin) {}
|
||||
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
|
||||
: Super(aTop, aRight, aBottom, aLeft) {}
|
||||
|
@ -844,16 +844,6 @@ public:
|
||||
*/
|
||||
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.
|
||||
float GetOpacity() { return mOpacity; }
|
||||
const nsIntRect* GetClipRect() { return mUseClipRect ? &mClipRect : nullptr; }
|
||||
@ -870,7 +860,6 @@ public:
|
||||
float GetPostYScale() { return mPostYScale; }
|
||||
bool GetIsFixedPosition() { return mIsFixedPosition; }
|
||||
gfxPoint GetFixedPositionAnchor() { return mAnchor; }
|
||||
const gfx::Margin& GetFixedPositionMargins() { return mMargins; }
|
||||
Layer* GetMaskLayer() { return mMaskLayer; }
|
||||
|
||||
// Note that all lengths in animation data are either in CSS pixels or app
|
||||
@ -1219,7 +1208,6 @@ protected:
|
||||
bool mUseTileSourceRect;
|
||||
bool mIsFixedPosition;
|
||||
gfxPoint mAnchor;
|
||||
gfx::Margin mMargins;
|
||||
DebugOnly<uint32_t> mDebugColorIndex;
|
||||
// If this layer is used for OMTA, then this counter is used to ensure we
|
||||
// stay in sync with the animation manager
|
||||
|
@ -640,8 +640,7 @@ Translate2D(gfx3DMatrix& aTransform, const gfxPoint& aOffset)
|
||||
void
|
||||
CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||
const gfxPoint& aTranslation,
|
||||
const gfxSize& aScaleDiff,
|
||||
const gfx::Margin& aFixedLayerMargins)
|
||||
const gfxSize& aScaleDiff)
|
||||
{
|
||||
if (aLayer->GetIsFixedPosition() &&
|
||||
!aLayer->GetParent()->GetIsFixedPosition()) {
|
||||
@ -651,26 +650,6 @@ CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||
const gfxPoint& anchor = aLayer->GetFixedPositionAnchor();
|
||||
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
|
||||
// will apply the resolution scale again when computing the effective
|
||||
// transform, we must apply the inverse resolution scale here.
|
||||
@ -697,7 +676,7 @@ CompositorParent::TransformFixedLayers(Layer* aLayer,
|
||||
|
||||
for (Layer* child = aLayer->GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
TransformFixedLayers(child, aTranslation, aScaleDiff, aFixedLayerMargins);
|
||||
TransformFixedLayers(child, aTranslation, aScaleDiff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,12 +869,10 @@ CompositorParent::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFrame,
|
||||
1);
|
||||
shadow->SetShadowTransform(transform);
|
||||
|
||||
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
|
||||
TransformFixedLayers(
|
||||
aLayer,
|
||||
-treeTransform.mTranslation / treeTransform.mScale,
|
||||
treeTransform.mScale,
|
||||
fixedLayerMargins);
|
||||
treeTransform.mScale);
|
||||
|
||||
appliedTransform = true;
|
||||
}
|
||||
@ -960,9 +937,8 @@ CompositorParent::TransformScrollableLayer(Layer* aLayer, const gfx3DMatrix& aRo
|
||||
displayPortDevPixels.x += scrollOffsetDevPixels.x;
|
||||
displayPortDevPixels.y += scrollOffsetDevPixels.y;
|
||||
|
||||
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
|
||||
SyncViewportInfo(displayPortDevPixels, 1/rootScaleX, mLayersUpdated,
|
||||
mScrollOffset, mXScale, mYScale, fixedLayerMargins);
|
||||
mScrollOffset, mXScale, mYScale);
|
||||
mLayersUpdated = false;
|
||||
|
||||
// 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);
|
||||
shadow->SetShadowTransform(computedTransform);
|
||||
TransformFixedLayers(aLayer, offset, scaleDiff, fixedLayerMargins);
|
||||
TransformFixedLayers(aLayer, offset, scaleDiff);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1083,12 +1059,11 @@ CompositorParent::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||
void
|
||||
CompositorParent::SyncViewportInfo(const nsIntRect& aDisplayPort,
|
||||
float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins)
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
||||
aScrollOffset, aScaleX, aScaleY, aFixedLayerMargins);
|
||||
aScrollOffset, aScaleX, aScaleY);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,7 @@ protected:
|
||||
virtual void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||
virtual void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||
virtual void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins);
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||
void SetEGLSurfaceSize(int width, int height);
|
||||
// If SetPanZoomControllerForLayerTree is not set, Compositor will use
|
||||
// derived class AsyncPanZoomController transformations.
|
||||
@ -262,8 +261,7 @@ private:
|
||||
*/
|
||||
void TransformFixedLayers(Layer* aLayer,
|
||||
const gfxPoint& aTranslation,
|
||||
const gfxSize& aScaleDiff,
|
||||
const gfx::Margin& aFixedLayerMargins);
|
||||
const gfxSize& aScaleDiff);
|
||||
|
||||
virtual PGrallocBufferParent* AllocPGrallocBuffer(
|
||||
const gfxIntSize&, const uint32_t&, const uint32_t&,
|
||||
|
@ -26,7 +26,6 @@ using mozilla::TimeStamp;
|
||||
using mozilla::ScreenRotation;
|
||||
using nsCSSProperty;
|
||||
using mozilla::dom::ScreenOrientation;
|
||||
using mozilla::gfx::Margin;
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
@ -186,7 +185,6 @@ struct CommonLayerAttributes {
|
||||
nsIntRect clipRect;
|
||||
bool isFixedPosition;
|
||||
gfxPoint fixedPositionAnchor;
|
||||
Margin fixedPositionMargin;
|
||||
nullable PLayer maskLayer;
|
||||
// Animated colors will only honored for ColorLayers.
|
||||
Animation[] animations;
|
||||
|
@ -344,7 +344,6 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
||||
*mutant->GetClipRect() : nsIntRect());
|
||||
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
||||
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
||||
common.fixedPositionMargin() = mutant->GetFixedPositionMargins();
|
||||
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
||||
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
||||
} else {
|
||||
|
@ -248,7 +248,6 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
layer->SetPostScale(common.postXScale(), common.postYScale());
|
||||
layer->SetIsFixedPosition(common.isFixedPosition());
|
||||
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
||||
layer->SetFixedPositionMargins(common.fixedPositionMargin());
|
||||
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
||||
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
||||
} 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.top);
|
||||
WriteParam(msg, param.right);
|
||||
WriteParam(msg, param.bottom);
|
||||
WriteParam(msg, param.left);
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, void** iter, paramType* result)
|
||||
{
|
||||
return (ReadParam(msg, iter, &result->top) &&
|
||||
ReadParam(msg, iter, &result->right) &&
|
||||
ReadParam(msg, iter, &result->bottom) &&
|
||||
ReadParam(msg, iter, &result->left));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsRect>
|
||||
{
|
||||
|
@ -2978,19 +2978,6 @@ nsDisplayFixedPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
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.top, factor) *
|
||||
aContainerParameters.mYScale,
|
||||
NSAppUnitsToFloatPixels(fixedMargins.right, factor) *
|
||||
aContainerParameters.mXScale,
|
||||
NSAppUnitsToFloatPixels(fixedMargins.bottom, factor) *
|
||||
aContainerParameters.mYScale,
|
||||
NSAppUnitsToFloatPixels(fixedMargins.left, factor) *
|
||||
aContainerParameters.mXScale);
|
||||
layer->SetFixedPositionMargins(fixedLayerMargins);
|
||||
|
||||
return layer.forget();
|
||||
}
|
||||
|
||||
|
@ -121,10 +121,10 @@ typedef struct CapturingContentInfo {
|
||||
nsIContent* mContent;
|
||||
} CapturingContentInfo;
|
||||
|
||||
// bf539e0a-c314-4ea7-ba7c-ebd34e8a4065
|
||||
// 835b3946-1a4f-4132-b3ce-2e2e8be377c8
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0xbf539e0a, 0xc314, 0x4ea7, \
|
||||
{ 0xba, 0x7c, 0xeb, 0xd3, 0x4e, 0x8a, 0x40, 0x65 } }
|
||||
{ 0x835b3946, 0x1a4f, 0x4132, \
|
||||
{ 0xb3, 0xce, 0x2e, 0x2e, 0x8b, 0xe3, 0x77, 0xc8 } }
|
||||
|
||||
// debug VerifyReflow flags
|
||||
#define VERIFY_REFLOW_ON 0x01
|
||||
@ -498,11 +498,6 @@ public:
|
||||
IntrinsicDirty aIntrinsicDirty,
|
||||
nsFrameState aBitToAdd) = 0;
|
||||
|
||||
/**
|
||||
* Calls FrameNeedsReflow on all fixed position children of the root frame.
|
||||
*/
|
||||
virtual void MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty);
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@ -1386,11 +1381,6 @@ public:
|
||||
return mScrollPositionClampingScrollPortSize;
|
||||
}
|
||||
|
||||
void SetContentDocumentFixedPositionMargins(const nsMargin& aMargins);
|
||||
const nsMargin& GetContentDocumentFixedPositionMargins() {
|
||||
return mContentDocumentFixedPositionMargins;
|
||||
}
|
||||
|
||||
virtual void WindowSizeMoveDone() = 0;
|
||||
virtual void SysColorChanged() = 0;
|
||||
virtual void ThemeChanged() = 0;
|
||||
@ -1438,12 +1428,6 @@ protected:
|
||||
|
||||
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.
|
||||
nsWeakFrame* mWeakFrames;
|
||||
|
||||
|
@ -9440,18 +9440,6 @@ PresShell::SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
/* clear = */false);
|
||||
}
|
||||
|
||||
void
|
||||
nsIPresShell::MarkFixedFramesForReflow(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
|
||||
nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
@ -9462,22 +9450,18 @@ nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aH
|
||||
mScrollPositionClampingScrollPortSize.width = aWidth;
|
||||
mScrollPositionClampingScrollPortSize.height = aHeight;
|
||||
|
||||
MarkFixedFramesForReflow(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;
|
||||
|
||||
MarkFixedFramesForReflow(eResize);
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::SetupFontInflation()
|
||||
{
|
||||
|
@ -366,17 +366,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
||||
|
||||
nsresult rv;
|
||||
// Get the border values
|
||||
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;
|
||||
}
|
||||
const nsMargin& border = aReflowState.mStyleBorder->GetComputedBorder();
|
||||
|
||||
nscoord availWidth = aContainingBlockWidth;
|
||||
if (availWidth == -1) {
|
||||
|
@ -682,9 +682,6 @@ pref("memory.free_dirty_pages", true);
|
||||
|
||||
pref("layout.imagevisibility.enabled", false);
|
||||
|
||||
// Disable the dynamic toolbar
|
||||
pref("browser.chrome.dynamictoolbar", false);
|
||||
|
||||
#ifdef MOZ_PKG_SPECIAL
|
||||
// Disable webgl on ARMv6 because running the reftests takes
|
||||
// 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.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
||||
import org.mozilla.gecko.util.UiAsyncTask;
|
||||
import org.mozilla.gecko.util.GeckoBackgroundThread;
|
||||
|
||||
@ -46,7 +45,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.InputStream;
|
||||
@ -59,8 +57,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
PropertyAnimator.PropertyAnimationListener {
|
||||
private static final String LOGTAG = "GeckoBrowserApp";
|
||||
|
||||
private static final String PREF_CHROME_DYNAMICTOOLBAR = "browser.chrome.dynamictoolbar";
|
||||
|
||||
public static BrowserToolbar mBrowserToolbar;
|
||||
private AboutHomeContent mAboutHomeContent;
|
||||
private Boolean mAboutHomeShowing = null;
|
||||
@ -95,14 +91,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
// We'll ask for feedback after the user launches the app this many times.
|
||||
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
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
switch(msg) {
|
||||
@ -113,17 +101,10 @@ abstract public class BrowserApp extends GeckoApp
|
||||
// fall through
|
||||
case SELECTED:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
if ("about:home".equals(tab.getURL())) {
|
||||
if ("about:home".equals(tab.getURL()))
|
||||
showAboutHome();
|
||||
|
||||
if (mDynamicToolbarEnabled) {
|
||||
// Show the toolbar immediately.
|
||||
mBrowserToolbar.animateVisibility(true, 0);
|
||||
mToolbarLocked = true;
|
||||
}
|
||||
} else {
|
||||
else
|
||||
hideAboutHome();
|
||||
}
|
||||
|
||||
// Dismiss any SiteIdentity Popup
|
||||
SiteIdentityPopup.getInstance().dismiss();
|
||||
@ -142,27 +123,9 @@ abstract public class BrowserApp extends GeckoApp
|
||||
});
|
||||
}
|
||||
break;
|
||||
case START:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
invalidateOptionsMenu();
|
||||
|
||||
if (mDynamicToolbarEnabled) {
|
||||
// Show the toolbar.
|
||||
mBrowserToolbar.animateVisibility(true, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LOAD_ERROR:
|
||||
case START:
|
||||
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:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
invalidateOptionsMenu();
|
||||
@ -190,105 +153,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
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) {
|
||||
if (!success) {
|
||||
showToast(R.string.reading_list_failed, Toast.LENGTH_SHORT);
|
||||
@ -333,10 +197,8 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mToolbarSpacer = findViewById(R.id.toolbar_spacer);
|
||||
|
||||
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
|
||||
mMainLayout.addView(actionBar, 2);
|
||||
mMainLayout.addView(actionBar, 0);
|
||||
|
||||
((GeckoApp.MainLayout) mMainLayout).setOnInterceptTouchListener(new HideTabsTouchListener());
|
||||
|
||||
@ -375,35 +237,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
mToolbarSpacer.setPadding(0, 0, 0, 0);
|
||||
} else {
|
||||
// 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
|
||||
@ -453,7 +286,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
mBrowserToolbar.updateBackButton(false);
|
||||
mBrowserToolbar.updateForwardButton(false);
|
||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
||||
|
||||
mDoorHangerPopup.setAnchor(mBrowserToolbar.mFavicon);
|
||||
|
||||
@ -476,36 +308,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.
|
||||
if (mDynamicToolbarEnabled) {
|
||||
// When the dynamic toolbar is enabled, set the padding on the
|
||||
// about:home widget directly - this is to avoid resizing the
|
||||
// LayerView, which can cause visible artifacts.
|
||||
mAboutHomeContent.setPadding(0, aVisibleHeight, 0, 0);
|
||||
} else {
|
||||
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
|
||||
void toggleChrome(final boolean aShow) {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@ -960,9 +762,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
mAboutHomeShowing = true;
|
||||
Runnable r = new AboutHomeRunnable(true);
|
||||
mMainHandler.postAtFrontOfQueue(r);
|
||||
|
||||
// Refresh margins to possibly remove the toolbar padding
|
||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
||||
}
|
||||
|
||||
private void hideAboutHome() {
|
||||
@ -975,9 +774,6 @@ abstract public class BrowserApp extends GeckoApp
|
||||
mAboutHomeShowing = false;
|
||||
Runnable r = new AboutHomeRunnable(false);
|
||||
mMainHandler.postAtFrontOfQueue(r);
|
||||
|
||||
// Refresh margins to possibly restore the toolbar padding
|
||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
||||
}
|
||||
|
||||
private class AboutHomeRunnable implements Runnable {
|
||||
|
@ -41,9 +41,6 @@ import android.widget.ViewSwitcher;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
||||
|
||||
public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
Tabs.OnTabsChangedListener,
|
||||
@ -108,23 +105,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
private int mCount;
|
||||
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_EXPANDED = 2;
|
||||
|
||||
private static final int FORWARD_ANIMATION_DURATION = 450;
|
||||
|
||||
private static final int VISIBILITY_ANIMATION_DURATION = 250;
|
||||
|
||||
public BrowserToolbar(BrowserApp activity) {
|
||||
// BrowserToolbar is attached to BrowserApp only.
|
||||
mActivity = activity;
|
||||
@ -133,8 +118,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
sActionItems = new ArrayList<View>();
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
mAnimateSiteSecurity = true;
|
||||
|
||||
mVisibility = ToolbarVisibility.INCONSISTENT;
|
||||
}
|
||||
|
||||
public void from(LinearLayout layout) {
|
||||
@ -487,67 +470,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
|
||||
public void onAnimationStart(Animation animation) {
|
||||
if (animation.equals(mLockFadeIn)) {
|
||||
|
@ -1,65 +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) {
|
||||
// Post this to happen outside of onSizeChanged, as this may cause
|
||||
// a layout change and relayouts within a layout change don't work.
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
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
|
||||
implements GeckoEventListener, SensorEventListener, LocationListener,
|
||||
Tabs.OnTabsChangedListener, GeckoEventResponder,
|
||||
GeckoMenu.Callback, GeckoMenu.MenuPresenter,
|
||||
OnInterceptTouchListener
|
||||
GeckoMenu.Callback, GeckoMenu.MenuPresenter
|
||||
{
|
||||
private static final String LOGTAG = "GeckoApp";
|
||||
|
||||
@ -150,7 +149,7 @@ abstract public class GeckoApp
|
||||
static public final int RESTORE_CRASH = 2;
|
||||
|
||||
StartupMode mStartupMode = null;
|
||||
protected RelativeLayout mMainLayout;
|
||||
protected LinearLayout mMainLayout;
|
||||
protected RelativeLayout mGeckoLayout;
|
||||
public View getView() { return mGeckoLayout; }
|
||||
public SurfaceView cameraView;
|
||||
@ -187,8 +186,6 @@ abstract public class GeckoApp
|
||||
|
||||
private String mPrivateBrowsingSession;
|
||||
|
||||
private PointF mInitialTouchPoint = null;
|
||||
|
||||
private static Boolean sIsLargeTablet = null;
|
||||
private static Boolean sIsSmallTablet = null;
|
||||
|
||||
@ -1398,7 +1395,7 @@ abstract public class GeckoApp
|
||||
|
||||
// setup 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
|
||||
mTabsPanel = (TabsPanel) findViewById(R.id.tabs_panel);
|
||||
@ -2428,41 +2425,42 @@ abstract public class GeckoApp
|
||||
protected void connectGeckoLayerClient() {
|
||||
mLayerView.getLayerClient().notifyGeckoReady();
|
||||
|
||||
mLayerView.setTouchIntercepter(this);
|
||||
}
|
||||
mLayerView.setTouchIntercepter(new OnInterceptTouchListener() {
|
||||
private PointF initialPoint = null;
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
||||
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;
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createMotionEvent(event));
|
||||
return true;
|
||||
@Override
|
||||
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;
|
||||
|
||||
public MainLayout(Context context, AttributeSet attrs) {
|
||||
|
@ -552,10 +552,6 @@ public class GeckoEvent {
|
||||
sb.append("{ \"x\" : ").append(metrics.viewportRectLeft)
|
||||
.append(", \"y\" : ").append(metrics.viewportRectTop)
|
||||
.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('}');
|
||||
event.mCharactersExtra = sb.toString();
|
||||
|
@ -59,7 +59,6 @@ FENNEC_JAVA_FILES = \
|
||||
BrowserApp.java \
|
||||
BrowserToolbar.java \
|
||||
BrowserToolbarBackground.java \
|
||||
BrowserToolbarLayout.java \
|
||||
CameraImageResultHandler.java \
|
||||
CameraVideoResultHandler.java \
|
||||
CanvasDelegate.java \
|
||||
|
@ -141,18 +141,12 @@ public class PropertyAnimator implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stop the animation, optionally snapping to the end position.
|
||||
* onPropertyAnimationEnd is only called when snapping to the end position.
|
||||
*/
|
||||
public void stop(boolean snapToEndPosition) {
|
||||
public void stop() {
|
||||
mFramePoster.cancelAnimationFrame();
|
||||
|
||||
// Make sure to snap to the end position.
|
||||
for (ElementHolder element : mElementsList) {
|
||||
if (snapToEndPosition)
|
||||
invalidate(element, element.to);
|
||||
for (ElementHolder element : mElementsList) {
|
||||
invalidate(element, element.to);
|
||||
|
||||
if (shouldEnableHardwareLayer(element))
|
||||
element.view.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
@ -163,16 +157,11 @@ public class PropertyAnimator implements Runnable {
|
||||
mElementsList.clear();
|
||||
|
||||
if (mListener != null) {
|
||||
if (snapToEndPosition)
|
||||
mListener.onPropertyAnimationEnd();
|
||||
mListener.onPropertyAnimationEnd();
|
||||
mListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
stop(true);
|
||||
}
|
||||
|
||||
private boolean shouldEnableHardwareLayer(ElementHolder element) {
|
||||
if (!mUseHardwareLayer)
|
||||
return false;
|
||||
|
@ -17,7 +17,6 @@ import org.mozilla.gecko.util.FloatUtils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.SystemClock;
|
||||
import android.util.DisplayMetrics;
|
||||
@ -91,8 +90,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
private final PanZoomController mPanZoomController;
|
||||
private LayerView mView;
|
||||
|
||||
private boolean mClampOnMarginChange;
|
||||
|
||||
public GeckoLayerClient(Context context, LayerView view, EventDispatcher eventDispatcher) {
|
||||
// we can fill these in with dummy values because they are always written
|
||||
// to before being read
|
||||
@ -107,7 +104,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
mProgressiveUpdateDisplayPort = new DisplayPortMetrics();
|
||||
mLastProgressiveUpdateWasLowPrecision = false;
|
||||
mProgressiveUpdateWasInDanger = false;
|
||||
mClampOnMarginChange = true;
|
||||
|
||||
mForceRedraw = true;
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
@ -261,20 +257,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
ImmutableViewportMetrics metrics = getViewportMetrics();
|
||||
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) {
|
||||
displayPort = DisplayPortCalculator.calculate(metrics, mPanZoomController.getVelocityVector());
|
||||
}
|
||||
@ -321,8 +303,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
default:
|
||||
case UPDATE:
|
||||
// Keep the old viewport size
|
||||
metrics = messageMetrics.setViewportSize(oldMetrics.getWidth(), oldMetrics.getHeight())
|
||||
.setFixedLayerMarginsFrom(oldMetrics);
|
||||
metrics = messageMetrics.setViewportSize(oldMetrics.getWidth(), oldMetrics.getHeight());
|
||||
if (!oldMetrics.fuzzyEquals(metrics)) {
|
||||
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
|
||||
// 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
|
||||
@ -506,15 +457,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
float pageLeft, float pageTop, float pageRight, float pageBottom,
|
||||
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
|
||||
synchronized (this) {
|
||||
ImmutableViewportMetrics currentMetrics = 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
|
||||
final ImmutableViewportMetrics newMetrics = getViewportMetrics()
|
||||
.setViewportOrigin(offsetX, offsetY)
|
||||
.setZoomFactor(zoom)
|
||||
.setPageRect(new RectF(pageLeft, pageTop, pageRight, pageBottom),
|
||||
@ -594,20 +537,6 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
mCurrentViewTransform.y = mFrameMetrics.viewportRectTop;
|
||||
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);
|
||||
|
||||
if (layersUpdated && mRecordDrawTimes) {
|
||||
@ -744,7 +673,7 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
return;
|
||||
}
|
||||
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 viewportRectRight;
|
||||
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 ImmutableViewportMetrics(DisplayMetrics metrics) {
|
||||
@ -43,7 +39,6 @@ public class ImmutableViewportMetrics {
|
||||
viewportRectTop = pageRectTop = cssPageRectTop = 0;
|
||||
viewportRectRight = pageRectRight = cssPageRectRight = metrics.widthPixels;
|
||||
viewportRectBottom = pageRectBottom = cssPageRectBottom = metrics.heightPixels;
|
||||
fixedLayerMarginLeft = fixedLayerMarginTop = fixedLayerMarginRight = fixedLayerMarginBottom = 0;
|
||||
zoomFactor = 1.0f;
|
||||
}
|
||||
|
||||
@ -52,21 +47,6 @@ public class ImmutableViewportMetrics {
|
||||
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
||||
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
||||
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;
|
||||
pageRectTop = aPageRectTop;
|
||||
@ -80,10 +60,6 @@ public class ImmutableViewportMetrics {
|
||||
viewportRectTop = aViewportRectTop;
|
||||
viewportRectRight = aViewportRectRight;
|
||||
viewportRectBottom = aViewportRectBottom;
|
||||
fixedLayerMarginLeft = aFixedLayerMarginLeft;
|
||||
fixedLayerMarginTop = aFixedLayerMarginTop;
|
||||
fixedLayerMarginRight = aFixedLayerMarginRight;
|
||||
fixedLayerMarginBottom = aFixedLayerMarginBottom;
|
||||
zoomFactor = aZoomFactor;
|
||||
}
|
||||
|
||||
@ -149,10 +125,6 @@ public class ImmutableViewportMetrics {
|
||||
FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
|
||||
FloatUtils.interpolate(viewportRectRight, to.viewportRectRight, 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));
|
||||
}
|
||||
|
||||
@ -161,7 +133,6 @@ public class ImmutableViewportMetrics {
|
||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||
viewportRectLeft, viewportRectTop, viewportRectLeft + width, viewportRectTop + height,
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
zoomFactor);
|
||||
}
|
||||
|
||||
@ -170,7 +141,6 @@ public class ImmutableViewportMetrics {
|
||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||
newOriginX, newOriginY, newOriginX + getWidth(), newOriginY + getHeight(),
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
zoomFactor);
|
||||
}
|
||||
|
||||
@ -179,7 +149,6 @@ public class ImmutableViewportMetrics {
|
||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
newZoomFactor);
|
||||
}
|
||||
|
||||
@ -192,25 +161,9 @@ public class ImmutableViewportMetrics {
|
||||
pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
|
||||
cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
|
||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
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
|
||||
* accordingly. The given focus will remain at the same point on the screen
|
||||
* after scaling.
|
||||
@ -232,51 +185,35 @@ public class ImmutableViewportMetrics {
|
||||
newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
|
||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||
origin.x, origin.y, origin.x + getWidth(), origin.y + getHeight(),
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
newZoomFactor);
|
||||
}
|
||||
|
||||
/** Clamps the viewport to remain within the page rect. */
|
||||
private ImmutableViewportMetrics clamp(float marginLeft, float marginTop,
|
||||
float marginRight, float marginBottom) {
|
||||
public ImmutableViewportMetrics clamp() {
|
||||
RectF newViewport = getViewport();
|
||||
|
||||
// The viewport bounds ought to never exceed the page bounds.
|
||||
if (newViewport.right > pageRectRight + marginRight)
|
||||
newViewport.offset((pageRectRight + marginRight) - newViewport.right, 0);
|
||||
if (newViewport.left < pageRectLeft - marginLeft)
|
||||
newViewport.offset((pageRectLeft - marginLeft) - newViewport.left, 0);
|
||||
if (newViewport.right > pageRectRight)
|
||||
newViewport.offset(pageRectRight - newViewport.right, 0);
|
||||
if (newViewport.left < pageRectLeft)
|
||||
newViewport.offset(pageRectLeft - newViewport.left, 0);
|
||||
|
||||
if (newViewport.bottom > pageRectBottom + marginBottom)
|
||||
newViewport.offset(0, (pageRectBottom + marginBottom) - newViewport.bottom);
|
||||
if (newViewport.top < pageRectTop - marginTop)
|
||||
newViewport.offset(0, (pageRectTop - marginTop) - newViewport.top);
|
||||
if (newViewport.bottom > pageRectBottom)
|
||||
newViewport.offset(0, pageRectBottom - newViewport.bottom);
|
||||
if (newViewport.top < pageRectTop)
|
||||
newViewport.offset(0, pageRectTop - newViewport.top);
|
||||
|
||||
return new ImmutableViewportMetrics(
|
||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||
newViewport.left, newViewport.top, newViewport.right, newViewport.bottom,
|
||||
fixedLayerMarginLeft, fixedLayerMarginTop, fixedLayerMarginRight, fixedLayerMarginBottom,
|
||||
zoomFactor);
|
||||
}
|
||||
|
||||
public ImmutableViewportMetrics clamp() {
|
||||
return clamp(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public ImmutableViewportMetrics clampWithMargins() {
|
||||
return clamp(fixedLayerMarginLeft, fixedLayerMarginTop,
|
||||
fixedLayerMarginRight, fixedLayerMarginBottom);
|
||||
}
|
||||
|
||||
public boolean fuzzyEquals(ImmutableViewportMetrics other) {
|
||||
// Don't bother checking the pageRectXXX values because they are a product
|
||||
// of the cssPageRectXXX values and the zoomFactor, except with more rounding
|
||||
// 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)
|
||||
&& FloatUtils.fuzzyEquals(cssPageRectTop, other.cssPageRectTop)
|
||||
&& FloatUtils.fuzzyEquals(cssPageRectRight, other.cssPageRectRight)
|
||||
@ -294,8 +231,6 @@ public class ImmutableViewportMetrics {
|
||||
+ viewportRectRight + "," + viewportRectBottom + ") p=(" + pageRectLeft + ","
|
||||
+ pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
|
||||
+ cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
|
||||
+ cssPageRectBottom + ") m=(" + fixedLayerMarginLeft + ","
|
||||
+ fixedLayerMarginTop + "," + fixedLayerMarginRight + ","
|
||||
+ fixedLayerMarginBottom + ") z=" + zoomFactor;
|
||||
+ cssPageRectBottom + ") z=" + zoomFactor;
|
||||
}
|
||||
}
|
||||
|
@ -909,21 +909,15 @@ class JavaPanZoomController
|
||||
|
||||
// Ensure minZoomFactor keeps the page at least as big as the viewport.
|
||||
if (pageRect.width() > 0) {
|
||||
float pageWidth = pageRect.width() +
|
||||
viewportMetrics.fixedLayerMarginLeft +
|
||||
viewportMetrics.fixedLayerMarginRight;
|
||||
float scaleFactor = viewport.width() / pageWidth;
|
||||
float scaleFactor = viewport.width() / pageRect.width();
|
||||
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||
if (viewport.width() > pageWidth)
|
||||
if (viewport.width() > pageRect.width())
|
||||
focusX = 0.0f;
|
||||
}
|
||||
if (pageRect.height() > 0) {
|
||||
float pageHeight = pageRect.height() +
|
||||
viewportMetrics.fixedLayerMarginTop +
|
||||
viewportMetrics.fixedLayerMarginBottom;
|
||||
float scaleFactor = viewport.height() / pageHeight;
|
||||
float scaleFactor = viewport.height() / pageRect.height();
|
||||
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||
if (viewport.height() > pageHeight)
|
||||
if (viewport.height() > pageRect.height())
|
||||
focusY = 0.0f;
|
||||
}
|
||||
|
||||
@ -943,7 +937,7 @@ class JavaPanZoomController
|
||||
}
|
||||
|
||||
/* Now we pan to the right origin. */
|
||||
viewportMetrics = viewportMetrics.clampWithMargins();
|
||||
viewportMetrics = viewportMetrics.clamp();
|
||||
|
||||
return viewportMetrics;
|
||||
}
|
||||
@ -955,15 +949,9 @@ class JavaPanZoomController
|
||||
@Override
|
||||
protected float getViewportLength() { return getMetrics().getWidth(); }
|
||||
@Override
|
||||
protected float getPageStart() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
return metrics.pageRectLeft - metrics.fixedLayerMarginLeft;
|
||||
}
|
||||
protected float getPageStart() { return getMetrics().pageRectLeft; }
|
||||
@Override
|
||||
protected float getPageLength() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
return metrics.getPageWidth() + metrics.fixedLayerMarginLeft + metrics.fixedLayerMarginRight;
|
||||
}
|
||||
protected float getPageLength() { return getMetrics().getPageWidth(); }
|
||||
}
|
||||
|
||||
private class AxisY extends Axis {
|
||||
@ -973,15 +961,9 @@ class JavaPanZoomController
|
||||
@Override
|
||||
protected float getViewportLength() { return getMetrics().getHeight(); }
|
||||
@Override
|
||||
protected float getPageStart() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
return metrics.pageRectTop - metrics.fixedLayerMarginTop;
|
||||
}
|
||||
protected float getPageStart() { return getMetrics().pageRectTop; }
|
||||
@Override
|
||||
protected float getPageLength() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
return metrics.getPageHeight() + metrics.fixedLayerMarginTop + metrics.fixedLayerMarginBottom;
|
||||
}
|
||||
protected float getPageLength() { return getMetrics().getPageHeight(); }
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -9,19 +9,11 @@ public class ViewTransform {
|
||||
public float x;
|
||||
public float y;
|
||||
public float scale;
|
||||
public float fixedLayerMarginLeft;
|
||||
public float fixedLayerMarginTop;
|
||||
public float fixedLayerMarginRight;
|
||||
public float fixedLayerMarginBottom;
|
||||
|
||||
public ViewTransform(float inX, float inY, float inScale) {
|
||||
x = inX;
|
||||
y = inY;
|
||||
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
|
||||
- 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@"
|
||||
android:id="@+id/browser_toolbar"
|
||||
style="@style/BrowserToolbar">
|
||||
@ -165,4 +165,4 @@
|
||||
|
||||
</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
|
||||
- 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@"
|
||||
android:id="@+id/browser_toolbar"
|
||||
style="@style/BrowserToolbar">
|
||||
@ -173,4 +173,4 @@
|
||||
|
||||
</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
|
||||
- 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@"
|
||||
android:id="@+id/browser_toolbar"
|
||||
style="@style/BrowserToolbar">
|
||||
@ -179,4 +179,4 @@
|
||||
|
||||
</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
|
||||
- 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@"
|
||||
android:id="@+id/browser_toolbar"
|
||||
style="@style/BrowserToolbar">
|
||||
@ -163,4 +163,4 @@
|
||||
|
||||
</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
|
||||
- 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@"
|
||||
android:id="@+id/browser_toolbar"
|
||||
style="@style/BrowserToolbar">
|
||||
@ -172,4 +172,4 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</org.mozilla.gecko.BrowserToolbarLayout>
|
||||
</LinearLayout>
|
||||
|
@ -17,18 +17,13 @@
|
||||
<view class="org.mozilla.gecko.GeckoApp$MainLayout"
|
||||
android:id="@+id/main_layout"
|
||||
style="@style/Screen.Transparent">
|
||||
|
||||
|
||||
<!-- 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"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_below="@+id/toolbar_spacer">
|
||||
android:layout_weight="1">
|
||||
|
||||
<include layout="@layout/shared_ui_components"/>
|
||||
|
||||
|
@ -205,7 +205,6 @@ var BrowserApp = {
|
||||
Services.obs.addObserver(this, "FullScreen:Exit", false);
|
||||
Services.obs.addObserver(this, "Viewport:Change", 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, "FormHistory:Init", false);
|
||||
Services.obs.addObserver(this, "ToggleProfiling", false);
|
||||
@ -1253,10 +1252,6 @@ var BrowserApp = {
|
||||
sendMessageToJava({ type: "Telemetry:Gather" });
|
||||
break;
|
||||
|
||||
case "Viewport:FixedMarginsChanged":
|
||||
gViewportMargins = JSON.parse(aData);
|
||||
break;
|
||||
|
||||
default:
|
||||
dump('BrowserApp.observe: unexpected topic "' + aTopic + '"\n');
|
||||
break;
|
||||
@ -2790,12 +2785,6 @@ nsBrowserAccess.prototype = {
|
||||
let gScreenWidth = 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) {
|
||||
this.browser = null;
|
||||
this.id = 0;
|
||||
@ -2803,14 +2792,7 @@ function Tab(aURL, aParams) {
|
||||
this.showProgress = true;
|
||||
this._zoom = 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.viewportExcludesHorizontalMargins = true;
|
||||
this.viewportExcludesVerticalMargins = true;
|
||||
this.updatingViewportForPageSizeChange = false;
|
||||
this.contentDocumentIsDisplayed = true;
|
||||
this.pluginDoorhangerTimeout = null;
|
||||
this.shouldShowPluginDoorhanger = true;
|
||||
@ -3279,34 +3261,15 @@ Tab.prototype = {
|
||||
setScrollClampingSize: function(zoom) {
|
||||
let viewportWidth = gScreenWidth / zoom;
|
||||
let viewportHeight = gScreenHeight / zoom;
|
||||
let screenWidth = gScreenWidth;
|
||||
let screenHeight = gScreenHeight;
|
||||
|
||||
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument,
|
||||
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
|
||||
// the clamping scroll-port size.
|
||||
let factor = Math.min(viewportWidth / screenWidth, pageWidth / screenWidth,
|
||||
viewportHeight / screenHeight, pageHeight / screenHeight);
|
||||
let scrollPortWidth = Math.min(screenWidth * factor, pageWidth * zoom);
|
||||
let scrollPortHeight = Math.min(screenHeight * factor, pageHeight * zoom);
|
||||
let factor = Math.min(viewportWidth / gScreenWidth, pageWidth / gScreenWidth,
|
||||
viewportHeight / gScreenHeight, pageHeight / gScreenHeight);
|
||||
let scrollPortWidth = gScreenWidth * factor;
|
||||
let scrollPortHeight = gScreenHeight * factor;
|
||||
|
||||
let win = this.browser.contentWindow;
|
||||
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).
|
||||
@ -3343,19 +3306,6 @@ Tab.prototype = {
|
||||
if (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", "");
|
||||
},
|
||||
|
||||
@ -3379,27 +3329,20 @@ Tab.prototype = {
|
||||
},
|
||||
|
||||
getViewport: function() {
|
||||
let screenW = gScreenWidth - gViewportMargins.left - gViewportMargins.right;
|
||||
let screenH = gScreenHeight - gViewportMargins.top - gViewportMargins.bottom;
|
||||
|
||||
let viewport = {
|
||||
width: screenW,
|
||||
height: screenH,
|
||||
cssWidth: screenW / this._zoom,
|
||||
cssHeight: screenH / this._zoom,
|
||||
width: gScreenWidth,
|
||||
height: gScreenHeight,
|
||||
cssWidth: gScreenWidth / this._zoom,
|
||||
cssHeight: gScreenHeight / this._zoom,
|
||||
pageLeft: 0,
|
||||
pageTop: 0,
|
||||
pageRight: screenW,
|
||||
pageBottom: screenH,
|
||||
pageRight: gScreenWidth,
|
||||
pageBottom: gScreenHeight,
|
||||
// We make up matching css page dimensions
|
||||
cssPageLeft: 0,
|
||||
cssPageTop: 0,
|
||||
cssPageRight: screenW / this._zoom,
|
||||
cssPageBottom: screenH / this._zoom,
|
||||
fixedMarginLeft: this._fixedMarginLeft,
|
||||
fixedMarginTop: this._fixedMarginTop,
|
||||
fixedMarginRight: this._fixedMarginRight,
|
||||
fixedMarginBottom: this._fixedMarginBottom,
|
||||
cssPageRight: gScreenWidth / this._zoom,
|
||||
cssPageBottom: gScreenHeight / this._zoom,
|
||||
zoom: this._zoom,
|
||||
};
|
||||
|
||||
@ -3449,20 +3392,6 @@ Tab.prototype = {
|
||||
let displayPort = getBridge().getDisplayPort(aPageSizeUpdate, BrowserApp.isBrowserContentDocumentDisplayed(), this.id, viewport);
|
||||
if (displayPort != null)
|
||||
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) {
|
||||
@ -3889,11 +3818,9 @@ Tab.prototype = {
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
let screenW = gScreenWidth - gViewportMargins.left - gViewportMargins.right;
|
||||
let screenH = gScreenHeight - gViewportMargins.top - gViewportMargins.bottom;
|
||||
let screenW = gScreenWidth;
|
||||
let screenH = gScreenHeight;
|
||||
let viewportW, viewportH;
|
||||
this.viewportExcludesHorizontalMargins = true;
|
||||
this.viewportExcludesVerticalMargins = true;
|
||||
|
||||
let metadata = this.metadata;
|
||||
if (metadata.autoSize) {
|
||||
@ -3948,21 +3875,7 @@ Tab.prototype = {
|
||||
// this may get run during a Viewport:Change message while the document
|
||||
// has not yet loaded, so need to guard against a null document.
|
||||
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument, viewportW, viewportH);
|
||||
|
||||
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 = gScreenWidth / pageWidth;
|
||||
}
|
||||
minScale = this.clampZoom(minScale);
|
||||
viewportH = Math.max(viewportH, screenH / minScale);
|
||||
|
@ -2110,15 +2110,13 @@ AndroidBridge::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||
|
||||
void
|
||||
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins)
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
AndroidGeckoLayerClient *client = mLayerClient;
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated,
|
||||
aScrollOffset, aScaleX, aScaleY, aFixedLayerMargins);
|
||||
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated, aScrollOffset, aScaleX, aScaleY);
|
||||
}
|
||||
|
||||
AndroidBridge::AndroidBridge()
|
||||
|
@ -332,8 +332,7 @@ public:
|
||||
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins);
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||
|
||||
void AddPluginView(jobject view, const gfxRect& rect, bool isFullScreen);
|
||||
void RemovePluginView(jobject view, bool isFullScreen);
|
||||
|
@ -100,10 +100,6 @@ jclass AndroidViewTransform::jViewTransformClass = 0;
|
||||
jfieldID AndroidViewTransform::jXField = 0;
|
||||
jfieldID AndroidViewTransform::jYField = 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;
|
||||
jfieldID AndroidProgressiveUpdateData::jXField = 0;
|
||||
@ -369,10 +365,6 @@ AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jFixedLayerMarginLeft = getField("fixedLayerMarginLeft", "F");
|
||||
jFixedLayerMarginTop = getField("fixedLayerMarginTop", "F");
|
||||
jFixedLayerMarginRight = getField("fixedLayerMarginRight", "F");
|
||||
jFixedLayerMarginBottom = getField("fixedLayerMarginBottom", "F");
|
||||
}
|
||||
|
||||
void
|
||||
@ -747,8 +739,7 @@ AndroidGeckoLayerClient::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins)
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
||||
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));
|
||||
aScaleX = aScaleY = viewTransform.GetScale(env);
|
||||
viewTransform.GetFixedLayerMargins(env, aFixedLayerMargins);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1006,18 +996,6 @@ AndroidViewTransform::GetScale(JNIEnv *env)
|
||||
return env->GetFloatField(wrapped_obj, jScaleField);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::GetFixedLayerMargins(JNIEnv *env, gfx::Margin &aFixedLayerMargins)
|
||||
{
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
aFixedLayerMargins.top = env->GetFloatField(wrapped_obj, jFixedLayerMarginTop);
|
||||
aFixedLayerMargins.right = env->GetFloatField(wrapped_obj, jFixedLayerMarginRight);
|
||||
aFixedLayerMargins.bottom = env->GetFloatField(wrapped_obj, jFixedLayerMarginBottom);
|
||||
aFixedLayerMargins.left = env->GetFloatField(wrapped_obj, jFixedLayerMarginLeft);
|
||||
}
|
||||
|
||||
float
|
||||
AndroidProgressiveUpdateData::GetX(JNIEnv *env)
|
||||
{
|
||||
|
@ -191,17 +191,12 @@ public:
|
||||
float GetX(JNIEnv *env);
|
||||
float GetY(JNIEnv *env);
|
||||
float GetScale(JNIEnv *env);
|
||||
void GetFixedLayerMargins(JNIEnv *env, gfx::Margin &aFixedLayerMargins);
|
||||
|
||||
private:
|
||||
static jclass jViewTransformClass;
|
||||
static jfieldID jXField;
|
||||
static jfieldID jYField;
|
||||
static jfieldID jScaleField;
|
||||
static jfieldID jFixedLayerMarginLeft;
|
||||
static jfieldID jFixedLayerMarginTop;
|
||||
static jfieldID jFixedLayerMarginRight;
|
||||
static jfieldID jFixedLayerMarginBottom;
|
||||
};
|
||||
|
||||
class AndroidProgressiveUpdateData : public WrappedJavaObject {
|
||||
@ -262,8 +257,7 @@ public:
|
||||
void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
|
||||
void SetPageRect(const gfx::Rect& aCssPageRect);
|
||||
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY,
|
||||
gfx::Margin& aFixedLayerMargins);
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const gfx::Rect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, gfx::Rect& aViewport, float& aScaleX, float& aScaleY);
|
||||
bool CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame);
|
||||
bool ActivateProgram(AutoLocalJNIFrame *jniFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user