зеркало из https://github.com/mozilla/gecko-dev.git
Backout 492d12fa8b65 (bug 732016) for regressions. a=regression
--HG-- extra : rebase_source : cda0401baa2c3e5f6192f76c1cd25eca8187a9a0
This commit is contained in:
Родитель
d5ef482443
Коммит
04af952550
|
@ -2317,26 +2317,3 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, jsval* aPlugins)
|
||||||
*aPlugins = OBJECT_TO_JSVAL(jsPlugins);
|
*aPlugins = OBJECT_TO_JSVAL(jsPlugins);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight)
|
|
||||||
{
|
|
||||||
if (!IsUniversalXPConnectCapable()) {
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(aWidth >= 0.0 && aHeight >= 0.0)) {
|
|
||||||
return NS_ERROR_ILLEGAL_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIPresShell* presShell = GetPresShell();
|
|
||||||
if (!presShell) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
presShell->SetScrollPositionClampingScrollPortSize(
|
|
||||||
nsPresContext::CSSPixelsToAppUnits(aWidth),
|
|
||||||
nsPresContext::CSSPixelsToAppUnits(aHeight));
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ interface nsIDOMFile;
|
||||||
interface nsIFile;
|
interface nsIFile;
|
||||||
interface nsIDOMTouch;
|
interface nsIDOMTouch;
|
||||||
|
|
||||||
[scriptable, uuid(66a68858-df38-40e1-a792-fda04ebcc084)]
|
[scriptable, uuid(c7f303a1-4f7b-4d38-a192-c3f0e25dadb1)]
|
||||||
interface nsIDOMWindowUtils : nsISupports {
|
interface nsIDOMWindowUtils : nsISupports {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1110,12 +1110,4 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||||
*/
|
*/
|
||||||
[implicit_jscontext]
|
[implicit_jscontext]
|
||||||
readonly attribute jsval plugins;
|
readonly attribute jsval plugins;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the scrollport size for the purposes of clamping scroll positions for
|
|
||||||
* the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels.
|
|
||||||
*
|
|
||||||
* The caller of this method must have UniversalXPConnect privileges.
|
|
||||||
*/
|
|
||||||
void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1265,15 +1265,6 @@ public:
|
||||||
// clears that capture.
|
// clears that capture.
|
||||||
static void ClearMouseCapture(nsIFrame* aFrame);
|
static void ClearMouseCapture(nsIFrame* aFrame);
|
||||||
|
|
||||||
void SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight);
|
|
||||||
bool IsScrollPositionClampingScrollPortSizeSet() {
|
|
||||||
return mScrollPositionClampingScrollPortSizeSet;
|
|
||||||
}
|
|
||||||
nsSize GetScrollPositionClampingScrollPortSize() {
|
|
||||||
NS_ASSERTION(mScrollPositionClampingScrollPortSizeSet, "asking for scroll port when its not set?");
|
|
||||||
return mScrollPositionClampingScrollPortSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class nsRefreshDriver;
|
friend class nsRefreshDriver;
|
||||||
|
|
||||||
|
@ -1324,8 +1315,6 @@ protected:
|
||||||
|
|
||||||
bool mSuppressInterruptibleReflows;
|
bool mSuppressInterruptibleReflows;
|
||||||
|
|
||||||
bool mScrollPositionClampingScrollPortSizeSet;
|
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
@ -1344,8 +1333,6 @@ protected:
|
||||||
float mXResolution;
|
float mXResolution;
|
||||||
float mYResolution;
|
float mYResolution;
|
||||||
|
|
||||||
nsSize mScrollPositionClampingScrollPortSize;
|
|
||||||
|
|
||||||
static nsIContent* gKeyDownTarget;
|
static nsIContent* gKeyDownTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -831,8 +831,6 @@ PresShell::PresShell()
|
||||||
mYResolution = 1.0;
|
mYResolution = 1.0;
|
||||||
mViewportOverridden = false;
|
mViewportOverridden = false;
|
||||||
|
|
||||||
mScrollPositionClampingScrollPortSizeSet = false;
|
|
||||||
|
|
||||||
static bool addedSynthMouseMove = false;
|
static bool addedSynthMouseMove = false;
|
||||||
if (!addedSynthMouseMove) {
|
if (!addedSynthMouseMove) {
|
||||||
Preferences::AddBoolVarCache(&sSynthMouseMove,
|
Preferences::AddBoolVarCache(&sSynthMouseMove,
|
||||||
|
@ -9149,10 +9147,3 @@ PresShell::SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const
|
||||||
/* clear = */false);
|
/* clear = */false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
|
|
||||||
{
|
|
||||||
mScrollPositionClampingScrollPortSizeSet = true;
|
|
||||||
mScrollPositionClampingScrollPortSize.width = aWidth;
|
|
||||||
mScrollPositionClampingScrollPortSize.height = aHeight;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1645,7 +1645,7 @@ Clamp(nscoord aLower, nscoord aVal, nscoord aUpper)
|
||||||
nsPoint
|
nsPoint
|
||||||
nsGfxScrollFrameInner::ClampScrollPosition(const nsPoint& aPt) const
|
nsGfxScrollFrameInner::ClampScrollPosition(const nsPoint& aPt) const
|
||||||
{
|
{
|
||||||
nsRect range = GetScrollRangeForClamping();
|
nsRect range = GetScrollRange();
|
||||||
return nsPoint(Clamp(range.x, aPt.x, range.XMost()),
|
return nsPoint(Clamp(range.x, aPt.x, range.XMost()),
|
||||||
Clamp(range.y, aPt.y, range.YMost()));
|
Clamp(range.y, aPt.y, range.YMost()));
|
||||||
}
|
}
|
||||||
|
@ -1971,7 +1971,7 @@ nsGfxScrollFrameInner::RestrictToDevPixels(const nsPoint& aPt,
|
||||||
// pixels. But we also need to make sure that our position remains
|
// pixels. But we also need to make sure that our position remains
|
||||||
// inside the allowed region.
|
// inside the allowed region.
|
||||||
if (aShouldClamp) {
|
if (aShouldClamp) {
|
||||||
nsRect scrollRange = GetScrollRangeForClamping();
|
nsRect scrollRange = GetScrollRange();
|
||||||
*aPtDevPx = nsIntPoint(ClampInt(scrollRange.x, aPt.x, scrollRange.XMost(), appUnitsPerDevPixel),
|
*aPtDevPx = nsIntPoint(ClampInt(scrollRange.x, aPt.x, scrollRange.XMost(), appUnitsPerDevPixel),
|
||||||
ClampInt(scrollRange.y, aPt.y, scrollRange.YMost(), appUnitsPerDevPixel));
|
ClampInt(scrollRange.y, aPt.y, scrollRange.YMost(), appUnitsPerDevPixel));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2326,16 +2326,10 @@ AlignToDevPixelRoundingToZero(nscoord aVal, PRInt32 aAppUnitsPerDevPixel)
|
||||||
|
|
||||||
nsRect
|
nsRect
|
||||||
nsGfxScrollFrameInner::GetScrollRange() const
|
nsGfxScrollFrameInner::GetScrollRange() const
|
||||||
{
|
|
||||||
return GetScrollRange(mScrollPort.width, mScrollPort.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRect
|
|
||||||
nsGfxScrollFrameInner::GetScrollRange(nscoord aWidth, nscoord aHeight) const
|
|
||||||
{
|
{
|
||||||
nsRect range = GetScrolledRect();
|
nsRect range = GetScrolledRect();
|
||||||
range.width -= aWidth;
|
range.width -= mScrollPort.width;
|
||||||
range.height -= aHeight;
|
range.height -= mScrollPort.height;
|
||||||
|
|
||||||
nsPresContext* presContext = mOuter->PresContext();
|
nsPresContext* presContext = mOuter->PresContext();
|
||||||
PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||||
|
@ -2348,17 +2342,6 @@ nsGfxScrollFrameInner::GetScrollRange(nscoord aWidth, nscoord aHeight) const
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect
|
|
||||||
nsGfxScrollFrameInner::GetScrollRangeForClamping() const
|
|
||||||
{
|
|
||||||
nsIPresShell* presShell = mOuter->PresContext()->PresShell();
|
|
||||||
if (presShell->IsScrollPositionClampingScrollPortSizeSet()) {
|
|
||||||
nsSize size = presShell->GetScrollPositionClampingScrollPortSize();
|
|
||||||
return GetScrollRange(size.width, size.height);
|
|
||||||
}
|
|
||||||
return GetScrollRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AdjustForWholeDelta(PRInt32 aDelta, nscoord* aCoord)
|
AdjustForWholeDelta(PRInt32 aDelta, nscoord* aCoord)
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,12 +178,7 @@ public:
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
nsRect GetScrollRange() const;
|
nsRect GetScrollRange() const;
|
||||||
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
|
||||||
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
|
||||||
protected:
|
|
||||||
nsRect GetScrollRangeForClamping() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
nsPoint RestrictToDevPixels(const nsPoint& aPt, nsIntPoint* aPtDevPx, bool aShouldClamp) const;
|
nsPoint RestrictToDevPixels(const nsPoint& aPt, nsIntPoint* aPtDevPx, bool aShouldClamp) const;
|
||||||
nsPoint ClampScrollPosition(const nsPoint& aPt) const;
|
nsPoint ClampScrollPosition(const nsPoint& aPt) const;
|
||||||
static void AsyncScrollCallback(nsITimer *aTimer, void* anInstance);
|
static void AsyncScrollCallback(nsITimer *aTimer, void* anInstance);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче