Bug 848725 - limited the scale factors at the end of nsMathMLChar::StretchInternal and added crashtests. r=fredw.

This commit is contained in:
Anuj Agarwal 2014-05-12 01:32:00 +02:00
parent ce5226a69f
commit 146c702167
4 changed files with 44 additions and 4 deletions

View File

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>Bug 848725</title>
<meta charset="utf-8"/>
</head>
<body>
<div>
<math>
<mover>
<mo>&#x21A0;</mo>
<mspace width="500px"></mspace>
</mover>
</math>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>Bug 848725</title>
<meta charset="utf-8"/>
</head>
<body>
<div>
<math>
<mover>
<mo>&#x21A1;</mo>
<mspace height="500px"></mspace>
</mover>
</math>
</div>
</body>
</html>

View File

@ -60,3 +60,5 @@ load 713606-1.html
load 716349-1.html
load 947557-1.html
test-pref(layout.css.sticky.enabled,true) load 973322-1.xhtml
load 848725-1.html
load 848725-2.html

View File

@ -34,6 +34,10 @@ using namespace mozilla;
//#define NOISY_SEARCH 1
// BUG 848725 Drawing failure with stretchy horizontal parenthesis when no fonts
// are installed. "kMaxScaleFactor" is required to limit the scale for the
// vertical and horizontal stretchy operators.
static const float kMaxScaleFactor = 20.0;
static const float kLargeOpFactor = float(M_SQRT2);
static const float kIntegralFactor = 2.0;
@ -1663,8 +1667,8 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
if (stretchy) {
if (isVertical) {
float scale =
float(aContainerSize.ascent + aContainerSize.descent) /
(aDesiredStretchSize.ascent + aDesiredStretchSize.descent);
std::min(kMaxScaleFactor, float(aContainerSize.ascent + aContainerSize.descent) /
(aDesiredStretchSize.ascent + aDesiredStretchSize.descent));
if (!largeop || scale > 1.0) {
// make the character match the desired height.
if (!maxWidth) {
@ -1675,8 +1679,8 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
}
} else {
float scale =
float(aContainerSize.rightBearing - aContainerSize.leftBearing) /
(aDesiredStretchSize.rightBearing - aDesiredStretchSize.leftBearing);
std::min(kMaxScaleFactor, float(aContainerSize.rightBearing - aContainerSize.leftBearing) /
(aDesiredStretchSize.rightBearing - aDesiredStretchSize.leftBearing));
if (!largeop || scale > 1.0) {
// make the character match the desired width.
if (!maxWidth) {