зеркало из https://github.com/mozilla/pjs.git
Relanding bug 412679. r+sr=dbaron
This commit is contained in:
Родитель
46a02b1e65
Коммит
d5b1efb012
|
@ -304,7 +304,7 @@ public:
|
|||
* override ComputeSize to enforce their width/height invariants.
|
||||
*
|
||||
* Implementations may optimize by returning a garbage width if
|
||||
* GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto, and
|
||||
* GetStylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
|
||||
* likewise for height, since in such cases the result is guaranteed
|
||||
* to be unused.
|
||||
*/
|
||||
|
|
|
@ -67,6 +67,15 @@ nsLeafFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* virtual */ nsSize
|
||||
nsLeafFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap)
|
||||
{
|
||||
return nsSize(GetIntrinsicWidth(), GetIntrinsicHeight());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
|
@ -80,12 +89,6 @@ nsLeafFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
|
||||
|
||||
// XXX add in code to check for width/height being set via css
|
||||
// and if set use them instead of calling GetDesiredSize.
|
||||
|
||||
NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
|
||||
"Shouldn't have unconstrained stuff here");
|
||||
|
||||
DoReflow(aPresContext, aMetrics, aReflowState, aStatus);
|
||||
|
||||
FinishAndStoreOverflow(&aMetrics);
|
||||
|
@ -98,16 +101,15 @@ nsLeafFrame::DoReflow(nsPresContext* aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
|
||||
"Shouldn't have unconstrained stuff here "
|
||||
"Thanks to the rules of reflow");
|
||||
NS_ASSERTION(NS_INTRINSICSIZE != aReflowState.ComputedHeight(),
|
||||
"Shouldn't have unconstrained stuff here "
|
||||
"thanks to ComputeAutoSize");
|
||||
|
||||
aMetrics.width = aReflowState.ComputedWidth();
|
||||
if (NS_INTRINSICSIZE != aReflowState.ComputedHeight()) {
|
||||
aMetrics.height = aReflowState.ComputedHeight();
|
||||
} else {
|
||||
aMetrics.height = GetIntrinsicHeight();
|
||||
// XXXbz using NS_CSS_MINMAX like this presupposes content-box sizing.
|
||||
aMetrics.height = NS_CSS_MINMAX(aMetrics.height,
|
||||
aReflowState.mComputedMinHeight,
|
||||
aReflowState.mComputedMaxHeight);
|
||||
}
|
||||
aMetrics.height = aReflowState.ComputedHeight();
|
||||
|
||||
AddBordersAndPadding(aReflowState, aMetrics);
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
@ -126,7 +128,7 @@ nsLeafFrame::DoReflow(nsPresContext* aPresContext,
|
|||
nscoord
|
||||
nsLeafFrame::GetIntrinsicHeight()
|
||||
{
|
||||
NS_NOTREACHED("Someone didn't override Reflow");
|
||||
NS_NOTREACHED("Someone didn't override Reflow or ComputeAutoSize");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,14 @@ public:
|
|||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
||||
/**
|
||||
* Our auto size is just intrinsic width and intrinsic height.
|
||||
*/
|
||||
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
/**
|
||||
* Reflow our frame. This will use the computed width plus borderpadding for
|
||||
* the desired width, and use the return value of GetIntrinsicHeight plus
|
||||
|
@ -106,9 +114,10 @@ protected:
|
|||
|
||||
/**
|
||||
* Return the intrinsic height of the frame's content area. This should not
|
||||
* include border or padding. This will only be called if there is no
|
||||
* computed height. Note that subclasses must either implement this or
|
||||
* override Reflow; the default Reflow impl calls this method.
|
||||
* include border or padding. This will only matter if the specified height
|
||||
* is auto. Note that subclasses must either implement this or override
|
||||
* Reflow and ComputeAutoSize; the default Reflow and ComputeAutoSize impls
|
||||
* call this method.
|
||||
*/
|
||||
virtual nscoord GetIntrinsicHeight();
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<style>
|
||||
#red {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#green {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
width: 80px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
#blue {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
left: 10px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#yellow {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
right: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe id=red></iframe>
|
||||
<iframe id=green></iframe>
|
||||
<iframe id=blue></iframe>
|
||||
<iframe id=yellow></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<style>
|
||||
#red {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
right: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#green {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
width: 80px;
|
||||
right: 10px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#blue {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
left: 10px;
|
||||
height: 80px;
|
||||
right: 100px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#yellow {
|
||||
position: fixed;
|
||||
background-color: blue;
|
||||
right: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe id=red></iframe>
|
||||
<iframe id=green></iframe>
|
||||
<iframe id=blue></iframe>
|
||||
<iframe id=yellow></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<style>
|
||||
#red {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#green {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
width: 80px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
#blue {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
left: 10px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#yellow {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
right: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe id=red></iframe>
|
||||
<iframe id=green></iframe>
|
||||
<iframe id=blue></iframe>
|
||||
<iframe id=yellow></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<style>
|
||||
#red {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
right: 100px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#green {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
top: 10px;
|
||||
width: 80px;
|
||||
right: 10px;
|
||||
bottom: 100px;
|
||||
}
|
||||
|
||||
#blue {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
left: 10px;
|
||||
height: 80px;
|
||||
right: 100px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#yellow {
|
||||
position: absolute;
|
||||
background-color: blue;
|
||||
right: 10px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe id=red></iframe>
|
||||
<iframe id=green></iframe>
|
||||
<iframe id=blue></iframe>
|
||||
<iframe id=yellow></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -662,6 +662,8 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
|
|||
!= 409659-1b.html 409659-1-ref.html
|
||||
!= 409659-1c.html 409659-1-ref.html
|
||||
== 409659-1d.html 409659-1-ref.html
|
||||
== 412679-1.html 412679-1-ref.html
|
||||
== 412679-2.html 412679-2-ref.html
|
||||
== 411334-1.xml 411334-1-ref.xml
|
||||
== 411792-1.html 411792-1-ref.html
|
||||
== 413292-1.html 413292-1-ref.html
|
||||
|
|
|
@ -229,6 +229,17 @@ nsLeafBoxFrame::GetIntrinsicWidth()
|
|||
return 0;
|
||||
}
|
||||
|
||||
nsSize
|
||||
nsLeafBoxFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap)
|
||||
{
|
||||
// Important: NOT calling our direct superclass here!
|
||||
return nsFrame::ComputeAutoSize(aRenderingContext, aCBSize, aAvailableWidth,
|
||||
aMargin, aBorder, aPadding, aShrinkWrap);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -77,6 +77,12 @@ public:
|
|||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
||||
// Our auto size is that provided by nsFrame, not nsLeafFrame
|
||||
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
nsSize aCBSize, nscoord aAvailableWidth,
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
|
|
Загрузка…
Ссылка в новой задаче