Bug 381130. Small changes to layout to fix an inline reflow bug and add a new API to nsLineLayout to support tab stops. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2007-05-20 20:44:26 -07:00
Родитель 6b030703f3
Коммит 09bccacf57
6 изменённых файлов: 45 добавлений и 2 удалений

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

@ -1446,6 +1446,7 @@ GK_ATOM(overflowOutOfFlowsProperty, "OverflowOutOfFlowsProperty") // nsFram
GK_ATOM(overflowPlaceholdersProperty, "OverflowPlaceholdersProperty") // nsFrameList* GK_ATOM(overflowPlaceholdersProperty, "OverflowPlaceholdersProperty") // nsFrameList*
GK_ATOM(rowUnpaginatedHeightProperty, "RowUnpaginatedHeightProperty") // nscoord* GK_ATOM(rowUnpaginatedHeightProperty, "RowUnpaginatedHeightProperty") // nscoord*
GK_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block GK_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block
GK_ATOM(tabWidthProperty, "TabWidthProperty") // nsTArray<TabSetting>* array of tab widths
GK_ATOM(tableBCProperty, "TableBCProperty") // table border collapsing info (e.g. damage area, table border widths) GK_ATOM(tableBCProperty, "TableBCProperty") // table border collapsing info (e.g. damage area, table border widths)
GK_ATOM(usedMarginProperty, "UsedMarginProperty") // nsMargin* GK_ATOM(usedMarginProperty, "UsedMarginProperty") // nsMargin*
GK_ATOM(usedPaddingProperty, "UsedPaddingProperty") // nsMargin* GK_ATOM(usedPaddingProperty, "UsedPaddingProperty") // nsMargin*

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

@ -1038,7 +1038,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// See if we can place the frame. If we can't fit it, then we // See if we can place the frame. If we can't fit it, then we
// return now. // return now.
if (CanPlaceFrame(pfd, reflowState, notSafeToBreak, continuingTextRun, if (CanPlaceFrame(pfd, reflowState, notSafeToBreak, continuingTextRun,
metrics, aReflowStatus)) { savedOptionalBreakContent != nsnull, metrics,
aReflowStatus)) {
// Place the frame, updating aBounds with the final size and // Place the frame, updating aBounds with the final size and
// location. Then apply the bottom+right margins (as // location. Then apply the bottom+right margins (as
// appropriate) to the frame. // appropriate) to the frame.
@ -1141,6 +1142,17 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
} }
} }
nscoord
nsLineLayout::GetCurrentFrameXDistanceFromBlock()
{
PerSpanData* psd;
nscoord x = 0;
for (psd = mCurrentSpan; psd; psd = psd->mParent) {
x += psd->mX;
}
return x;
}
/** /**
* See if the frame can be placed now that we know it's desired size. * See if the frame can be placed now that we know it's desired size.
* We can always place the frame if the line is empty. Note that we * We can always place the frame if the line is empty. Note that we
@ -1156,6 +1168,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
PRBool aNotSafeToBreak, PRBool aNotSafeToBreak,
PRBool aFrameCanContinueTextRun, PRBool aFrameCanContinueTextRun,
PRBool aCanRollBackBeforeFrame,
nsHTMLReflowMetrics& aMetrics, nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
@ -1288,7 +1301,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
#ifdef NOISY_CAN_PLACE_FRAME #ifdef NOISY_CAN_PLACE_FRAME
printf(" ==> placing overflowing textrun, requesting backup\n"); printf(" ==> placing overflowing textrun, requesting backup\n");
#endif #endif
if (!mLastOptionalBreakContent) { if (!aCanRollBackBeforeFrame) {
// Nowhere to roll back to, so make this fit // Nowhere to roll back to, so make this fit
return PR_TRUE; return PR_TRUE;
} }

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

@ -407,6 +407,13 @@ public:
const nsLineList::iterator* GetLine() const { const nsLineList::iterator* GetLine() const {
return GetFlag(LL_GOTLINEBOX) ? &mLineBox : nsnull; return GetFlag(LL_GOTLINEBOX) ? &mLineBox : nsnull;
} }
/**
* Return the horizontal offset of the current reflowed-frame from the
* edge of the line container. This is always positive, measured from
* the right edge for RTL blocks and from the left edge for LTR blocks.
*/
nscoord GetCurrentFrameXDistanceFromBlock();
protected: protected:
// This state is constant for a given block frame doing line layout // This state is constant for a given block frame doing line layout
@ -601,6 +608,7 @@ protected:
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
PRBool aNotSafeToBreak, PRBool aNotSafeToBreak,
PRBool aFrameCanContinueTextRun, PRBool aFrameCanContinueTextRun,
PRBool aCanRollBackBeforeFrame,
nsHTMLReflowMetrics& aMetrics, nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus); nsReflowStatus& aStatus);

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

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Bug 381130</title>
</head>
<body>
<div><span>Trythis</span>whynot?
</div>
</body>
</html>

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

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Bug 381130</title>
</head>
<body>
<div style="width:1px;"><span>Trythis</span>whynot?
</div>
</body>
</html>

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

@ -238,3 +238,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug
== 380004-1.html 380004-1-ref.html == 380004-1.html 380004-1-ref.html
== 380227-1.html 380227-1-ref.html == 380227-1.html 380227-1-ref.html
== 380842-1.html 380842-1-ref.html == 380842-1.html 380842-1-ref.html
== 381130-1.html 381130-1-ref.html