Bug 1000879 - Remove the ::-moz-math-stretchy pseudo-element. r=karl, roc

This commit is contained in:
Frédéric Wang 2014-04-24 21:30:00 +02:00
parent 024abcbb26
commit 7a5fdadd38
13 changed files with 15 additions and 92 deletions

View File

@ -196,42 +196,8 @@ mtable[frame="dashed"] > mtr > mtd:last-child {
}
/**************************************************************************/
/* Style used for stretchy symbols *must* be normal to avoid misaligments */
/* By leaving the font-family empty, the MathML engine will use the value
provided by the mathfont-family property in the mathfont.properties file
or the value of the user's pref("font.mathfont-family", "...").
Authors can make elements on a document to be stretched with different
fonts, e.g.,
To request the use of STIX fonts, you can add a <style>...</style> with:
<mo myfonts="stix">...</mo> with the associated CSS declaration
mo[myfonts="stix"]::-moz-math-stretchy {
font-family: STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral;
}
To request the use of Asana fonts, you can add a <style>...</style> with:
<mo myfonts="asana">...</mo> with the associated CSS declaration
mo[myfonts="asana"]::-moz-math-stretchy {
font-family: Asana Math;
}
Of course, if you just want all of the stretchy characters in your
document to be stretched with your preferred list, you can just do:
::-moz-math-stretchy {
font-family: [your-particular-list]
}
Note that like other fonts in the document, users can override this by
clicking the pref to override document fonts.
/**************************************************************************/
::-moz-math-stretchy {
font-style: normal;
font-family: serif; /* an empty family is ignored as an error and behaves like inherit */
/* background-color: #3C6; */
}
/* Don't actually style -moz-math-anonymous by default */
/* This rule is used to give a style context suitable for nsMathMLChars.
We don't actually style -moz-math-anonymous by default. */
/*
::-moz-math-anonymous {
}

View File

@ -79,11 +79,9 @@ nsMathMLFrame::UpdatePresentationData(uint32_t aFlagsValues,
nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aParentStyleContext,
nsMathMLChar* aMathMLChar,
bool aIsMutableChar)
nsMathMLChar* aMathMLChar)
{
nsCSSPseudoElements::Type pseudoType = (aIsMutableChar) ?
nsCSSPseudoElements::ePseudo_mozMathStretchy :
nsCSSPseudoElements::Type pseudoType =
nsCSSPseudoElements::ePseudo_mozMathAnonymous; // savings
nsRefPtr<nsStyleContext> newStyleContext;
newStyleContext = aPresContext->StyleSet()->

View File

@ -111,8 +111,7 @@ public:
ResolveMathMLCharStyle(nsPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aParenStyleContext,
nsMathMLChar* aMathMLChar,
bool aIsMutableChar);
nsMathMLChar* aMathMLChar);
// helper to get the mEmbellishData of a frame
// The MathML REC precisely defines an "embellished operator" as:

View File

@ -428,25 +428,6 @@ nsMathMLOperators::LookupOperators(const nsString& aOperator,
}
}
bool
nsMathMLOperators::IsMutableOperator(const nsString& aOperator)
{
if (!gGlobalsInitialized) {
InitGlobals();
}
// lookup all the variants of the operator and return true if there
// is a variant that is stretchy or largeop
nsOperatorFlags flags[4];
float lspace[4], rspace[4];
nsMathMLOperators::LookupOperators(aOperator, flags, lspace, rspace);
nsOperatorFlags allFlags =
flags[NS_MATHML_OPERATOR_FORM_INFIX] |
flags[NS_MATHML_OPERATOR_FORM_POSTFIX] |
flags[NS_MATHML_OPERATOR_FORM_PREFIX];
return NS_MATHML_OPERATOR_IS_STRETCHY(allFlags) ||
NS_MATHML_OPERATOR_IS_LARGEOP(allFlags);
}
/* static */ bool
nsMathMLOperators::IsMirrorableOperator(const nsString& aOperator)
{

View File

@ -92,11 +92,6 @@ public:
float* aLeadingSpace,
float* aTrailingSpace);
// IsMutableOperator:
// Return true if the operator exists and is stretchy or largeop
static bool
IsMutableOperator(const nsString& aOperator);
// Helper functions used by the nsMathMLChar class.
static bool
IsMirrorableOperator(const nsString& aOperator);

View File

@ -72,9 +72,7 @@ nsresult nsMathMLmencloseFrame::AllocateMathMLChar(nsMencloseNotation mask)
nsPresContext *presContext = PresContext();
mMathMLChar[i].SetData(presContext, Char);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext,
&mMathMLChar[i],
true);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar[i]);
return NS_OK;
}

View File

@ -97,7 +97,6 @@ void
nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext)
{
nsAutoString value;
bool isMutable = false;
//////////////
// see if the opening fence is there ...
@ -110,8 +109,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext)
if (!value.IsEmpty()) {
mOpenChar = new nsMathMLChar;
mOpenChar->SetData(aPresContext, value);
isMutable = nsMathMLOperators::IsMutableOperator(value);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mOpenChar, isMutable);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mOpenChar);
}
//////////////
@ -125,8 +123,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext)
if (!value.IsEmpty()) {
mCloseChar = new nsMathMLChar;
mCloseChar->SetData(aPresContext, value);
isMutable = nsMathMLOperators::IsMutableOperator(value);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mCloseChar, isMutable);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, mCloseChar);
}
//////////////
@ -146,14 +143,12 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext)
for (int32_t i = 0; i < sepCount; i++) {
if (i < mSeparatorsCount) {
sepChar = value[i];
isMutable = nsMathMLOperators::IsMutableOperator(sepChar);
}
else {
sepChar = value[mSeparatorsCount-1];
// keep the value of isMutable that was set earlier
}
mSeparatorsChar[i].SetData(aPresContext, sepChar);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mSeparatorsChar[i], isMutable);
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mSeparatorsChar[i]);
}
mSeparatorsCount = sepCount;
} else {

View File

@ -136,7 +136,7 @@ nsMathMLmoFrame::ProcessTextData()
if (mFrames.GetLength() != 1) {
data.Truncate(); // empty data to reset the char
mMathMLChar.SetData(presContext, data);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar, false);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar);
return;
}
@ -192,7 +192,7 @@ nsMathMLmoFrame::ProcessTextData()
if (isMutable)
mFlags |= NS_MATHML_OPERATOR_MUTABLE;
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar, isMutable);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mMathMLChar);
}
// get our 'form' and lookup in the Operator Dictionary to fetch

View File

@ -59,7 +59,7 @@ nsMathMLmrootFrame::Init(nsIContent* aContent,
// up-to-date if dynamic changes arise.
nsAutoString sqrChar; sqrChar.Assign(kSqrChar);
mSqrChar.SetData(presContext, sqrChar);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mSqrChar, true);
ResolveMathMLCharStyle(presContext, mContent, mStyleContext, &mSqrChar);
}
NS_IMETHODIMP

View File

@ -12,10 +12,6 @@
font-family: stretchy;
font-size: 10px;
}
::-moz-math-stretchy {
font-family: stretchy;
font-size: 10px;
}
</style>
</head>
<body>

View File

@ -12,10 +12,6 @@
font-family: stretchy;
font-size: 10px;
}
::-moz-math-stretchy {
font-family: stretchy;
font-size: 10px;
}
</style>
</head>
<body>

View File

@ -35,7 +35,7 @@ skip-if(B2G) fails-if(smallScreen&&Android) fuzzy(255,200) == mirror-op-1.html m
== mfenced-7.html mfenced-7-ref.html
!= mfenced-8.html mfenced-8-ref.html
== mfenced-9.html mfenced-9-ref.html
fails-if(winWidget) == mfenced-10.html mfenced-10-ref.html
== mfenced-10.html mfenced-10-ref.html
== mi-mathvariant-1.xhtml mi-mathvariant-1-ref.xhtml
== mi-mathvariant-2.xhtml mi-mathvariant-2-ref.xhtml
!= non-spacing-accent-1.xhtml non-spacing-accent-1-ref.xhtml
@ -68,7 +68,7 @@ skip-if(B2G) == quotes-1.xhtml quotes-1-ref.xhtml
== embellished-op-4-3.html embellished-op-4-3-ref.html
== embellished-op-5-1.html embellished-op-5-ref.html
== embellished-op-5-2.html embellished-op-5-ref.html
== semantics-1.xhtml semantics-1-ref.xhtml
fails-if(winWidget&&!/^Windows\x20NT\x205\.1/.test(http.oscpu)) == semantics-1.xhtml semantics-1-ref.xhtml # Windows versions with Cambria Math
== semantics-2.html semantics-2-ref.html
== semantics-3.html semantics-3-ref.html
!= mathcolor-1.xml mathcolor-1-ref.xml
@ -182,7 +182,7 @@ fails-if(B2G) == menclose-2-box.html menclose-2-box-ref.html # B2G slight thickn
== menclose-2-downdiagonalstrike.html menclose-2-downdiagonalstrike-ref.html
== menclose-2-horizontalstrike.html menclose-2-horizontalstrike-ref.html
fails-if(B2G) == menclose-2-left.html menclose-2-left-ref.html # B2G slight thickness variation
== menclose-2-longdiv.html menclose-2-longdiv-ref.html
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == menclose-2-longdiv.html menclose-2-longdiv-ref.html # Windows versions without Cambria Math
== menclose-2-right.html menclose-2-right-ref.html
fails-if(B2G) == menclose-2-roundedbox.html menclose-2-roundedbox-ref.html # B2G slight thickness variation
fails-if(B2G) == menclose-2-top.html menclose-2-top-ref.html # B2G slight thickness variation

View File

@ -48,7 +48,6 @@ CSS_PSEUDO_ELEMENT(mozFocusOuter, ":-moz-focus-outer", 0)
CSS_PSEUDO_ELEMENT(mozListBullet, ":-moz-list-bullet", 0)
CSS_PSEUDO_ELEMENT(mozListNumber, ":-moz-list-number", 0)
CSS_PSEUDO_ELEMENT(mozMathStretchy, ":-moz-math-stretchy", 0)
CSS_PSEUDO_ELEMENT(mozMathAnonymous, ":-moz-math-anonymous", 0)
// HTML5 Forms pseudo elements