From 80299f60247a22469f274a56e8b086f60a319c0a Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Mon, 10 Jul 2000 13:57:52 +0000 Subject: [PATCH] [not part of default build] Some updates in the land of stretchy chars. partial fix for b:45010 git-svn-id: svn://10.0.0.236/trunk@73912 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/mathml/base/src/nsMathMLChar.cpp | 56 ++-- .../layout/mathml/base/src/nsMathMLCharList.h | 283 +++++++++--------- .../mathml/base/src/nsMathMLmfencedFrame.cpp | 31 +- .../mathml/base/src/nsMathMLmoFrame.cpp | 1 + .../mathml/base/src/nsMathMLmsqrtFrame.cpp | 1 + 5 files changed, 190 insertions(+), 182 deletions(-) diff --git a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp index ecf104e540a..7377b79c40e 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp @@ -303,7 +303,7 @@ nsGlyphTable::DrawGlyph(nsIRenderingContext& aRenderingContext, } } -// Class used to walk/try all the the glyph tables that we have. +// Class used to walk/try all the glyph tables that we have. // Glyph tables are singly linked together through their next-table pointer. // ----------------------------------------------------------------------------------- @@ -575,6 +575,7 @@ void InitGlobals(nsIPresContext* aPresContext) #endif } + // ----------------------------------------------------------------------------------- // And now the implementation of nsMathMLChar @@ -621,27 +622,40 @@ nsMathMLChar::SetData(nsIPresContext* aPresContext, // lookup the enum ... if (1 == mData.Length()) { PRUnichar ch = mData[0]; - for (PRInt32 i = 0; i < eMathMLChar_COUNT; i++) { - if (ch == gCharInfo[i].mUnicode) { - // found ... - mEnum = nsMathMLCharEnum(i); - mDirection = gCharInfo[i].mDirection; - if (mDirection != NS_STRETCH_DIRECTION_UNSUPPORTED) { - // ... now see if there is a glyph table for us - mGlyphTable = gGlyphTableList.FindTableFor(mEnum); - // don't bother with the stretching if there is no glyph table for us... - if (!mGlyphTable) { - gCharInfo[i].mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED; // update to never try again - mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED; - mEnum = eMathMLChar_DONT_STRETCH; - } -#ifdef NS_DEBUG - // hitting this assertion? - // check nsMathMLCharList to ensure that enum and Unicode (of size0) match in MATHML_CHAR(index, enum, ...) - else NS_ASSERTION(mGlyphTable->Has(nsGlyphCode(mData[0])), "Something is wrong somewhere"); -#endif + PRInt32 i = eMathMLChar_COUNT; + // binary search + PRInt32 low = 0; + PRInt32 high = eMathMLChar_COUNT-1; + while (low <= high) { + PRInt32 middle = (low + high) >> 1; + PRInt32 result = (PRInt32)ch - (PRInt32)gCharInfo[middle].mUnicode; + if (result == 0) { + i = middle; + break; + } + if (result > 0) + low = middle + 1; + else + high = middle - 1; + } + if (i != eMathMLChar_COUNT) { + // found ... + mEnum = nsMathMLCharEnum(i); + mDirection = gCharInfo[i].mDirection; + if (mDirection != NS_STRETCH_DIRECTION_UNSUPPORTED) { + // ... now see if there is a glyph table for us + mGlyphTable = gGlyphTableList.FindTableFor(mEnum); + // don't bother with the stretching if there is no glyph table for us... + if (!mGlyphTable) { + gCharInfo[i].mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED; // update to never try again + mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED; + mEnum = eMathMLChar_DONT_STRETCH; } - return; +#ifdef NS_DEBUG + // hitting this assertion? + // check nsMathMLCharList to ensure that enum and Unicode (of size0) match in MATHML_CHAR(index, enum, ...) + else NS_ASSERTION(mGlyphTable->Has(nsGlyphCode(mData[0])), "Something is wrong somewhere"); +#endif } } } diff --git a/mozilla/layout/mathml/base/src/nsMathMLCharList.h b/mozilla/layout/mathml/base/src/nsMathMLCharList.h index 550fc391cd9..be65bf49591 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLCharList.h +++ b/mozilla/layout/mathml/base/src/nsMathMLCharList.h @@ -70,10 +70,10 @@ ******/ #if defined(WANT_CHAR_ENUM) - #define MATHML_CHAR(_enum, _unicode, _direction) eMathMLChar_##_enum, + #define MATHML_CHAR(_unicode, _enum, _direction) eMathMLChar_##_enum, #elif defined(WANT_CHAR_INFO) - #define MATHML_CHAR(_enum, _unicode, _direction) {_unicode, _direction, nsnull}, + #define MATHML_CHAR(_unicode, _enum, _direction) {_unicode, _direction, nsnull}, #elif defined(WANT_CHAR_DATA) #define MATHML_CHAR(_index, _enum, _parts, _sizes) {eMathMLChar_##_enum, _index}, @@ -91,154 +91,145 @@ #define STRETCH_HORIZONTAL NS_STRETCH_DIRECTION_HORIZONTAL #define STRETCH_VERTICAL NS_STRETCH_DIRECTION_VERTICAL -// List of all strecthy chars from the MathML's Operator Dictionary ------------------ -// ----------------------------------------------------------------------------------- - -MATHML_CHAR(LeftParenthesis, '(' , STRETCH_VERTICAL) -MATHML_CHAR(RightParenthesis, ')' , STRETCH_VERTICAL) -MATHML_CHAR(LeftSquareBracket, '[' , STRETCH_VERTICAL) -MATHML_CHAR(RightSquareBracket, ']' , STRETCH_VERTICAL) -MATHML_CHAR(LeftCurlyBracket, '{' , STRETCH_VERTICAL) -MATHML_CHAR(RightCurlyBracket, '}' , STRETCH_VERTICAL) -MATHML_CHAR(VertBar, 0x007C, STRETCH_VERTICAL) // '|' -MATHML_CHAR(Integral, 0x222B, STRETCH_VERTICAL) -MATHML_CHAR(DownArrow, 0x2193, STRETCH_VERTICAL) -MATHML_CHAR(UpArrow, 0x2191, STRETCH_VERTICAL) -MATHML_CHAR(LeftArrow, 0x2190, STRETCH_HORIZONTAL) -MATHML_CHAR(RightArrow, 0x2192, STRETCH_HORIZONTAL) -MATHML_CHAR(OverBar, 0x00AF, STRETCH_HORIZONTAL) -MATHML_CHAR(Sqrt, 0x221A, STRETCH_VERTICAL) -MATHML_CHAR(LeftAngleBracket, 0x3008, STRETCH_VERTICAL) -MATHML_CHAR(LeftBracketingBar, 0xF603, STRETCH_VERTICAL) -MATHML_CHAR(LeftCeiling, 0x2308, STRETCH_VERTICAL) -MATHML_CHAR(LeftDoubleBracket, 0x301A, STRETCH_VERTICAL) -MATHML_CHAR(LeftDoubleBracketingBar, 0xF605, STRETCH_VERTICAL) -MATHML_CHAR(LeftFloor, 0x230A, STRETCH_VERTICAL) -MATHML_CHAR(RightAngleBracket, 0x3009, STRETCH_VERTICAL) -MATHML_CHAR(RightBracketingBar, 0xF604, STRETCH_VERTICAL) -MATHML_CHAR(RightCeiling, 0x2309, STRETCH_VERTICAL) -MATHML_CHAR(RightDoubleBracket, 0x301B, STRETCH_VERTICAL) -MATHML_CHAR(RightDoubleBracketingBar, 0xF606, STRETCH_VERTICAL) -MATHML_CHAR(RightFloor, 0x230B, STRETCH_VERTICAL) -MATHML_CHAR(HorizontalLine, 0xE859, STRETCH_HORIZONTAL) -MATHML_CHAR(VerticalLine, 0xE85A, STRETCH_VERTICAL) -MATHML_CHAR(VerticalSeparator, 0xE85C, STRETCH_VERTICAL) -MATHML_CHAR(And, 0x2227, STRETCH_HORIZONTAL) -MATHML_CHAR(Or, 0x2228, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleLeftArrow, 0x21D0, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleLeftRightArrow, 0x21D4, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleRightArrow, 0x21D2, STRETCH_HORIZONTAL) -MATHML_CHAR(DownLeftRightVector, 0xF50B, STRETCH_VERTICAL) -MATHML_CHAR(DownLeftTeeVector, 0xF50E, STRETCH_VERTICAL) -MATHML_CHAR(DownLeftVector, 0x21BD, STRETCH_VERTICAL) -MATHML_CHAR(DownLeftVectorBar, 0xF50C, STRETCH_VERTICAL) -MATHML_CHAR(DownRightTeeVector, 0xF50F, STRETCH_VERTICAL) -MATHML_CHAR(DownRightVector, 0x21C1, STRETCH_VERTICAL) -MATHML_CHAR(DownRightVectorBar, 0xF50D, STRETCH_VERTICAL) -MATHML_CHAR(LeftArrowBar, 0x21E4, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftArrowRightArrow, 0x21C6, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftRightArrow, 0x2194, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftRightVector, 0xF505, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftTeeArrow, 0x21A4, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftTeeVector, 0xF509, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftVector, 0x21BC, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftVectorBar, 0xF507, STRETCH_HORIZONTAL) -MATHML_CHAR(LowerLeftArrow, 0x2199, STRETCH_HORIZONTAL) -MATHML_CHAR(LowerRightArrow, 0x2198, STRETCH_HORIZONTAL) -MATHML_CHAR(RightArrowBar, 0x21E5, STRETCH_HORIZONTAL) -MATHML_CHAR(RightArrowLeftArrow, 0x21C4, STRETCH_HORIZONTAL) -MATHML_CHAR(RightTeeArrow, 0x21A6, STRETCH_HORIZONTAL) -MATHML_CHAR(RightTeeVector, 0xF50A, STRETCH_HORIZONTAL) -MATHML_CHAR(RightVector, 0x21C0, STRETCH_HORIZONTAL) -MATHML_CHAR(RightVectorBar, 0xF508, STRETCH_HORIZONTAL) -MATHML_CHAR(UpperLeftArrow, 0x2196, STRETCH_VERTICAL) -MATHML_CHAR(UpperRightArrow, 0x2197, STRETCH_VERTICAL) -MATHML_CHAR(Equilibrium, 0x21CC, STRETCH_HORIZONTAL) -MATHML_CHAR(ReverseEquilibrium, 0x21CB, STRETCH_HORIZONTAL) -MATHML_CHAR(SquareUnion, 0x2294, STRETCH_VERTICAL) -MATHML_CHAR(Union, 0x22C3, STRETCH_VERTICAL) -MATHML_CHAR(UnionPlus, 0x228E, STRETCH_VERTICAL) -MATHML_CHAR(Intersection, 0x22C2, STRETCH_VERTICAL) -MATHML_CHAR(SquareIntersection, 0x2293, STRETCH_VERTICAL) -MATHML_CHAR(Vee, 0x22C1, STRETCH_VERTICAL) -MATHML_CHAR(Sum, 0x2211, STRETCH_VERTICAL) -MATHML_CHAR(ClockwiseContourIntegral, 0x2232, STRETCH_VERTICAL) -MATHML_CHAR(ContourIntegral, 0x222E, STRETCH_VERTICAL) -MATHML_CHAR(CounterClockwiseContourIntegral, 0x2233, STRETCH_VERTICAL) -MATHML_CHAR(DoubleContourIntegral, 0x222F, STRETCH_VERTICAL) -MATHML_CHAR(Wedge, 0x22C0, STRETCH_VERTICAL) -MATHML_CHAR(Coproduct, 0x2210, STRETCH_VERTICAL) -MATHML_CHAR(Product, 0x220F, STRETCH_VERTICAL) -MATHML_CHAR(Backslash, 0x2216, STRETCH_VERTICAL) -MATHML_CHAR(Slash, '/' , STRETCH_VERTICAL) -MATHML_CHAR(DoubleDownArrow, 0x21D3, STRETCH_VERTICAL) -MATHML_CHAR(DoubleLongLeftArrow, 0xE200, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleLongLeftRightArrow, 0xE202, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleLongRightArrow, 0xE204, STRETCH_HORIZONTAL) -MATHML_CHAR(DoubleUpArrow, 0x21D1, STRETCH_VERTICAL) -MATHML_CHAR(DoubleUpDownArrow, 0x21D5, STRETCH_VERTICAL) -MATHML_CHAR(DownArrowBar, 0xF504, STRETCH_VERTICAL) -MATHML_CHAR(DownArrowUpArrow, 0xE216, STRETCH_VERTICAL) -MATHML_CHAR(DownTeeArrow, 0x21A7, STRETCH_VERTICAL) -MATHML_CHAR(LeftDownTeeVector, 0xF519, STRETCH_VERTICAL) -MATHML_CHAR(LeftDownVector, 0x21C3, STRETCH_VERTICAL) -MATHML_CHAR(LeftDownVectorBar, 0xF517, STRETCH_VERTICAL) -MATHML_CHAR(LeftUpDownVector, 0xF515, STRETCH_VERTICAL) -MATHML_CHAR(LeftUpTeeVector, 0xF518, STRETCH_VERTICAL) -MATHML_CHAR(LeftUpVector, 0x21BF, STRETCH_VERTICAL) -MATHML_CHAR(LeftUpVectorBar, 0xF516, STRETCH_VERTICAL) -MATHML_CHAR(LongLeftArrow, 0xE201, STRETCH_HORIZONTAL) -MATHML_CHAR(LongLeftRightArrow, 0xE203, STRETCH_HORIZONTAL) -MATHML_CHAR(LongRightArrow, 0xE205, STRETCH_HORIZONTAL) -MATHML_CHAR(ReverseUpEquilibrium, 0xE217, STRETCH_VERTICAL) -MATHML_CHAR(RightDownTeeVector, 0xF514, STRETCH_VERTICAL) -MATHML_CHAR(RightDownVector, 0x21C2, STRETCH_VERTICAL) -MATHML_CHAR(RightDownVectorBar, 0xF512, STRETCH_VERTICAL) -MATHML_CHAR(RightUpDownVector, 0xF510, STRETCH_VERTICAL) -MATHML_CHAR(RightUpTeeVector, 0xF513, STRETCH_VERTICAL) -MATHML_CHAR(RightUpVector, 0x21BE, STRETCH_VERTICAL) -MATHML_CHAR(RightUpVectorBar, 0xF511, STRETCH_VERTICAL) -MATHML_CHAR(UpArrowBar, 0xF503, STRETCH_VERTICAL) -MATHML_CHAR(UpArrowDownArrow, 0x21C5, STRETCH_VERTICAL) -MATHML_CHAR(UpDownArrow, 0x2195, STRETCH_VERTICAL) -MATHML_CHAR(UpEquilibrium, 0xE218, STRETCH_VERTICAL) -MATHML_CHAR(UpTeeArrow, 0x21A5, STRETCH_VERTICAL) -MATHML_CHAR(DiacriticalTilde, 0x02DC, STRETCH_HORIZONTAL) -MATHML_CHAR(Hacek, 0x02C7, STRETCH_HORIZONTAL) -MATHML_CHAR(Hat, 0x0302, STRETCH_HORIZONTAL) -MATHML_CHAR(OverCurlyBracket, 0xF612, STRETCH_HORIZONTAL) -MATHML_CHAR(OverSquareBracket, 0xF614, STRETCH_HORIZONTAL) -MATHML_CHAR(OverParenthesis, 0xF610, STRETCH_HORIZONTAL) -MATHML_CHAR(UnderBar, 0x0332, STRETCH_HORIZONTAL) -MATHML_CHAR(UnderCurlyBracket, 0xF613, STRETCH_HORIZONTAL) -MATHML_CHAR(UnderSquareBracket, 0xF615, STRETCH_HORIZONTAL) -MATHML_CHAR(UnderParenthesis, 0xF611, STRETCH_HORIZONTAL) -MATHML_CHAR(CircleDot, 0x2299, STRETCH_VERTICAL) -MATHML_CHAR(CirclePlus, 0x2295, STRETCH_VERTICAL) -MATHML_CHAR(CircleMultiply, 0x2297, STRETCH_VERTICAL) -MATHML_CHAR(Tilde, 0x223C, STRETCH_HORIZONTAL) - -//UnionMultiply (UnionPlus?), 0x228E, STRETCH_VERTICAL, - -// Extra stretchy operators that are not in the MathML REC Operator Dictionary -// ----------------------------------------------------------------------------------- -// XXX For these extra to work, they must also be added in nsMathMLOperators -MATHML_CHAR(VerticalBar, 0x2223, STRETCH_VERTICAL) -MATHML_CHAR(DoubleVerticalBar, 0x2225, STRETCH_VERTICAL) -MATHML_CHAR(RightArrowAccent, 0x20D7, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftArrowAccent, 0x20D6, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftRightArrowAccent, 0x20E1, STRETCH_HORIZONTAL) -MATHML_CHAR(RightHarpoonAccent, 0x20D1, STRETCH_HORIZONTAL) -MATHML_CHAR(LeftHarpoonAccent, 0x20D0, STRETCH_HORIZONTAL) - - +// List of all strecthy chars -------------------------------------------------------- +// Includes extra stretchy operators that are not in the MathML REC Operator Dictionary +// The list is *sorted* so that we can use binary search for quick lookup. +// For stretching to work, chars must also be added in nsMathMLOperators. // Duplicate stretchy chars (i.e., with same Unicode points) that are in the // MathML REC Operator Dictionary shouldn't be added to the list, otherwise // they get different enums and these play havoc with the setup // ----------------------------------------------------------------------------------- -// These should not be added to the list -//MATHML_CHAR(Implies, 0x21D2, STRETCH_HORIZONTAL), see DoubleRightArrow +MATHML_CHAR(0x0028, LeftParenthesis, STRETCH_VERTICAL) +MATHML_CHAR(0x0029, RightParenthesis, STRETCH_VERTICAL) +MATHML_CHAR(0x002F, Slash, STRETCH_VERTICAL) +MATHML_CHAR(0x005B, LeftSquareBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x005D, RightSquareBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x007B, LeftCurlyBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x007C, VertBar, STRETCH_VERTICAL) // '|' +MATHML_CHAR(0x007D, RightCurlyBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x00AF, OverBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0x02C7, Hacek, STRETCH_HORIZONTAL) +MATHML_CHAR(0x02DC, DiacriticalTilde, STRETCH_HORIZONTAL) +MATHML_CHAR(0x0302, Hat, STRETCH_HORIZONTAL) +MATHML_CHAR(0x0332, UnderBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0x20D0, LeftHarpoonAccent, STRETCH_HORIZONTAL) +MATHML_CHAR(0x20D1, RightHarpoonAccent, STRETCH_HORIZONTAL) +MATHML_CHAR(0x20D6, LeftArrowAccent, STRETCH_HORIZONTAL) +MATHML_CHAR(0x20D7, RightArrowAccent, STRETCH_HORIZONTAL) +MATHML_CHAR(0x20E1, LeftRightArrowAccent, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2190, LeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2191, UpArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x2192, RightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2193, DownArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x2194, LeftRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2195, UpDownArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x2196, UpperLeftArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x2197, UpperRightArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x2198, LowerRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2199, LowerLeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21A4, LeftTeeArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21A5, UpTeeArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21A6, RightTeeArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21A7, DownTeeArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21BC, LeftVector, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21BD, DownLeftVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21BE, RightUpVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21BF, LeftUpVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21C0, RightVector, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21C1, DownRightVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21C2, RightDownVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21C3, LeftDownVector, STRETCH_VERTICAL) +MATHML_CHAR(0x21C4, RightArrowLeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21C5, UpArrowDownArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21C6, LeftArrowRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21CB, ReverseEquilibrium, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21CC, Equilibrium, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21D0, DoubleLeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21D1, DoubleUpArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21D2, DoubleRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21D3, DoubleDownArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21D4, DoubleLeftRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21D5, DoubleUpDownArrow, STRETCH_VERTICAL) +MATHML_CHAR(0x21E4, LeftArrowBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0x21E5, RightArrowBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0x220F, Product, STRETCH_VERTICAL) +MATHML_CHAR(0x2210, Coproduct, STRETCH_VERTICAL) +MATHML_CHAR(0x2211, Sum, STRETCH_VERTICAL) +MATHML_CHAR(0x2216, Backslash, STRETCH_VERTICAL) +MATHML_CHAR(0x221A, Sqrt, STRETCH_VERTICAL) +MATHML_CHAR(0x2223, VerticalBar, STRETCH_VERTICAL) +MATHML_CHAR(0x2225, DoubleVerticalBar, STRETCH_VERTICAL) +MATHML_CHAR(0x2227, And, STRETCH_HORIZONTAL) +MATHML_CHAR(0x2228, Or, STRETCH_HORIZONTAL) +MATHML_CHAR(0x222B, Integral, STRETCH_VERTICAL) +MATHML_CHAR(0x222E, ContourIntegral, STRETCH_VERTICAL) +MATHML_CHAR(0x222F, DoubleContourIntegral, STRETCH_VERTICAL) +MATHML_CHAR(0x2232, ClockwiseContourIntegral, STRETCH_VERTICAL) +MATHML_CHAR(0x2233, CounterClockwiseContourIntegral, STRETCH_VERTICAL) +MATHML_CHAR(0x223C, Tilde, STRETCH_HORIZONTAL) +MATHML_CHAR(0x228E, UnionPlus, STRETCH_VERTICAL) +MATHML_CHAR(0x2293, SquareIntersection, STRETCH_VERTICAL) +MATHML_CHAR(0x2294, SquareUnion, STRETCH_VERTICAL) +MATHML_CHAR(0x2295, CirclePlus, STRETCH_VERTICAL) +MATHML_CHAR(0x2297, CircleMultiply, STRETCH_VERTICAL) +MATHML_CHAR(0x2299, CircleDot, STRETCH_VERTICAL) +MATHML_CHAR(0x22C0, Wedge, STRETCH_VERTICAL) +MATHML_CHAR(0x22C1, Vee, STRETCH_VERTICAL) +MATHML_CHAR(0x22C2, Intersection, STRETCH_VERTICAL) +MATHML_CHAR(0x22C3, Union, STRETCH_VERTICAL) +MATHML_CHAR(0x2308, LeftCeiling, STRETCH_VERTICAL) +MATHML_CHAR(0x2309, RightCeiling, STRETCH_VERTICAL) +MATHML_CHAR(0x230A, LeftFloor, STRETCH_VERTICAL) +MATHML_CHAR(0x230B, RightFloor, STRETCH_VERTICAL) +MATHML_CHAR(0x3008, LeftAngleBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x3009, RightAngleBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x301A, LeftDoubleBracket, STRETCH_VERTICAL) +MATHML_CHAR(0x301B, RightDoubleBracket, STRETCH_VERTICAL) +MATHML_CHAR(0xE200, DoubleLongLeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE201, LongLeftArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE202, DoubleLongLeftRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE203, LongLeftRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE204, DoubleLongRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE205, LongRightArrow, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE216, DownArrowUpArrow, STRETCH_VERTICAL) +MATHML_CHAR(0xE217, ReverseUpEquilibrium, STRETCH_VERTICAL) +MATHML_CHAR(0xE218, UpEquilibrium, STRETCH_VERTICAL) +MATHML_CHAR(0xE859, HorizontalLine, STRETCH_HORIZONTAL) +MATHML_CHAR(0xE85A, VerticalLine, STRETCH_VERTICAL) +MATHML_CHAR(0xE85C, VerticalSeparator, STRETCH_VERTICAL) +MATHML_CHAR(0xF503, UpArrowBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF504, DownArrowBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF505, LeftRightVector, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF507, LeftVectorBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF508, RightVectorBar, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF509, LeftTeeVector, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF50A, RightTeeVector, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF50B, DownLeftRightVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF50C, DownLeftVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF50D, DownRightVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF50E, DownLeftTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF50F, DownRightTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF510, RightUpDownVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF511, RightUpVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF512, RightDownVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF513, RightUpTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF514, RightDownTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF515, LeftUpDownVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF516, LeftUpVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF517, LeftDownVectorBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF518, LeftUpTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF519, LeftDownTeeVector, STRETCH_VERTICAL) +MATHML_CHAR(0xF603, LeftBracketingBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF604, RightBracketingBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF605, LeftDoubleBracketingBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF606, RightDoubleBracketingBar, STRETCH_VERTICAL) +MATHML_CHAR(0xF610, OverParenthesis, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF611, UnderParenthesis, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF612, OverCurlyBracket, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF613, UnderCurlyBracket, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF614, OverSquareBracket, STRETCH_HORIZONTAL) +MATHML_CHAR(0xF615, UnderSquareBracket, STRETCH_HORIZONTAL) #undef STRETCH_UNSUPPORTED #undef STRETCH_HORIZONTAL @@ -317,7 +308,7 @@ MATHML_CHAR(144, CirclePlus, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x2295 _ MATHML_CHAR(152, CircleMultiply, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x2297 _ 0xE04E _ 0xE04F) MATHML_CHAR(160, Sum, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x2211 _ 0xE050 _ 0xE058) MATHML_CHAR(168, Product, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x220F _ 0xE051 _ 0xE059) -MATHML_CHAR(176, Slash, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, '/' _ 0xE02E _ 0xE09D _ 0xE08D _ 0xE02C) +MATHML_CHAR(176, Slash, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x002F _ 0xE02E _ 0xE09D _ 0xE08D _ 0xE02C) MATHML_CHAR(186, Union, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x22C3 _ 0xE053 _ 0xE05B) MATHML_CHAR(194, Intersection, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x22C2 _ 0xE054 _ 0xE05C) MATHML_CHAR(202, UnionPlus, 0x0000 _ 0x0000 _ 0x0000 _ 0x0000, 0x228E _ 0xE055 _ 0xE05D) diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 41719a1c48c..ace8b4eb601 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -449,6 +449,22 @@ nsMathMLmfencedFrame::ReflowChar(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize) { if (aMathMLChar && 0 < aMathMLChar->Length()) { + nsOperatorFlags aFlags; + float aLeftSpace = 0.0f; + float aRightSpace = 0.0f; + + nsAutoString aData; + aMathMLChar->GetData(aData); + aMathMLChar->SetData(aPresContext, aData); // XXX hack to reset the enum, bug 45010 + PRBool found = nsMathMLOperators::LookupOperator(aData, aForm, + &aFlags, &aLeftSpace, &aRightSpace); + + // If we don't want extra space when we are a script + if (found && aScriptLevel > 0) { + aLeftSpace /= 2.0f; + aRightSpace /= 2.0f; + } + // stretch the char to the appropriate height if it is not big enough. nsBoundingMetrics charSize; charSize.Clear(); // this will tell stretch that we don't know the default size @@ -473,21 +489,6 @@ nsMathMLmfencedFrame::ReflowChar(nsIPresContext* aPresContext, if (aDesiredSize.descent < charSize.descent) aDesiredSize.descent = charSize.descent; - nsOperatorFlags aFlags; - float aLeftSpace = 0.0f; - float aRightSpace = 0.0f; - - nsAutoString aData; - aMathMLChar->GetData(aData); - PRBool found = nsMathMLOperators::LookupOperator(aData, aForm, - &aFlags, &aLeftSpace, &aRightSpace); - - // If we don't want extra space when we are a script - if (found && aScriptLevel > 0) { - aLeftSpace /= 2.0f; - aRightSpace /= 2.0f; - } - // account the spacing charSize.width += NSToCoordRound((aLeftSpace + aRightSpace) * em); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp index 017bdba43fb..f3b22cab562 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -388,6 +388,7 @@ nsMathMLmoFrame::InitData(nsIPresContext* aPresContext) // Lookup the operator dictionary nsAutoString aData; mMathMLChar.GetData(aData); + mMathMLChar.SetData(aPresContext, aData); // XXX hack to reset the enum, bug 45010 PRBool found = nsMathMLOperators::LookupOperator(aData, aForm, &mFlags, &mLeftSpace, &mRightSpace); // All operators are symmetric. But this symmetric flag is *not* stored in diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp index 1acaff740f5..450847a6444 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp @@ -211,6 +211,7 @@ nsMathMLmsqrtFrame::Reflow(nsIPresContext* aPresContext, // height(radical) should be >= height(base) + psi + ruleThickness // however, nsMathMLChar will only try to meet this condition // with no guarantee. + mSqrChar.SetEnum(aPresContext, eMathMLChar_Sqrt); // XXX hack to reset the enum, bug 45010 mSqrChar.Stretch(aPresContext, renderingContext, NS_STRETCH_DIRECTION_VERTICAL, contSize, radicalSize,