Bug 1784014 - Remove MathML preference mfrac_bevelled_attribute. r=emilio

- remove flag and corresponding warning/counter.
- remove attribute from parsers, but keep the atom since it's
  used by TreeSanitizer.
- remove tests for mfrac@bevelled, there is a WPT test to check it's
  not supported.
- layout/mathml/tests/test_bug975681.html is removed, its tests are
  currently (wrongly) all disabled when the flag is off and equivalent
  tests for attributes other than bevelled exist in WPT.

Differential Revision: https://phabricator.services.mozilla.com/D154199
This commit is contained in:
Frederic Wang 2022-08-27 07:22:22 +00:00
parent 6f54c781b2
commit ecf2b4d3d6
22 changed files with 155 additions and 692 deletions

View File

@ -46,7 +46,6 @@ DEPRECATED_OPERATION(MozfullscreenchangeDeprecatedPrefix)
DEPRECATED_OPERATION(MozfullscreenerrorDeprecatedPrefix)
DEPRECATED_OPERATION(External_AddSearchProvider)
DEPRECATED_OPERATION(MouseEvent_MozPressure)
DEPRECATED_OPERATION(MathML_DeprecatedBevelledAttribute)
DEPRECATED_OPERATION(MathML_DeprecatedMathSizeValue)
DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue)
DEPRECATED_OPERATION(MathML_DeprecatedMfencedElement)

View File

@ -373,8 +373,6 @@ MozfullscreenerrorDeprecatedPrefixWarning=onmozfullscreenerror is deprecated.
External_AddSearchProviderWarning=AddSearchProvider is deprecated.
# LOCALIZATION NOTE: Do not translate "MouseEvent.mozPressure" and "PointerEvent.pressure".
MouseEvent_MozPressureWarning=MouseEvent.mozPressure is deprecated. Use PointerEvent.pressure instead.
# LOCALIZATION NOTE: Do not translate MathML and bevelled.
MathML_DeprecatedBevelledAttribute=MathML attribute “bevelled” is deprecated and may be removed at a future date.
# LOCALIZATION NOTE: Do not translate small, normal, big and mathsize.
MathML_DeprecatedMathSizeValueWarning=“small”, “normal” and “big” are deprecated values for the mathsize attribute and will be removed at a future date.
# LOCALIZATION NOTE: Do not translate veryverythinmathspace, verythinmathspace,

View File

@ -110,11 +110,7 @@ void nsMathMLmfracFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
/////////////
// paint the fraction line
if (mIsBevelled) {
DisplaySlash(aBuilder, mLineRect, mLineThickness, aLists);
} else {
DisplayBar(aBuilder, this, mLineRect, aLists);
}
DisplayBar(aBuilder, this, mLineRect, aLists);
}
nsresult nsMathMLmfracFrame::AttributeChanged(int32_t aNameSpaceID,
@ -202,389 +198,177 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
CalcLineThickness(presContext, mComputedStyle, value, onePixel,
defaultRuleThickness, fontSizeInflation);
// bevelled attribute
mIsBevelled = false;
if (!StaticPrefs::mathml_mfrac_bevelled_attribute_disabled()) {
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::bevelled_,
value)) {
mContent->OwnerDoc()->WarnOnceAbout(
dom::DeprecatedOperations::eMathML_DeprecatedBevelledAttribute);
mIsBevelled = value.EqualsLiteral("true");
bool displayStyle = StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL;
mLineRect.height = mLineThickness;
// by default, leave at least one-pixel padding at either end, and add
// lspace & rspace that may come from <mo> if we are an outermost
// embellished container (we fetch values from the core since they may use
// units that depend on style data, and style changes could have occurred
// in the core since our last visit there)
nscoord leftSpace = onePixel;
nscoord rightSpace = onePixel;
if (outermostEmbellished) {
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
nsEmbellishData coreData;
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
leftSpace += isRTL ? coreData.trailingSpace : coreData.leadingSpace;
rightSpace += isRTL ? coreData.leadingSpace : coreData.trailingSpace;
}
nscoord actualRuleThickness = mLineThickness;
//////////////////
// Get shifts
nscoord numShift = 0;
nscoord denShift = 0;
// Rule 15b, App. G, TeXbook
nscoord numShift1, numShift2, numShift3;
nscoord denShift1, denShift2;
GetNumeratorShifts(fm, numShift1, numShift2, numShift3);
GetDenominatorShifts(fm, denShift1, denShift2);
if (0 == actualRuleThickness) {
numShift = displayStyle ? numShift1 : numShift3;
denShift = displayStyle ? denShift1 : denShift2;
if (mathFont) {
numShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackTopDisplayStyleShiftUp
: gfxMathTable::StackTopShiftUp,
oneDevPixel);
denShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackBottomDisplayStyleShiftDown
: gfxMathTable::StackBottomShiftDown,
oneDevPixel);
}
} else {
numShift = displayStyle ? numShift1 : numShift2;
denShift = displayStyle ? denShift1 : denShift2;
if (mathFont) {
numShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionNumeratorDisplayStyleShiftUp
: gfxMathTable::FractionNumeratorShiftUp,
oneDevPixel);
denShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionDenominatorDisplayStyleShiftDown
: gfxMathTable::FractionDenominatorShiftDown,
oneDevPixel);
}
}
bool displayStyle = StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL;
if (0 == actualRuleThickness) {
// Rule 15c, App. G, TeXbook
if (!mIsBevelled) {
mLineRect.height = mLineThickness;
// by default, leave at least one-pixel padding at either end, and add
// lspace & rspace that may come from <mo> if we are an outermost
// embellished container (we fetch values from the core since they may use
// units that depend on style data, and style changes could have occurred
// in the core since our last visit there)
nscoord leftSpace = onePixel;
nscoord rightSpace = onePixel;
if (outermostEmbellished) {
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
nsEmbellishData coreData;
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
leftSpace += isRTL ? coreData.trailingSpace : coreData.leadingSpace;
rightSpace += isRTL ? coreData.leadingSpace : coreData.trailingSpace;
// min clearance between numerator and denominator
nscoord minClearance =
displayStyle ? 7 * defaultRuleThickness : 3 * defaultRuleThickness;
if (mathFont) {
minClearance = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackDisplayStyleGapMin
: gfxMathTable::StackGapMin,
oneDevPixel);
}
nscoord actualRuleThickness = mLineThickness;
//////////////////
// Get shifts
nscoord numShift = 0;
nscoord denShift = 0;
// Rule 15b, App. G, TeXbook
nscoord numShift1, numShift2, numShift3;
nscoord denShift1, denShift2;
GetNumeratorShifts(fm, numShift1, numShift2, numShift3);
GetDenominatorShifts(fm, denShift1, denShift2);
if (0 == actualRuleThickness) {
numShift = displayStyle ? numShift1 : numShift3;
denShift = displayStyle ? denShift1 : denShift2;
if (mathFont) {
numShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackTopDisplayStyleShiftUp
: gfxMathTable::StackTopShiftUp,
oneDevPixel);
denShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackBottomDisplayStyleShiftDown
: gfxMathTable::StackBottomShiftDown,
oneDevPixel);
}
} else {
numShift = displayStyle ? numShift1 : numShift2;
denShift = displayStyle ? denShift1 : denShift2;
if (mathFont) {
numShift = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionNumeratorDisplayStyleShiftUp
: gfxMathTable::FractionNumeratorShiftUp,
oneDevPixel);
denShift = mathFont->MathTable()->Constant(
displayStyle
? gfxMathTable::FractionDenominatorDisplayStyleShiftDown
: gfxMathTable::FractionDenominatorShiftDown,
oneDevPixel);
}
}
if (0 == actualRuleThickness) {
// Rule 15c, App. G, TeXbook
// min clearance between numerator and denominator
nscoord minClearance =
displayStyle ? 7 * defaultRuleThickness : 3 * defaultRuleThickness;
if (mathFont) {
minClearance = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::StackDisplayStyleGapMin
: gfxMathTable::StackGapMin,
oneDevPixel);
}
nscoord actualClearance =
(numShift - bmNum.descent) - (bmDen.ascent - denShift);
// actualClearance should be >= minClearance
if (actualClearance < minClearance) {
nscoord halfGap = (minClearance - actualClearance) / 2;
numShift += halfGap;
denShift += halfGap;
}
} else {
// Rule 15d, App. G, TeXbook
// min clearance between numerator or denominator and middle of bar
// TeX has a different interpretation of the thickness.
// Try $a \above10pt b$ to see. Here is what TeX does:
// minClearance = displayStyle ?
// 3 * actualRuleThickness : actualRuleThickness;
// we slightly depart from TeX here. We use the defaultRuleThickness
// instead of the value coming from the linethickness attribute, i.e., we
// recover what TeX does if the user hasn't set linethickness. But when
// the linethickness is set, we avoid the wide gap problem.
nscoord minClearanceNum = displayStyle ? 3 * defaultRuleThickness
: defaultRuleThickness + onePixel;
nscoord minClearanceDen = minClearanceNum;
if (mathFont) {
minClearanceNum = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionNumDisplayStyleGapMin
: gfxMathTable::FractionNumeratorGapMin,
oneDevPixel);
minClearanceDen = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionDenomDisplayStyleGapMin
: gfxMathTable::FractionDenominatorGapMin,
oneDevPixel);
}
// adjust numShift to maintain minClearanceNum if needed
nscoord actualClearanceNum =
(numShift - bmNum.descent) - (axisHeight + actualRuleThickness / 2);
if (actualClearanceNum < minClearanceNum) {
numShift += (minClearanceNum - actualClearanceNum);
}
// adjust denShift to maintain minClearanceDen if needed
nscoord actualClearanceDen =
(axisHeight - actualRuleThickness / 2) - (bmDen.ascent - denShift);
if (actualClearanceDen < minClearanceDen) {
denShift += (minClearanceDen - actualClearanceDen);
}
}
//////////////////
// Place Children
// XXX Need revisiting the width. TeX uses the exact width
// e.g. in $$\huge\frac{\displaystyle\int}{i}$$
nscoord width = std::max(bmNum.width, bmDen.width);
nscoord dxNum = leftSpace + (width - sizeNum.Width()) / 2;
nscoord dxDen = leftSpace + (width - sizeDen.Width()) / 2;
width += leftSpace + rightSpace;
mBoundingMetrics.rightBearing =
std::max(dxNum + bmNum.rightBearing, dxDen + bmDen.rightBearing);
if (mBoundingMetrics.rightBearing < width - rightSpace)
mBoundingMetrics.rightBearing = width - rightSpace;
mBoundingMetrics.leftBearing =
std::min(dxNum + bmNum.leftBearing, dxDen + bmDen.leftBearing);
if (mBoundingMetrics.leftBearing > leftSpace)
mBoundingMetrics.leftBearing = leftSpace;
mBoundingMetrics.ascent = bmNum.ascent + numShift;
mBoundingMetrics.descent = bmDen.descent + denShift;
mBoundingMetrics.width = width;
aDesiredSize.SetBlockStartAscent(sizeNum.BlockStartAscent() + numShift);
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() + sizeDen.Height() -
sizeDen.BlockStartAscent() + denShift;
aDesiredSize.Width() = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();
if (aPlaceOrigin) {
nscoord dy;
// place numerator
dy = 0;
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dxNum, dy,
ReflowChildFlags::Default);
// place denominator
dy = aDesiredSize.Height() - sizeDen.Height();
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dxDen, dy,
ReflowChildFlags::Default);
// place the fraction bar - dy is top of bar
dy = aDesiredSize.BlockStartAscent() -
(axisHeight + actualRuleThickness / 2);
mLineRect.SetRect(leftSpace, dy, width - (leftSpace + rightSpace),
actualRuleThickness);
nscoord actualClearance =
(numShift - bmNum.descent) - (bmDen.ascent - denShift);
// actualClearance should be >= minClearance
if (actualClearance < minClearance) {
nscoord halfGap = (minClearance - actualClearance) / 2;
numShift += halfGap;
denShift += halfGap;
}
} else {
nscoord numShift = 0.0;
nscoord denShift = 0.0;
nscoord padding = 3 * defaultRuleThickness;
nscoord slashRatio = 3;
// Rule 15d, App. G, TeXbook
// Define the constant used in the expression of the maximum width
nscoord em = fm->EmHeight();
nscoord slashMaxWidthConstant = 2 * em;
// min clearance between numerator or denominator and middle of bar
// For large line thicknesses the minimum slash height is limited to the
// largest expected height of a fraction
nscoord slashMinHeight =
slashRatio * std::min(2 * mLineThickness, slashMaxWidthConstant);
// TeX has a different interpretation of the thickness.
// Try $a \above10pt b$ to see. Here is what TeX does:
// minClearance = displayStyle ?
// 3 * actualRuleThickness : actualRuleThickness;
nscoord leadingSpace = padding;
nscoord trailingSpace = padding;
if (outermostEmbellished) {
nsEmbellishData coreData;
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
leadingSpace += coreData.leadingSpace;
trailingSpace += coreData.trailingSpace;
}
nscoord delta;
// ___________
// | | /
// {|-NUMERATOR-| /
// {|___________| S
// { L
// numShift{ A
// ------------------------------------------------------- baseline
// S _____________ } denShift
// H | |}
// / |-DENOMINATOR-|}
// / |_____________|
//
// first, ensure that the top of the numerator is at least as high as the
// top of the denominator (and the reverse for the bottoms)
delta =
std::max(bmDen.ascent - bmNum.ascent, bmNum.descent - bmDen.descent) /
2;
if (delta > 0) {
numShift += delta;
denShift += delta;
// we slightly depart from TeX here. We use the defaultRuleThickness
// instead of the value coming from the linethickness attribute, i.e., we
// recover what TeX does if the user hasn't set linethickness. But when
// the linethickness is set, we avoid the wide gap problem.
nscoord minClearanceNum = displayStyle ? 3 * defaultRuleThickness
: defaultRuleThickness + onePixel;
nscoord minClearanceDen = minClearanceNum;
if (mathFont) {
minClearanceNum = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionNumDisplayStyleGapMin
: gfxMathTable::FractionNumeratorGapMin,
oneDevPixel);
minClearanceDen = mathFont->MathTable()->Constant(
displayStyle ? gfxMathTable::FractionDenomDisplayStyleGapMin
: gfxMathTable::FractionDenominatorGapMin,
oneDevPixel);
}
if (StyleFont()->mMathStyle == NS_STYLE_MATH_STYLE_NORMAL) {
delta =
std::min(bmDen.ascent + bmDen.descent, bmNum.ascent + bmNum.descent) /
2;
numShift += delta;
denShift += delta;
} else {
nscoord xHeight = fm->XHeight();
numShift += xHeight / 2;
denShift += xHeight / 4;
// adjust numShift to maintain minClearanceNum if needed
nscoord actualClearanceNum =
(numShift - bmNum.descent) - (axisHeight + actualRuleThickness / 2);
if (actualClearanceNum < minClearanceNum) {
numShift += (minClearanceNum - actualClearanceNum);
}
// Set the ascent/descent of our BoundingMetrics.
mBoundingMetrics.ascent = bmNum.ascent + numShift;
mBoundingMetrics.descent = bmDen.descent + denShift;
// At this point the height of the slash is
// mBoundingMetrics.ascent + mBoundingMetrics.descent
// Ensure that it is greater than slashMinHeight
delta = (slashMinHeight -
(mBoundingMetrics.ascent + mBoundingMetrics.descent)) /
2;
if (delta > 0) {
mBoundingMetrics.ascent += delta;
mBoundingMetrics.descent += delta;
// adjust denShift to maintain minClearanceDen if needed
nscoord actualClearanceDen =
(axisHeight - actualRuleThickness / 2) - (bmDen.ascent - denShift);
if (actualClearanceDen < minClearanceDen) {
denShift += (minClearanceDen - actualClearanceDen);
}
}
// Set the width of the slash
if (aWidthOnly) {
mLineRect.width = mLineThickness + slashMaxWidthConstant;
} else {
mLineRect.width =
mLineThickness +
std::min(slashMaxWidthConstant,
(mBoundingMetrics.ascent + mBoundingMetrics.descent) /
slashRatio);
}
//////////////////
// Place Children
// Set horizontal bounding metrics
if (StyleVisibility()->mDirection == StyleDirection::Rtl) {
mBoundingMetrics.leftBearing = trailingSpace + bmDen.leftBearing;
mBoundingMetrics.rightBearing =
trailingSpace + bmDen.width + mLineRect.width + bmNum.rightBearing;
} else {
mBoundingMetrics.leftBearing = leadingSpace + bmNum.leftBearing;
mBoundingMetrics.rightBearing =
leadingSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
}
mBoundingMetrics.width = leadingSpace + bmNum.width + mLineRect.width +
bmDen.width + trailingSpace;
// XXX Need revisiting the width. TeX uses the exact width
// e.g. in $$\huge\frac{\displaystyle\int}{i}$$
nscoord width = std::max(bmNum.width, bmDen.width);
nscoord dxNum = leftSpace + (width - sizeNum.Width()) / 2;
nscoord dxDen = leftSpace + (width - sizeDen.Width()) / 2;
width += leftSpace + rightSpace;
// Set aDesiredSize
aDesiredSize.SetBlockStartAscent(mBoundingMetrics.ascent + padding);
aDesiredSize.Height() =
mBoundingMetrics.ascent + mBoundingMetrics.descent + 2 * padding;
aDesiredSize.Width() = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
mBoundingMetrics.rightBearing =
std::max(dxNum + bmNum.rightBearing, dxDen + bmDen.rightBearing);
if (mBoundingMetrics.rightBearing < width - rightSpace)
mBoundingMetrics.rightBearing = width - rightSpace;
mBoundingMetrics.leftBearing =
std::min(dxNum + bmNum.leftBearing, dxDen + bmDen.leftBearing);
if (mBoundingMetrics.leftBearing > leftSpace)
mBoundingMetrics.leftBearing = leftSpace;
mBoundingMetrics.ascent = bmNum.ascent + numShift;
mBoundingMetrics.descent = bmDen.descent + denShift;
mBoundingMetrics.width = width;
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();
aDesiredSize.SetBlockStartAscent(sizeNum.BlockStartAscent() + numShift);
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() + sizeDen.Height() -
sizeDen.BlockStartAscent() + denShift;
aDesiredSize.Width() = mBoundingMetrics.width;
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
if (aPlaceOrigin) {
nscoord dx, dy;
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();
// place numerator
dx = MirrorIfRTL(aDesiredSize.Width(), sizeNum.Width(), leadingSpace);
dy = aDesiredSize.BlockStartAscent() - numShift -
sizeNum.BlockStartAscent();
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dx, dy,
ReflowChildFlags::Default);
// place the fraction bar
dx = MirrorIfRTL(aDesiredSize.Width(), mLineRect.width,
leadingSpace + bmNum.width);
dy = aDesiredSize.BlockStartAscent() - mBoundingMetrics.ascent;
mLineRect.SetRect(dx, dy, mLineRect.width,
aDesiredSize.Height() - 2 * padding);
// place denominator
dx = MirrorIfRTL(aDesiredSize.Width(), sizeDen.Width(),
leadingSpace + bmNum.width + mLineRect.width);
dy = aDesiredSize.BlockStartAscent() + denShift -
sizeDen.BlockStartAscent();
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dx, dy,
ReflowChildFlags::Default);
}
if (aPlaceOrigin) {
nscoord dy;
// place numerator
dy = 0;
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dxNum, dy,
ReflowChildFlags::Default);
// place denominator
dy = aDesiredSize.Height() - sizeDen.Height();
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dxDen, dy,
ReflowChildFlags::Default);
// place the fraction bar - dy is top of bar
dy = aDesiredSize.BlockStartAscent() -
(axisHeight + actualRuleThickness / 2);
mLineRect.SetRect(leftSpace, dy, width - (leftSpace + rightSpace),
actualRuleThickness);
}
return NS_OK;
}
namespace mozilla {
class nsDisplayMathMLSlash : public nsPaintedDisplayItem {
public:
nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, nscoord aThickness)
: nsPaintedDisplayItem(aBuilder, aFrame),
mRect(aRect),
mThickness(aThickness) {
MOZ_COUNT_CTOR(nsDisplayMathMLSlash);
}
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLSlash)
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
NS_DISPLAY_DECL_NAME("MathMLSlash", TYPE_MATHML_SLASH)
private:
nsRect mRect;
nscoord mThickness;
};
void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
// get the gfxRect
nsPresContext* presContext = mFrame->PresContext();
Rect rect = NSRectToRect(mRect + ToReferenceFrame(),
presContext->AppUnitsPerDevPixel());
ColorPattern color(ToDeviceColor(
mFrame->GetVisitedDependentColor(&nsStyleText::mWebkitTextFillColor)));
// draw the slash as a parallelogram
Point delta = Point(presContext->AppUnitsToGfxUnits(mThickness), 0);
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder();
if (mFrame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
builder->MoveTo(rect.TopLeft());
builder->LineTo(rect.TopLeft() + delta);
builder->LineTo(rect.BottomRight());
builder->LineTo(rect.BottomRight() - delta);
} else {
builder->MoveTo(rect.BottomLeft());
builder->LineTo(rect.BottomLeft() + delta);
builder->LineTo(rect.TopRight());
builder->LineTo(rect.TopRight() - delta);
}
RefPtr<Path> path = builder->Finish();
aDrawTarget.Fill(path, color);
}
} // namespace mozilla
void nsMathMLmfracFrame::DisplaySlash(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, nscoord aThickness,
const nsDisplayListSet& aLists) {
if (!StyleVisibility()->IsVisible() || aRect.IsEmpty()) {
return;
}
aLists.Content()->AppendNewToTop<nsDisplayMathMLSlash>(aBuilder, this, aRect,
aThickness);
}

View File

@ -96,8 +96,7 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
: nsMathMLContainerFrame(aStyle, aPresContext, kClassID),
mLineRect(),
mSlashChar(nullptr),
mLineThickness(0),
mIsBevelled(false) {}
mLineThickness(0) {}
virtual ~nsMathMLmfracFrame();
nsresult PlaceInternal(DrawTarget* aDrawTarget, bool aPlaceOrigin,
@ -110,7 +109,6 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
nsRect mLineRect;
nsMathMLChar* mSlashChar;
nscoord mLineThickness;
bool mIsBevelled;
};
#endif /* nsMathMLmfracFrame_h___ */

View File

@ -6,7 +6,6 @@ support-files =
[test_bug553917.html]
[test_bug706406.html]
[test_bug827713-2.html]
[test_bug975681.html]
[test_disabled.html]
[test_opentype-axis-height.html]
[test_opentype-limits.html]

View File

@ -1,93 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=975681
-->
<head>
<meta charset="utf-8">
<title> Test for Bug 975681 </title>
<script src="/tests/SimpleTest/SimpleTest.js"> </script>
<script src="/tests/SimpleTest/EventUtils.js"> </script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975681"> Mozilla Bug 975681 </a>
<p id="display"></p>
<p>
<math>
<mfrac id="test_mfrac">
<mspace width="100px" height="20px" mathbackground="red"></mspace>
<mspace width="100px" height="20px" mathbackground="red"></mspace>
</mfrac>
</math>
</p>
<p>
<math>
<mfrac linethickness="30px" id="mfrac_linethickness">
<mspace width="100px" height="20px" mathbackground="red"></mspace>
<mspace width="100px" height="20px" mathbackground="red"></mspace>
</mfrac>
</math>
</p>
<p>
<math>
<mfrac bevelled="true" id="mfrac_bevelled">
<mspace width="100px" height="20px" mathbackground="red"></mspace>
<mspace width="100px" height="20px" mathbackground="red"></mspace>
</mfrac>
</math>
</p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 975681 **/
SimpleTest.waitForExplicitFinish();
if (SpecialPowers.getBoolPref('mathml.mfrac_bevelled_attribute.disabled')) {
ok(true, "bevelled attribute disabled.")
} else {
var epsilon = 1; // allow a small relative error
var delta = .25; // used to indicate a small shift
function almostEqualAbs(x, y) {
var e = Math.abs(x - y);
return (e <= epsilon);
}
function almostLessThanAbs(x, y) {
var e = x - y;
return (e <= epsilon);
}
// test: mfrac
var mfracNum = document.getElementById("test_mfrac").firstElementChild.getBoundingClientRect();
var mfracDenom = document.getElementById("test_mfrac").lastElementChild.getBoundingClientRect();
ok(almostEqualAbs(mfracNum.left, mfracDenom.left) &&
almostEqualAbs(mfracNum.right, mfracDenom.right), "Numerator and denominator should be vertical aligned");
ok(almostLessThanAbs(mfracNum.bottom, mfracDenom.top), "Numerator should be above denominator");
// test: mfrac attributes
var mfrac = document.getElementById("mfrac_linethickness").getBoundingClientRect();
var num = document.getElementById("mfrac_linethickness").firstElementChild.getBoundingClientRect();
var denom = document.getElementById("mfrac_linethickness").lastElementChild.getBoundingClientRect();
ok(almostLessThanAbs(num.height + 30 + denom.height, mfrac.height) &&
almostLessThanAbs(num.bottom + 30, denom.top), "numerator and denominator should be separated by linethickness");
num = document.getElementById("mfrac_bevelled").firstElementChild.getBoundingClientRect();
denom = document.getElementById("mfrac_bevelled").lastElementChild.getBoundingClientRect();
ok(almostLessThanAbs(num.right, denom.left) &&
almostLessThanAbs(num.top*(1-delta)+num.bottom*delta, denom.top), "incorrect position of mfrac children");
}
SimpleTest.finish();
</script>
</body>
</html>

View File

@ -74,15 +74,6 @@
<mspace width="20px" height="20px" mathbackground="grey"/>
</munderover>
</math><br/>
<!-- mfrac (bevelled=true) -->
<math dir="rtl">
<mstyle mathcolor="white">
<mfrac bevelled="true">
<mspace width="20px" height="20px"/>
<mspace width="20px" height="20px" mathbackground="red"/>
</mfrac>
</mstyle>
</math><br/>
<!-- mroot -->
<math dir="rtl">
<mstyle mathcolor="white">

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac bevelled</title>
</head>
<body>
<math>
<mfrac style="font-size: 300%" bevelled="false">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac bevelled</title>
</head>
<body>
<math>
<mfrac style="font-size: 300%">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac bevelled</title>
</head>
<body>
<math>
<mfrac style="font-size: 300%">
<mspace width="20px" height="20px" mathbackground="red"></mspace>
<mspace width="20px" height="20px" mathbackground="red"></mspace>
</mfrac>
</math>
</body>
</html>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>mfrac bevelled</title>
<script type="text/javascript">
function doTest() {
document.getElementById("testMfrac").removeAttribute("bevelled");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate",doTest);
</script>
</head>
<body>
<math>
<mfrac id="testMfrac" style="font-size: 300%" bevelled="true">
<mspace width="20px" height="20px" mathbackground="red"></mspace>
<mspace width="20px" height="20px" mathbackground="red"></mspace>
</mfrac>
</math>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac bevelled</title>
</head>
<body>
<math>
<mfrac style="font-size: 300%" bevelled="true">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>mfrac bevelled</title>
<script type="text/javascript">
function doTest() {
document.getElementById("testMfrac").setAttribute("bevelled","true");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate",doTest);
</script>
</head>
<body>
<math>
<mfrac id="testMfrac" style="font-size: 300%">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac bevelled</title>
</head>
<body>
<math>
<mfrac style="font-size: 300%" bevelled="true">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>mfrac bevelled</title>
<script type="text/javascript">
function doTest() {
document.getElementById("testMfrac").setAttribute("bevelled","true");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate",doTest);
</script>
</head>
<body>
<math>
<mfrac id="testMfrac" style="font-size: 300%" bevelled="false">
<mi> a </mi>
<mi> b </mi>
</mfrac>
</math>
</body>
</html>

View File

@ -13,19 +13,5 @@
<mtext>_</mtext>
</math>
</p>
<p>
<math>
<mtext>_</mtext>
<mrow>
<mfrac bevelled="true">
<mo lspace="1em" rspace="2em">_</mo>
<mtext>_</mtext>
</mfrac>
</mrow>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -11,17 +11,5 @@
<mtext>_</mtext>
</math>
</p>
<p>
<math>
<mtext>_</mtext>
<mfrac bevelled="true">
<mo lspace="1em" rspace="2em">_</mo>
<mtext>_</mtext>
</mfrac>
<mtext>_</mtext>
</math>
</p>
</body>
</html>

View File

@ -16,7 +16,7 @@ fuzzy(0-2,0-529) == 393760-2.xml 393760-2-ref.xml
== 414123.xhtml 414123-ref.xhtml
== dir-1.html dir-1-ref.html
== dir-2.html dir-2-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) random-if(gtkWidget) == dir-3.html dir-3-ref.html # bug 1309426
random-if(gtkWidget) == dir-3.html dir-3-ref.html # bug 1309426
== dir-5.html dir-5-ref.html
fuzzy-if(cocoaWidget,0-135,0-56) == dir-6a.html dir-6a-ref.html
== css-spacing-1.html css-spacing-1-ref.html
@ -64,7 +64,7 @@ fails == stretchy-mover-2a.html stretchy-mover-2-ref.html
== stretchy-largeop-1.html stretchy-largeop-1-ref.html
== stretchy-largeop-2.html stretchy-largeop-2-ref.html
== stretchy-largeop-3.html stretchy-largeop-3-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) == table-width-1.xhtml table-width-1-ref.xhtml
== table-width-1.xhtml table-width-1-ref.xhtml
== table-width-2.html table-width-2-ref.html
== table-width-3.html table-width-3-ref.html
== table-width-4.html table-width-4-ref.html
@ -158,7 +158,7 @@ pref(mathml.mathspace_names.disabled,false) == positive-namedspace.html positive
== mo-lspace-rspace.html mo-lspace-rspace-ref.html
== mo-lspace-rspace-2.html mo-lspace-rspace-2-ref.html
== mo-lspace-rspace-3.html mo-lspace-rspace-3-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) == mo-lspace-rspace-4.html mo-lspace-rspace-4-ref.html
== mo-lspace-rspace-4.html mo-lspace-rspace-4-ref.html
== mo-invisibleoperators.html mo-invisibleoperators-ref.html
== mo-invisibleoperators-2.html mo-invisibleoperators-2-ref.html
random-if(gtkWidget) == mo-glyph-size.html mo-glyph-size-ref.html # bug 1309426
@ -306,16 +306,12 @@ random-if(gtkWidget) == rowlines-3-2.html rowlines-3-2-ref.html # bug 1309426
!= op-dict-11.html op-dict-11-ref.html
== op-dict-12.html op-dict-12-ref.html
!= op-dict-13.html op-dict-13-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) == mfrac-A-1.html mfrac-A-1-ref.html
== mfrac-A-4.html mfrac-A-4-ref.html
== mfrac-A-5.html mfrac-A-5-ref.html
== mfrac-A-8.html mfrac-A-8-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) == mfrac-B-1.html mfrac-B-1-ref.html
== mfrac-B-2.html mfrac-B-2-3-ref.html
== mfrac-B-3.html mfrac-B-2-3-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) fuzzy(0-1,0-14) == mfrac-C-1.html mfrac-C-1-ref.html
== mfrac-C-2.html mfrac-C-2-ref.html
pref(mathml.mfrac_bevelled_attribute.disabled,false) fuzzy(0-1,0-14) == mfrac-D-1.html mfrac-D-1-ref.html
== mfrac-D-2.html mfrac-D-2-ref.html
== mfrac-E-1.html mfrac-E-1-ref.html
== shadow-dom-1.html shadow-dom-1-ref.html

View File

@ -58,18 +58,6 @@
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mphantom>
<mfrac bevelled="true">
<mn>82</mn>
<mn>28</mn>
</mfrac>
</mphantom>
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
@ -87,17 +75,5 @@
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mphantom>
<mfrac bevelled="true" linethickness="30px">
<mn>1473903823894702</mn>
<mn>2808472638402743</mn>
</mfrac>
</mphantom>
</math>
</td>
</table>
</body>
</html>

View File

@ -55,16 +55,6 @@
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac bevelled="true">
<mn>82</mn>
<mn>28</mn>
</mfrac>
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
@ -82,15 +72,5 @@
</math>
</td>
</table>
<table>
<td>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac bevelled="true" linethickness="30px">
<mn>1473903823894702</mn>
<mn>2808472638402743</mn>
</mfrac>
</math>
</td>
</table>
</body>
</html>

View File

@ -8710,12 +8710,6 @@
value: @IS_NIGHTLY_BUILD@
mirror: always
# Whether to disable the mfrac bevelled attribute.
- name: mathml.mfrac_bevelled_attribute.disabled
type: bool
value: true
mirror: always
# Whether to disable the scriptminsize attribute.
# Note that this only disables parsing, not the default effect when no attribute
# is unspecified.

View File

@ -1 +1 @@
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, mathml.mfrac_bevelled_attribute.disabled: true, mathml.mfenced_element.disabled: true, layout.css.math-style.enabled: true]
prefs: [mathml.scriptsizemultiplier_attribute.disabled: true, mathml.scriptminsize_attribute.disabled: true, mathml.mathspace_names.disabled: true, mathml.mfenced_element.disabled: true, layout.css.math-style.enabled: true]