Bug 479156. Fix unit scale factors in border-image drawing. r+sr=roc

--HG--
extra : rebase_source : 06899c9162b0b30f890385fd4caa3f4cd22ecf48
This commit is contained in:
Zack Weinberg 2009-02-24 21:31:22 +13:00
Родитель 0d8343ec6e
Коммит ecf9454841
13 изменённых файлов: 400 добавлений и 12 удалений

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

@ -1936,6 +1936,10 @@ DrawBorderImage(nsPresContext* aPresContext,
split.bottom,
};
// In all the 'factor' calculations below, 'border' measurements are
// in app units but 'split' measurements are in image/CSS pixels, so
// the factor corresponding to no additional scaling is
// CSSPixelsToAppUnits(1), not simply 1.
for (int i = LEFT; i <= RIGHT; i++) {
for (int j = TOP; j <= BOTTOM; j++) {
nsRect destArea(borderX[i], borderY[j], borderWidth[i], borderHeight[j]);
@ -1946,14 +1950,14 @@ DrawBorderImage(nsPresContext* aPresContext,
if (i == MIDDLE && j == MIDDLE) {
// css-background:
// The middle image's width is scaled by the same factor as
// the top image unless that factor is zero or infinity, in
// which case the scaling factor of the bottom is substituted,
// and failing that, the width is not scaled. The height of
// the middle image is scaled by the same factor as the left
// image unless that factor is zero or infinity, in which case
// the scaling factor of the right image is substituted, and
// failing that, the height is not scaled.
// The middle image's width is scaled by the same factor as the
// top image unless that factor is zero or infinity, in which
// case the scaling factor of the bottom is substituted, and
// failing that, the width is not scaled. The height of the
// middle image is scaled by the same factor as the left image
// unless that factor is zero or infinity, in which case the
// scaling factor of the right image is substituted, and failing
// that, the height is not scaled.
gfxFloat hFactor, vFactor;
if (0 < border.left && 0 < split.left)
@ -1961,14 +1965,14 @@ DrawBorderImage(nsPresContext* aPresContext,
else if (0 < border.right && 0 < split.right)
vFactor = gfxFloat(border.right)/split.right;
else
vFactor = 1.0;
vFactor = nsPresContext::CSSPixelsToAppUnits(1);
if (0 < border.top && 0 < split.top)
hFactor = gfxFloat(border.top)/split.top;
else if (0 < border.bottom && 0 < split.bottom)
hFactor = gfxFloat(border.bottom)/split.bottom;
else
hFactor = 1.0;
hFactor = nsPresContext::CSSPixelsToAppUnits(1);
unitSize.width = splitWidth[i]*hFactor;
unitSize.height = splitHeight[j]*vFactor;
@ -1978,9 +1982,11 @@ DrawBorderImage(nsPresContext* aPresContext,
} else if (i == MIDDLE) { // top, bottom
// Sides are always stretched to the thickness of their border,
// and stretched proportionately on the other axis.
gfxFloat factor = 1.0;
gfxFloat factor;
if (0 < borderHeight[j] && 0 < splitHeight[j])
factor = gfxFloat(borderHeight[j])/splitHeight[j];
else
factor = nsPresContext::CSSPixelsToAppUnits(1);
unitSize.width = splitWidth[i]*factor;
unitSize.height = borderHeight[j];
@ -1988,9 +1994,11 @@ DrawBorderImage(nsPresContext* aPresContext,
fillStyleV = NS_STYLE_BORDER_IMAGE_STRETCH;
} else if (j == MIDDLE) { // left, right
gfxFloat factor = 1.0;
gfxFloat factor;
if (0 < borderWidth[i] && 0 < splitWidth[i])
factor = gfxFloat(borderWidth[i])/splitWidth[i];
else
factor = nsPresContext::CSSPixelsToAppUnits(1);
unitSize.width = borderWidth[i];
unitSize.height = splitHeight[j]*factor;

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

@ -0,0 +1,54 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-tl.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-tr.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 27px 27px 0 27px;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>

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

@ -0,0 +1,58 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-tr.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-br.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 27px 27px 27px 0;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>

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

@ -0,0 +1,52 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 27px 0 27px 0;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>

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

@ -0,0 +1,58 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-tl.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"
><img src="reticule-to.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"></div
><div><img src="reticule-bl.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 27px 0 27px 27px;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>

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

@ -0,0 +1,54 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-bl.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-bo.png" width="27" height="27"
><img src="reticule-br.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 0 27px 27px 27px;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>

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

@ -0,0 +1,44 @@
<!doctype html>
<style>div { line-height: 0 }</style>
<body
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
><div><img src="reticule-le.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ct.png" width="27" height="27"
><img src="reticule-ri.png" width="27" height="27"></div
></body>

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

@ -0,0 +1,10 @@
<!doctype html>
<style>
div {
border-width: 0 27px 0 27px;
-moz-border-image: url("reticule.png") 27 round;
width: 216px;
height: 108px;
}
</style>
<div></div>