зеркало из https://github.com/mozilla/gecko-dev.git
Bug 582037. When computing intrinsic widths, take the viewport's dimensions into account when it has percent-height descendants. r=dbaron
This commit is contained in:
Родитель
256d4fa87a
Коммит
9e848ad2db
|
@ -1743,12 +1743,26 @@ GetPercentHeight(const nsStyleCoord& aStyle,
|
|||
NS_ASSERTION(pos->mHeight.GetUnit() == eStyleUnit_Auto ||
|
||||
pos->mHeight.GetUnit() == eStyleUnit_Percent,
|
||||
"unknown height unit");
|
||||
// There's no basis for the percentage height, so it acts like auto.
|
||||
// Should we consider a max-height < min-height pair a basis for
|
||||
// percentage heights? The spec is somewhat unclear, and not doing
|
||||
// so is simpler and avoids troubling discontinuities in behavior,
|
||||
// so I'll choose not to. -LDB
|
||||
return PR_FALSE;
|
||||
nsIAtom* fType = f->GetType();
|
||||
if (fType != nsGkAtoms::viewportFrame && fType != nsGkAtoms::canvasFrame &&
|
||||
fType != nsGkAtoms::pageContentFrame) {
|
||||
// There's no basis for the percentage height, so it acts like auto.
|
||||
// Should we consider a max-height < min-height pair a basis for
|
||||
// percentage heights? The spec is somewhat unclear, and not doing
|
||||
// so is simpler and avoids troubling discontinuities in behavior,
|
||||
// so I'll choose not to. -LDB
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(pos->mHeight.GetUnit() == eStyleUnit_Auto,
|
||||
"Unexpected height unit for viewport or canvas or page-content");
|
||||
// For the viewport, canvas, and page-content kids, the percentage
|
||||
// basis is just the parent height.
|
||||
h = f->GetSize().height;
|
||||
if (h == NS_UNCONSTRAINEDSIZE) {
|
||||
// We don't have a percentage basis after all
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
nscoord maxh;
|
||||
|
|
|
@ -446,6 +446,11 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// Set our size up front, since some parts of reflow depend on it
|
||||
// being already set. Note that the computed height may be
|
||||
// unconstrained; that's ok. Consumers should watch out for that.
|
||||
SetSize(nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight()));
|
||||
|
||||
// Reflow our one and only normal child frame. It's either the root
|
||||
// element's frame or a placeholder for that frame, if the root element
|
||||
// is abs-pos or fixed-pos. We may have additional children which
|
||||
|
|
|
@ -88,6 +88,11 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Set our size up front, since some parts of reflow depend on it
|
||||
// being already set. Note that the computed height may be
|
||||
// unconstrained; that's ok. Consumers should watch out for that.
|
||||
SetSize(nsSize(aReflowState.availableWidth, aReflowState.availableHeight));
|
||||
|
||||
// A PageContentFrame must always have one child: the canvas frame.
|
||||
// Resize our frame allowing it only to be as big as we are
|
||||
// XXX Pay attention to the page's border and padding...
|
||||
|
|
|
@ -258,6 +258,11 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
|||
// availableHeight.
|
||||
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
|
||||
|
||||
// Set our size up front, since some parts of reflow depend on it
|
||||
// being already set. Note that the computed height may be
|
||||
// unconstrained; that's ok. Consumers should watch out for that.
|
||||
SetSize(nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight()));
|
||||
|
||||
// Reflow the main content first so that the placeholders of the
|
||||
// fixed-position frames will be in the right places on an initial
|
||||
// reflow.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<!DOCTYPE html>
|
||||
<html style="background: green">
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- This test assumes that the document is 800px wide by 1000px high,
|
||||
as documented in the readme. In particular, it assumes that
|
||||
height > width. -->
|
||||
<html style="margin: 0; padding: 0; border: none; overflow: hidden">
|
||||
<body style="margin: 0; padding: 0; border: none">
|
||||
<div style="position: fixed; height: 100%; background: green">
|
||||
<img src="solidblue.png" style="height: 100%; visibility: hidden;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- This test assumes that the document is 800px wide by 1000px high,
|
||||
as documented in the readme. In particular, it assumes that
|
||||
height > width. -->
|
||||
<html style="margin: 0; padding: 0; border: none; height: 100%; overflow: hidden">
|
||||
<body style="margin: 0; padding: 0; border: none; height: 100%">
|
||||
<div style="float: left; height: 100%; background: green">
|
||||
<img src="solidblue.png" style="height: 100%; visibility: hidden;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print" style="margin: 0; padding: 0; border: none">
|
||||
<body style="margin: 0; padding: 0; border: none">
|
||||
<div style="width: 2in; height: 2in; background: green;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- This test assumes that the document is 2in tall by 4in wide. -->
|
||||
<html style="margin: 0; padding: 0; border: none; overflow: hidden"
|
||||
class="reftest-print">
|
||||
<body style="margin: 0; padding: 0; border: none">
|
||||
<div style="position: fixed; height: 100%; background: green">
|
||||
<img src="solidblue.png" style="height: 100%; visibility: hidden;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- This test assumes that the document is 2in tall by 4in wide. -->
|
||||
<html style="margin: 0; padding: 0; border: none; height: 100%; overflow: hidden"
|
||||
class="reftest-print">
|
||||
<body style="margin: 0; padding: 0; border: none; height: 100%">
|
||||
<div style="float: left; height: 100%; background: green">
|
||||
<img src="solidblue.png" style="height: 100%; visibility: hidden;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1459,6 +1459,10 @@ random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
|
|||
== 571347-3.html 571347-3-ref.html
|
||||
== 572598-1.html 572598-ref.html
|
||||
== 574898-1.html 574898-ref.html
|
||||
== 582037-1a.html 582037-1-ref.html
|
||||
== 582037-1b.html 582037-1-ref.html
|
||||
== 582037-2a.html 582037-2-ref.html
|
||||
== 582037-2b.html 582037-2-ref.html
|
||||
== 577838-1.html 577838-1-ref.html
|
||||
== 577838-2.html 577838-2-ref.html
|
||||
== 581579-1.html 581579-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче