зеркало из https://github.com/mozilla/gecko-dev.git
Backing out changes for bug 326944.
This commit is contained in:
Родитель
e1862a3c80
Коммит
bde356f1f5
|
@ -3124,24 +3124,6 @@ nsBlockFrame::IsSelfEmpty()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsBlockFrame::CachedIsEmpty()
|
||||
{
|
||||
if (!IsSelfEmpty()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
for (line_iterator line = begin_lines(), line_end = end_lines();
|
||||
line != line_end;
|
||||
++line)
|
||||
{
|
||||
if (!line->CachedIsEmpty())
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsBlockFrame::IsEmpty()
|
||||
{
|
||||
|
@ -3178,11 +3160,7 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
|
|||
}
|
||||
|
||||
// Determine if this line is "essentially" the first line
|
||||
line_iterator line = begin_lines();
|
||||
if (aState.GetFlag(BRS_HAVELINEADJACENTTOTOP)) {
|
||||
line = aState.mLineAdjacentToTop;
|
||||
}
|
||||
while (line != aLine) {
|
||||
for (line_iterator line = begin_lines(); line != aLine; ++line) {
|
||||
if (!line->CachedIsEmpty() || line->HasClearance()) {
|
||||
// A line which precedes aLine is non-empty, or has clearance,
|
||||
// so therefore the top margin applies.
|
||||
|
@ -3191,9 +3169,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
|
|||
}
|
||||
// No need to apply the top margin if the line has floats. We
|
||||
// should collapse anyway (bug 44419)
|
||||
++line;
|
||||
aState.SetFlag(BRS_HAVELINEADJACENTTOTOP, PR_TRUE);
|
||||
aState.mLineAdjacentToTop = line;
|
||||
}
|
||||
|
||||
// The line being reflowed is "essentially" the first line in the
|
||||
|
|
|
@ -203,7 +203,6 @@ public:
|
|||
virtual PRBool IsVisibleInSelection(nsISelection* aSelection);
|
||||
|
||||
virtual PRBool IsEmpty();
|
||||
virtual PRBool CachedIsEmpty();
|
||||
virtual PRBool IsSelfEmpty();
|
||||
|
||||
// nsIHTMLReflow
|
||||
|
|
|
@ -90,8 +90,7 @@ static nsIFrame* DescendIntoBlockLevelFrame(nsIFrame* aFrame)
|
|||
|
||||
PRBool
|
||||
nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
||||
nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame,
|
||||
PRBool* aMayNeedRetry, PRBool* aBlockIsEmpty)
|
||||
nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame, PRBool* aMayNeedRetry)
|
||||
{
|
||||
// Include frame's top margin
|
||||
aMargin->Include(aRS.mComputedMargin.top);
|
||||
|
@ -106,7 +105,6 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
|||
#endif
|
||||
|
||||
PRBool dirtiedLine = PR_FALSE;
|
||||
PRBool setBlockIsEmpty = PR_FALSE;
|
||||
|
||||
// Calculate the frame's generational top-margin from its child
|
||||
// blocks. Note that if the frame has a non-zero top-border or
|
||||
|
@ -153,10 +151,8 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
|||
dirtiedLine = PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool isEmpty;
|
||||
if (line->IsInline()) {
|
||||
isEmpty = line->IsEmpty();
|
||||
} else {
|
||||
PRBool isEmpty = line->IsEmpty();
|
||||
if (line->IsBlock()) {
|
||||
nsIFrame* kid = line->mFirstChild;
|
||||
if (kid == aClearanceFrame) {
|
||||
line->SetHasClearance();
|
||||
|
@ -198,7 +194,7 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
|||
if (kid->GetStyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE) {
|
||||
*aMayNeedRetry = PR_TRUE;
|
||||
}
|
||||
if (ComputeCollapsedTopMargin(innerReflowState, aMargin, aClearanceFrame, aMayNeedRetry, &isEmpty)) {
|
||||
if (ComputeCollapsedTopMargin(innerReflowState, aMargin, aClearanceFrame, aMayNeedRetry)) {
|
||||
line->MarkDirty();
|
||||
dirtiedLine = PR_TRUE;
|
||||
}
|
||||
|
@ -209,30 +205,14 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
|||
delete NS_CONST_CAST(nsHTMLReflowState*, outerReflowState);
|
||||
}
|
||||
}
|
||||
if (!isEmpty) {
|
||||
if (!setBlockIsEmpty && aBlockIsEmpty) {
|
||||
setBlockIsEmpty = PR_TRUE;
|
||||
*aBlockIsEmpty = PR_FALSE;
|
||||
}
|
||||
if (!isEmpty)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (!setBlockIsEmpty && aBlockIsEmpty) {
|
||||
// The first time we reach here is when this is the first block
|
||||
// and we have processed all its normal lines.
|
||||
setBlockIsEmpty = PR_TRUE;
|
||||
// All lines are empty, or we wouldn't be here!
|
||||
*aBlockIsEmpty = aRS.frame->IsSelfEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
;
|
||||
}
|
||||
|
||||
if (!setBlockIsEmpty && aBlockIsEmpty) {
|
||||
*aBlockIsEmpty = aRS.frame->IsEmpty();
|
||||
}
|
||||
|
||||
#ifdef NOISY_VERTICAL_MARGINS
|
||||
nsFrame::ListTag(stdout, aRS.frame);
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
*/
|
||||
static PRBool ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
|
||||
nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame,
|
||||
PRBool* aMayNeedRetry, PRBool* aIsEmpty = nsnull);
|
||||
PRBool* aMayNeedRetry);
|
||||
|
||||
protected:
|
||||
nsPresContext* mPresContext;
|
||||
|
|
|
@ -58,9 +58,7 @@ class nsBlockFrame;
|
|||
#define BRS_COMPUTEMAXELEMENTWIDTH 0x00000100
|
||||
#define BRS_COMPUTEMAXWIDTH 0x00000200
|
||||
#define BRS_ISFIRSTINFLOW 0x00000400
|
||||
// Set when mLineAdjacentToTop is valid
|
||||
#define BRS_HAVELINEADJACENTTOTOP 0x00000800
|
||||
#define BRS_LASTFLAG BRS_HAVELINEADJACENTTOTOP
|
||||
#define BRS_LASTFLAG BRS_ISFIRSTINFLOW
|
||||
|
||||
class nsBlockReflowState {
|
||||
public:
|
||||
|
@ -200,12 +198,6 @@ public:
|
|||
// If it is mBlock->end_lines(), then it is invalid.
|
||||
nsLineList::iterator mCurrentLine;
|
||||
|
||||
// When BRS_HAVELINEADJACENTTOTOP is set, this refers to a line
|
||||
// which we know is adjacent to the top of the block (in other words,
|
||||
// all lines before it are empty and do not have clearance. This line is
|
||||
// always before the current line.
|
||||
nsLineList::iterator mLineAdjacentToTop;
|
||||
|
||||
// The current Y coordinate in the block
|
||||
nscoord mY;
|
||||
|
||||
|
|
|
@ -3545,14 +3545,6 @@ nsFrame::IsEmpty()
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsIFrame::CachedIsEmpty()
|
||||
{
|
||||
NS_PRECONDITION(!(GetStateBits() & NS_FRAME_IS_DIRTY),
|
||||
"Must only be called on reflowed lines");
|
||||
return IsEmpty();
|
||||
}
|
||||
|
||||
/* virtual */ PRBool
|
||||
nsFrame::IsSelfEmpty()
|
||||
{
|
||||
|
|
|
@ -1402,11 +1402,7 @@ public:
|
|||
* should return true.
|
||||
*/
|
||||
virtual PRBool IsEmpty() = 0;
|
||||
/**
|
||||
* Return the same as IsEmpty(). This may only be called after the frame
|
||||
* has been reflowed and before any further style or content changes.
|
||||
*/
|
||||
virtual PRBool CachedIsEmpty();
|
||||
|
||||
/**
|
||||
* Determine whether the frame is logically empty, assuming that all
|
||||
* its children are empty.
|
||||
|
|
|
@ -307,24 +307,7 @@ nsLineBox::CachedIsEmpty()
|
|||
return mFlags.mEmptyCacheState;
|
||||
}
|
||||
|
||||
PRBool result;
|
||||
if (IsBlock()) {
|
||||
result = mFirstChild->CachedIsEmpty();
|
||||
} else {
|
||||
PRInt32 n;
|
||||
nsIFrame *kid;
|
||||
result = PR_TRUE;
|
||||
for (n = GetChildCount(), kid = mFirstChild;
|
||||
n > 0;
|
||||
--n, kid = kid->GetNextSibling())
|
||||
{
|
||||
if (!kid->CachedIsEmpty()) {
|
||||
result = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool result = IsEmpty();
|
||||
mFlags.mEmptyCacheValid = PR_TRUE;
|
||||
mFlags.mEmptyCacheState = result;
|
||||
return result;
|
||||
|
|
Загрузка…
Ссылка в новой задаче