mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1056340 - Clip viewport fixed position overflow to scroll frame. r=roc
This commit is contained in:
parent
cad4ea6f15
commit
4b2df54aa2
@ -167,6 +167,7 @@ CopyToImageSurface(unsigned char *aData,
|
||||
aRect.y * aStride +
|
||||
aRect.x * pixelWidth;
|
||||
|
||||
MOZ_ASSERT(aStride >= aRect.width * pixelWidth);
|
||||
for (int32_t y = 0; y < aRect.height; ++y) {
|
||||
memcpy(surfData + y * surfStride,
|
||||
source + y * aStride,
|
||||
|
@ -736,6 +736,9 @@ public:
|
||||
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
||||
aParameters, aClipRect, aOutput);
|
||||
}
|
||||
virtual bool IsIgnoringViewportClipping() const MOZ_OVERRIDE {
|
||||
return mHelper.IsIgnoringViewportClipping();
|
||||
}
|
||||
|
||||
// nsIStatefulFrame
|
||||
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {
|
||||
@ -1088,6 +1091,9 @@ public:
|
||||
mHelper.ComputeFrameMetrics(aLayer, aContainerReferenceFrame,
|
||||
aParameters, aClipRect, aOutput);
|
||||
}
|
||||
virtual bool IsIgnoringViewportClipping() const MOZ_OVERRIDE {
|
||||
return mHelper.IsIgnoringViewportClipping();
|
||||
}
|
||||
|
||||
// nsIStatefulFrame
|
||||
NS_IMETHOD SaveState(nsPresState** aState) MOZ_OVERRIDE {
|
||||
|
@ -380,6 +380,11 @@ public:
|
||||
const ContainerLayerParameters& aParameters,
|
||||
nsRect* aOutClipRect,
|
||||
nsTArray<FrameMetrics>* aOutput) const = 0;
|
||||
|
||||
/**
|
||||
* If this scroll frame is ignoring viewporting clipping
|
||||
*/
|
||||
virtual bool IsIgnoringViewportClipping() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -190,7 +190,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
// being already set. Note that the computed height may be
|
||||
// unconstrained; that's ok. Consumers should watch out for that.
|
||||
SetSize(nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight()));
|
||||
|
||||
|
||||
// Reflow the main content first so that the placeholders of the
|
||||
// fixed-position frames will be in the right places on an initial
|
||||
// reflow.
|
||||
@ -236,10 +236,6 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
aDesiredSize.SetSize(wm, maxSize);
|
||||
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
||||
|
||||
if (mFrames.NotEmpty()) {
|
||||
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
|
||||
}
|
||||
|
||||
if (IsAbsoluteContainer()) {
|
||||
// Make a copy of the reflow state and change the computed width and height
|
||||
// to reflect the available space for the fixed items
|
||||
@ -262,6 +258,16 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
rect,
|
||||
false, true, true, // XXX could be optimized
|
||||
&aDesiredSize.mOverflowAreas);
|
||||
|
||||
nsIScrollableFrame* rootScrollFrame =
|
||||
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
|
||||
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
|
||||
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
||||
}
|
||||
}
|
||||
|
||||
if (mFrames.NotEmpty()) {
|
||||
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
|
||||
}
|
||||
|
||||
// If we were dirty then do a repaint
|
||||
@ -287,6 +293,18 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
}
|
||||
|
||||
bool
|
||||
ViewportFrame::UpdateOverflow()
|
||||
{
|
||||
nsIScrollableFrame* rootScrollFrame =
|
||||
PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
|
||||
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return nsFrame::UpdateOverflow();
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
ViewportFrame::GetType() const
|
||||
{
|
||||
|
@ -17,8 +17,8 @@
|
||||
class nsPresContext;
|
||||
|
||||
/**
|
||||
* ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
|
||||
* containing the doc root frame. ViewportFrame stores this child in its primary child
|
||||
* ViewportFrame is the parent of a single child - the doc root frame or a scroll frame
|
||||
* containing the doc root frame. ViewportFrame stores this child in its primary child
|
||||
* list.
|
||||
*/
|
||||
class ViewportFrame : public nsContainerFrame {
|
||||
@ -68,6 +68,8 @@ public:
|
||||
*/
|
||||
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool UpdateOverflow() MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Adjust aReflowState to account for scrollbars and pres shell
|
||||
* GetScrollPositionClampingScrollPortSizeSet and
|
||||
|
Loading…
Reference in New Issue
Block a user