bug 124637 - when figuring available width for HRs subtract out both margins. a=asa, sr=attinasi, r=alexsavulov.

git-svn-id: svn://10.0.0.236/trunk@116999 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
karnaze%netscape.com
2002-03-20 22:14:27 +00:00
parent f99650da6a
commit 4cedce858a
4 changed files with 42 additions and 14 deletions

View File

@@ -1794,12 +1794,13 @@ mRect.height);
fprintf(out, " [content=%p]", mContent);
// output the img src url
nsCOMPtr<nsIURI> uri;
mLoads[0].mRequest->GetURI(getter_AddRefs(uri));
nsCAutoString uristr;
uri->GetAsciiSpec(uristr);
fprintf(out, " [src=%s]", uristr.get());
if (mLoads[0].mRequest) {
nsCOMPtr<nsIURI> uri;
mLoads[0].mRequest->GetURI(getter_AddRefs(uri));
nsCAutoString uristr;
uri->GetAsciiSpec(uristr);
fprintf(out, " [src=%s]", uristr.get());
}
fputs("\n", out);
return NS_OK;
}

View File

@@ -1420,6 +1420,19 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
// XXXwaterson probably not the right way to get this; e.g., embeddings, etc.
PRBool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection);
PRBool reducedBothMargins = PR_FALSE;
// An HR needs to reduce the avail width by both margins, because it effectively fits
// on one line. If it gets continued then only the continuation has any width. XXX - Are
// there other elements with these characterstics and if so, is there a bit indicating that?
if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) {
nsCOMPtr<nsIAtom> frameType;
pfd->mFrame->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::hrFrame == frameType.get()) {
aReflowState.availableWidth -= pfd->mMargin.left + pfd->mMargin.right;
reducedBothMargins = PR_TRUE;
}
}
// Only apply start-margin on the first-in flow for inline frames
nsIFrame *prevInFlow;
pfd->mFrame->GetPrevInFlow(&prevInFlow);
@@ -1432,7 +1445,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
pfd->mMargin.right = 0;
}
if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) {
if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) && !reducedBothMargins){
// Adjust available width to account for the left margin. The
// right margin will be accounted for when we finish flowing the
// frame.

View File

@@ -1794,12 +1794,13 @@ mRect.height);
fprintf(out, " [content=%p]", mContent);
// output the img src url
nsCOMPtr<nsIURI> uri;
mLoads[0].mRequest->GetURI(getter_AddRefs(uri));
nsCAutoString uristr;
uri->GetAsciiSpec(uristr);
fprintf(out, " [src=%s]", uristr.get());
if (mLoads[0].mRequest) {
nsCOMPtr<nsIURI> uri;
mLoads[0].mRequest->GetURI(getter_AddRefs(uri));
nsCAutoString uristr;
uri->GetAsciiSpec(uristr);
fprintf(out, " [src=%s]", uristr.get());
}
fputs("\n", out);
return NS_OK;
}

View File

@@ -1420,6 +1420,19 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
// XXXwaterson probably not the right way to get this; e.g., embeddings, etc.
PRBool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection);
PRBool reducedBothMargins = PR_FALSE;
// An HR needs to reduce the avail width by both margins, because it effectively fits
// on one line. If it gets continued then only the continuation has any width. XXX - Are
// there other elements with these characterstics and if so, is there a bit indicating that?
if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) {
nsCOMPtr<nsIAtom> frameType;
pfd->mFrame->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::hrFrame == frameType.get()) {
aReflowState.availableWidth -= pfd->mMargin.left + pfd->mMargin.right;
reducedBothMargins = PR_TRUE;
}
}
// Only apply start-margin on the first-in flow for inline frames
nsIFrame *prevInFlow;
pfd->mFrame->GetPrevInFlow(&prevInFlow);
@@ -1432,7 +1445,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
pfd->mMargin.right = 0;
}
if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) {
if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) && !reducedBothMargins){
// Adjust available width to account for the left margin. The
// right margin will be accounted for when we finish flowing the
// frame.