mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Set the position of the childRect in nsXULScrollFrame::LayoutScrollArea before calling Layout. Bug 632379, r=dbaron, a=blocker
This commit is contained in:
parent
e4d75164b1
commit
8e5a76d4bc
@ -2638,7 +2638,7 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
|
|||||||
const nsPoint& aScrollPosition)
|
const nsPoint& aScrollPosition)
|
||||||
{
|
{
|
||||||
PRUint32 oldflags = aState.LayoutFlags();
|
PRUint32 oldflags = aState.LayoutFlags();
|
||||||
nsRect childRect = nsRect(nsPoint(0, 0),
|
nsRect childRect = nsRect(mInner.mScrollPort.TopLeft() - aScrollPosition,
|
||||||
mInner.mScrollPort.Size());
|
mInner.mScrollPort.Size());
|
||||||
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
|
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
|
||||||
|
|
||||||
@ -2654,7 +2654,7 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
|
|||||||
childRect.width = minSize.width;
|
childRect.width = minSize.width;
|
||||||
|
|
||||||
aState.SetLayoutFlags(flags);
|
aState.SetLayoutFlags(flags);
|
||||||
mInner.mScrolledFrame->SetBounds(aState, childRect);
|
ClampAndSetBounds(aState, childRect, aScrollPosition);
|
||||||
mInner.mScrolledFrame->Layout(aState);
|
mInner.mScrolledFrame->Layout(aState);
|
||||||
|
|
||||||
childRect = mInner.mScrolledFrame->GetRect();
|
childRect = mInner.mScrolledFrame->GetRect();
|
||||||
@ -2668,29 +2668,9 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
|
|||||||
// remove overflow areas when we update the bounds,
|
// remove overflow areas when we update the bounds,
|
||||||
// because we've already accounted for it
|
// because we've already accounted for it
|
||||||
// REVIEW: Have we accounted for both?
|
// REVIEW: Have we accounted for both?
|
||||||
mInner.mScrolledFrame->SetBounds(aState, childRect, PR_TRUE);
|
ClampAndSetBounds(aState, childRect, aScrollPosition, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* After layout, restore the original position of the frame relative to the
|
|
||||||
* scroll port.
|
|
||||||
*
|
|
||||||
* In the LTR case, restore the original physical position (top left).
|
|
||||||
*
|
|
||||||
* In the RTL case, restore the original logical position (top right), then
|
|
||||||
* subtract the current width to find the physical position.
|
|
||||||
* This can break the invariant that the scroll position is a multiple of
|
|
||||||
* device pixels, so round off the result to the nearest device pixel.
|
|
||||||
*/
|
|
||||||
if (mInner.IsLTR())
|
|
||||||
childRect.x = mInner.mScrollPort.x - aScrollPosition.x;
|
|
||||||
else {
|
|
||||||
childRect.x = PresContext()->RoundAppUnitsToNearestDevPixels(
|
|
||||||
mInner.mScrollPort.XMost() - aScrollPosition.x - childRect.width);
|
|
||||||
}
|
|
||||||
childRect.y = mInner.mScrollPort.y - aScrollPosition.y;
|
|
||||||
mInner.mScrolledFrame->SetBounds(aState, childRect);
|
|
||||||
|
|
||||||
nsRect finalRect = mInner.mScrolledFrame->GetRect();
|
nsRect finalRect = mInner.mScrolledFrame->GetRect();
|
||||||
nsRect finalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
|
nsRect finalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
|
||||||
// The position of the scrolled frame shouldn't change, but if it does or
|
// The position of the scrolled frame shouldn't change, but if it does or
|
||||||
|
@ -758,6 +758,23 @@ protected:
|
|||||||
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRBool aIsRoot);
|
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRBool aIsRoot);
|
||||||
virtual PRIntn GetSkipSides() const;
|
virtual PRIntn GetSkipSides() const;
|
||||||
|
|
||||||
|
void ClampAndSetBounds(nsBoxLayoutState& aState,
|
||||||
|
nsRect& aRect,
|
||||||
|
nsPoint aScrollPosition,
|
||||||
|
PRBool aRemoveOverflowAreas = PR_FALSE) {
|
||||||
|
/*
|
||||||
|
* For RTL frames, restore the original scrolled position of the right
|
||||||
|
* edge, then subtract the current width to find the physical position.
|
||||||
|
* This can break the invariant that the scroll position is a multiple of
|
||||||
|
* device pixels, so round off the result to the nearest device pixel.
|
||||||
|
*/
|
||||||
|
if (!mInner.IsLTR()) {
|
||||||
|
aRect.x = PresContext()->RoundAppUnitsToNearestDevPixels(
|
||||||
|
mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width);
|
||||||
|
}
|
||||||
|
mInner.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class nsGfxScrollFrameInner;
|
friend class nsGfxScrollFrameInner;
|
||||||
nsGfxScrollFrameInner mInner;
|
nsGfxScrollFrameInner mInner;
|
||||||
|
Loading…
Reference in New Issue
Block a user