Bug 416752. Use the scrollbar min-height/min-width to establish the minimum scrollport size, not the pref-height/pref-width. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2008-02-24 17:21:08 -08:00
parent 1359e3a201
commit ac43fde6ea
4 changed files with 37 additions and 4 deletions

View File

@ -354,7 +354,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
aAssumeVScroll ? &vScrollbarPrefSize : nsnull, PR_TRUE);
}
nscoord vScrollbarDesiredWidth = aAssumeVScroll ? vScrollbarPrefSize.width : 0;
nscoord vScrollbarDesiredHeight = aAssumeVScroll ? vScrollbarPrefSize.height : 0;
nscoord vScrollbarMinHeight = aAssumeVScroll ? vScrollbarMinSize.height : 0;
nsSize hScrollbarMinSize(0, 0);
nsSize hScrollbarPrefSize(0, 0);
@ -364,15 +364,15 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
aAssumeHScroll ? &hScrollbarPrefSize : nsnull, PR_FALSE);
}
nscoord hScrollbarDesiredHeight = aAssumeHScroll ? hScrollbarPrefSize.height : 0;
nscoord hScrollbarDesiredWidth = aAssumeHScroll ? hScrollbarPrefSize.width : 0;
nscoord hScrollbarMinWidth = aAssumeHScroll ? hScrollbarMinSize.width : 0;
// First, compute our inside-border size and scrollport size
// XXXldb Can we depend more on ComputeSize here?
nsSize desiredInsideBorderSize;
desiredInsideBorderSize.width = vScrollbarDesiredWidth +
PR_MAX(aKidMetrics->width, hScrollbarDesiredWidth);
PR_MAX(aKidMetrics->width, hScrollbarMinWidth);
desiredInsideBorderSize.height = hScrollbarDesiredHeight +
PR_MAX(aKidMetrics->height, vScrollbarDesiredHeight);
PR_MAX(aKidMetrics->height, vScrollbarMinHeight);
aState->mInsideBorderSize =
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
nsSize scrollPortSize = nsSize(PR_MAX(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML>
<html>
<head><style>
div.post {
overflow: auto;
height: 15px;
border: 1px solid black;
}
div.filler {
height: 16px;
background: yellow;
}
</style></head>
<body><div class="post"><div class="filler"></div></div></body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html>
<head><style>
div.post {
overflow: auto;
border: 1px solid black;
}
div.filler {
height: 15px;
background: yellow;
}
div.d2 {
height: 16px;
}
</style></head>
<body><div class="post"><div class="filler"><div class="d2"></div></div></div></body>
</html>

View File

@ -732,5 +732,6 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 414123.xhtml 414123-ref.xhtml
== 414851-1.html 414851-1-ref.html
== 416106-1.xhtml 416106-1-ref.xhtml
== 416752-1.html 416752-1-ref.html
== 417676.html 417676-ref.html
== 419060.html 419060-ref.html