Bug 603106 - Make mfrac linethickness="medium" use the default linethickness; r=karlt

This commit is contained in:
Florian Scholz 2011-06-23 10:30:21 +02:00
Родитель 6e6fe5e90b
Коммит d31e9d98d5
4 изменённых файлов: 47 добавлений и 12 удалений

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

@ -24,6 +24,7 @@
* David J. Fiddes <D.J.Fiddes@hw.ac.uk>
* Shyjan Mahamud <mahamud@cs.cmu.edu>
* Frederic Wang <fred.wang@free.fr>
* Florian Scholz <elchi3@elchi3.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -60,11 +61,8 @@
#define THIN_FRACTION_LINE 0.5f
#define THIN_FRACTION_LINE_MINIMUM_PIXELS 1 // minimum of 1 pixel
#define MEDIUM_FRACTION_LINE 1.5f
#define MEDIUM_FRACTION_LINE_MINIMUM_PIXELS 2 // minimum of 2 pixels
#define THICK_FRACTION_LINE 2.0f
#define THICK_FRACTION_LINE_MINIMUM_PIXELS 4 // minimum of 4 pixels
#define THICK_FRACTION_LINE_MINIMUM_PIXELS 2 // minimum of 2 pixels
nsIFrame*
NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -135,18 +133,14 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext,
lineThickness = defaultThickness - onePixel;
}
else if (aThicknessAttribute.EqualsLiteral("medium")) {
lineThickness = NSToCoordRound(defaultThickness * MEDIUM_FRACTION_LINE);
minimumThickness = onePixel * MEDIUM_FRACTION_LINE_MINIMUM_PIXELS;
// should visually increase by at least one pixel
if (lineThickness < defaultThickness + onePixel)
lineThickness = defaultThickness + onePixel;
// medium is default
}
else if (aThicknessAttribute.EqualsLiteral("thick")) {
lineThickness = NSToCoordCeil(defaultThickness * THICK_FRACTION_LINE);
minimumThickness = onePixel * THICK_FRACTION_LINE_MINIMUM_PIXELS;
// should visually increase by at least two pixels
if (lineThickness < defaultThickness + 2*onePixel)
lineThickness = defaultThickness + 2*onePixel;
// should visually increase by at least one pixel
if (lineThickness < defaultThickness + onePixel)
lineThickness = defaultThickness + onePixel;
}
else { // see if it is a plain number, or a percentage, or a h/v-unit like 1ex, 2px, 1em
nsCSSValue cssValue;

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

@ -0,0 +1,20 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac linethickness="medium">
<mi>a</mi>
<mi>b</mi>
</mfrac>
<mo>=</mo>
<mfrac linethickness="1">
<mi>a</mi>
<mi>b</mi>
</mfrac>
<mo>=</mo>
<mfrac linethickness="medium">
<mi>a</mi>
<mi>b</mi>
</mfrac>
</math>
</body>
</html>

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

@ -0,0 +1,20 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac>
<mi>a</mi>
<mi>b</mi>
</mfrac>
<mo>=</mo>
<mfrac>
<mi>a</mi>
<mi>b</mi>
</mfrac>
<mo>=</mo>
<mfrac linethickness="1">
<mi>a</mi>
<mi>b</mi>
</mfrac>
</math>
</body>
</html>

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

@ -60,3 +60,4 @@ fails == mstyle-5.xhtml mstyle-5-ref.xhtml # See bug 569125#c29
!= scale-stretchy-4.xhtml scale-stretchy-4-ref.xhtml
!= scale-stretchy-5.xhtml scale-stretchy-5-ref.xhtml
== math-as-mstyle-1.xhtml math-as-mstyle-1-ref.xhtml
== mfrac-linethickness-1.xhtml mfrac-linethickness-1-ref.xhtml