Use 'Is' in noun-phrase-named predicate (518103 followup, r=jorendorff/Waldo).
[mozilla-central.git] / layout / generic / nsAbsoluteContainingBlock.cpp
bloba1f52fd7e919591ff837c331e9d034aefb80a81d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 * code for managing absolutely positioned children of a rendering
40 * object that is a containing block for them
43 #include "nsCOMPtr.h"
44 #include "nsAbsoluteContainingBlock.h"
45 #include "nsContainerFrame.h"
46 #include "nsIPresShell.h"
47 #include "nsHTMLContainerFrame.h"
48 #include "nsHTMLParts.h"
49 #include "nsPresContext.h"
50 #include "nsFrameManager.h"
51 #include "nsCSSFrameConstructor.h"
53 #ifdef DEBUG
54 #include "nsBlockFrame.h"
55 #endif
57 nsresult
58 nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame* aDelegatingFrame,
59 nsIAtom* aListName,
60 nsFrameList& aChildList)
62 NS_PRECONDITION(GetChildListName() == aListName, "unexpected child list name");
63 #ifdef NS_DEBUG
64 nsFrame::VerifyDirtyBitSet(aChildList);
65 #endif
66 mAbsoluteFrames.SetFrames(aChildList);
67 return NS_OK;
70 nsresult
71 nsAbsoluteContainingBlock::AppendFrames(nsIFrame* aDelegatingFrame,
72 nsIAtom* aListName,
73 nsFrameList& aFrameList)
75 NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
77 // Append the frames to our list of absolutely positioned frames
78 #ifdef NS_DEBUG
79 nsFrame::VerifyDirtyBitSet(aFrameList);
80 #endif
81 mAbsoluteFrames.AppendFrames(nsnull, aFrameList);
83 // no damage to intrinsic widths, since absolutely positioned frames can't
84 // change them
85 return aDelegatingFrame->PresContext()->PresShell()->
86 FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
87 NS_FRAME_HAS_DIRTY_CHILDREN);
90 nsresult
91 nsAbsoluteContainingBlock::InsertFrames(nsIFrame* aDelegatingFrame,
92 nsIAtom* aListName,
93 nsIFrame* aPrevFrame,
94 nsFrameList& aFrameList)
96 NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
97 NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == aDelegatingFrame,
98 "inserting after sibling frame with different parent");
100 #ifdef NS_DEBUG
101 nsFrame::VerifyDirtyBitSet(aFrameList);
102 #endif
103 mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
105 // no damage to intrinsic widths, since absolutely positioned frames can't
106 // change them
107 return aDelegatingFrame->PresContext()->PresShell()->
108 FrameNeedsReflow(aDelegatingFrame, nsIPresShell::eResize,
109 NS_FRAME_HAS_DIRTY_CHILDREN);
112 void
113 nsAbsoluteContainingBlock::RemoveFrame(nsIFrame* aDelegatingFrame,
114 nsIAtom* aListName,
115 nsIFrame* aOldFrame)
117 NS_ASSERTION(GetChildListName() == aListName, "unexpected child list");
118 nsIFrame* nif = aOldFrame->GetNextInFlow();
119 if (nif) {
120 static_cast<nsContainerFrame*>(nif->GetParent())
121 ->DeleteNextInFlowChild(aOldFrame->PresContext(), nif, PR_FALSE);
124 mAbsoluteFrames.DestroyFrame(aOldFrame);
127 nsresult
128 nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
129 nsPresContext* aPresContext,
130 const nsHTMLReflowState& aReflowState,
131 nsReflowStatus& aReflowStatus,
132 nscoord aContainingBlockWidth,
133 nscoord aContainingBlockHeight,
134 PRBool aConstrainHeight,
135 PRBool aCBWidthChanged,
136 PRBool aCBHeightChanged,
137 nsRect* aChildBounds)
139 // Initialize OUT parameter
140 if (aChildBounds)
141 aChildBounds->SetRect(0, 0, 0, 0);
142 nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
144 PRBool reflowAll = aReflowState.ShouldReflowAllKids();
146 nsIFrame* kidFrame;
147 nsOverflowContinuationTracker tracker(aPresContext, aDelegatingFrame, PR_TRUE);
148 for (kidFrame = mAbsoluteFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) {
149 PRBool kidNeedsReflow = reflowAll || NS_SUBTREE_DIRTY(kidFrame) ||
150 FrameDependsOnContainer(kidFrame, aCBWidthChanged, aCBHeightChanged);
151 if (kidNeedsReflow && !aPresContext->HasPendingInterrupt()) {
152 // Reflow the frame
153 nsReflowStatus kidStatus = NS_FRAME_COMPLETE;
154 ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowState,
155 aContainingBlockWidth, aContainingBlockHeight,
156 aConstrainHeight, kidFrame, kidStatus, aChildBounds);
157 nsIFrame* nextFrame = kidFrame->GetNextInFlow();
158 if (!NS_FRAME_IS_FULLY_COMPLETE(kidStatus)) {
159 // Need a continuation
160 if (!nextFrame) {
161 nsresult rv = aPresContext->PresShell()->FrameConstructor()->
162 CreateContinuingFrame(aPresContext, kidFrame, aDelegatingFrame, &nextFrame);
163 NS_ENSURE_SUCCESS(rv, rv);
165 // Add it as an overflow container.
166 //XXXfr This is a hack to fix some of our printing dataloss.
167 // See bug 154892. Not sure how to do it "right" yet; probably want
168 // to keep continuations within an nsAbsoluteContainingBlock eventually.
169 tracker.Insert(nextFrame, kidStatus);
170 NS_MergeReflowStatusInto(&reflowStatus, kidStatus);
172 else {
173 // Delete any continuations
174 if (nextFrame) {
175 tracker.Finish(kidFrame);
176 static_cast<nsContainerFrame*>(nextFrame->GetParent())
177 ->DeleteNextInFlowChild(aPresContext, nextFrame, PR_TRUE);
181 else {
182 tracker.Skip(kidFrame, reflowStatus);
183 if (aChildBounds) {
184 aChildBounds->UnionRect(*aChildBounds, kidFrame->GetOverflowRect() +
185 kidFrame->GetPosition());
189 // Make a CheckForInterrupt call, here, not just HasPendingInterrupt. That
190 // will make sure that we end up reflowing aDelegatingFrame in cases when
191 // one of our kids interrupted. Otherwise we'd set the dirty or
192 // dirty-children bit on the kid in the condition below, and then when
193 // reflow completes and we go to mark dirty bits on all ancestors of that
194 // kid we'll immediately bail out, because the kid already has a dirty bit.
195 // In particular, we won't set any dirty bits on aDelegatingFrame, so when
196 // the following reflow happens we won't reflow the kid in question. This
197 // might be slightly suboptimal in cases where |kidFrame| itself did not
198 // interrupt, since we'll trigger a reflow of it too when it's not strictly
199 // needed. But the logic to not do that is enough more complicated, and
200 // the case enough of an edge case, that this is probably better.
201 if (kidNeedsReflow && aPresContext->CheckForInterrupt(aDelegatingFrame)) {
202 if (aDelegatingFrame->GetStateBits() & NS_FRAME_IS_DIRTY) {
203 kidFrame->AddStateBits(NS_FRAME_IS_DIRTY);
204 } else {
205 kidFrame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
210 // Abspos frames can't cause their parent to be incomplete,
211 // only overflow incomplete.
212 if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus))
213 NS_FRAME_SET_OVERFLOW_INCOMPLETE(reflowStatus);
215 NS_MergeReflowStatusInto(&aReflowStatus, reflowStatus);
216 return NS_OK;
219 static inline PRBool IsFixedPaddingSize(nsStyleUnit aUnit) {
220 return aUnit == eStyleUnit_Coord;
222 static inline PRBool IsFixedMarginSize(nsStyleUnit aUnit) {
223 return aUnit == eStyleUnit_Coord;
225 static inline PRBool IsFixedMaxSize(nsStyleUnit aUnit) {
226 return aUnit == eStyleUnit_None || aUnit == eStyleUnit_Coord;
228 static inline PRBool IsFixedOffset(nsStyleUnit aUnit) {
229 return aUnit == eStyleUnit_Coord;
231 static inline PRBool IsFixedHeight(nsStyleUnit aUnit) {
232 return aUnit == eStyleUnit_Coord;
235 static inline PRBool IsFixedWidth(const nsStyleCoord& aCoord)
237 return aCoord.GetUnit() == eStyleUnit_Coord ||
238 (aCoord.GetUnit() == eStyleUnit_Enumerated &&
239 (aCoord.GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
240 aCoord.GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT));
243 static inline PRBool IsFixedMaxWidth(const nsStyleCoord& aCoord)
245 return aCoord.GetUnit() == eStyleUnit_None ||
246 IsFixedWidth(aCoord);
249 PRBool
250 nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f,
251 PRBool aCBWidthChanged,
252 PRBool aCBHeightChanged)
254 const nsStylePosition* pos = f->GetStylePosition();
255 // See if f's position might have changed because it depends on a
256 // placeholder's position
257 // This can happen in the following cases:
258 // 1) Vertical positioning. "top" must be auto and "bottom" must be auto
259 // (otherwise the vertical position is completely determined by
260 // whichever of them is not auto and the height).
261 // 2) Horizontal positioning. "left" must be auto and "right" must be auto
262 // (otherwise the horizontal position is completely determined by
263 // whichever of them is not auto and the width).
264 // See nsHTMLReflowState::InitAbsoluteConstraints -- these are the
265 // only cases when we call CalculateHypotheticalBox().
266 if ((pos->mOffset.GetTopUnit() == eStyleUnit_Auto &&
267 pos->mOffset.GetBottomUnit() == eStyleUnit_Auto) ||
268 (pos->mOffset.GetLeftUnit() == eStyleUnit_Auto &&
269 pos->mOffset.GetRightUnit() == eStyleUnit_Auto)) {
270 return PR_TRUE;
272 if (!aCBWidthChanged && !aCBHeightChanged) {
273 // skip getting style data
274 return PR_FALSE;
276 const nsStylePadding* padding = f->GetStylePadding();
277 const nsStyleMargin* margin = f->GetStyleMargin();
278 if (aCBWidthChanged) {
279 // See if f's width might have changed.
280 // If border-left, border-right, padding-left, padding-right,
281 // width, min-width, and max-width are all lengths, 'none', or enumerated,
282 // then our frame width does not depend on the parent width.
283 // Note that borders never depend on the parent width
284 // XXX All of the enumerated values except -moz-available are ok too.
285 if (!IsFixedWidth(pos->mWidth) ||
286 !IsFixedWidth(pos->mMinWidth) ||
287 !IsFixedMaxWidth(pos->mMaxWidth) ||
288 !IsFixedPaddingSize(padding->mPadding.GetLeftUnit()) ||
289 !IsFixedPaddingSize(padding->mPadding.GetRightUnit())) {
290 return PR_TRUE;
293 // See if f's position might have changed. If we're RTL then the
294 // rules are slightly different. We'll assume percentage or auto
295 // margins will always induce a dependency on the size
296 if (!IsFixedMarginSize(margin->mMargin.GetLeftUnit()) ||
297 !IsFixedMarginSize(margin->mMargin.GetRightUnit())) {
298 return PR_TRUE;
300 if (f->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
301 // Note that even if 'left' is a length, our position can
302 // still depend on the containing block width, because if
303 // 'right' is also a length we will discard 'left' and be
304 // positioned relative to the containing block right edge.
305 // 'left' length and 'right' auto is the only combination
306 // we can be sure of.
307 if (!IsFixedOffset(pos->mOffset.GetLeftUnit()) ||
308 pos->mOffset.GetRightUnit() != eStyleUnit_Auto) {
309 return PR_TRUE;
311 } else {
312 if (!IsFixedOffset(pos->mOffset.GetLeftUnit())) {
313 return PR_TRUE;
317 if (aCBHeightChanged) {
318 // See if f's height might have changed.
319 // If border-top, border-bottom, padding-top, padding-bottom,
320 // min-height, and max-height are all lengths or 'none',
321 // and height is a length or height and bottom are auto and top is not auto,
322 // then our frame height does not depend on the parent height.
323 // Note that borders never depend on the parent height
324 if (!(IsFixedHeight(pos->mHeight.GetUnit()) ||
325 (pos->mHeight.GetUnit() == eStyleUnit_Auto &&
326 pos->mOffset.GetBottomUnit() == eStyleUnit_Auto &&
327 pos->mOffset.GetTopUnit() != eStyleUnit_Auto)) ||
328 !IsFixedHeight(pos->mMinHeight.GetUnit()) ||
329 !IsFixedMaxSize(pos->mMaxHeight.GetUnit()) ||
330 !IsFixedPaddingSize(padding->mPadding.GetTopUnit()) ||
331 !IsFixedPaddingSize(padding->mPadding.GetBottomUnit())) {
332 return PR_TRUE;
335 // See if f's position might have changed.
336 if (!IsFixedMarginSize(margin->mMargin.GetTopUnit()) ||
337 !IsFixedMarginSize(margin->mMargin.GetBottomUnit())) {
338 return PR_TRUE;
340 if (!IsFixedOffset(pos->mOffset.GetTopUnit())) {
341 return PR_TRUE;
344 return PR_FALSE;
347 void
348 nsAbsoluteContainingBlock::DestroyFrames(nsIFrame* aDelegatingFrame)
350 mAbsoluteFrames.DestroyFrames();
353 void
354 nsAbsoluteContainingBlock::MarkSizeDependentFramesDirty()
356 DoMarkFramesDirty(PR_FALSE);
359 void
360 nsAbsoluteContainingBlock::MarkAllFramesDirty()
362 DoMarkFramesDirty(PR_TRUE);
365 void
366 nsAbsoluteContainingBlock::DoMarkFramesDirty(PRBool aMarkAllDirty)
368 for (nsIFrame* kidFrame = mAbsoluteFrames.FirstChild();
369 kidFrame;
370 kidFrame = kidFrame->GetNextSibling()) {
371 if (aMarkAllDirty) {
372 kidFrame->AddStateBits(NS_FRAME_IS_DIRTY);
373 } else if (FrameDependsOnContainer(kidFrame, PR_TRUE, PR_TRUE)) {
374 // Add the weakest flags that will make sure we reflow this frame later
375 kidFrame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
380 // XXX Optimize the case where it's a resize reflow and the absolutely
381 // positioned child has the exact same size and position and skip the
382 // reflow...
384 // When bug 154892 is checked in, make sure that when
385 // GetChildListName() == nsGkAtoms::fixedList, the height is unconstrained.
386 // since we don't allow replicated frames to split.
388 nsresult
389 nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
390 nsPresContext* aPresContext,
391 const nsHTMLReflowState& aReflowState,
392 nscoord aContainingBlockWidth,
393 nscoord aContainingBlockHeight,
394 PRBool aConstrainHeight,
395 nsIFrame* aKidFrame,
396 nsReflowStatus& aStatus,
397 nsRect* aChildBounds)
399 #ifdef DEBUG
400 if (nsBlockFrame::gNoisyReflow) {
401 nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
402 printf("abs pos ");
403 if (aKidFrame) {
404 nsAutoString name;
405 aKidFrame->GetFrameName(name);
406 printf("%s ", NS_LossyConvertUTF16toASCII(name).get());
409 char width[16];
410 char height[16];
411 PrettyUC(aReflowState.availableWidth, width);
412 PrettyUC(aReflowState.availableHeight, height);
413 printf(" a=%s,%s ", width, height);
414 PrettyUC(aReflowState.ComputedWidth(), width);
415 PrettyUC(aReflowState.ComputedHeight(), height);
416 printf("c=%s,%s \n", width, height);
418 AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
419 #endif // DEBUG
421 // Store position and overflow rect so taht we can invalidate the correct
422 // area if the position changes
423 nsRect oldOverflowRect(aKidFrame->GetOverflowRect() +
424 aKidFrame->GetPosition());
425 nsRect oldRect = aKidFrame->GetRect();
427 nsresult rv;
428 // Get the border values
429 const nsMargin& border = aReflowState.mStyleBorder->GetActualBorder();
431 nscoord availWidth = aContainingBlockWidth;
432 if (availWidth == -1) {
433 NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
434 "Must have a useful width _somewhere_");
435 availWidth =
436 aReflowState.ComputedWidth() + aReflowState.mComputedPadding.LeftRight();
439 nsHTMLReflowMetrics kidDesiredSize;
440 nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame,
441 nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
442 aContainingBlockWidth,
443 aContainingBlockHeight);
445 // Send the WillReflow() notification and position the frame
446 aKidFrame->WillReflow(aPresContext);
448 PRBool constrainHeight = (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE)
449 && aConstrainHeight
450 // Don't split if told not to (e.g. for fixed frames)
451 && (aDelegatingFrame->GetType() != nsGkAtoms::positionedInlineFrame)
452 //XXX we don't handle splitting frames for inline absolute containing blocks yet
453 && (aKidFrame->GetRect().y <= aReflowState.availableHeight);
454 // Don't split things below the fold. (Ideally we shouldn't *have*
455 // anything totally below the fold, but we can't position frames
456 // across next-in-flow breaks yet.
457 if (constrainHeight) {
458 kidReflowState.availableHeight = aReflowState.availableHeight - border.top
459 - kidReflowState.mComputedMargin.top;
460 if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.top)
461 kidReflowState.availableHeight -= kidReflowState.mComputedOffsets.top;
464 // Do the reflow
465 rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus);
467 // If we're solving for 'left' or 'top', then compute it now that we know the
468 // width/height
469 if ((NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) ||
470 (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top)) {
471 if (-1 == aContainingBlockWidth) {
472 // Get the containing block width/height
473 kidReflowState.ComputeContainingBlockRectangle(aPresContext,
474 &aReflowState,
475 aContainingBlockWidth,
476 aContainingBlockHeight);
479 if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) {
480 NS_ASSERTION(NS_AUTOOFFSET != kidReflowState.mComputedOffsets.right,
481 "Can't solve for both left and right");
482 kidReflowState.mComputedOffsets.left = aContainingBlockWidth -
483 kidReflowState.mComputedOffsets.right -
484 kidReflowState.mComputedMargin.right -
485 kidDesiredSize.width -
486 kidReflowState.mComputedMargin.left;
488 if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) {
489 kidReflowState.mComputedOffsets.top = aContainingBlockHeight -
490 kidReflowState.mComputedOffsets.bottom -
491 kidReflowState.mComputedMargin.bottom -
492 kidDesiredSize.height -
493 kidReflowState.mComputedMargin.top;
497 // Position the child relative to our padding edge
498 nsRect rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left,
499 border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top,
500 kidDesiredSize.width, kidDesiredSize.height);
501 aKidFrame->SetRect(rect);
503 nsIView* view = aKidFrame->GetView();
504 if (view) {
505 // Size and position the view and set its opacity, visibility, content
506 // transparency, and clip
507 nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame,
508 view,
509 &kidDesiredSize.mOverflowArea);
510 } else {
511 nsContainerFrame::PositionChildViews(aKidFrame);
514 if (oldRect.TopLeft() != rect.TopLeft() ||
515 (aDelegatingFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) ||
516 (kidDesiredSize.mOverflowArea + rect.TopLeft() != oldOverflowRect &&
517 (kidDesiredSize.mOverflowArea + rect.TopLeft() != rect || oldRect != oldOverflowRect))) {
518 // The frame moved; we have to invalidate the whole frame
519 // because the children may have moved after they were reflowed
520 // We also have to invalidate when we have overflow and the overflow
521 // changes because the change might be caused by clipping
522 // XXX This could be optimized in some cases, especially clipping changes
523 aKidFrame->GetParent()->Invalidate(oldOverflowRect);
524 aKidFrame->GetParent()->Invalidate(kidDesiredSize.mOverflowArea +
525 rect.TopLeft());
526 } else if (oldRect.Size() != rect.Size()) {
527 // Invalidate the area where the frame changed size.
528 nscoord innerWidth = NS_MIN(oldRect.width, rect.width);
529 nscoord innerHeight = NS_MIN(oldRect.height, rect.height);
530 nscoord outerWidth = NS_MAX(oldRect.width, rect.width);
531 nscoord outerHeight = NS_MAX(oldRect.height, rect.height);
532 aKidFrame->GetParent()->Invalidate(
533 nsRect(rect.x + innerWidth, rect.y, outerWidth - innerWidth, outerHeight));
534 // Invalidate the horizontal strip
535 aKidFrame->GetParent()->Invalidate(
536 nsRect(rect.x, rect.y + innerHeight, outerWidth, outerHeight - innerHeight));
538 aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
540 #ifdef DEBUG
541 if (nsBlockFrame::gNoisyReflow) {
542 nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent - 1);
543 printf("abs pos ");
544 if (aKidFrame) {
545 nsAutoString name;
546 aKidFrame->GetFrameName(name);
547 printf("%s ", NS_LossyConvertUTF16toASCII(name).get());
549 printf("%p rect=%d,%d,%d,%d\n", static_cast<void*>(aKidFrame),
550 rect.x, rect.y, rect.width, rect.height);
552 #endif
554 if (aChildBounds)
555 aChildBounds->UnionRect(*aChildBounds, kidDesiredSize.mOverflowArea +
556 rect.TopLeft());
558 return rv;
561 #ifdef DEBUG
562 void nsAbsoluteContainingBlock::PrettyUC(nscoord aSize,
563 char* aBuf)
565 if (NS_UNCONSTRAINEDSIZE == aSize) {
566 strcpy(aBuf, "UC");
568 else {
569 if((PRInt32)0xdeadbeef == aSize)
571 strcpy(aBuf, "deadbeef");
573 else {
574 sprintf(aBuf, "%d", aSize);
578 #endif