Change callers to use new nsIFrame overflow APIs. (Bug 542595, patch 20) r=roc a2.0=blocking2.0:beta8

This commit is contained in:
L. David Baron 2010-10-06 21:25:47 -07:00
Родитель 5a012f3090
Коммит 86a617e692
32 изменённых файлов: 159 добавлений и 108 удалений

Просмотреть файл

@ -7603,7 +7603,7 @@ UpdateViewsForTree(nsIFrame* aFrame, nsIViewManager* aViewManager,
if ((child->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER) &&
(aChange & nsChangeHint_RepaintFrame)) {
FrameLayerBuilder::InvalidateThebesLayerContents(child,
child->GetOverflowRectRelativeToSelf());
child->GetVisualOverflowRectRelativeToSelf());
}
UpdateViewsForTree(child, aViewManager, aFrameManager, aChange);
}
@ -7658,13 +7658,13 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
}
if (aChange & nsChangeHint_UpdateOpacityLayer) {
aFrame->MarkLayersActive();
aFrame->InvalidateLayer(aFrame->GetOverflowRectRelativeToSelf(),
aFrame->InvalidateLayer(aFrame->GetVisualOverflowRectRelativeToSelf(),
nsDisplayItem::TYPE_OPACITY);
}
if (aChange & nsChangeHint_UpdateTransformLayer) {
aFrame->MarkLayersActive();
aFrame->InvalidateLayer(aFrame->GetOverflowRectRelativeToSelf(),
aFrame->InvalidateLayer(aFrame->GetVisualOverflowRectRelativeToSelf(),
nsDisplayItem::TYPE_TRANSFORM);
}
}

Просмотреть файл

@ -666,7 +666,10 @@ GetOutlineInnerRect(nsIFrame* aFrame)
(aFrame->Properties().Get(nsIFrame::OutlineInnerRectProperty()));
if (savedOutlineInnerRect)
return *savedOutlineInnerRect;
return aFrame->GetOverflowRect();
// FIXME (bug 599652): We probably want something narrower than either
// overflow rect here, but for now use the visual overflow in order to
// be consistent with ComputeOutlineAndEffectsRect in nsFrame.cpp.
return aFrame->GetVisualOverflowRect();
}
void
@ -1115,7 +1118,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
}
nsRect frameRect =
nativeTheme ? aForFrame->GetOverflowRectRelativeToSelf() + aFrameArea.TopLeft() : aFrameArea;
nativeTheme ? aForFrame->GetVisualOverflowRectRelativeToSelf() + aFrameArea.TopLeft() : aFrameArea;
gfxRect frameGfxRect(nsLayoutUtils::RectToGfxRect(frameRect, twipsPerPixel));
frameGfxRect.Round();

Просмотреть файл

@ -399,7 +399,7 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
// Now see if thet caret extends beyond the view's bounds. If it does,
// then snap it back, put it as close to the edge as it can.
nscoord overflow = caretInScroll.XMost() -
scrolled->GetOverflowRectRelativeToSelf().width;
scrolled->GetVisualOverflowRectRelativeToSelf().width;
if (overflow > 0)
aRect->x -= overflow;
}
@ -524,7 +524,7 @@ void nsCaret::InvalidateOutsideCaret()
nsIFrame *frame = GetCaretFrame();
// Only invalidate if we are not fully contained by our frame's rect.
if (frame && !frame->GetOverflowRect().Contains(GetCaretRect()))
if (frame && !frame->GetVisualOverflowRect().Contains(GetCaretRect()))
InvalidateRects(mCaretRect, GetHookRect(), frame);
}

Просмотреть файл

@ -119,7 +119,7 @@ static void MarkFrameForDisplay(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
static void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
const nsRect& aDirtyRect) {
nsRect dirty = aDirtyRect - aFrame->GetOffsetTo(aDirtyFrame);
nsRect overflowRect = aFrame->GetOverflowRect();
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (!dirty.IntersectRect(dirty, overflowRect))
return;
aFrame->Properties().Set(nsDisplayListBuilder::OutOfFlowDirtyRectProperty(),
@ -894,7 +894,7 @@ nsDisplayBackground::GetBounds(nsDisplayListBuilder* aBuilder) {
nsRect
nsDisplayOutline::GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
void
@ -1022,7 +1022,7 @@ nsDisplayBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder,
nsRect
nsDisplayBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
PRBool
@ -1800,7 +1800,7 @@ void nsDisplayTransform::HitTest(nsDisplayListBuilder *aBuilder,
*/
nsRect nsDisplayTransform::GetBounds(nsDisplayListBuilder *aBuilder)
{
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
/* The transform is opaque iff the transform consists solely of scales and
@ -1931,7 +1931,7 @@ nsRect nsDisplayTransform::UntransformRect(const nsRect &aUntransformedBounds,
nsDisplaySVGEffects::nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList)
: nsDisplayWrapList(aBuilder, aFrame, aList), mEffectsFrame(aFrame),
mBounds(aFrame->GetOverflowRectRelativeToSelf())
mBounds(aFrame->GetVisualOverflowRectRelativeToSelf())
{
MOZ_COUNT_CTOR(nsDisplaySVGEffects);
}

Просмотреть файл

@ -237,7 +237,7 @@ nsImageLoader::DoRedraw(const nsRect* aDamageRect)
if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
// The canvas's background covers the whole viewport.
bounds = mFrame->GetOverflowRect();
bounds = mFrame->GetVisualOverflowRect();
}
// XXX this should be ok, but there is some crappy ass bug causing it not to work

Просмотреть файл

@ -849,7 +849,7 @@ nsLayoutUtils::GetPopupFrameForEventCoordinates(nsPresContext* aPresContext,
for (i = 0; i < popups.Length(); i++) {
nsIFrame* popup = popups[i];
if (popup->PresContext()->GetRootPresContext() == aPresContext &&
popup->GetOverflowRect().Contains(
popup->GetScrollableOverflowRect().Contains(
GetEventCoordinatesRelativeTo(aEvent, popup))) {
return popup;
}
@ -1242,7 +1242,7 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
// document-rendering state. We rely on PresShell to flush
// retained layers as needed when that persistent state changes.
if (!presShell->UsingDisplayPort()) {
visibleRegion = aFrame->GetOverflowRectRelativeToSelf();
visibleRegion = aFrame->GetVisualOverflowRectRelativeToSelf();
} else {
visibleRegion = presShell->GetDisplayPort();
}
@ -2787,7 +2787,9 @@ nsLayoutUtils::CalculateContentBottom(nsIFrame* aFrame)
nscoord contentBottom = aFrame->GetRect().height;
if (aFrame->GetOverflowRect().height > contentBottom) {
// We want scrollable overflow rather than visual because this
// calculation is intended to affect layout.
if (aFrame->GetScrollableOverflowRect().height > contentBottom) {
nsBlockFrame* blockFrame = GetAsBlock(aFrame);
nsIAtom* childList = nsnull;
PRIntn nextListID = 0;

Просмотреть файл

@ -2542,7 +2542,7 @@ nsRootPresContext::GetPluginGeometryUpdates(nsIFrame* aChangedSubtree,
closure.mRootFrame = mShell->FrameManager()->GetRootFrame();
closure.mRootAPD = closure.mRootFrame->PresContext()->AppUnitsPerDevPixel();
closure.mChangedSubtree = aChangedSubtree;
closure.mChangedRect = aChangedSubtree->GetOverflowRect() +
closure.mChangedRect = aChangedSubtree->GetVisualOverflowRect() +
aChangedSubtree->GetOffsetToCrossDoc(closure.mRootFrame);
PRInt32 subtreeAPD = aChangedSubtree->PresContext()->AppUnitsPerDevPixel();
closure.mChangedRect =

Просмотреть файл

@ -5576,7 +5576,7 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
if (!info)
return nsnull;
nsRect ancestorRect = ancestorFrame->GetOverflowRect();
nsRect ancestorRect = ancestorFrame->GetVisualOverflowRect();
// get a display list containing the range
if (aForPrimarySelection) {

Просмотреть файл

@ -115,7 +115,7 @@ private:
nsRect
nsDisplayButtonBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
void

Просмотреть файл

@ -672,7 +672,7 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Clip height only
nsRect clipRect(aBuilder->ToReferenceFrame(this), GetSize());
clipRect.width = GetOverflowRect().XMost();
clipRect.width = GetVisualOverflowRect().XMost();
nscoord radii[8] = {0, 0, 0, 0, 0, 0, 0, 0};
rv = OverflowClip(aBuilder, tempList, aLists, clipRect, radii);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -389,7 +389,7 @@ nsListControlFrame::InvalidateFocus()
// Invalidating from the containerFrame because that's where our focus
// is drawn.
// The origin of the scrollport is the origin of containerFrame.
nsRect invalidateArea = containerFrame->GetOverflowRect();
nsRect invalidateArea = containerFrame->GetVisualOverflowRect();
nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width, CalcFallbackRowHeight());
invalidateArea.UnionRect(invalidateArea, emptyFallbackArea);
containerFrame->Invalidate(invalidateArea);

Просмотреть файл

@ -178,7 +178,8 @@ public:
// override bounds because the list item focus ring may extend outside
// the nsSelectsAreaFrame
nsListControlFrame* listFrame = GetEnclosingListFrame(GetUnderlyingFrame());
return listFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(listFrame);
return listFrame->GetVisualOverflowRect() +
aBuilder->ToReferenceFrame(listFrame);
}
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx) {

Просмотреть файл

@ -399,7 +399,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
// Store position and overflow rect so taht we can invalidate the correct
// area if the position changes
nsRect oldOverflowRect(aKidFrame->GetOverflowRect() +
nsRect oldOverflowRect(aKidFrame->GetVisualOverflowRect() +
aKidFrame->GetPosition());
nsRect oldRect = aKidFrame->GetRect();

Просмотреть файл

@ -407,9 +407,12 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const
fprintf(out, " [state=%016llx]", mState);
}
nsBlockFrame* f = const_cast<nsBlockFrame*>(this);
if (f->HasOverflowRect()) {
nsRect overflowArea = f->GetOverflowRect();
fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
if (f->HasOverflowAreas()) {
nsRect overflowArea = f->GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = f->GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
PRInt32 numInlineLines = 0;
@ -3145,7 +3148,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
// wrong places. Invalidate the entire overflow rect at the new position.
if (!mayNeedRetry && clearanceFrame &&
frame->GetRect().y != passOriginalY) {
Invalidate(frame->GetOverflowRect() + frame->GetPosition());
Invalidate(frame->GetVisualOverflowRect() + frame->GetPosition());
}
NS_ENSURE_SUCCESS(rv, rv);
@ -5828,7 +5831,7 @@ nsBlockFrame::ReflowPushedFloats(nsBlockReflowState& aState,
if (NS_SUBTREE_DIRTY(f) || aState.mReflowState.ShouldReflowAllKids()) {
// Cache old bounds
nsRect oldRect = f->GetRect();
nsRect oldOverflow = f->GetOverflowRect();
nsRect oldOverflow = f->GetVisualOverflowRect();
// Reflow
aState.FlowAndPlaceFloat(f);
@ -5840,7 +5843,7 @@ nsBlockFrame::ReflowPushedFloats(nsBlockReflowState& aState,
dirtyRect.MoveBy(oldRect.x, oldRect.y);
Invalidate(dirtyRect);
dirtyRect = f->GetOverflowRect();
dirtyRect = f->GetVisualOverflowRect();
dirtyRect.MoveBy(rect.x, rect.y);
Invalidate(dirtyRect);
}

Просмотреть файл

@ -313,12 +313,8 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
}
#endif
if (!mFrame->HasOverflowRect()) {
// Provide overflow area for child that doesn't have any
mMetrics.mOverflowArea.x = 0;
mMetrics.mOverflowArea.y = 0;
mMetrics.mOverflowArea.width = mMetrics.width;
mMetrics.mOverflowArea.height = mMetrics.height;
if (!mFrame->HasOverflowAreas()) {
mMetrics.SetOverflowAreasToDesiredBounds();
}
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus) ||

Просмотреть файл

@ -208,7 +208,7 @@ nsCanvasFrame::RemoveFrame(nsIAtom* aListName,
// Damage the area occupied by the deleted frame
// The child of the canvas probably can't have an outline, but why bother
// thinking about that?
Invalidate(aOldFrame->GetOverflowRect() + aOldFrame->GetPosition());
Invalidate(aOldFrame->GetVisualOverflowRect() + aOldFrame->GetPosition());
// Remove the frame and destroy it
mFrames.DestroyFrame(aOldFrame);
@ -239,7 +239,9 @@ nsCanvasFrame::GetChildList(nsIAtom* aListName) const
nsRect nsCanvasFrame::CanvasArea() const
{
nsRect result(GetOverflowRect());
// Not clear which overflow rect we want here, but it probably doesn't
// matter.
nsRect result(GetVisualOverflowRect());
nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent());
if (scrollableFrame) {
@ -522,7 +524,7 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
// Note: Even though we request to be sized to our child's size, our
// scroll frame ensures that we are always the size of the viewport.
// Also note: GetPosition() on a CanvasFrame is always going to return
// (0, 0). We only want to invalidate GetRect() since GetOverflowRect()
// (0, 0). We only want to invalidate GetRect() since Get*OverflowRect()
// could also include overflow to our top and left (out of the viewport)
// which doesn't need to be painted.
nsIFrame* viewport = PresContext()->GetPresShell()->GetRootFrame();

Просмотреть файл

@ -443,7 +443,7 @@ static void MoveChildTo(nsIFrame* aParent, nsIFrame* aChild, nsPoint aOrigin) {
return;
}
nsRect r = aChild->GetOverflowRect();
nsRect r = aChild->GetVisualOverflowRect();
r += aChild->GetPosition();
aParent->Invalidate(r);
r -= aChild->GetPosition();
@ -603,8 +603,10 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
// may have overflowing content that cares about the available height boundary.
// (It may also have overflowing content that doesn't care about the available height
// boundary, but if so, too bad, this optimization is defeated.)
// We want scrollable overflow here since this is a calculation that
// affects layout.
PRBool skipResizeHeightShrink = shrinkingHeightOnly
&& child->GetOverflowRect().YMost() <= aConfig.mColMaxHeight;
&& child->GetScrollableOverflowRect().YMost() <= aConfig.mColMaxHeight;
nscoord childContentBottom = 0;
if (!reflowNext && (skipIncremental || skipResizeHeightShrink)) {

Просмотреть файл

@ -928,7 +928,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
// Cache old bounds
nsRect oldRect = frame->GetRect();
nsRect oldOverflow = frame->GetOverflowRect();
nsRect oldOverflow = frame->GetVisualOverflowRect();
// Reflow
rv = ReflowChild(frame, aPresContext, desiredSize, frameState,
@ -1549,9 +1549,12 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
}
fprintf(out, " [content=%p]", static_cast<void*>(mContent));
nsContainerFrame* f = const_cast<nsContainerFrame*>(this);
if (f->HasOverflowRect()) {
nsRect overflowArea = f->GetOverflowRect();
fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
if (f->HasOverflowAreas()) {
nsRect overflowArea = f->GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = f->GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext));

Просмотреть файл

@ -1640,7 +1640,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
if (aBuilder->GetSelectedFramesOnly() &&
(aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
dirty = aChild->GetOverflowRect();
dirty = aChild->GetVisualOverflowRect();
} else if (!(aChild->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
// No need to descend into aChild to catch placeholders for visible
// positioned stuff. So see if we can short-circuit frame traversal here.
@ -1652,7 +1652,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
// area even if the scrollframe itself doesn't.
if (aChild != aBuilder->GetIgnoreScrollFrame()) {
nsRect childDirty;
if (!childDirty.IntersectRect(dirty, aChild->GetOverflowRect()))
if (!childDirty.IntersectRect(dirty, aChild->GetVisualOverflowRect()))
return NS_OK;
// Usually we could set dirty to childDirty now but there's no
// benefit, and it can be confusing. It can especially confuse
@ -4198,14 +4198,14 @@ nsIFrame::InvalidateRectDifference(const nsRect& aR1, const nsRect& aR2)
void
nsIFrame::InvalidateFrameSubtree()
{
Invalidate(GetOverflowRectRelativeToSelf());
Invalidate(GetVisualOverflowRectRelativeToSelf());
FrameLayerBuilder::InvalidateThebesLayersInSubtree(this);
}
void
nsIFrame::InvalidateOverflowRect()
{
Invalidate(GetOverflowRectRelativeToSelf());
Invalidate(GetVisualOverflowRectRelativeToSelf());
}
NS_DECLARE_FRAME_PROPERTY(DeferInvalidatesProperty, nsIFrame::DestroyRegion)
@ -4314,6 +4314,11 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
nscoord offset = outline->mOutlineOffset;
nscoord inflateBy = NS_MAX(width + offset, 0);
// FIXME (bug 599652): We probably want outline to be drawn around
// something smaller than the visual overflow rect (perhaps the
// scrollable overflow rect is correct). When we change that, we
// need to keep this code (and the storing of properties just
// above) in sync with GetOutlineInnerRect in nsCSSRendering.cpp.
r.Inflate(inflateBy, inflateBy);
*aAnyOutlineOrEffects = PR_TRUE;
}
@ -4414,7 +4419,7 @@ nsIFrame::GetVisualOverflowRectRelativeToSelf() const
void
nsFrame::CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize)
{
nsIFrame::CheckInvalidateSizeChange(mRect, GetOverflowRect(),
nsIFrame::CheckInvalidateSizeChange(mRect, GetVisualOverflowRect(),
nsSize(aNewDesiredSize.width, aNewDesiredSize.height));
}
@ -4433,7 +4438,7 @@ InvalidateRectForFrameSizeChange(nsIFrame* aFrame, const nsRect& aRect)
void
nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
const nsRect& aOldOverflowRect,
const nsRect& aOldVisualOverflowRect,
const nsSize& aNewDesiredSize)
{
if (aNewDesiredSize == aOldRect.Size())
@ -4458,10 +4463,11 @@ nsIFrame::CheckInvalidateSizeChange(const nsRect& aOldRect,
// Invalidate the entire old frame+outline if the frame has an outline
PRBool anyOutlineOrEffects;
nsRect r = ComputeOutlineAndEffectsRect(this, &anyOutlineOrEffects,
aOldOverflowRect, aNewDesiredSize,
aOldVisualOverflowRect,
aNewDesiredSize,
PR_FALSE);
if (anyOutlineOrEffects) {
r.UnionRect(aOldOverflowRect, r);
r.UnionRect(aOldVisualOverflowRect, r);
InvalidateRectForFrameSizeChange(this, r);
return;
}
@ -4599,9 +4605,12 @@ nsFrame::List(FILE* out, PRInt32 aIndent) const
}
fprintf(out, " [content=%p]", static_cast<void*>(mContent));
nsFrame* f = const_cast<nsFrame*>(this);
if (f->HasOverflowRect()) {
nsRect overflowArea = f->GetOverflowRect();
fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
if (f->HasOverflowAreas()) {
nsRect overflowArea = f->GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = f->GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext));
@ -8116,19 +8125,32 @@ void nsFrame::DisplayReflowExit(nsPresContext* aPresContext,
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
printf(" status=0x%x", aStatus);
}
if (aFrame->HasOverflowRect()) {
DR_state->PrettyUC(aMetrics.mOverflowArea.x, x);
DR_state->PrettyUC(aMetrics.mOverflowArea.y, y);
DR_state->PrettyUC(aMetrics.mOverflowArea.width, width);
DR_state->PrettyUC(aMetrics.mOverflowArea.height, height);
printf(" o=(%s,%s) %s x %s", x, y, width, height);
if (aFrame->HasOverflowAreas()) {
DR_state->PrettyUC(aMetrics.VisualOverflow().x, x);
DR_state->PrettyUC(aMetrics.VisualOverflow().y, y);
DR_state->PrettyUC(aMetrics.VisualOverflow().width, width);
DR_state->PrettyUC(aMetrics.VisualOverflow().height, height);
printf(" vis-o=(%s,%s) %s x %s", x, y, width, height);
nsRect storedOverflow = aFrame->GetOverflowRect();
nsRect storedOverflow = aFrame->GetVisualOverflowRect();
DR_state->PrettyUC(storedOverflow.x, x);
DR_state->PrettyUC(storedOverflow.y, y);
DR_state->PrettyUC(storedOverflow.width, width);
DR_state->PrettyUC(storedOverflow.height, height);
printf(" sto=(%s,%s) %s x %s", x, y, width, height);
printf(" vis-sto=(%s,%s) %s x %s", x, y, width, height);
DR_state->PrettyUC(aMetrics.ScrollableOverflow().x, x);
DR_state->PrettyUC(aMetrics.ScrollableOverflow().y, y);
DR_state->PrettyUC(aMetrics.ScrollableOverflow().width, width);
DR_state->PrettyUC(aMetrics.ScrollableOverflow().height, height);
printf(" scr-o=(%s,%s) %s x %s", x, y, width, height);
storedOverflow = aFrame->GetScrollableOverflowRect();
DR_state->PrettyUC(storedOverflow.x, x);
DR_state->PrettyUC(storedOverflow.y, y);
DR_state->PrettyUC(storedOverflow.width, width);
DR_state->PrettyUC(storedOverflow.height, height);
printf(" scr-sto=(%s,%s) %s x %s", x, y, width, height);
}
printf("\n");
if (DR_state->mDisplayPixelErrors) {

Просмотреть файл

@ -533,7 +533,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
// overflow area doesn't include the frame bounds.
aMetrics->UnionOverflowAreasWithDesiredBounds();
aState->mContentsOverflowArea = aMetrics->mOverflowArea;
aState->mContentsOverflowArea = aMetrics->ScrollableOverflow();
aState->mReflowedContentsWithHScrollbar = aAssumeHScroll;
aState->mReflowedContentsWithVScrollbar = aAssumeVScroll;
@ -631,7 +631,8 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
ComputeInsideBorderSize(aState,
nsSize(kidDesiredSize.width, kidDesiredSize.height));
nsRect scrolledRect =
mInner.GetScrolledRectInternal(kidDesiredSize.mOverflowArea, insideBorderSize);
mInner.GetScrolledRectInternal(kidDesiredSize.ScrollableOverflow(),
insideBorderSize);
if (nsRect(nsPoint(0, 0), insideBorderSize).Contains(scrolledRect)) {
// Let's pretend we had no scrollbars coming in here
rv = ReflowScrolledFrame(aState, PR_FALSE, PR_FALSE,
@ -799,7 +800,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
nsRect oldScrollAreaBounds = mInner.mScrollPort;
nsRect oldScrolledAreaBounds =
mInner.mScrolledFrame->GetOverflowRectRelativeToParent();
mInner.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
// Adjust to a multiple of device pixels to restore the invariant that
// oldScrollPosition is a multiple of device pixels. This could have been
// thrown out by a zoom change.
@ -829,7 +830,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
mInner.mHasVerticalScrollbar = state.mShowVScrollbar;
nsRect newScrollAreaBounds = mInner.mScrollPort;
nsRect newScrolledAreaBounds =
mInner.mScrolledFrame->GetOverflowRectRelativeToParent();
mInner.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
if (mInner.mSkippedScrollbarLayout ||
reflowHScrollbar || reflowVScrollbar || reflowScrollCorner ||
(GetStateBits() & NS_FRAME_IS_DIRTY) ||
@ -2515,7 +2516,7 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
nsRect originalRect = mInner.mScrolledFrame->GetRect();
nsRect originalOverflow = mInner.mScrolledFrame->GetOverflowRect();
nsRect originalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
nsSize minSize = mInner.mScrolledFrame->GetMinSize(aState);
@ -2537,32 +2538,32 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
childRect.width = NS_MAX(childRect.width, mInner.mScrollPort.width);
childRect.height = NS_MAX(childRect.height, mInner.mScrollPort.height);
// remove overflow area when we update the bounds,
// remove overflow areas when we update the bounds,
// because we've already accounted for it
mInner.mScrolledFrame->SetBounds(aState, childRect);
mInner.mScrolledFrame->ClearOverflowRect();
// REVIEW: Have we accounted for both?
mInner.mScrolledFrame->SetBounds(aState, childRect, PR_TRUE);
}
nsRect finalRect = mInner.mScrolledFrame->GetRect();
nsRect finalOverflow = mInner.mScrolledFrame->GetOverflowRect();
nsRect finalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
// The position of the scrolled frame shouldn't change, but if it does or
// the position of the overflow rect changes just invalidate both the old
// and new overflow rect.
if (originalRect.TopLeft() != finalRect.TopLeft() ||
originalOverflow.TopLeft() != finalOverflow.TopLeft())
originalVisOverflow.TopLeft() != finalVisOverflow.TopLeft())
{
// The old overflow rect needs to be adjusted if the frame's position
// changed.
mInner.mScrolledFrame->Invalidate(
originalOverflow + originalRect.TopLeft() - finalRect.TopLeft());
mInner.mScrolledFrame->Invalidate(finalOverflow);
} else if (!originalOverflow.IsExactEqual(finalOverflow)) {
originalVisOverflow + originalRect.TopLeft() - finalRect.TopLeft());
mInner.mScrolledFrame->Invalidate(finalVisOverflow);
} else if (!originalVisOverflow.IsExactEqual(finalVisOverflow)) {
// If the overflow rect changed then invalidate the difference between the
// old and new overflow rects.
mInner.mScrolledFrame->CheckInvalidateSizeChange(
originalRect, originalOverflow, finalRect.Size());
originalRect, originalVisOverflow, finalRect.Size());
mInner.mScrolledFrame->InvalidateRectDifference(
originalOverflow, finalOverflow);
originalVisOverflow, finalVisOverflow);
}
aState.SetLayoutFlags(oldflags);
@ -2970,7 +2971,8 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
PRBool rectChanged = aBox->GetRect() != aRect;
if (rectChanged) {
if (aScrollbarIsBeingHidden) {
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
aBox->GetParent()->Invalidate(aBox->GetVisualOverflowRect() +
aBox->GetPosition());
} else {
aBox->InvalidateFrameSubtree();
}
@ -2978,7 +2980,8 @@ static void LayoutAndInvalidate(nsBoxLayoutState& aState,
nsBoxFrame::LayoutChildAt(aState, aBox, aRect);
if (rectChanged) {
if (aScrollbarIsBeingHidden) {
aBox->GetParent()->Invalidate(aBox->GetOverflowRect() + aBox->GetPosition());
aBox->GetParent()->Invalidate(aBox->GetVisualOverflowRect() +
aBox->GetPosition());
} else {
aBox->InvalidateFrameSubtree();
}
@ -3212,7 +3215,7 @@ nsRect
nsGfxScrollFrameInner::GetScrolledRect() const
{
nsRect result =
GetScrolledRectInternal(mScrolledFrame->GetOverflowRect(),
GetScrolledRectInternal(mScrolledFrame->GetScrollableOverflowRect(),
mScrollPort.Size());
NS_ASSERTION(result.width >= mScrollPort.width,
@ -3369,7 +3372,7 @@ nsGfxScrollFrameInner::FireScrolledAreaEvent()
nsPresContext *prescontext = mOuter->PresContext();
nsIContent* content = mOuter->GetContent();
event.mArea = mScrolledFrame->GetOverflowRectRelativeToParent();
event.mArea = mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
nsIDocument *doc = content->GetCurrentDoc();
if (doc) {

Просмотреть файл

@ -152,7 +152,7 @@ nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder,
nsRect
nsDisplayTextDecoration::GetBounds(nsDisplayListBuilder* aBuilder)
{
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
class nsDisplayTextShadow : public nsDisplayItem {
@ -324,7 +324,7 @@ nsRect
nsDisplayTextShadow::GetBounds(nsDisplayListBuilder* aBuilder)
{
// Shadows are always painted in the overflow rect
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
nsresult

Просмотреть файл

@ -2492,7 +2492,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()))
// box. You can pass PR_TRUE to aRemoveOverflowArea as a
// convenience.
virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
PRBool aRemoveOverflowArea = PR_FALSE)=0;
PRBool aRemoveOverflowAreas = PR_FALSE) = 0;
NS_HIDDEN_(nsresult) Layout(nsBoxLayoutState& aBoxLayoutState);
nsIBox* GetChildBox() const
{
@ -2573,7 +2573,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::EmbeddingLevelProperty()))
* did, whoever moved the frame will invalidate as needed anyway.
*/
void CheckInvalidateSizeChange(const nsRect& aOldRect,
const nsRect& aOldOverflowRect,
const nsRect& aOldVisualOverflowRect,
const nsSize& aNewDesiredSize);
/**

Просмотреть файл

@ -117,13 +117,17 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
// in the percentage padding case)
kidReflowState.mStylePadding->GetPadding(padding);
// First check the combined area
if (frame->HasOverflowRect()) {
// This is for shrink-to-fit, and therefore we want to use the
// scrollable overflow, since the purpose of shrink to fit is to
// make the content that ought to be reachable (represented by the
// scrollable overflow) fit in the page.
if (frame->HasOverflowAreas()) {
// The background covers the content area and padding area, so check
// for children sticking outside the child frame's padding edge
if (aDesiredSize.mOverflowArea.XMost() > aDesiredSize.width) {
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
if (xmost > aDesiredSize.width) {
mPD->mPageContentXMost =
aDesiredSize.mOverflowArea.XMost() +
xmost +
kidReflowState.mStyleBorder->GetActualBorderWidth(NS_SIDE_RIGHT) +
padding.right;
}

Просмотреть файл

@ -3938,7 +3938,7 @@ public:
#endif
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
@ -7063,9 +7063,14 @@ nsTextFrame::List(FILE* out, PRInt32 aIndent) const
}
}
fprintf(out, " [content=%p]", static_cast<void*>(mContent));
if (HasOverflowRect()) {
nsRect overflowArea = GetOverflowRect();
fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
if (HasOverflowAreas()) {
nsRect overflowArea = GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]",
overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]",
overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
fprintf(out, " sc=%p", static_cast<void*>(mStyleContext));

Просмотреть файл

@ -74,7 +74,7 @@ GetPreEffectsOverflowRect(nsIFrame* aFrame)
(aFrame->Properties().Get(nsIFrame::PreEffectsBBoxProperty()));
if (r)
return *r;
return aFrame->GetOverflowRect();
return aFrame->GetVisualOverflowRect();
}
struct BBoxCollector : public nsLayoutUtils::BoxCallback {
@ -152,7 +152,7 @@ nsSVGIntegrationUtils::GetInvalidAreaForChangedSource(nsIFrame* aFrame,
// The frame is either not there or not currently available,
// perhaps because we're in the middle of tearing stuff down.
// Be conservative.
return aFrame->GetOverflowRect();
return aFrame->GetVisualOverflowRect();
}
PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();

Просмотреть файл

@ -620,7 +620,7 @@ nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect)
viewportFrame = GetOuterSVGFrame(aFrame);
}
if (viewportFrame->GetType() == nsGkAtoms::svgOuterSVGFrame) {
nsRect r = viewportFrame->GetOverflowRect();
nsRect r = viewportFrame->GetVisualOverflowRect();
// GetOverflowRect is relative to our border box, but we need it
// relative to our content box.
r.MoveBy(viewportFrame->GetPosition() - viewportFrame->GetContentRect().TopLeft());

Просмотреть файл

@ -1090,7 +1090,7 @@ nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex) const
nsRect
nsDisplayTableItem::GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
PRBool

Просмотреть файл

@ -1907,7 +1907,7 @@ nsTableRowGroupFrame::GetFirstRowContaining(nscoord aY, nscoord* aOverflowAbove)
PRBool
nsTableRowGroupFrame::FrameCursorData::AppendFrame(nsIFrame* aFrame)
{
nsRect overflowRect = aFrame->GetOverflowRect();
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (overflowRect.IsEmpty())
return PR_TRUE;
nscoord overflowAbove = -overflowRect.y;

Просмотреть файл

@ -268,7 +268,7 @@ nsIFrame::GetClientRect(nsRect& aClientRect)
}
void
nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowArea)
nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOverflowAreas)
{
NS_BOX_ASSERTION(this, aRect.width >=0 && aRect.height >= 0, "SetBounds Size < 0");
@ -288,9 +288,9 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect, PRBool aRemoveOv
// Nuke the overflow area. The caller is responsible for restoring
// it if necessary.
if (aRemoveOverflowArea && HasOverflowRect()) {
if (aRemoveOverflowAreas) {
// remove the previously stored overflow area
ClearOverflowRect();
ClearOverflowRects();
}
if (!(flags & NS_FRAME_NO_MOVE_VIEW))
@ -661,7 +661,7 @@ nsIFrame::Redraw(nsBoxLayoutState& aState,
if (aDamageRect)
damageRect = *aDamageRect;
else
damageRect = GetOverflowRect();
damageRect = GetVisualOverflowRect();
Invalidate(damageRect);
// nsStackLayout, at least, expects us to repaint descendants even

Просмотреть файл

@ -67,7 +67,7 @@ public:
virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
virtual void SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
PRBool aRemoveOverflowArea = PR_FALSE);
PRBool aRemoveOverflowAreas = PR_FALSE);
NS_IMETHOD GetBorder(nsMargin& aBorderAndPadding);
NS_IMETHOD GetPadding(nsMargin& aBorderAndPadding);

Просмотреть файл

@ -211,9 +211,14 @@ nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const
}
fprintf(out, " [content=%p]", static_cast<void*>(mContent));
nsPopupSetFrame* f = const_cast<nsPopupSetFrame*>(this);
if (f->HasOverflowRect()) {
nsRect overflowArea = f->GetOverflowRect();
fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y,
if (f->HasOverflowAreas()) {
nsRect overflowArea = f->GetVisualOverflowRect();
fprintf(out, " [vis-overflow=%d,%d,%d,%d]",
overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
overflowArea = f->GetScrollableOverflowRect();
fprintf(out, " [scr-overflow=%d,%d,%d,%d]",
overflowArea.x, overflowArea.y,
overflowArea.width, overflowArea.height);
}
fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext));

Просмотреть файл

@ -358,7 +358,7 @@ nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
nsRect
nsDisplayXULTextBox::GetBounds(nsDisplayListBuilder* aBuilder) {
return mFrame->GetOverflowRect() + ToReferenceFrame();
return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
}
NS_IMETHODIMP