зеркало из https://github.com/mozilla/gecko-dev.git
Bug 382721 - Part 8: Render too large dotted/dashed corner with solid style. r=jrmuizel
This commit is contained in:
Родитель
d453deaf6e
Коммит
f56d021842
|
@ -23,5 +23,6 @@
|
|||
#define C_BL NS_CORNER_BOTTOM_LEFT
|
||||
|
||||
#define BORDER_SEGMENT_COUNT_MAX 100
|
||||
#define BORDER_DOTTED_CORNER_MAX_RADIUS 100000
|
||||
|
||||
#endif /* mozilla_BorderConsts_h_ */
|
||||
|
|
|
@ -2193,6 +2193,13 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::css::Side aSide,
|
|||
return;
|
||||
}
|
||||
|
||||
Float maxRadius = std::max(mBorderRadii[aCorner].width,
|
||||
mBorderRadii[aCorner].height);
|
||||
if (maxRadius > BORDER_DOTTED_CORNER_MAX_RADIUS) {
|
||||
DrawFallbackSolidCorner(aSide, aCorner);
|
||||
return;
|
||||
}
|
||||
|
||||
if (borderWidthH != borderWidthV || borderWidthH > 2.0f) {
|
||||
uint8_t style = mBorderStyles[aSide];
|
||||
if (style == NS_STYLE_BORDER_STYLE_DOTTED) {
|
||||
|
@ -2428,6 +2435,38 @@ nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::css::Side aSide,
|
|||
mDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner)
|
||||
{
|
||||
// Render too large dashed or dotted corner with solid style, to avoid hangup
|
||||
// inside DashedCornerFinder and DottedCornerFinder.
|
||||
|
||||
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
|
||||
mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
|
||||
"Style should be dashed or dotted.");
|
||||
|
||||
nscolor borderColor = mBorderColors[aSide];
|
||||
Bezier outerBezier;
|
||||
Bezier innerBezier;
|
||||
GetOuterAndInnerBezier(&outerBezier, &innerBezier, aCorner);
|
||||
|
||||
RefPtr<PathBuilder> builder = mDrawTarget->CreatePathBuilder();
|
||||
|
||||
builder->MoveTo(outerBezier.mPoints[0]);
|
||||
builder->BezierTo(outerBezier.mPoints[1],
|
||||
outerBezier.mPoints[2],
|
||||
outerBezier.mPoints[3]);
|
||||
builder->LineTo(innerBezier.mPoints[3]);
|
||||
builder->BezierTo(innerBezier.mPoints[2],
|
||||
innerBezier.mPoints[1],
|
||||
innerBezier.mPoints[0]);
|
||||
builder->LineTo(outerBezier.mPoints[0]);
|
||||
|
||||
RefPtr<Path> path = builder->Finish();
|
||||
mDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
|
||||
}
|
||||
|
||||
bool
|
||||
nsCSSBorderRenderer::AllBordersSameWidth()
|
||||
{
|
||||
|
|
|
@ -229,6 +229,10 @@ private:
|
|||
void DrawDashedCornerSlow(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
|
||||
// Draw the given dashed/dotted corner with solid style
|
||||
void DrawFallbackSolidCorner(mozilla::css::Side aSide,
|
||||
mozilla::css::Corner aCorner);
|
||||
|
||||
// Analyze if all border sides have the same width.
|
||||
bool AllBordersSameWidth();
|
||||
|
||||
|
|
|
@ -627,3 +627,7 @@ load 1233191.html
|
|||
asserts(2) load 1272983-1.html # bug 586628
|
||||
asserts(2) load 1272983-2.html # bug 586628
|
||||
load 1278007.html
|
||||
load large-border-radius-dashed.html
|
||||
load large-border-radius-dashed2.html
|
||||
load large-border-radius-dotted.html
|
||||
load large-border-radius-dotted2.html
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html style="height: 10000000px; width: 10000000px; box-sizing: border-box; border-radius: 10000000px; border-style: dashed; border-width: 10px 20px;"></html>
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html style="height: 6523790304542em; width: 6207636626031em; box-sizing: border-box; border-radius: 6523790304542em; border-style: dashed; border-width: 10px 20px;"></html>
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html style="height: 10000000px; width: 10000000px; box-sizing: border-box; border-radius: 10000000px; border-style: dotted; border-width: 10px 20px;"></html>
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html style="height: 6523790304542em; width: 6207636626031em; box-sizing: border-box; border-radius: 6523790304542em; border-style: dotted; border-width: 10px 20px;"></html>
|
Загрузка…
Ссылка в новой задаче