Bug 1285658 - Part 2: Use less-erroneous value while calculating border corner dimensions. r=jrmuizel

This commit is contained in:
Tooru Fujisawa 2016-07-16 10:39:44 +09:00
Родитель 71255bc78d
Коммит 5343dbd6c2
6 изменённых файлов: 111 добавлений и 9 удалений

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

@ -59,8 +59,7 @@ using namespace mozilla::gfx;
* |- DrawDashedOrDottedSide || DrawBorderSides with one side
*/
static void ComputeBorderCornerDimensions(const Rect& aOuterRect,
const Rect& aInnerRect,
static void ComputeBorderCornerDimensions(const Float* aBorderWidths,
const RectCornerRadii& aRadii,
RectCornerRadii *aDimsResult);
@ -202,7 +201,7 @@ nsCSSBorderRenderer::nsCSSBorderRenderer(nsPresContext* aPresContext,
mBorderStyles[2] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[2] : 0,
mBorderStyles[3] != NS_STYLE_BORDER_STYLE_NONE ? mBorderWidths[3] : 0));
ComputeBorderCornerDimensions(mOuterRect, mInnerRect,
ComputeBorderCornerDimensions(mBorderWidths,
mBorderRadii, &mBorderCornerDimensions);
mOneUnitBorder = CheckFourFloatsEqual(mBorderWidths, 1.0);
@ -263,15 +262,14 @@ nsCSSBorderRenderer::ComputeOuterRadii(const RectCornerRadii& aRadii,
}
/*static*/ void
ComputeBorderCornerDimensions(const Rect& aOuterRect,
const Rect& aInnerRect,
ComputeBorderCornerDimensions(const Float* aBorderWidths,
const RectCornerRadii& aRadii,
RectCornerRadii* aDimsRet)
{
Float leftWidth = aInnerRect.X() - aOuterRect.X();
Float topWidth = aInnerRect.Y() - aOuterRect.Y();
Float rightWidth = aOuterRect.Width() - aInnerRect.Width() - leftWidth;
Float bottomWidth = aOuterRect.Height() - aInnerRect.Height() - topWidth;
Float leftWidth = aBorderWidths[NS_SIDE_LEFT];
Float topWidth = aBorderWidths[NS_SIDE_TOP];
Float rightWidth = aBorderWidths[NS_SIDE_RIGHT];
Float bottomWidth = aBorderWidths[NS_SIDE_BOTTOM];
if (AllCornersZeroSize(aRadii)) {
// These will always be in pixel units from CSS

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.5 KiB

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

@ -0,0 +1,82 @@
<!DOCTYPE HTML>
<html reftest-zoom="1.3300000429153442">
<head>
<meta charset="utf-8">
<title>dashed border with radius</title>
<style>
.box {
position: relative;
width: 420px;
height: 420px;
}
.mask {
position: absolute;
top: 0px;
left: 0px;
width: 420px;
height: 420px;
}
table {
border-collapse: separate;
border-spacing: 10px;
empty-cells: show;
}
td {
border-style: dashed;
border-radius: 24px;
border-color: black;
height: 120px;
width: 120px;
box-sizing: border-box;
}
.A {
border-width: 1px;
}
.B {
border-width: 2px;
}
.C {
border-width: 6px;
}
.D {
border-width: 8px;
}
.E {
border-width: 16px;
}
.F {
border-width: 24px;
}
.G {
border-width: 32px;
}
.H {
border-width: 48px;
}
.I {
border-width: 60px;
}
</style>
</head>
<body>
<div class="box">
<table>
<tr><td class="A"></td><td class="B"></td><td class="C"></td></tr>
<tr><td class="D"></td><td class="E"></td><td class="F"></td></tr>
<tr><td class="G"></td><td class="H"></td><td class="I"></td></tr>
</table>
<img class="mask" src="border-dashed-radius-zoom-filled-mask.png">
</div>
<div class="box">
<table>
<tr><td class="A"></td><td class="B"></td><td class="C"></td></tr>
<tr><td class="D"></td><td class="E"></td><td class="F"></td></tr>
<tr><td class="G"></td><td class="H"></td><td class="I"></td></tr>
</table>
<img class="mask" src="border-dashed-radius-zoom-unfilled-mask.png">
</div>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html reftest-zoom="1.3300000429153442">
<head>
<meta charset="utf-8">
<title>Correctly masked page</title>
<style>
.box {
position: relative;
width: 420px;
height: 420px;
}
</style>
</head>
<body>
<div class="box" style="background-color: black;">
</div>
<div class="box" style="background-color: white;">
</div>
</body>
</html>

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

@ -9,3 +9,4 @@ fuzzy(80,1500) == border-dashed-no-radius.html masked.html
fuzzy(80,1500) == border-dashed-radius.html masked.html
fuzzy(80,1500) == border-mixed.html masked.html
fuzzy(80,1500) == border-dashed-non-integer.html masked.html
fuzzy(80,1500) == border-dashed-radius-zoom.html masked-zoom.html