Bug 77414. Break nsBlockReflowState out into its own files. sr=attinasi

This commit is contained in:
waterson%netscape.com 2001-05-01 04:22:57 +00:00
Родитель bd07e601ce
Коммит 781b8bd98d
15 изменённых файлов: 433 добавлений и 2952 удалений

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

@ -0,0 +1,44 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsBlockDebugFlags_h__
#define nsBlockDebugFlags_h__
#undef NOISY_FIRST_LINE // enables debug output for first-line specific layout
#undef REALLY_NOISY_FIRST_LINE // enables extra debug output for first-line specific layout
#undef NOISY_FIRST_LETTER // enables debug output for first-letter specific layout
#undef NOISY_MAX_ELEMENT_SIZE // enables debug output for max element size computation
#undef NOISY_MAXIMUM_WIDTH // enables debug output for max width computation
#undef NOISY_KIDXMOST // enables debug output for aState.mKidXMost computation
#undef NOISY_FLOATER // enables debug output for floater reflow (the in/out metrics for the floated block)
#undef NOISY_FLOATER_CLEARING
#undef NOISY_FINAL_SIZE // enables debug output for desired width/height computation, once all children have been reflowed
#undef NOISY_REMOVE_FRAME
#undef NOISY_COMBINED_AREA // enables debug output for combined area computation
#undef NOISY_VERTICAL_MARGINS
#undef NOISY_REFLOW_REASON // gives a little info about why each reflow was requested
#undef REFLOW_STATUS_COVERAGE // I think this is most useful for printing, to see which frames return "incomplete"
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floaters and positioned elements
#undef NOISY_BLOCK_INVALIDATE // enables debug output for all calls to invalidate
#undef REALLY_NOISY_REFLOW // some extra debug info
#endif // nsBlockDebugFlags_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -165,6 +165,8 @@ public:
// to support 'vertical-align: baseline' in table-cells
nscoord GetAscent() const;
static void CombineRects(const nsRect& r1, nsRect& r2);
protected:
nsBlockFrame();
virtual ~nsBlockFrame();
@ -452,7 +454,30 @@ protected:
private:
nsAbsoluteContainingBlock mAbsoluteContainer;
#ifdef DEBUG
public:
static PRBool gLamePaintMetrics;
static PRBool gLameReflowMetrics;
static PRBool gNoisy;
static PRBool gNoisyDamageRepair;
static PRBool gNoisyMaxElementSize;
static PRBool gNoisyReflow;
static PRBool gReallyNoisyReflow;
static PRBool gNoisySpaceManager;
static PRBool gVerifyLines;
static PRBool gDisableResizeOpt;
static PRInt32 gNoiseIndent;
protected:
static void InitDebugFlags();
#endif
};
// Some #ifdef'd bug fixes
#define FIX_BUG_38157
#define FIX_BUG_37657
#endif /* nsBlockFrame_h___ */

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

@ -23,7 +23,17 @@
* L. David Baron <dbaron@fas.harvard.edu>
*/
//----------------------------------------------------------------------
#include "nsBlockReflowContext.h"
#include "nsBlockReflowState.h"
#include "nsBlockFrame.h"
#include "nsLineLayout.h"
#include "nsIPresContext.h"
#include "nsLayoutAtoms.h"
#include "nsIFrame.h"
#ifdef DEBUG
#include "nsBlockDebugFlags.h"
#endif
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
nsIPresContext* aPresContext,
@ -315,6 +325,30 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
#endif
}
void
nsBlockReflowState::GetAvailableSpace(nscoord aY)
{
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wx, wy;
mSpaceManager->GetTranslation(wx, wy);
NS_ASSERTION((wx == mSpaceManagerX) && (wy == mSpaceManagerY),
"bad coord system");
#endif
mBand.GetAvailableSpace(aY - BorderPadding().top, mAvailSpaceRect);
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n",
mAvailSpaceRect.x, mAvailSpaceRect.y,
mAvailSpaceRect.width, mAvailSpaceRect.height,
mBand.GetTrapezoidCount());
}
#endif
}
PRBool
nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
{
@ -558,10 +592,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
floater->GetRect(r);
floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY);
#ifdef DEBUG
if (gNoisyReflow || gNoisySpaceManager) {
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
nscoord tx, ty;
mSpaceManager->GetTranslation(tx, ty);
nsFrame::IndentBy(stdout, gNoiseIndent);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverState: txy=%d,%d (%d,%d) ",
tx, ty, mSpaceManagerX, mSpaceManagerY);
nsFrame::ListTag(stdout, floater);
@ -575,7 +609,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
fc = fc->Next();
}
#ifdef DEBUG
if (gNoisyReflow || gNoisySpaceManager) {
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
mSpaceManager->List(stdout);
}
#endif
@ -610,6 +644,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
}
}
PRBool
nsBlockReflowState::IsImpactedByFloater() const
{
#ifdef REALLY_NOISY_REFLOW
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
this, mBand.GetFloaterCount());
#endif
return mBand.GetFloaterCount();
}
void
nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholder)
@ -730,6 +775,44 @@ nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFra
return PR_TRUE;
}
void
nsBlockReflowState::UpdateMaxElementSize(const nsSize& aMaxElementSize)
{
#ifdef NOISY_MAX_ELEMENT_SIZE
nsSize oldSize = mMaxElementSize;
#endif
if (aMaxElementSize.width > mMaxElementSize.width) {
mMaxElementSize.width = aMaxElementSize.width;
}
if (aMaxElementSize.height > mMaxElementSize.height) {
mMaxElementSize.height = aMaxElementSize.height;
}
#ifdef NOISY_MAX_ELEMENT_SIZE
if ((mMaxElementSize.width != oldSize.width) ||
(mMaxElementSize.height != oldSize.height)) {
nsFrame::IndentBy(stdout, mBlock->GetDepth());
if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) {
printf("PASS1 ");
}
nsFrame::ListTag(stdout, mBlock);
printf(": old max-element-size=%d,%d new=%d,%d\n",
oldSize.width, oldSize.height,
mMaxElementSize.width, mMaxElementSize.height);
}
#endif
}
void
nsBlockReflowState::UpdateMaximumWidth(nscoord aMaximumWidth)
{
if (aMaximumWidth > mMaximumWidth) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth);
#endif
mMaximumWidth = aMaximumWidth;
}
}
PRBool
nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
PRUint8 aFloats)
@ -992,21 +1075,21 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache,
mHaveRightFloaters = PR_TRUE;
}
else {
CombineRects(combinedArea, mRightFloaterCombinedArea);
nsBlockFrame::CombineRects(combinedArea, mRightFloaterCombinedArea);
}
}
else {
CombineRects(combinedArea, mFloaterCombinedArea);
nsBlockFrame::CombineRects(combinedArea, mFloaterCombinedArea);
}
// Now restore mY
mY = saveY;
#ifdef DEBUG
if (gNoisyReflow) {
if (nsBlockFrame::gNoisyReflow) {
nsRect r;
floater->GetRect(r);
nsFrame::IndentBy(stdout, gNoiseIndent);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placed floater: ");
((nsFrame*)floater)->ListTag(stdout);
printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
@ -1024,8 +1107,8 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
while (fc) {
if (!fc->mIsCurrentLineFloater) {
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placing bcl floater: ");
nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame());
printf("\n");
@ -1046,15 +1129,15 @@ void
nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
{
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("clear floaters: in: mY=%d aY=%d(%d)\n",
mY, aY, aY - BorderPadding().top);
}
#endif
#ifdef NOISY_FLOATER_CLEARING
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn",
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%d\n",
aY, aBreakType);
mSpaceManager->List(stdout);
#endif
@ -1064,9 +1147,10 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
GetAvailableSpace();
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top);
}
#endif
}

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

@ -23,6 +23,12 @@
* L. David Baron <dbaron@fas.harvard.edu>
*/
#ifndef nsBlockReflowState_h__
#define nsBlockReflowState_h__
#include "nsBlockBandData.h"
#include "nsLineBox.h"
class nsBlockReflowState {
public:
nsBlockReflowState(const nsHTMLReflowState& aReflowState,
@ -48,27 +54,7 @@ public:
GetAvailableSpace(mY);
}
void GetAvailableSpace(nscoord aY) {
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wx, wy;
mSpaceManager->GetTranslation(wx, wy);
NS_ASSERTION((wx == mSpaceManagerX) && (wy == mSpaceManagerY),
"bad coord system");
#endif
mBand.GetAvailableSpace(aY - BorderPadding().top, mAvailSpaceRect);
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n",
mAvailSpaceRect.x, mAvailSpaceRect.y,
mAvailSpaceRect.width, mAvailSpaceRect.height,
mBand.GetTrapezoidCount());
}
#endif
}
void GetAvailableSpace(nscoord aY);
void InitFloater(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholderFrame);
@ -102,39 +88,9 @@ public:
return mReflowState.mComputedMargin;
}
void UpdateMaxElementSize(const nsSize& aMaxElementSize) {
#ifdef NOISY_MAX_ELEMENT_SIZE
nsSize oldSize = mMaxElementSize;
#endif
if (aMaxElementSize.width > mMaxElementSize.width) {
mMaxElementSize.width = aMaxElementSize.width;
}
if (aMaxElementSize.height > mMaxElementSize.height) {
mMaxElementSize.height = aMaxElementSize.height;
}
#ifdef NOISY_MAX_ELEMENT_SIZE
if ((mMaxElementSize.width != oldSize.width) ||
(mMaxElementSize.height != oldSize.height)) {
nsFrame::IndentBy(stdout, mBlock->GetDepth());
if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) {
printf("PASS1 ");
}
nsFrame::ListTag(stdout, mBlock);
printf(": old max-element-size=%d,%d new=%d,%d\n",
oldSize.width, oldSize.height,
mMaxElementSize.width, mMaxElementSize.height);
}
#endif
}
void UpdateMaxElementSize(const nsSize& aMaxElementSize);
void UpdateMaximumWidth(nscoord aMaximumWidth) {
if (aMaximumWidth > mMaximumWidth) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth);
#endif
mMaximumWidth = aMaximumWidth;
}
}
void UpdateMaximumWidth(nscoord aMaximumWidth);
void RecoverVerticalMargins(nsLineBox* aLine,
PRBool aApplyTopMargin,
@ -154,13 +110,7 @@ public:
mLineNumber++;
}
PRBool IsImpactedByFloater() {
#ifdef REALLY_NOISY_REFLOW
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
this, mBand.GetFloaterCount());
#endif
return mBand.GetFloaterCount();
}
PRBool IsImpactedByFloater() const;
nsLineBox* NewLineBox(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock);
@ -314,3 +264,5 @@ public:
return PR_FALSE;
}
};
#endif // nsBlockReflowState_h__

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

@ -33,9 +33,9 @@
#include "nsFrame.h"
#include "nsVoidArray.h"
#include "nsLineBox.h"
#include "nsBlockReflowState.h"
class nsISpaceManager;
class nsBlockReflowState;
class nsPlaceholderFrame;
struct nsStyleText;
@ -230,8 +230,13 @@ public:
//----------------------------------------
// Inform the line-layout about the presence of a floating frame
// XXX get rid of this: use get-frame-type?
void InitFloater(nsPlaceholderFrame* aFrame);
void AddFloater(nsPlaceholderFrame* aFrame);
void InitFloater(nsPlaceholderFrame* aFrame) {
mBlockRS->InitFloater(*this, aFrame);
}
void AddFloater(nsPlaceholderFrame* aFrame) {
mBlockRS->AddFloater(*this, aFrame, PR_FALSE);
}
//----------------------------------------

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

@ -38,6 +38,7 @@ CPPSRCS = \
nsBlockBandData.cpp \
nsBlockFrame.cpp \
nsBlockReflowContext.cpp \
nsBlockReflowState.cpp \
nsBulletFrame.cpp \
nsContainerFrame.cpp \
nsDST.cpp \

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

@ -48,6 +48,7 @@ CPPSRCS= \
nsBlockBandData.cpp \
nsBlockFrame.cpp \
nsBlockReflowContext.cpp \
nsBlockReflowState.cpp \
nsBulletFrame.cpp \
nsContainerFrame.cpp \
nsDST.cpp \
@ -93,6 +94,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsBlockBandData.obj \
.\$(OBJDIR)\nsBlockFrame.obj \
.\$(OBJDIR)\nsBlockReflowContext.obj \
.\$(OBJDIR)\nsBlockReflowState.obj \
.\$(OBJDIR)\nsBulletFrame.obj \
.\$(OBJDIR)\nsContainerFrame.obj \
.\$(OBJDIR)\nsDST.obj \

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

@ -0,0 +1,44 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsBlockDebugFlags_h__
#define nsBlockDebugFlags_h__
#undef NOISY_FIRST_LINE // enables debug output for first-line specific layout
#undef REALLY_NOISY_FIRST_LINE // enables extra debug output for first-line specific layout
#undef NOISY_FIRST_LETTER // enables debug output for first-letter specific layout
#undef NOISY_MAX_ELEMENT_SIZE // enables debug output for max element size computation
#undef NOISY_MAXIMUM_WIDTH // enables debug output for max width computation
#undef NOISY_KIDXMOST // enables debug output for aState.mKidXMost computation
#undef NOISY_FLOATER // enables debug output for floater reflow (the in/out metrics for the floated block)
#undef NOISY_FLOATER_CLEARING
#undef NOISY_FINAL_SIZE // enables debug output for desired width/height computation, once all children have been reflowed
#undef NOISY_REMOVE_FRAME
#undef NOISY_COMBINED_AREA // enables debug output for combined area computation
#undef NOISY_VERTICAL_MARGINS
#undef NOISY_REFLOW_REASON // gives a little info about why each reflow was requested
#undef REFLOW_STATUS_COVERAGE // I think this is most useful for printing, to see which frames return "incomplete"
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floaters and positioned elements
#undef NOISY_BLOCK_INVALIDATE // enables debug output for all calls to invalidate
#undef REALLY_NOISY_REFLOW // some extra debug info
#endif // nsBlockDebugFlags_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -165,6 +165,8 @@ public:
// to support 'vertical-align: baseline' in table-cells
nscoord GetAscent() const;
static void CombineRects(const nsRect& r1, nsRect& r2);
protected:
nsBlockFrame();
virtual ~nsBlockFrame();
@ -452,7 +454,30 @@ protected:
private:
nsAbsoluteContainingBlock mAbsoluteContainer;
#ifdef DEBUG
public:
static PRBool gLamePaintMetrics;
static PRBool gLameReflowMetrics;
static PRBool gNoisy;
static PRBool gNoisyDamageRepair;
static PRBool gNoisyMaxElementSize;
static PRBool gNoisyReflow;
static PRBool gReallyNoisyReflow;
static PRBool gNoisySpaceManager;
static PRBool gVerifyLines;
static PRBool gDisableResizeOpt;
static PRInt32 gNoiseIndent;
protected:
static void InitDebugFlags();
#endif
};
// Some #ifdef'd bug fixes
#define FIX_BUG_38157
#define FIX_BUG_37657
#endif /* nsBlockFrame_h___ */

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

@ -23,7 +23,17 @@
* L. David Baron <dbaron@fas.harvard.edu>
*/
//----------------------------------------------------------------------
#include "nsBlockReflowContext.h"
#include "nsBlockReflowState.h"
#include "nsBlockFrame.h"
#include "nsLineLayout.h"
#include "nsIPresContext.h"
#include "nsLayoutAtoms.h"
#include "nsIFrame.h"
#ifdef DEBUG
#include "nsBlockDebugFlags.h"
#endif
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
nsIPresContext* aPresContext,
@ -315,6 +325,30 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
#endif
}
void
nsBlockReflowState::GetAvailableSpace(nscoord aY)
{
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wx, wy;
mSpaceManager->GetTranslation(wx, wy);
NS_ASSERTION((wx == mSpaceManagerX) && (wy == mSpaceManagerY),
"bad coord system");
#endif
mBand.GetAvailableSpace(aY - BorderPadding().top, mAvailSpaceRect);
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n",
mAvailSpaceRect.x, mAvailSpaceRect.y,
mAvailSpaceRect.width, mAvailSpaceRect.height,
mBand.GetTrapezoidCount());
}
#endif
}
PRBool
nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
{
@ -558,10 +592,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
floater->GetRect(r);
floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY);
#ifdef DEBUG
if (gNoisyReflow || gNoisySpaceManager) {
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
nscoord tx, ty;
mSpaceManager->GetTranslation(tx, ty);
nsFrame::IndentBy(stdout, gNoiseIndent);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverState: txy=%d,%d (%d,%d) ",
tx, ty, mSpaceManagerX, mSpaceManagerY);
nsFrame::ListTag(stdout, floater);
@ -575,7 +609,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
fc = fc->Next();
}
#ifdef DEBUG
if (gNoisyReflow || gNoisySpaceManager) {
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
mSpaceManager->List(stdout);
}
#endif
@ -610,6 +644,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
}
}
PRBool
nsBlockReflowState::IsImpactedByFloater() const
{
#ifdef REALLY_NOISY_REFLOW
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
this, mBand.GetFloaterCount());
#endif
return mBand.GetFloaterCount();
}
void
nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholder)
@ -730,6 +775,44 @@ nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFra
return PR_TRUE;
}
void
nsBlockReflowState::UpdateMaxElementSize(const nsSize& aMaxElementSize)
{
#ifdef NOISY_MAX_ELEMENT_SIZE
nsSize oldSize = mMaxElementSize;
#endif
if (aMaxElementSize.width > mMaxElementSize.width) {
mMaxElementSize.width = aMaxElementSize.width;
}
if (aMaxElementSize.height > mMaxElementSize.height) {
mMaxElementSize.height = aMaxElementSize.height;
}
#ifdef NOISY_MAX_ELEMENT_SIZE
if ((mMaxElementSize.width != oldSize.width) ||
(mMaxElementSize.height != oldSize.height)) {
nsFrame::IndentBy(stdout, mBlock->GetDepth());
if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) {
printf("PASS1 ");
}
nsFrame::ListTag(stdout, mBlock);
printf(": old max-element-size=%d,%d new=%d,%d\n",
oldSize.width, oldSize.height,
mMaxElementSize.width, mMaxElementSize.height);
}
#endif
}
void
nsBlockReflowState::UpdateMaximumWidth(nscoord aMaximumWidth)
{
if (aMaximumWidth > mMaximumWidth) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth);
#endif
mMaximumWidth = aMaximumWidth;
}
}
PRBool
nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
PRUint8 aFloats)
@ -992,21 +1075,21 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache,
mHaveRightFloaters = PR_TRUE;
}
else {
CombineRects(combinedArea, mRightFloaterCombinedArea);
nsBlockFrame::CombineRects(combinedArea, mRightFloaterCombinedArea);
}
}
else {
CombineRects(combinedArea, mFloaterCombinedArea);
nsBlockFrame::CombineRects(combinedArea, mFloaterCombinedArea);
}
// Now restore mY
mY = saveY;
#ifdef DEBUG
if (gNoisyReflow) {
if (nsBlockFrame::gNoisyReflow) {
nsRect r;
floater->GetRect(r);
nsFrame::IndentBy(stdout, gNoiseIndent);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placed floater: ");
((nsFrame*)floater)->ListTag(stdout);
printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
@ -1024,8 +1107,8 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
while (fc) {
if (!fc->mIsCurrentLineFloater) {
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placing bcl floater: ");
nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame());
printf("\n");
@ -1046,15 +1129,15 @@ void
nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
{
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("clear floaters: in: mY=%d aY=%d(%d)\n",
mY, aY, aY - BorderPadding().top);
}
#endif
#ifdef NOISY_FLOATER_CLEARING
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn",
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%d\n",
aY, aBreakType);
mSpaceManager->List(stdout);
#endif
@ -1064,9 +1147,10 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
GetAvailableSpace();
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
if (nsBlockFrame::gNoisyReflow) {
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top);
}
#endif
}

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

@ -23,6 +23,12 @@
* L. David Baron <dbaron@fas.harvard.edu>
*/
#ifndef nsBlockReflowState_h__
#define nsBlockReflowState_h__
#include "nsBlockBandData.h"
#include "nsLineBox.h"
class nsBlockReflowState {
public:
nsBlockReflowState(const nsHTMLReflowState& aReflowState,
@ -48,27 +54,7 @@ public:
GetAvailableSpace(mY);
}
void GetAvailableSpace(nscoord aY) {
#ifdef DEBUG
// Verify that the caller setup the coordinate system properly
nscoord wx, wy;
mSpaceManager->GetTranslation(wx, wy);
NS_ASSERTION((wx == mSpaceManagerX) && (wy == mSpaceManagerY),
"bad coord system");
#endif
mBand.GetAvailableSpace(aY - BorderPadding().top, mAvailSpaceRect);
#ifdef DEBUG
if (gNoisyReflow) {
nsFrame::IndentBy(stdout, gNoiseIndent);
printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n",
mAvailSpaceRect.x, mAvailSpaceRect.y,
mAvailSpaceRect.width, mAvailSpaceRect.height,
mBand.GetTrapezoidCount());
}
#endif
}
void GetAvailableSpace(nscoord aY);
void InitFloater(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholderFrame);
@ -102,39 +88,9 @@ public:
return mReflowState.mComputedMargin;
}
void UpdateMaxElementSize(const nsSize& aMaxElementSize) {
#ifdef NOISY_MAX_ELEMENT_SIZE
nsSize oldSize = mMaxElementSize;
#endif
if (aMaxElementSize.width > mMaxElementSize.width) {
mMaxElementSize.width = aMaxElementSize.width;
}
if (aMaxElementSize.height > mMaxElementSize.height) {
mMaxElementSize.height = aMaxElementSize.height;
}
#ifdef NOISY_MAX_ELEMENT_SIZE
if ((mMaxElementSize.width != oldSize.width) ||
(mMaxElementSize.height != oldSize.height)) {
nsFrame::IndentBy(stdout, mBlock->GetDepth());
if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) {
printf("PASS1 ");
}
nsFrame::ListTag(stdout, mBlock);
printf(": old max-element-size=%d,%d new=%d,%d\n",
oldSize.width, oldSize.height,
mMaxElementSize.width, mMaxElementSize.height);
}
#endif
}
void UpdateMaxElementSize(const nsSize& aMaxElementSize);
void UpdateMaximumWidth(nscoord aMaximumWidth) {
if (aMaximumWidth > mMaximumWidth) {
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth);
#endif
mMaximumWidth = aMaximumWidth;
}
}
void UpdateMaximumWidth(nscoord aMaximumWidth);
void RecoverVerticalMargins(nsLineBox* aLine,
PRBool aApplyTopMargin,
@ -154,13 +110,7 @@ public:
mLineNumber++;
}
PRBool IsImpactedByFloater() {
#ifdef REALLY_NOISY_REFLOW
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
this, mBand.GetFloaterCount());
#endif
return mBand.GetFloaterCount();
}
PRBool IsImpactedByFloater() const;
nsLineBox* NewLineBox(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock);
@ -314,3 +264,5 @@ public:
return PR_FALSE;
}
};
#endif // nsBlockReflowState_h__

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

@ -33,9 +33,9 @@
#include "nsFrame.h"
#include "nsVoidArray.h"
#include "nsLineBox.h"
#include "nsBlockReflowState.h"
class nsISpaceManager;
class nsBlockReflowState;
class nsPlaceholderFrame;
struct nsStyleText;
@ -230,8 +230,13 @@ public:
//----------------------------------------
// Inform the line-layout about the presence of a floating frame
// XXX get rid of this: use get-frame-type?
void InitFloater(nsPlaceholderFrame* aFrame);
void AddFloater(nsPlaceholderFrame* aFrame);
void InitFloater(nsPlaceholderFrame* aFrame) {
mBlockRS->InitFloater(*this, aFrame);
}
void AddFloater(nsPlaceholderFrame* aFrame) {
mBlockRS->AddFloater(*this, aFrame, PR_FALSE);
}
//----------------------------------------

Двоичные данные
layout/macbuild/layout.mcp

Двоичный файл не отображается.