From e320553e23f2dc1ad9f407101fa711a112739fde Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Tue, 5 Aug 2003 02:07:14 +0000 Subject: [PATCH] Sync the handling of stretchy MathML frames with the new ::-moz notation, b=214989, r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@145578 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/public/nsCSSAnonBoxList.h | 6 ++++++ mozilla/layout/base/nsCSSFrameConstructor.cpp | 2 +- .../layout/html/style/src/nsCSSFrameConstructor.cpp | 2 +- mozilla/layout/mathml/base/src/nsMathMLChar.cpp | 6 +++--- mozilla/layout/mathml/base/src/nsMathMLFrame.cpp | 9 +++++---- mozilla/layout/mathml/content/src/mathml.css | 12 ++++++------ mozilla/layout/mathml/content/src/nsMathMLAtomList.h | 3 --- mozilla/layout/style/nsCSSAnonBoxList.h | 6 ++++++ 8 files changed, 28 insertions(+), 18 deletions(-) diff --git a/mozilla/content/shared/public/nsCSSAnonBoxList.h b/mozilla/content/shared/public/nsCSSAnonBoxList.h index e74c3ae672d..8ddf6ed87dd 100644 --- a/mozilla/content/shared/public/nsCSSAnonBoxList.h +++ b/mozilla/content/shared/public/nsCSSAnonBoxList.h @@ -103,3 +103,9 @@ CSS_ANON_BOX(moztreeseparator, ":-moz-tree-separator") CSS_ANON_BOX(moztreedropfeedback, ":-moz-tree-drop-feedback") CSS_ANON_BOX(moztreeprogressmeter, ":-moz-tree-progressmeter") #endif + +#ifdef MOZ_MATHML +CSS_ANON_BOX(mozMathStretchy, ":-moz-math-stretchy") +CSS_ANON_BOX(mozMathAnonymous, ":-moz-math-anonymous") +CSS_ANON_BOX(mozMathInline, ":-moz-math-inline") +#endif diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 3805c460902..a07e3d09189 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -6732,7 +6732,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, if (NS_FAILED(rv)) return rv; nsRefPtr mrowContext; mrowContext = aPresContext->ResolvePseudoStyleContextFor(aContent, - nsMathMLAtoms::mozMathInline, + nsCSSAnonBoxes::mozMathInline, parentContext); InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame, mrowContext, nsnull, newFrame); diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 3805c460902..a07e3d09189 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -6732,7 +6732,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell, if (NS_FAILED(rv)) return rv; nsRefPtr mrowContext; mrowContext = aPresContext->ResolvePseudoStyleContextFor(aContent, - nsMathMLAtoms::mozMathInline, + nsCSSAnonBoxes::mozMathInline, parentContext); InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame, mrowContext, nsnull, newFrame); diff --git a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp index 3613252e8c6..f431fefd1d2 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp @@ -897,7 +897,7 @@ nsGlyphTableList::GetListFor(nsIPresContext* aPresContext, nsFont* aFont, nsVoidArray* aGlyphTableList) { - // @see the documentation of -moz-math-font-style-stretchy in mathml.css + // @see the documentation of -moz-math-stretchy in mathml.css // for how this work aGlyphTableList->Clear(); PRBool useDocumentFonts = PR_TRUE; @@ -905,7 +905,7 @@ nsGlyphTableList::GetListFor(nsIPresContext* aPresContext, // Check to honor the pref("browser.display.use_document_fonts", 0) // Only include fonts from CSS if the pref to disallow authors' fonts isn't set if (useDocumentFonts) { - // Convert the list of fonts in aFont (from -moz-math-font-style-stretchy) + // Convert the list of fonts in aFont (from -moz-math-stretchy) // to an ordered list of corresponding glyph extension tables StretchyFontEnumContext context = {aPresContext, aChar, aGlyphTableList}; aFont->EnumerateFamilies(StretchyFontEnumCallback, &context); @@ -1373,7 +1373,7 @@ nsMathMLChar::SetData(nsIPresContext* aPresContext, 2) We search for the first larger variant of the char that fits the container' size. We search fonts for larger variants in the order specified in the list of stretchy fonts held by the leaf style - context (from -moz-math-font-style-stretchy in mathml.css). + context (from -moz-math-stretchy in mathml.css). Issues : a) the largeop and display settings determine the starting size when we do the above search, regardless of whether diff --git a/mozilla/layout/mathml/base/src/nsMathMLFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLFrame.cpp index 16e3e8ae00d..33495d9f9e3 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLFrame.cpp @@ -22,6 +22,7 @@ #include "nsINameSpaceManager.h" #include "nsMathMLFrame.h" #include "nsMathMLChar.h" +#include "nsCSSAnonBoxes.h" // used to map attributes into CSS rules #include "nsIDocument.h" @@ -112,11 +113,11 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsIPresContext* aPresContext, nsMathMLChar* aMathMLChar, PRBool aIsMutableChar) { - nsIAtom* fontAtom = (aIsMutableChar) ? - nsMathMLAtoms::fontstyle_stretchy : - nsMathMLAtoms::fontstyle_anonymous; // savings + nsIAtom* pseudoStyle = (aIsMutableChar) ? + nsCSSAnonBoxes::mozMathStretchy : + nsCSSAnonBoxes::mozMathAnonymous; // savings nsRefPtr newStyleContext; - newStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent, fontAtom, + newStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent, pseudoStyle, aParentStyleContext); if (newStyleContext) aMathMLChar->SetStyleContext(newStyleContext); diff --git a/mozilla/layout/mathml/content/src/mathml.css b/mozilla/layout/mathml/content/src/mathml.css index 5a20b3d0074..ce5d9a297d1 100644 --- a/mozilla/layout/mathml/content/src/mathml.css +++ b/mozilla/layout/mathml/content/src/mathml.css @@ -44,7 +44,7 @@ math[mode="display"], math[display="block"] { display: block; text-align: -moz-center; } -:-moz-math-inline { +::-moz-math-inline { display: inline; } @@ -390,19 +390,19 @@ mtd[-moz-math-columnline="dashed"] { To request the use of TeX fonts, you can add a with: ... with the associated CSS declaration - mo[myfonts="tex"]:-moz-math-font-style-stretchy { + mo[myfonts="tex"]::-moz-math-stretchy { font-family: CMSY10, CMEX10; } To request the use of Mathematica fonts, you can add a with: ... with the associated CSS declaration - mo[myfonts="mathematica"]:-moz-math-font-style-stretchy { + mo[myfonts="mathematica"]::-moz-math-stretchy { font-family: Math1, Math2, Math4; } 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-font-style-stretchy { + ::-moz-math-stretchy { font-family: [your-particular-list] } @@ -410,12 +410,12 @@ mtd[-moz-math-columnline="dashed"] { clicking the pref to override document fonts. /**************************************************************************/ -:-moz-math-font-style-stretchy { +::-moz-math-stretchy { font-style: normal; font-family: serif; /* background-color: #3C6; */ } -:-moz-math-font-style-anonymous { +::-moz-math-anonymous { } /**********************************************************************/ diff --git a/mozilla/layout/mathml/content/src/nsMathMLAtomList.h b/mozilla/layout/mathml/content/src/nsMathMLAtomList.h index 86c61addafd..b623748ba8d 100644 --- a/mozilla/layout/mathml/content/src/nsMathMLAtomList.h +++ b/mozilla/layout/mathml/content/src/nsMathMLAtomList.h @@ -40,15 +40,12 @@ MATHML_ATOM(fontsize, "-moz-math-font-size") // different from fontsize_ MATHML_ATOM(fontstyle, "-moz-math-font-style") // different from fontstyle_ -MATHML_ATOM(fontstyle_stretchy, ":-moz-math-font-style-stretchy") -MATHML_ATOM(fontstyle_anonymous, ":-moz-math-font-style-anonymous") MATHML_ATOM(rowline, "-moz-math-rowline") // different from rowlines_ MATHML_ATOM(columnline, "-moz-math-columnline") // different from columnlines_ MATHML_ATOM(firstrow, "-moz-math-firstrow") MATHML_ATOM(lastrow, "-moz-math-lastrow") MATHML_ATOM(firstcolumn, "-moz-math-firstcolumn") MATHML_ATOM(lastcolumn, "-moz-math-lastcolumn") -MATHML_ATOM(mozMathInline, ":-moz-math-inline") // Alphabetical list of MathML frame types MATHML_ATOM(operatorVisibleMathMLFrame, "OperatorVisibleMathMLFrame") diff --git a/mozilla/layout/style/nsCSSAnonBoxList.h b/mozilla/layout/style/nsCSSAnonBoxList.h index e74c3ae672d..8ddf6ed87dd 100644 --- a/mozilla/layout/style/nsCSSAnonBoxList.h +++ b/mozilla/layout/style/nsCSSAnonBoxList.h @@ -103,3 +103,9 @@ CSS_ANON_BOX(moztreeseparator, ":-moz-tree-separator") CSS_ANON_BOX(moztreedropfeedback, ":-moz-tree-drop-feedback") CSS_ANON_BOX(moztreeprogressmeter, ":-moz-tree-progressmeter") #endif + +#ifdef MOZ_MATHML +CSS_ANON_BOX(mozMathStretchy, ":-moz-math-stretchy") +CSS_ANON_BOX(mozMathAnonymous, ":-moz-math-anonymous") +CSS_ANON_BOX(mozMathInline, ":-moz-math-inline") +#endif