зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1471708 - Rename the "scroll-position clamping scroll port size" to "visual viewport size". r=botond
MozReview-Commit-ID: IWPzXSF5jfR --HG-- extra : rebase_source : 9d13a680ebf76a5f86c9040a5a16981514435dc8
This commit is contained in:
Родитель
929aa24075
Коммит
e591a6945a
|
@ -3240,7 +3240,7 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugin
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight)
|
||||
nsDOMWindowUtils::SetVisualViewportSize(float aWidth, float aHeight)
|
||||
{
|
||||
if (!(aWidth >= 0.0 && aHeight >= 0.0)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -3251,7 +3251,7 @@ nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aH
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsLayoutUtils::SetScrollPositionClampingScrollPortSize(presShell, CSSSize(aWidth, aHeight));
|
||||
nsLayoutUtils::SetVisualViewportSize(presShell, CSSSize(aWidth, aHeight));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3137,9 +3137,9 @@ nsGlobalWindowOuter::GetInnerSize(CSSIntSize& aSize)
|
|||
* be the visual viewport, but we fall back to the CSS viewport
|
||||
* if it is not set.
|
||||
*/
|
||||
if (presShell->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
if (presShell->IsVisualViewportSizeSet()) {
|
||||
aSize = CSSIntRect::FromAppUnitsRounded(
|
||||
presShell->GetScrollPositionClampingScrollPortSize());
|
||||
presShell->GetVisualViewportSize());
|
||||
} else {
|
||||
RefPtr<nsViewManager> viewManager = presShell->GetViewManager();
|
||||
if (viewManager) {
|
||||
|
|
|
@ -23,9 +23,9 @@ function run()
|
|||
var newHeight = oldHeight / 2;
|
||||
|
||||
var utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
utils.setScrollPositionClampingScrollPortSize(newWidth, newHeight);
|
||||
is(window.innerWidth, newWidth, "innerWidth not updated to scroll port width");
|
||||
is(window.innerHeight, newHeight, "innerHeight not updated to scroll port height");
|
||||
utils.setVisualViewportSize(newWidth, newHeight);
|
||||
is(window.innerWidth, newWidth, "innerWidth not updated to viewport width");
|
||||
is(window.innerHeight, newHeight, "innerHeight not updated to viewport height");
|
||||
|
||||
var innerWidthGetter = Object.getOwnPropertyDescriptor(window, "innerWidth").get;
|
||||
var innerHeightGetter = Object.getOwnPropertyDescriptor(window, "innerHeight").get;
|
||||
|
|
|
@ -2753,7 +2753,7 @@ EventStateManager::GetScrollAmount(nsPresContext* aPresContext,
|
|||
aScrollableFrame->GetLineScrollAmount();
|
||||
}
|
||||
|
||||
// If there is no scrollable frame and page scrolling, use view port size.
|
||||
// If there is no scrollable frame and page scrolling, use viewport size.
|
||||
if (isPage) {
|
||||
return aPresContext->GetVisibleArea().Size();
|
||||
}
|
||||
|
|
|
@ -1591,12 +1591,12 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
readonly attribute jsval plugins;
|
||||
|
||||
/**
|
||||
* Set the scrollport size for the purposes of clamping scroll positions for
|
||||
* Set the viewport 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 chrome privileges.
|
||||
*/
|
||||
void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
|
||||
void setVisualViewportSize(in float aWidth, in float aHeight);
|
||||
|
||||
/**
|
||||
* These are used to control whether dialogs (alert, prompt, confirm) are
|
||||
|
|
|
@ -301,8 +301,8 @@ MobileViewportManager::UpdateSPCSPS(const ScreenIntSize& aDisplaySize,
|
|||
compositionSize.width -= scrollbars.LeftRight();
|
||||
compositionSize.height -= scrollbars.TopBottom();
|
||||
CSSSize compSize = compositionSize / aZoom;
|
||||
MVM_LOG("%p: Setting SPCSPS %s\n", this, Stringify(compSize).c_str());
|
||||
nsLayoutUtils::SetScrollPositionClampingScrollPortSize(mPresShell, compSize);
|
||||
MVM_LOG("%p: Setting VVPS %s\n", this, Stringify(compSize).c_str());
|
||||
nsLayoutUtils::SetVisualViewportSize(mPresShell, compSize);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -777,7 +777,7 @@ nsIPresShell::nsIPresShell()
|
|||
, mIsFirstPaint(false)
|
||||
, mObservesMutationsForPrint(false)
|
||||
, mWasLastReflowInterrupted(false)
|
||||
, mScrollPositionClampingScrollPortSizeSet(false)
|
||||
, mVisualViewportSizeSet(false)
|
||||
, mNeedLayoutFlush(true)
|
||||
, mNeedStyleFlush(true)
|
||||
, mObservingStyleFlushes(false)
|
||||
|
@ -850,7 +850,7 @@ PresShell::PresShell()
|
|||
mFrozen = false;
|
||||
mRenderFlags = 0;
|
||||
|
||||
mScrollPositionClampingScrollPortSizeSet = false;
|
||||
mVisualViewportSizeSet = false;
|
||||
|
||||
static bool addedSynthMouseMove = false;
|
||||
if (!addedSynthMouseMove) {
|
||||
|
@ -3445,7 +3445,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
|
|||
{
|
||||
nsPoint scrollPt = aFrameAsScrollable->GetScrollPosition();
|
||||
nsRect visibleRect(scrollPt,
|
||||
aFrameAsScrollable->GetScrollPositionClampingScrollPortSize());
|
||||
aFrameAsScrollable->GetVisualViewportSize());
|
||||
|
||||
nsSize lineSize;
|
||||
// Don't call GetLineScrollAmount unless we actually need it. Not only
|
||||
|
@ -10590,14 +10590,14 @@ nsIPresShell::MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty)
|
|||
}
|
||||
|
||||
void
|
||||
nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
|
||||
nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (!mScrollPositionClampingScrollPortSizeSet ||
|
||||
mScrollPositionClampingScrollPortSize.width != aWidth ||
|
||||
mScrollPositionClampingScrollPortSize.height != aHeight) {
|
||||
mScrollPositionClampingScrollPortSizeSet = true;
|
||||
mScrollPositionClampingScrollPortSize.width = aWidth;
|
||||
mScrollPositionClampingScrollPortSize.height = aHeight;
|
||||
if (!mVisualViewportSizeSet ||
|
||||
mVisualViewportSize.width != aWidth ||
|
||||
mVisualViewportSize.height != aHeight) {
|
||||
mVisualViewportSizeSet = true;
|
||||
mVisualViewportSize.width = aWidth;
|
||||
mVisualViewportSize.height = aHeight;
|
||||
|
||||
if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
|
||||
rootScrollFrame->MarkScrollbarsDirtyForReflow();
|
||||
|
|
|
@ -1660,13 +1660,13 @@ public:
|
|||
// clears that capture.
|
||||
static void ClearMouseCapture(nsIFrame* aFrame);
|
||||
|
||||
void SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight);
|
||||
bool IsScrollPositionClampingScrollPortSizeSet() {
|
||||
return mScrollPositionClampingScrollPortSizeSet;
|
||||
void SetVisualViewportSize(nscoord aWidth, nscoord aHeight);
|
||||
bool IsVisualViewportSizeSet() {
|
||||
return mVisualViewportSizeSet;
|
||||
}
|
||||
nsSize GetScrollPositionClampingScrollPortSize() {
|
||||
NS_ASSERTION(mScrollPositionClampingScrollPortSizeSet, "asking for scroll port when its not set?");
|
||||
return mScrollPositionClampingScrollPortSize;
|
||||
nsSize GetVisualViewportSize() {
|
||||
NS_ASSERTION(mVisualViewportSizeSet, "asking for visual viewport size when its not set?");
|
||||
return mVisualViewportSize;
|
||||
}
|
||||
|
||||
void SetVisualViewportOffset(const nsPoint& aScrollOffset) {
|
||||
|
@ -1753,7 +1753,7 @@ protected:
|
|||
// Count of the number of times this presshell has been painted to a window.
|
||||
uint64_t mPaintCount;
|
||||
|
||||
nsSize mScrollPositionClampingScrollPortSize;
|
||||
nsSize mVisualViewportSize;
|
||||
|
||||
nsPoint mVisualViewportOffset;
|
||||
|
||||
|
@ -1813,7 +1813,7 @@ protected:
|
|||
|
||||
// Whether the most recent interruptible reflow was actually interrupted:
|
||||
bool mWasLastReflowInterrupted : 1;
|
||||
bool mScrollPositionClampingScrollPortSizeSet : 1;
|
||||
bool mVisualViewportSizeSet : 1;
|
||||
|
||||
// True if a layout flush might not be a no-op
|
||||
bool mNeedLayoutFlush : 1;
|
||||
|
|
|
@ -9040,11 +9040,11 @@ MaybeReflowForInflationScreenSizeChange(nsPresContext *aPresContext)
|
|||
}
|
||||
|
||||
/* static */ void
|
||||
nsLayoutUtils::SetScrollPositionClampingScrollPortSize(nsIPresShell* aPresShell, CSSSize aSize)
|
||||
nsLayoutUtils::SetVisualViewportSize(nsIPresShell* aPresShell, CSSSize aSize)
|
||||
{
|
||||
MOZ_ASSERT(aSize.width >= 0.0 && aSize.height >= 0.0);
|
||||
|
||||
aPresShell->SetScrollPositionClampingScrollPortSize(
|
||||
aPresShell->SetVisualViewportSize(
|
||||
nsPresContext::CSSPixelsToAppUnits(aSize.width),
|
||||
nsPresContext::CSSPixelsToAppUnits(aSize.height));
|
||||
|
||||
|
|
|
@ -2852,11 +2852,11 @@ public:
|
|||
static bool HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell);
|
||||
|
||||
/**
|
||||
* Set the scroll port size for the purpose of clamping the scroll position
|
||||
* Set the viewport size for the purpose of clamping the scroll position
|
||||
* for the root scroll frame of this document
|
||||
* (see nsIDOMWindowUtils.setScrollPositionClampingScrollPortSize).
|
||||
* (see nsIDOMWindowUtils.setVisualViewportSize).
|
||||
*/
|
||||
static void SetScrollPositionClampingScrollPortSize(nsIPresShell* aPresShell,
|
||||
static void SetVisualViewportSize(nsIPresShell* aPresShell,
|
||||
CSSSize aSize);
|
||||
|
||||
/**
|
||||
|
|
|
@ -281,12 +281,12 @@ ViewportFrame::AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) con
|
|||
"We don't handle correct positioning of fixed frames with "
|
||||
"scrollbars in odd positions");
|
||||
|
||||
// If a scroll position clamping scroll-port size has been set, layout
|
||||
// If a scroll position clamping viewport size has been set, layout
|
||||
// fixed position elements to this size instead of the computed size.
|
||||
nsRect rect(0, 0, aReflowInput->ComputedWidth(), aReflowInput->ComputedHeight());
|
||||
nsIPresShell* ps = PresShell();
|
||||
if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
rect.SizeTo(ps->GetScrollPositionClampingScrollPortSize());
|
||||
if (ps->IsVisualViewportSizeSet()) {
|
||||
rect.SizeTo(ps->GetVisualViewportSize());
|
||||
}
|
||||
|
||||
return rect;
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
/**
|
||||
* Adjust aReflowInput to account for scrollbars and pres shell
|
||||
* GetScrollPositionClampingScrollPortSizeSet and
|
||||
* GetVisualViewportSizeSet and
|
||||
* GetContentDocumentFixedPositionMargins adjustments.
|
||||
* @return the rect to use as containing block rect
|
||||
*/
|
||||
|
|
|
@ -381,23 +381,22 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
std::max(aKidMetrics->Height(), vScrollbarMinHeight);
|
||||
aState->mInsideBorderSize =
|
||||
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
|
||||
nsSize scrollPortSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
|
||||
nsSize visualViewportSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
|
||||
std::max(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
|
||||
|
||||
nsSize visualScrollPortSize = scrollPortSize;
|
||||
nsIPresShell* presShell = PresShell();
|
||||
if (mHelper.mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
if (mHelper.mIsRoot && presShell->IsVisualViewportSizeSet()) {
|
||||
nsSize compositionSize = nsLayoutUtils::CalculateCompositionSizeForFrame(this, false);
|
||||
float resolution = presShell->GetResolution();
|
||||
compositionSize.width /= resolution;
|
||||
compositionSize.height /= resolution;
|
||||
visualScrollPortSize = nsSize(std::max(0, compositionSize.width - vScrollbarDesiredWidth),
|
||||
visualViewportSize = nsSize(std::max(0, compositionSize.width - vScrollbarDesiredWidth),
|
||||
std::max(0, compositionSize.height - hScrollbarDesiredHeight));
|
||||
}
|
||||
|
||||
nsRect scrolledRect =
|
||||
mHelper.GetUnsnappedScrolledRectInternal(aState->mContentsOverflowAreas.ScrollableOverflow(),
|
||||
scrollPortSize);
|
||||
visualViewportSize);
|
||||
nscoord oneDevPixel = aState->mBoxState.PresContext()->DevPixelsToAppUnits(1);
|
||||
|
||||
if (!aForce) {
|
||||
|
@ -405,9 +404,9 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
if (aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
bool wantHScrollbar =
|
||||
aState->mStyles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
|
||||
scrolledRect.XMost() >= visualScrollPortSize.width + oneDevPixel ||
|
||||
scrolledRect.XMost() >= visualViewportSize.width + oneDevPixel ||
|
||||
scrolledRect.x <= -oneDevPixel;
|
||||
if (scrollPortSize.width < hScrollbarMinSize.width)
|
||||
if (visualViewportSize.width < hScrollbarMinSize.width)
|
||||
wantHScrollbar = false;
|
||||
if (wantHScrollbar != aAssumeHScroll)
|
||||
return false;
|
||||
|
@ -417,9 +416,9 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
if (aState->mStyles.mVertical != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
bool wantVScrollbar =
|
||||
aState->mStyles.mVertical == NS_STYLE_OVERFLOW_SCROLL ||
|
||||
scrolledRect.YMost() >= visualScrollPortSize.height + oneDevPixel ||
|
||||
scrolledRect.YMost() >= visualViewportSize.height + oneDevPixel ||
|
||||
scrolledRect.y <= -oneDevPixel;
|
||||
if (scrollPortSize.height < vScrollbarMinSize.height)
|
||||
if (visualViewportSize.height < vScrollbarMinSize.height)
|
||||
wantVScrollbar = false;
|
||||
if (wantVScrollbar != aAssumeVScroll)
|
||||
return false;
|
||||
|
@ -432,7 +431,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
}
|
||||
// Check whether there is actually any overflow.
|
||||
nscoord scrolledWidth = scrolledRect.width + oneDevPixel;
|
||||
if (scrolledWidth <= scrollPortSize.width) {
|
||||
if (scrolledWidth <= visualViewportSize.width) {
|
||||
break;
|
||||
}
|
||||
// Viewport scrollbar style is used below instead of aState->mStyles
|
||||
|
@ -448,10 +447,10 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
if (!doc->IsTopLevelContentDocument()) {
|
||||
break;
|
||||
}
|
||||
doc->UpdateViewportOverflowType(scrolledWidth, scrollPortSize.width);
|
||||
doc->UpdateViewportOverflowType(scrolledWidth, visualViewportSize.width);
|
||||
} while (false);
|
||||
|
||||
nscoord vScrollbarActualWidth = aState->mInsideBorderSize.width - scrollPortSize.width;
|
||||
nscoord vScrollbarActualWidth = aState->mInsideBorderSize.width - visualViewportSize.width;
|
||||
|
||||
aState->mShowHScrollbar = aAssumeHScroll;
|
||||
aState->mShowVScrollbar = aAssumeVScroll;
|
||||
|
@ -460,7 +459,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
if (!IsScrollbarOnRight()) {
|
||||
scrollPortOrigin.x += vScrollbarActualWidth;
|
||||
}
|
||||
mHelper.mScrollPort = nsRect(scrollPortOrigin, scrollPortSize);
|
||||
mHelper.mScrollPort = nsRect(scrollPortOrigin, visualViewportSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2860,10 +2859,10 @@ ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsAtom* aOrig
|
|||
|
||||
nsPoint dist(std::abs(pt.x - mLastUpdateFramesPos.x),
|
||||
std::abs(pt.y - mLastUpdateFramesPos.y));
|
||||
nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
|
||||
nscoord horzAllowance = std::max(scrollPortSize.width / std::max(sHorzScrollFraction, 1),
|
||||
nsSize visualViewportSize = GetVisualViewportSize();
|
||||
nscoord horzAllowance = std::max(visualViewportSize.width / std::max(sHorzScrollFraction, 1),
|
||||
nsPresContext::AppUnitsPerCSSPixel());
|
||||
nscoord vertAllowance = std::max(scrollPortSize.height / std::max(sVertScrollFraction, 1),
|
||||
nscoord vertAllowance = std::max(visualViewportSize.height / std::max(sVertScrollFraction, 1),
|
||||
nsPresContext::AppUnitsPerCSSPixel());
|
||||
if (dist.x >= horzAllowance || dist.y >= vertAllowance) {
|
||||
needFrameVisibilityUpdate = true;
|
||||
|
@ -3491,7 +3490,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
const nsStyleDisplay* disp = mOuter->StyleDisplay();
|
||||
if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL)) {
|
||||
aBuilder->AddToWillChangeBudget(mOuter, GetScrollPositionClampingScrollPortSize());
|
||||
aBuilder->AddToWillChangeBudget(mOuter, GetVisualViewportSize());
|
||||
}
|
||||
|
||||
mScrollParentID = aBuilder->GetCurrentScrollParentId();
|
||||
|
@ -4056,16 +4055,16 @@ ScrollFrameHelper::GetScrollRangeForClamping() const
|
|||
return nsRect(nscoord_MIN/2, nscoord_MIN/2,
|
||||
nscoord_MAX - nscoord_MIN/2, nscoord_MAX - nscoord_MIN/2);
|
||||
}
|
||||
nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
|
||||
return GetScrollRange(scrollPortSize.width, scrollPortSize.height);
|
||||
nsSize visualViewportSize = GetVisualViewportSize();
|
||||
return GetScrollRange(visualViewportSize.width, visualViewportSize.height);
|
||||
}
|
||||
|
||||
nsSize
|
||||
ScrollFrameHelper::GetScrollPositionClampingScrollPortSize() const
|
||||
ScrollFrameHelper::GetVisualViewportSize() const
|
||||
{
|
||||
nsIPresShell* presShell = mOuter->PresShell();
|
||||
if (mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
return presShell->GetScrollPositionClampingScrollPortSize();
|
||||
if (mIsRoot && presShell->IsVisualViewportSizeSet()) {
|
||||
return presShell->GetVisualViewportSize();
|
||||
}
|
||||
return mScrollPort.Size();
|
||||
}
|
||||
|
@ -5296,7 +5295,7 @@ ScrollFrameHelper::IsScrollingActive(nsDisplayListBuilder* aBuilder) const
|
|||
{
|
||||
const nsStyleDisplay* disp = mOuter->StyleDisplay();
|
||||
if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL) &&
|
||||
aBuilder->IsInWillChangeBudget(mOuter, GetScrollPositionClampingScrollPortSize())) {
|
||||
aBuilder->IsInWillChangeBudget(mOuter, GetVisualViewportSize())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5604,7 +5603,7 @@ ScrollFrameHelper::ReflowFinished()
|
|||
}
|
||||
|
||||
nsRect scrolledContentRect = GetScrolledRect();
|
||||
nsSize scrollClampingScrollPort = GetScrollPositionClampingScrollPortSize();
|
||||
nsSize scrollClampingScrollPort = GetVisualViewportSize();
|
||||
nscoord minX = scrolledContentRect.x;
|
||||
nscoord maxX = scrolledContentRect.XMost() - scrollClampingScrollPort.width;
|
||||
nscoord minY = scrolledContentRect.y;
|
||||
|
@ -5824,12 +5823,12 @@ ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
|||
bool scrollbarOnLeft = !IsScrollbarOnRight();
|
||||
bool overlayScrollBarsWithZoom =
|
||||
mIsRoot && LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) &&
|
||||
presShell->IsScrollPositionClampingScrollPortSizeSet();
|
||||
presShell->IsVisualViewportSizeSet();
|
||||
|
||||
nsSize scrollPortClampingSize = mScrollPort.Size();
|
||||
double res = 1.0;
|
||||
if (overlayScrollBarsWithZoom) {
|
||||
scrollPortClampingSize = presShell->GetScrollPositionClampingScrollPortSize();
|
||||
scrollPortClampingSize = presShell->GetVisualViewportSize();
|
||||
res = presShell->GetCumulativeResolution();
|
||||
}
|
||||
|
||||
|
@ -6109,11 +6108,11 @@ ScrollFrameHelper::GetScrolledRect() const
|
|||
// For that, we first convert the scroll port and the scrolled rect to rects
|
||||
// relative to the reference frame, since that's the space where painting does
|
||||
// snapping.
|
||||
nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
|
||||
nsSize visualViewportSize = GetVisualViewportSize();
|
||||
const nsIFrame* referenceFrame =
|
||||
mReferenceFrameDuringPainting ? mReferenceFrameDuringPainting : nsLayoutUtils::GetReferenceFrame(mOuter);
|
||||
nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(referenceFrame);
|
||||
nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame, scrollPortSize);
|
||||
nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame, visualViewportSize);
|
||||
nsRect scrolledRect = result + scrollPort.TopLeft();
|
||||
|
||||
if (scrollPort.Overflows() || scrolledRect.Overflows()) {
|
||||
|
|
|
@ -214,9 +214,9 @@ public:
|
|||
return pt;
|
||||
}
|
||||
nsRect GetScrollRange() const;
|
||||
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
|
||||
// Get the scroll range assuming the viewport has size (aWidth, aHeight).
|
||||
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
|
||||
nsSize GetScrollPositionClampingScrollPortSize() const;
|
||||
nsSize GetVisualViewportSize() const;
|
||||
void ScrollSnap(nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
||||
void ScrollSnap(const nsPoint &aDestination,
|
||||
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
||||
|
@ -852,8 +852,8 @@ public:
|
|||
virtual nsRect GetScrollRange() const override {
|
||||
return mHelper.GetScrollRange();
|
||||
}
|
||||
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
||||
return mHelper.GetScrollPositionClampingScrollPortSize();
|
||||
virtual nsSize GetVisualViewportSize() const override {
|
||||
return mHelper.GetVisualViewportSize();
|
||||
}
|
||||
virtual nsSize GetLineScrollAmount() const override {
|
||||
return mHelper.GetLineScrollAmount();
|
||||
|
@ -1304,8 +1304,8 @@ public:
|
|||
virtual nsRect GetScrollRange() const override {
|
||||
return mHelper.GetScrollRange();
|
||||
}
|
||||
virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
|
||||
return mHelper.GetScrollPositionClampingScrollPortSize();
|
||||
virtual nsSize GetVisualViewportSize() const override {
|
||||
return mHelper.GetVisualViewportSize();
|
||||
}
|
||||
virtual nsSize GetLineScrollAmount() const override {
|
||||
return mHelper.GetLineScrollAmount();
|
||||
|
|
|
@ -148,10 +148,10 @@ public:
|
|||
*/
|
||||
virtual nsRect GetScrollRange() const = 0;
|
||||
/**
|
||||
* Get the size of the scroll port to use when clamping the scroll
|
||||
* Get the size of the view port to use when clamping the scroll
|
||||
* position.
|
||||
*/
|
||||
virtual nsSize GetScrollPositionClampingScrollPortSize() const = 0;
|
||||
virtual nsSize GetVisualViewportSize() const = 0;
|
||||
/**
|
||||
* Return how much we would try to scroll by in each direction if
|
||||
* asked to scroll by one "line" vertically and horizontally.
|
||||
|
|
|
@ -7017,8 +7017,8 @@ nsDisplayFixedPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
if (viewportFrame) {
|
||||
// Fixed position frames are reflowed into the scroll-port size if one has
|
||||
// been set.
|
||||
if (presContext->PresShell()->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
anchorRect.SizeTo(presContext->PresShell()->GetScrollPositionClampingScrollPortSize());
|
||||
if (presContext->PresShell()->IsVisualViewportSizeSet()) {
|
||||
anchorRect.SizeTo(presContext->PresShell()->GetVisualViewportSize());
|
||||
} else {
|
||||
anchorRect.SizeTo(viewportFrame->GetSize());
|
||||
}
|
||||
|
@ -7193,9 +7193,9 @@ nsDisplayStickyPosition::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
// reflowed into the scroll-port size if one has been set.
|
||||
nsSize scrollFrameSize = scrollFrame->GetSize();
|
||||
if (scrollFrame == presContext->PresShell()->GetRootScrollFrame() &&
|
||||
presContext->PresShell()->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
presContext->PresShell()->IsVisualViewportSizeSet()) {
|
||||
scrollFrameSize = presContext->PresShell()->
|
||||
GetScrollPositionClampingScrollPortSize();
|
||||
GetVisualViewportSize();
|
||||
}
|
||||
|
||||
nsLayoutUtils::SetFixedPositionLayerData(layer, scrollFrame,
|
||||
|
|
|
@ -1465,12 +1465,11 @@ public:
|
|||
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
|
||||
aBuilder->IsPaintingToWindow()) {
|
||||
// position: fixed items are reflowed into and only drawn inside the
|
||||
// viewport, or the scroll position clamping scrollport size, if one is
|
||||
// set.
|
||||
// viewport, or the visual viewport size, if one is set.
|
||||
nsIPresShell* ps = aFrame->PresShell();
|
||||
if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
|
||||
if (ps->IsVisualViewportSizeSet()) {
|
||||
dirtyRectRelativeToDirtyFrame =
|
||||
nsRect(nsPoint(0, 0), ps->GetScrollPositionClampingScrollPortSize());
|
||||
nsRect(nsPoint(0, 0), ps->GetVisualViewportSize());
|
||||
visible = dirtyRectRelativeToDirtyFrame;
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
} else {
|
||||
|
|
|
@ -292,8 +292,8 @@ function setupViewport(contentRootElement) {
|
|||
var sw = attrOrDefault(contentRootElement, "reftest-scrollport-w", 0);
|
||||
var sh = attrOrDefault(contentRootElement, "reftest-scrollport-h", 0);
|
||||
if (sw !== 0 || sh !== 0) {
|
||||
LogInfo("Setting scrollport to <w=" + sw + ", h=" + sh + ">");
|
||||
windowUtils().setScrollPositionClampingScrollPortSize(sw, sh);
|
||||
LogInfo("Setting viewport to <w=" + sw + ", h=" + sh + ">");
|
||||
windowUtils().setVisualViewportSize(sw, sh);
|
||||
}
|
||||
|
||||
// XXX support resolution when needed
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
It uses demo web applications to simulate user actions such as adding to-do items.
|
||||
</p>
|
||||
<p id="screen-size-warning"><strong>
|
||||
Your browser window is too small. For most accurate results, please make the view port size at least 850px by 650px.<br>
|
||||
Your browser window is too small. For most accurate results, please make the viewport size at least 850px by 650px.<br>
|
||||
It's currently <span id="screen-size"></span>.
|
||||
</strong></p>
|
||||
<div class="buttons">
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
StyleBench is a browser benchmark that measures the performance of the style resolution mechanism.
|
||||
</p>
|
||||
<p id="screen-size-warning"><strong>
|
||||
Your browser window is too small. For most accurate results, please make the view port size at least 850px by 650px.<br>
|
||||
Your browser window is too small. For most accurate results, please make the viewport size at least 850px by 650px.<br>
|
||||
It's currently <span id="screen-size"></span>.
|
||||
</strong>
|
||||
<div class="buttons">
|
||||
|
|
Загрузка…
Ссылка в новой задаче