RenderMathMLOperator.cpp [plain text]
#define _USE_MATH_DEFINES 1
#include "config.h"
#if ENABLE(MATHML)
#include "RenderMathMLOperator.h"
#include "FontCache.h"
#include "FontSelector.h"
#include "MathMLNames.h"
#include "PaintInfo.h"
#include "RenderBlockFlow.h"
#include "RenderText.h"
#include "ScaleTransformOperation.h"
#include "TransformOperations.h"
#include <wtf/MathExtras.h>
#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
using namespace MathMLNames;
struct StretchyCharacter {
UChar character;
UChar topChar;
UChar extensionChar;
UChar bottomChar;
UChar middleChar;
};
static const short leftRightPairsCount = 5;
static const StretchyCharacter stretchyCharacters[14] = {
{ 0x28 , 0x239b, 0x239c, 0x239d, 0x0 }, { 0x29 , 0x239e, 0x239f, 0x23a0, 0x0 }, { 0x5b , 0x23a1, 0x23a2, 0x23a3, 0x0 }, { 0x5d , 0x23a4, 0x23a5, 0x23a6, 0x0 }, { 0x7b , 0x23a7, 0x23aa, 0x23a9, 0x23a8 }, { 0x7d , 0x23ab, 0x23aa, 0x23ad, 0x23ac }, { 0x2308, 0x23a1, 0x23a2, 0x23a2, 0x0 }, { 0x2309, 0x23a4, 0x23a5, 0x23a5, 0x0 }, { 0x230a, 0x23a2, 0x23a2, 0x23a3, 0x0 }, { 0x230b, 0x23a5, 0x23a5, 0x23a6, 0x0 }, { 0x7c , 0x7c, 0x7c, 0x7c, 0x0 }, { 0x2016, 0x2016, 0x2016, 0x2016, 0x0 }, { 0x2225, 0x2225, 0x2225, 0x2225, 0x0 }, { 0x222b, 0x2320, 0x23ae, 0x2321, 0x0 } };
namespace MathMLOperatorDictionary {
typedef std::pair<UChar, Form> Key;
inline Key ExtractKey(const Entry* entry) { return Key(entry->character, entry->form); }
inline UChar ExtractChar(const Entry* entry) { return entry->character; }
#define MATHML_OPDICT_SIZE 1041
static const Entry dictionary[MATHML_OPDICT_SIZE] = {
{ 0x21, Postfix, 1, 0, 0}, { 0x25, Infix, 3, 3, 0}, { 0x26, Postfix, 0, 0, 0}, { 0x27, Postfix, 0, 0, Accent}, { 0x28, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x29, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2A, Infix, 3, 3, 0}, { 0x2B, Infix, 4, 4, 0}, { 0x2B, Prefix, 0, 1, 0}, { 0x2C, Infix, 0, 3, Separator}, { 0x2D, Infix, 4, 4, 0}, { 0x2D, Prefix, 0, 1, 0}, { 0x2E, Infix, 3, 3, 0}, { 0x2F, Infix, 1, 1, 0}, { 0x3A, Infix, 1, 2, 0}, { 0x3B, Infix, 0, 3, Separator}, { 0x3C, Infix, 5, 5, 0}, { 0x3D, Infix, 5, 5, 0}, { 0x3E, Infix, 5, 5, 0}, { 0x3F, Infix, 1, 1, 0}, { 0x40, Infix, 1, 1, 0}, { 0x5B, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x5C, Infix, 0, 0, 0}, { 0x5D, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x5E, Postfix, 0, 0, Accent | Stretchy}, { 0x5E, Infix, 1, 1, 0}, { 0x5F, Postfix, 0, 0, Accent | Stretchy}, { 0x5F, Infix, 1, 1, 0}, { 0x60, Postfix, 0, 0, Accent}, { 0x7B, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x7C, Infix, 2, 2, Stretchy | Symmetric | Fence}, { 0x7C, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x7C, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x7D, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x7E, Postfix, 0, 0, Accent | Stretchy}, { 0xA8, Postfix, 0, 0, Accent}, { 0xAC, Prefix, 2, 1, 0}, { 0xAF, Postfix, 0, 0, Accent | Stretchy}, { 0xB0, Postfix, 0, 0, 0}, { 0xB1, Infix, 4, 4, 0}, { 0xB1, Prefix, 0, 1, 0}, { 0xB4, Postfix, 0, 0, Accent}, { 0xB7, Infix, 4, 4, 0}, { 0xB8, Postfix, 0, 0, Accent}, { 0xD7, Infix, 4, 4, 0}, { 0xF7, Infix, 4, 4, 0}, { 0x2C6, Postfix, 0, 0, Accent | Stretchy}, { 0x2C7, Postfix, 0, 0, Accent | Stretchy}, { 0x2C9, Postfix, 0, 0, Accent | Stretchy}, { 0x2CA, Postfix, 0, 0, Accent}, { 0x2CB, Postfix, 0, 0, Accent}, { 0x2CD, Postfix, 0, 0, Accent | Stretchy}, { 0x2D8, Postfix, 0, 0, Accent}, { 0x2D9, Postfix, 0, 0, Accent}, { 0x2DA, Postfix, 0, 0, Accent}, { 0x2DC, Postfix, 0, 0, Accent | Stretchy}, { 0x2DD, Postfix, 0, 0, Accent}, { 0x2F7, Postfix, 0, 0, Accent | Stretchy}, { 0x302, Postfix, 0, 0, Accent | Stretchy}, { 0x311, Postfix, 0, 0, Accent}, { 0x3F6, Infix, 5, 5, 0}, { 0x2016, Prefix, 0, 0, Fence | Stretchy}, { 0x2016, Postfix, 0, 0, Fence | Stretchy}, { 0x2018, Prefix, 0, 0, Fence}, { 0x2019, Postfix, 0, 0, Fence}, { 0x201C, Prefix, 0, 0, Fence}, { 0x201D, Postfix, 0, 0, Fence}, { 0x2022, Infix, 4, 4, 0}, { 0x2026, Infix, 0, 0, 0}, { 0x2032, Postfix, 0, 2, 0}, { 0x203E, Postfix, 0, 0, Accent | Stretchy}, { 0x2044, Infix, 4, 4, Stretchy}, { 0x2061, Infix, 0, 0, 0}, { 0x2062, Infix, 0, 0, 0}, { 0x2063, Infix, 0, 0, Separator}, { 0x2064, Infix, 0, 0, 0}, { 0x20DB, Postfix, 0, 0, Accent}, { 0x20DC, Postfix, 0, 0, Accent}, { 0x2145, Prefix, 2, 1, 0}, { 0x2146, Prefix, 2, 0, 0}, { 0x2190, Infix, 5, 5, Accent | Stretchy}, { 0x2191, Infix, 5, 5, Stretchy}, { 0x2192, Infix, 5, 5, Stretchy | Accent}, { 0x2193, Infix, 5, 5, Stretchy}, { 0x2194, Infix, 5, 5, Stretchy | Accent}, { 0x2195, Infix, 5, 5, Stretchy}, { 0x2196, Infix, 5, 5, Stretchy}, { 0x2197, Infix, 5, 5, Stretchy}, { 0x2198, Infix, 5, 5, Stretchy}, { 0x2199, Infix, 5, 5, Stretchy}, { 0x219A, Infix, 5, 5, Accent}, { 0x219B, Infix, 5, 5, Accent}, { 0x219C, Infix, 5, 5, Stretchy | Accent}, { 0x219D, Infix, 5, 5, Stretchy | Accent}, { 0x219E, Infix, 5, 5, Stretchy | Accent}, { 0x219F, Infix, 5, 5, Stretchy | Accent}, { 0x21A0, Infix, 5, 5, Stretchy | Accent}, { 0x21A1, Infix, 5, 5, Stretchy}, { 0x21A2, Infix, 5, 5, Stretchy | Accent}, { 0x21A3, Infix, 5, 5, Stretchy | Accent}, { 0x21A4, Infix, 5, 5, Stretchy | Accent}, { 0x21A5, Infix, 5, 5, Stretchy}, { 0x21A6, Infix, 5, 5, Stretchy | Accent}, { 0x21A7, Infix, 5, 5, Stretchy}, { 0x21A8, Infix, 5, 5, Stretchy}, { 0x21A9, Infix, 5, 5, Stretchy | Accent}, { 0x21AA, Infix, 5, 5, Stretchy | Accent}, { 0x21AB, Infix, 5, 5, Stretchy | Accent}, { 0x21AC, Infix, 5, 5, Stretchy | Accent}, { 0x21AD, Infix, 5, 5, Stretchy | Accent}, { 0x21AE, Infix, 5, 5, Accent}, { 0x21AF, Infix, 5, 5, Stretchy}, { 0x21B0, Infix, 5, 5, Stretchy}, { 0x21B1, Infix, 5, 5, Stretchy}, { 0x21B2, Infix, 5, 5, Stretchy}, { 0x21B3, Infix, 5, 5, Stretchy}, { 0x21B4, Infix, 5, 5, Stretchy}, { 0x21B5, Infix, 5, 5, Stretchy}, { 0x21B6, Infix, 5, 5, Accent}, { 0x21B7, Infix, 5, 5, Accent}, { 0x21B8, Infix, 5, 5, 0}, { 0x21B9, Infix, 5, 5, Stretchy | Accent}, { 0x21BA, Infix, 5, 5, 0}, { 0x21BB, Infix, 5, 5, 0}, { 0x21BC, Infix, 5, 5, Stretchy | Accent}, { 0x21BD, Infix, 5, 5, Stretchy | Accent}, { 0x21BE, Infix, 5, 5, Stretchy}, { 0x21BF, Infix, 5, 5, Stretchy}, { 0x21C0, Infix, 5, 5, Stretchy | Accent}, { 0x21C1, Infix, 5, 5, Stretchy | Accent}, { 0x21C2, Infix, 5, 5, Stretchy}, { 0x21C3, Infix, 5, 5, Stretchy}, { 0x21C4, Infix, 5, 5, Stretchy | Accent}, { 0x21C5, Infix, 5, 5, Stretchy}, { 0x21C6, Infix, 5, 5, Stretchy | Accent}, { 0x21C7, Infix, 5, 5, Stretchy | Accent}, { 0x21C8, Infix, 5, 5, Stretchy}, { 0x21C9, Infix, 5, 5, Stretchy | Accent}, { 0x21CA, Infix, 5, 5, Stretchy}, { 0x21CB, Infix, 5, 5, Stretchy | Accent}, { 0x21CC, Infix, 5, 5, Stretchy | Accent}, { 0x21CD, Infix, 5, 5, Accent}, { 0x21CE, Infix, 5, 5, Accent}, { 0x21CF, Infix, 5, 5, Accent}, { 0x21D0, Infix, 5, 5, Stretchy | Accent}, { 0x21D1, Infix, 5, 5, Stretchy}, { 0x21D2, Infix, 5, 5, Stretchy | Accent}, { 0x21D3, Infix, 5, 5, Stretchy}, { 0x21D4, Infix, 5, 5, Stretchy | Accent}, { 0x21D5, Infix, 5, 5, Stretchy}, { 0x21D6, Infix, 5, 5, Stretchy}, { 0x21D7, Infix, 5, 5, Stretchy}, { 0x21D8, Infix, 5, 5, Stretchy}, { 0x21D9, Infix, 5, 5, Stretchy}, { 0x21DA, Infix, 5, 5, Stretchy | Accent}, { 0x21DB, Infix, 5, 5, Stretchy | Accent}, { 0x21DC, Infix, 5, 5, Stretchy | Accent}, { 0x21DD, Infix, 5, 5, Stretchy | Accent}, { 0x21DE, Infix, 5, 5, 0}, { 0x21DF, Infix, 5, 5, 0}, { 0x21E0, Infix, 5, 5, Stretchy | Accent}, { 0x21E1, Infix, 5, 5, Stretchy}, { 0x21E2, Infix, 5, 5, Stretchy | Accent}, { 0x21E3, Infix, 5, 5, Stretchy}, { 0x21E4, Infix, 5, 5, Stretchy | Accent}, { 0x21E5, Infix, 5, 5, Stretchy | Accent}, { 0x21E6, Infix, 5, 5, Stretchy | Accent}, { 0x21E7, Infix, 5, 5, Stretchy}, { 0x21E8, Infix, 5, 5, Stretchy | Accent}, { 0x21E9, Infix, 5, 5, Stretchy}, { 0x21EA, Infix, 5, 5, Stretchy}, { 0x21EB, Infix, 5, 5, Stretchy}, { 0x21EC, Infix, 5, 5, Stretchy}, { 0x21ED, Infix, 5, 5, Stretchy}, { 0x21EE, Infix, 5, 5, Stretchy}, { 0x21EF, Infix, 5, 5, Stretchy}, { 0x21F0, Infix, 5, 5, Stretchy | Accent}, { 0x21F1, Infix, 5, 5, 0}, { 0x21F2, Infix, 5, 5, 0}, { 0x21F3, Infix, 5, 5, Stretchy}, { 0x21F4, Infix, 5, 5, Accent}, { 0x21F5, Infix, 5, 5, Stretchy}, { 0x21F6, Infix, 5, 5, Stretchy | Accent}, { 0x21F7, Infix, 5, 5, Accent}, { 0x21F8, Infix, 5, 5, Accent}, { 0x21F9, Infix, 5, 5, Accent}, { 0x21FA, Infix, 5, 5, Accent}, { 0x21FB, Infix, 5, 5, Accent}, { 0x21FC, Infix, 5, 5, Accent}, { 0x21FD, Infix, 5, 5, Stretchy | Accent}, { 0x21FE, Infix, 5, 5, Stretchy | Accent}, { 0x21FF, Infix, 5, 5, Stretchy | Accent}, { 0x2200, Prefix, 2, 1, 0}, { 0x2201, Infix, 1, 2, 0}, { 0x2202, Prefix, 2, 1, 0}, { 0x2203, Prefix, 2, 1, 0}, { 0x2204, Prefix, 2, 1, 0}, { 0x2206, Infix, 3, 3, 0}, { 0x2207, Prefix, 2, 1, 0}, { 0x2208, Infix, 5, 5, 0}, { 0x2209, Infix, 5, 5, 0}, { 0x220A, Infix, 5, 5, 0}, { 0x220B, Infix, 5, 5, 0}, { 0x220C, Infix, 5, 5, 0}, { 0x220D, Infix, 5, 5, 0}, { 0x220E, Infix, 3, 3, 0}, { 0x220F, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2210, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2211, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2212, Infix, 4, 4, 0}, { 0x2212, Prefix, 0, 1, 0}, { 0x2213, Infix, 4, 4, 0}, { 0x2213, Prefix, 0, 1, 0}, { 0x2214, Infix, 4, 4, 0}, { 0x2215, Infix, 4, 4, Stretchy}, { 0x2216, Infix, 4, 4, 0}, { 0x2217, Infix, 4, 4, 0}, { 0x2218, Infix, 4, 4, 0}, { 0x2219, Infix, 4, 4, 0}, { 0x221A, Prefix, 1, 1, Stretchy}, { 0x221B, Prefix, 1, 1, 0}, { 0x221C, Prefix, 1, 1, 0}, { 0x221D, Infix, 5, 5, 0}, { 0x221F, Infix, 5, 5, 0}, { 0x2220, Prefix, 0, 0, 0}, { 0x2221, Prefix, 0, 0, 0}, { 0x2222, Prefix, 0, 0, 0}, { 0x2223, Infix, 5, 5, 0}, { 0x2224, Infix, 5, 5, 0}, { 0x2225, Infix, 5, 5, 0}, { 0x2225, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2225, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2226, Infix, 5, 5, 0}, { 0x2227, Infix, 4, 4, 0}, { 0x2228, Infix, 4, 4, 0}, { 0x2229, Infix, 4, 4, 0}, { 0x222A, Infix, 4, 4, 0}, { 0x222B, Prefix, 0, 1, Symmetric | LargeOp}, { 0x222C, Prefix, 0, 1, Symmetric | LargeOp}, { 0x222D, Prefix, 0, 1, Symmetric | LargeOp}, { 0x222E, Prefix, 0, 1, Symmetric | LargeOp}, { 0x222F, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2230, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2231, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2232, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2233, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2234, Infix, 5, 5, 0}, { 0x2235, Infix, 5, 5, 0}, { 0x2236, Infix, 5, 5, 0}, { 0x2237, Infix, 5, 5, 0}, { 0x2238, Infix, 4, 4, 0}, { 0x2239, Infix, 5, 5, 0}, { 0x223A, Infix, 4, 4, 0}, { 0x223B, Infix, 5, 5, 0}, { 0x223C, Infix, 5, 5, 0}, { 0x223D, Infix, 5, 5, 0}, { 0x223E, Infix, 5, 5, 0}, { 0x223F, Infix, 3, 3, 0}, { 0x2240, Infix, 4, 4, 0}, { 0x2241, Infix, 5, 5, 0}, { 0x2242, Infix, 5, 5, 0}, { 0x2243, Infix, 5, 5, 0}, { 0x2244, Infix, 5, 5, 0}, { 0x2245, Infix, 5, 5, 0}, { 0x2246, Infix, 5, 5, 0}, { 0x2247, Infix, 5, 5, 0}, { 0x2248, Infix, 5, 5, 0}, { 0x2249, Infix, 5, 5, 0}, { 0x224A, Infix, 5, 5, 0}, { 0x224B, Infix, 5, 5, 0}, { 0x224C, Infix, 5, 5, 0}, { 0x224D, Infix, 5, 5, 0}, { 0x224E, Infix, 5, 5, 0}, { 0x224F, Infix, 5, 5, 0}, { 0x2250, Infix, 5, 5, 0}, { 0x2251, Infix, 5, 5, 0}, { 0x2252, Infix, 5, 5, 0}, { 0x2253, Infix, 5, 5, 0}, { 0x2254, Infix, 5, 5, 0}, { 0x2255, Infix, 5, 5, 0}, { 0x2256, Infix, 5, 5, 0}, { 0x2257, Infix, 5, 5, 0}, { 0x2258, Infix, 5, 5, 0}, { 0x2259, Infix, 5, 5, 0}, { 0x225A, Infix, 5, 5, 0}, { 0x225C, Infix, 5, 5, 0}, { 0x225D, Infix, 5, 5, 0}, { 0x225E, Infix, 5, 5, 0}, { 0x225F, Infix, 5, 5, 0}, { 0x2260, Infix, 5, 5, 0}, { 0x2261, Infix, 5, 5, 0}, { 0x2262, Infix, 5, 5, 0}, { 0x2263, Infix, 5, 5, 0}, { 0x2264, Infix, 5, 5, 0}, { 0x2265, Infix, 5, 5, 0}, { 0x2266, Infix, 5, 5, 0}, { 0x2267, Infix, 5, 5, 0}, { 0x2268, Infix, 5, 5, 0}, { 0x2269, Infix, 5, 5, 0}, { 0x226A, Infix, 5, 5, 0}, { 0x226B, Infix, 5, 5, 0}, { 0x226C, Infix, 5, 5, 0}, { 0x226D, Infix, 5, 5, 0}, { 0x226E, Infix, 5, 5, 0}, { 0x226F, Infix, 5, 5, 0}, { 0x2270, Infix, 5, 5, 0}, { 0x2271, Infix, 5, 5, 0}, { 0x2272, Infix, 5, 5, 0}, { 0x2273, Infix, 5, 5, 0}, { 0x2274, Infix, 5, 5, 0}, { 0x2275, Infix, 5, 5, 0}, { 0x2276, Infix, 5, 5, 0}, { 0x2277, Infix, 5, 5, 0}, { 0x2278, Infix, 5, 5, 0}, { 0x2279, Infix, 5, 5, 0}, { 0x227A, Infix, 5, 5, 0}, { 0x227B, Infix, 5, 5, 0}, { 0x227C, Infix, 5, 5, 0}, { 0x227D, Infix, 5, 5, 0}, { 0x227E, Infix, 5, 5, 0}, { 0x227F, Infix, 5, 5, 0}, { 0x2280, Infix, 5, 5, 0}, { 0x2281, Infix, 5, 5, 0}, { 0x2282, Infix, 5, 5, 0}, { 0x2283, Infix, 5, 5, 0}, { 0x2284, Infix, 5, 5, 0}, { 0x2285, Infix, 5, 5, 0}, { 0x2286, Infix, 5, 5, 0}, { 0x2287, Infix, 5, 5, 0}, { 0x2288, Infix, 5, 5, 0}, { 0x2289, Infix, 5, 5, 0}, { 0x228A, Infix, 5, 5, 0}, { 0x228B, Infix, 5, 5, 0}, { 0x228C, Infix, 4, 4, 0}, { 0x228D, Infix, 4, 4, 0}, { 0x228E, Infix, 4, 4, 0}, { 0x228F, Infix, 5, 5, 0}, { 0x2290, Infix, 5, 5, 0}, { 0x2291, Infix, 5, 5, 0}, { 0x2292, Infix, 5, 5, 0}, { 0x2293, Infix, 4, 4, 0}, { 0x2294, Infix, 4, 4, 0}, { 0x2295, Infix, 4, 4, 0}, { 0x2296, Infix, 4, 4, 0}, { 0x2297, Infix, 4, 4, 0}, { 0x2298, Infix, 4, 4, 0}, { 0x2299, Infix, 4, 4, 0}, { 0x229A, Infix, 4, 4, 0}, { 0x229B, Infix, 4, 4, 0}, { 0x229C, Infix, 4, 4, 0}, { 0x229D, Infix, 4, 4, 0}, { 0x229E, Infix, 4, 4, 0}, { 0x229F, Infix, 4, 4, 0}, { 0x22A0, Infix, 4, 4, 0}, { 0x22A1, Infix, 4, 4, 0}, { 0x22A2, Infix, 5, 5, 0}, { 0x22A3, Infix, 5, 5, 0}, { 0x22A4, Infix, 5, 5, 0}, { 0x22A5, Infix, 5, 5, 0}, { 0x22A6, Infix, 5, 5, 0}, { 0x22A7, Infix, 5, 5, 0}, { 0x22A8, Infix, 5, 5, 0}, { 0x22A9, Infix, 5, 5, 0}, { 0x22AA, Infix, 5, 5, 0}, { 0x22AB, Infix, 5, 5, 0}, { 0x22AC, Infix, 5, 5, 0}, { 0x22AD, Infix, 5, 5, 0}, { 0x22AE, Infix, 5, 5, 0}, { 0x22AF, Infix, 5, 5, 0}, { 0x22B0, Infix, 5, 5, 0}, { 0x22B1, Infix, 5, 5, 0}, { 0x22B2, Infix, 5, 5, 0}, { 0x22B3, Infix, 5, 5, 0}, { 0x22B4, Infix, 5, 5, 0}, { 0x22B5, Infix, 5, 5, 0}, { 0x22B6, Infix, 5, 5, 0}, { 0x22B7, Infix, 5, 5, 0}, { 0x22B8, Infix, 5, 5, 0}, { 0x22B9, Infix, 5, 5, 0}, { 0x22BA, Infix, 4, 4, 0}, { 0x22BB, Infix, 4, 4, 0}, { 0x22BC, Infix, 4, 4, 0}, { 0x22BD, Infix, 4, 4, 0}, { 0x22BE, Infix, 3, 3, 0}, { 0x22BF, Infix, 3, 3, 0}, { 0x22C0, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x22C1, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x22C2, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x22C3, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x22C4, Infix, 4, 4, 0}, { 0x22C5, Infix, 4, 4, 0}, { 0x22C6, Infix, 4, 4, 0}, { 0x22C7, Infix, 4, 4, 0}, { 0x22C8, Infix, 5, 5, 0}, { 0x22C9, Infix, 4, 4, 0}, { 0x22CA, Infix, 4, 4, 0}, { 0x22CB, Infix, 4, 4, 0}, { 0x22CC, Infix, 4, 4, 0}, { 0x22CD, Infix, 5, 5, 0}, { 0x22CE, Infix, 4, 4, 0}, { 0x22CF, Infix, 4, 4, 0}, { 0x22D0, Infix, 5, 5, 0}, { 0x22D1, Infix, 5, 5, 0}, { 0x22D2, Infix, 4, 4, 0}, { 0x22D3, Infix, 4, 4, 0}, { 0x22D4, Infix, 5, 5, 0}, { 0x22D5, Infix, 5, 5, 0}, { 0x22D6, Infix, 5, 5, 0}, { 0x22D7, Infix, 5, 5, 0}, { 0x22D8, Infix, 5, 5, 0}, { 0x22D9, Infix, 5, 5, 0}, { 0x22DA, Infix, 5, 5, 0}, { 0x22DB, Infix, 5, 5, 0}, { 0x22DC, Infix, 5, 5, 0}, { 0x22DD, Infix, 5, 5, 0}, { 0x22DE, Infix, 5, 5, 0}, { 0x22DF, Infix, 5, 5, 0}, { 0x22E0, Infix, 5, 5, 0}, { 0x22E1, Infix, 5, 5, 0}, { 0x22E2, Infix, 5, 5, 0}, { 0x22E3, Infix, 5, 5, 0}, { 0x22E4, Infix, 5, 5, 0}, { 0x22E5, Infix, 5, 5, 0}, { 0x22E6, Infix, 5, 5, 0}, { 0x22E7, Infix, 5, 5, 0}, { 0x22E8, Infix, 5, 5, 0}, { 0x22E9, Infix, 5, 5, 0}, { 0x22EA, Infix, 5, 5, 0}, { 0x22EB, Infix, 5, 5, 0}, { 0x22EC, Infix, 5, 5, 0}, { 0x22ED, Infix, 5, 5, 0}, { 0x22EE, Infix, 5, 5, 0}, { 0x22EF, Infix, 0, 0, 0}, { 0x22F0, Infix, 5, 5, 0}, { 0x22F1, Infix, 5, 5, 0}, { 0x22F2, Infix, 5, 5, 0}, { 0x22F3, Infix, 5, 5, 0}, { 0x22F4, Infix, 5, 5, 0}, { 0x22F5, Infix, 5, 5, 0}, { 0x22F6, Infix, 5, 5, 0}, { 0x22F7, Infix, 5, 5, 0}, { 0x22F8, Infix, 5, 5, 0}, { 0x22F9, Infix, 5, 5, 0}, { 0x22FA, Infix, 5, 5, 0}, { 0x22FB, Infix, 5, 5, 0}, { 0x22FC, Infix, 5, 5, 0}, { 0x22FD, Infix, 5, 5, 0}, { 0x22FE, Infix, 5, 5, 0}, { 0x22FF, Infix, 5, 5, 0}, { 0x2308, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2309, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x230A, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x230B, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x23B4, Postfix, 0, 0, Accent | Stretchy}, { 0x23B5, Postfix, 0, 0, Accent | Stretchy}, { 0x23DC, Postfix, 0, 0, Accent | Stretchy}, { 0x23DD, Postfix, 0, 0, Accent | Stretchy}, { 0x23DE, Postfix, 0, 0, Accent | Stretchy}, { 0x23DF, Postfix, 0, 0, Accent | Stretchy}, { 0x23E0, Postfix, 0, 0, Accent | Stretchy}, { 0x23E1, Postfix, 0, 0, Accent | Stretchy}, { 0x25A0, Infix, 3, 3, 0}, { 0x25A1, Infix, 3, 3, 0}, { 0x25AA, Infix, 3, 3, 0}, { 0x25AB, Infix, 3, 3, 0}, { 0x25AD, Infix, 3, 3, 0}, { 0x25AE, Infix, 3, 3, 0}, { 0x25AF, Infix, 3, 3, 0}, { 0x25B0, Infix, 3, 3, 0}, { 0x25B1, Infix, 3, 3, 0}, { 0x25B2, Infix, 4, 4, 0}, { 0x25B3, Infix, 4, 4, 0}, { 0x25B4, Infix, 4, 4, 0}, { 0x25B5, Infix, 4, 4, 0}, { 0x25B6, Infix, 4, 4, 0}, { 0x25B7, Infix, 4, 4, 0}, { 0x25B8, Infix, 4, 4, 0}, { 0x25B9, Infix, 4, 4, 0}, { 0x25BC, Infix, 4, 4, 0}, { 0x25BD, Infix, 4, 4, 0}, { 0x25BE, Infix, 4, 4, 0}, { 0x25BF, Infix, 4, 4, 0}, { 0x25C0, Infix, 4, 4, 0}, { 0x25C1, Infix, 4, 4, 0}, { 0x25C2, Infix, 4, 4, 0}, { 0x25C3, Infix, 4, 4, 0}, { 0x25C4, Infix, 4, 4, 0}, { 0x25C5, Infix, 4, 4, 0}, { 0x25C6, Infix, 4, 4, 0}, { 0x25C7, Infix, 4, 4, 0}, { 0x25C8, Infix, 4, 4, 0}, { 0x25C9, Infix, 4, 4, 0}, { 0x25CC, Infix, 4, 4, 0}, { 0x25CD, Infix, 4, 4, 0}, { 0x25CE, Infix, 4, 4, 0}, { 0x25CF, Infix, 4, 4, 0}, { 0x25D6, Infix, 4, 4, 0}, { 0x25D7, Infix, 4, 4, 0}, { 0x25E6, Infix, 4, 4, 0}, { 0x266D, Postfix, 0, 2, 0}, { 0x266E, Postfix, 0, 2, 0}, { 0x266F, Postfix, 0, 2, 0}, { 0x2758, Infix, 5, 5, 0}, { 0x2772, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2773, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27E6, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27E7, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27E8, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27E9, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27EA, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27EB, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27EC, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27ED, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27EE, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27EF, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x27F0, Infix, 5, 5, Stretchy}, { 0x27F1, Infix, 5, 5, Stretchy}, { 0x27F5, Infix, 5, 5, Stretchy | Accent}, { 0x27F6, Infix, 5, 5, Stretchy | Accent}, { 0x27F7, Infix, 5, 5, Stretchy | Accent}, { 0x27F8, Infix, 5, 5, Stretchy | Accent}, { 0x27F9, Infix, 5, 5, Stretchy | Accent}, { 0x27FA, Infix, 5, 5, Stretchy | Accent}, { 0x27FB, Infix, 5, 5, Stretchy | Accent}, { 0x27FC, Infix, 5, 5, Stretchy | Accent}, { 0x27FD, Infix, 5, 5, Stretchy | Accent}, { 0x27FE, Infix, 5, 5, Stretchy | Accent}, { 0x27FF, Infix, 5, 5, Stretchy | Accent}, { 0x2900, Infix, 5, 5, Accent}, { 0x2901, Infix, 5, 5, Accent}, { 0x2902, Infix, 5, 5, Accent}, { 0x2903, Infix, 5, 5, Accent}, { 0x2904, Infix, 5, 5, Accent}, { 0x2905, Infix, 5, 5, Accent}, { 0x2906, Infix, 5, 5, Accent}, { 0x2907, Infix, 5, 5, Accent}, { 0x2908, Infix, 5, 5, 0}, { 0x2909, Infix, 5, 5, 0}, { 0x290A, Infix, 5, 5, Stretchy}, { 0x290B, Infix, 5, 5, Stretchy}, { 0x290C, Infix, 5, 5, Stretchy | Accent}, { 0x290D, Infix, 5, 5, Stretchy | Accent}, { 0x290E, Infix, 5, 5, Stretchy | Accent}, { 0x290F, Infix, 5, 5, Stretchy | Accent}, { 0x2910, Infix, 5, 5, Stretchy | Accent}, { 0x2911, Infix, 5, 5, Accent}, { 0x2912, Infix, 5, 5, Stretchy}, { 0x2913, Infix, 5, 5, Stretchy}, { 0x2914, Infix, 5, 5, Accent}, { 0x2915, Infix, 5, 5, Accent}, { 0x2916, Infix, 5, 5, Accent}, { 0x2917, Infix, 5, 5, Accent}, { 0x2918, Infix, 5, 5, Accent}, { 0x2919, Infix, 5, 5, Accent}, { 0x291A, Infix, 5, 5, Accent}, { 0x291B, Infix, 5, 5, Accent}, { 0x291C, Infix, 5, 5, Accent}, { 0x291D, Infix, 5, 5, Accent}, { 0x291E, Infix, 5, 5, Accent}, { 0x291F, Infix, 5, 5, Accent}, { 0x2920, Infix, 5, 5, Accent}, { 0x2921, Infix, 5, 5, Stretchy}, { 0x2922, Infix, 5, 5, Stretchy}, { 0x2923, Infix, 5, 5, 0}, { 0x2924, Infix, 5, 5, 0}, { 0x2925, Infix, 5, 5, 0}, { 0x2926, Infix, 5, 5, 0}, { 0x2927, Infix, 5, 5, 0}, { 0x2928, Infix, 5, 5, 0}, { 0x2929, Infix, 5, 5, 0}, { 0x292A, Infix, 5, 5, 0}, { 0x292B, Infix, 5, 5, 0}, { 0x292C, Infix, 5, 5, 0}, { 0x292D, Infix, 5, 5, 0}, { 0x292E, Infix, 5, 5, 0}, { 0x292F, Infix, 5, 5, 0}, { 0x2930, Infix, 5, 5, 0}, { 0x2931, Infix, 5, 5, 0}, { 0x2932, Infix, 5, 5, 0}, { 0x2933, Infix, 5, 5, Accent}, { 0x2934, Infix, 5, 5, 0}, { 0x2935, Infix, 5, 5, 0}, { 0x2936, Infix, 5, 5, 0}, { 0x2937, Infix, 5, 5, 0}, { 0x2938, Infix, 5, 5, 0}, { 0x2939, Infix, 5, 5, 0}, { 0x293A, Infix, 5, 5, Accent}, { 0x293B, Infix, 5, 5, Accent}, { 0x293C, Infix, 5, 5, Accent}, { 0x293D, Infix, 5, 5, Accent}, { 0x293E, Infix, 5, 5, 0}, { 0x293F, Infix, 5, 5, 0}, { 0x2940, Infix, 5, 5, 0}, { 0x2941, Infix, 5, 5, 0}, { 0x2942, Infix, 5, 5, Accent}, { 0x2943, Infix, 5, 5, Accent}, { 0x2944, Infix, 5, 5, Accent}, { 0x2945, Infix, 5, 5, Accent}, { 0x2946, Infix, 5, 5, Accent}, { 0x2947, Infix, 5, 5, Accent}, { 0x2948, Infix, 5, 5, Accent}, { 0x2949, Infix, 5, 5, 0}, { 0x294A, Infix, 5, 5, Accent}, { 0x294B, Infix, 5, 5, Accent}, { 0x294C, Infix, 5, 5, 0}, { 0x294D, Infix, 5, 5, 0}, { 0x294E, Infix, 5, 5, Stretchy | Accent}, { 0x294F, Infix, 5, 5, Stretchy}, { 0x2950, Infix, 5, 5, Stretchy | Accent}, { 0x2951, Infix, 5, 5, Stretchy}, { 0x2952, Infix, 5, 5, Stretchy | Accent}, { 0x2953, Infix, 5, 5, Stretchy | Accent}, { 0x2954, Infix, 5, 5, Stretchy}, { 0x2955, Infix, 5, 5, Stretchy}, { 0x2956, Infix, 5, 5, Stretchy}, { 0x2957, Infix, 5, 5, Stretchy}, { 0x2958, Infix, 5, 5, Stretchy}, { 0x2959, Infix, 5, 5, Stretchy}, { 0x295A, Infix, 5, 5, Stretchy | Accent}, { 0x295B, Infix, 5, 5, Stretchy | Accent}, { 0x295C, Infix, 5, 5, Stretchy}, { 0x295D, Infix, 5, 5, Stretchy}, { 0x295E, Infix, 5, 5, Stretchy | Accent}, { 0x295F, Infix, 5, 5, Stretchy | Accent}, { 0x2960, Infix, 5, 5, Stretchy}, { 0x2961, Infix, 5, 5, Stretchy}, { 0x2962, Infix, 5, 5, Accent}, { 0x2963, Infix, 5, 5, 0}, { 0x2964, Infix, 5, 5, Accent}, { 0x2965, Infix, 5, 5, 0}, { 0x2966, Infix, 5, 5, Accent}, { 0x2967, Infix, 5, 5, Accent}, { 0x2968, Infix, 5, 5, Accent}, { 0x2969, Infix, 5, 5, Accent}, { 0x296A, Infix, 5, 5, Accent}, { 0x296B, Infix, 5, 5, Accent}, { 0x296C, Infix, 5, 5, Accent}, { 0x296D, Infix, 5, 5, Accent}, { 0x296E, Infix, 5, 5, Stretchy}, { 0x296F, Infix, 5, 5, Stretchy}, { 0x2970, Infix, 5, 5, Accent}, { 0x2971, Infix, 5, 5, Accent}, { 0x2972, Infix, 5, 5, Accent}, { 0x2973, Infix, 5, 5, Accent}, { 0x2974, Infix, 5, 5, Accent}, { 0x2975, Infix, 5, 5, Accent}, { 0x2976, Infix, 5, 5, Accent}, { 0x2977, Infix, 5, 5, Accent}, { 0x2978, Infix, 5, 5, Accent}, { 0x2979, Infix, 5, 5, Accent}, { 0x297A, Infix, 5, 5, Accent}, { 0x297B, Infix, 5, 5, Accent}, { 0x297C, Infix, 5, 5, Accent}, { 0x297D, Infix, 5, 5, Accent}, { 0x297E, Infix, 5, 5, 0}, { 0x297F, Infix, 5, 5, 0}, { 0x2980, Prefix, 0, 0, Fence | Stretchy}, { 0x2980, Postfix, 0, 0, Fence | Stretchy}, { 0x2981, Infix, 3, 3, 0}, { 0x2982, Infix, 3, 3, 0}, { 0x2983, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2984, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2985, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2986, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2987, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2988, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2989, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298A, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298B, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298C, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298D, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298E, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x298F, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2990, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2991, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2992, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2993, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2994, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2995, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2996, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2997, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2998, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x2999, Infix, 3, 3, 0}, { 0x299A, Infix, 3, 3, 0}, { 0x299B, Infix, 3, 3, 0}, { 0x299C, Infix, 3, 3, 0}, { 0x299D, Infix, 3, 3, 0}, { 0x299E, Infix, 3, 3, 0}, { 0x299F, Infix, 3, 3, 0}, { 0x29A0, Infix, 3, 3, 0}, { 0x29A1, Infix, 3, 3, 0}, { 0x29A2, Infix, 3, 3, 0}, { 0x29A3, Infix, 3, 3, 0}, { 0x29A4, Infix, 3, 3, 0}, { 0x29A5, Infix, 3, 3, 0}, { 0x29A6, Infix, 3, 3, 0}, { 0x29A7, Infix, 3, 3, 0}, { 0x29A8, Infix, 3, 3, 0}, { 0x29A9, Infix, 3, 3, 0}, { 0x29AA, Infix, 3, 3, 0}, { 0x29AB, Infix, 3, 3, 0}, { 0x29AC, Infix, 3, 3, 0}, { 0x29AD, Infix, 3, 3, 0}, { 0x29AE, Infix, 3, 3, 0}, { 0x29AF, Infix, 3, 3, 0}, { 0x29B0, Infix, 3, 3, 0}, { 0x29B1, Infix, 3, 3, 0}, { 0x29B2, Infix, 3, 3, 0}, { 0x29B3, Infix, 3, 3, 0}, { 0x29B4, Infix, 3, 3, 0}, { 0x29B5, Infix, 3, 3, 0}, { 0x29B6, Infix, 4, 4, 0}, { 0x29B7, Infix, 4, 4, 0}, { 0x29B8, Infix, 4, 4, 0}, { 0x29B9, Infix, 4, 4, 0}, { 0x29BA, Infix, 4, 4, 0}, { 0x29BB, Infix, 4, 4, 0}, { 0x29BC, Infix, 4, 4, 0}, { 0x29BD, Infix, 4, 4, 0}, { 0x29BE, Infix, 4, 4, 0}, { 0x29BF, Infix, 4, 4, 0}, { 0x29C0, Infix, 5, 5, 0}, { 0x29C1, Infix, 5, 5, 0}, { 0x29C2, Infix, 3, 3, 0}, { 0x29C3, Infix, 3, 3, 0}, { 0x29C4, Infix, 4, 4, 0}, { 0x29C5, Infix, 4, 4, 0}, { 0x29C6, Infix, 4, 4, 0}, { 0x29C7, Infix, 4, 4, 0}, { 0x29C8, Infix, 4, 4, 0}, { 0x29C9, Infix, 3, 3, 0}, { 0x29CA, Infix, 3, 3, 0}, { 0x29CB, Infix, 3, 3, 0}, { 0x29CC, Infix, 3, 3, 0}, { 0x29CD, Infix, 3, 3, 0}, { 0x29CE, Infix, 5, 5, 0}, { 0x29CF, Infix, 5, 5, 0}, { 0x29D0, Infix, 5, 5, 0}, { 0x29D1, Infix, 5, 5, 0}, { 0x29D2, Infix, 5, 5, 0}, { 0x29D3, Infix, 5, 5, 0}, { 0x29D4, Infix, 5, 5, 0}, { 0x29D5, Infix, 5, 5, 0}, { 0x29D6, Infix, 4, 4, 0}, { 0x29D7, Infix, 4, 4, 0}, { 0x29D8, Infix, 3, 3, 0}, { 0x29D9, Infix, 3, 3, 0}, { 0x29DB, Infix, 3, 3, 0}, { 0x29DC, Infix, 3, 3, 0}, { 0x29DD, Infix, 3, 3, 0}, { 0x29DE, Infix, 5, 5, 0}, { 0x29DF, Infix, 3, 3, 0}, { 0x29E0, Infix, 3, 3, 0}, { 0x29E1, Infix, 5, 5, 0}, { 0x29E2, Infix, 4, 4, 0}, { 0x29E3, Infix, 5, 5, 0}, { 0x29E4, Infix, 5, 5, 0}, { 0x29E5, Infix, 5, 5, 0}, { 0x29E6, Infix, 5, 5, 0}, { 0x29E7, Infix, 3, 3, 0}, { 0x29E8, Infix, 3, 3, 0}, { 0x29E9, Infix, 3, 3, 0}, { 0x29EA, Infix, 3, 3, 0}, { 0x29EB, Infix, 3, 3, 0}, { 0x29EC, Infix, 3, 3, 0}, { 0x29ED, Infix, 3, 3, 0}, { 0x29EE, Infix, 3, 3, 0}, { 0x29EF, Infix, 3, 3, 0}, { 0x29F0, Infix, 3, 3, 0}, { 0x29F1, Infix, 3, 3, 0}, { 0x29F2, Infix, 3, 3, 0}, { 0x29F3, Infix, 3, 3, 0}, { 0x29F4, Infix, 5, 5, 0}, { 0x29F5, Infix, 4, 4, 0}, { 0x29F6, Infix, 4, 4, 0}, { 0x29F7, Infix, 4, 4, 0}, { 0x29F8, Infix, 3, 3, 0}, { 0x29F9, Infix, 3, 3, 0}, { 0x29FA, Infix, 3, 3, 0}, { 0x29FB, Infix, 3, 3, 0}, { 0x29FC, Prefix, 0, 0, Symmetric | Fence | Stretchy}, { 0x29FD, Postfix, 0, 0, Symmetric | Fence | Stretchy}, { 0x29FE, Infix, 4, 4, 0}, { 0x29FF, Infix, 4, 4, 0}, { 0x2A00, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A01, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A02, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A03, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A04, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A05, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A06, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A07, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A08, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A09, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A0A, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A0B, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A0C, Prefix, 0, 1, Symmetric | LargeOp}, { 0x2A0D, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A0E, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A0F, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A10, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A11, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A12, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A13, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A14, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2A15, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A16, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A17, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A18, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A19, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A1A, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A1B, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A1C, Prefix, 1, 2, Symmetric | LargeOp}, { 0x2A1D, Infix, 3, 3, 0}, { 0x2A1E, Infix, 3, 3, 0}, { 0x2A1F, Infix, 3, 3, 0}, { 0x2A20, Infix, 3, 3, 0}, { 0x2A21, Infix, 3, 3, 0}, { 0x2A22, Infix, 4, 4, 0}, { 0x2A23, Infix, 4, 4, 0}, { 0x2A24, Infix, 4, 4, 0}, { 0x2A25, Infix, 4, 4, 0}, { 0x2A26, Infix, 4, 4, 0}, { 0x2A27, Infix, 4, 4, 0}, { 0x2A28, Infix, 4, 4, 0}, { 0x2A29, Infix, 4, 4, 0}, { 0x2A2A, Infix, 4, 4, 0}, { 0x2A2B, Infix, 4, 4, 0}, { 0x2A2C, Infix, 4, 4, 0}, { 0x2A2D, Infix, 4, 4, 0}, { 0x2A2E, Infix, 4, 4, 0}, { 0x2A2F, Infix, 4, 4, 0}, { 0x2A30, Infix, 4, 4, 0}, { 0x2A31, Infix, 4, 4, 0}, { 0x2A32, Infix, 4, 4, 0}, { 0x2A33, Infix, 4, 4, 0}, { 0x2A34, Infix, 4, 4, 0}, { 0x2A35, Infix, 4, 4, 0}, { 0x2A36, Infix, 4, 4, 0}, { 0x2A37, Infix, 4, 4, 0}, { 0x2A38, Infix, 4, 4, 0}, { 0x2A39, Infix, 4, 4, 0}, { 0x2A3A, Infix, 4, 4, 0}, { 0x2A3B, Infix, 4, 4, 0}, { 0x2A3C, Infix, 4, 4, 0}, { 0x2A3D, Infix, 4, 4, 0}, { 0x2A3E, Infix, 4, 4, 0}, { 0x2A3F, Infix, 4, 4, 0}, { 0x2A40, Infix, 4, 4, 0}, { 0x2A41, Infix, 4, 4, 0}, { 0x2A42, Infix, 4, 4, 0}, { 0x2A43, Infix, 4, 4, 0}, { 0x2A44, Infix, 4, 4, 0}, { 0x2A45, Infix, 4, 4, 0}, { 0x2A46, Infix, 4, 4, 0}, { 0x2A47, Infix, 4, 4, 0}, { 0x2A48, Infix, 4, 4, 0}, { 0x2A49, Infix, 4, 4, 0}, { 0x2A4A, Infix, 4, 4, 0}, { 0x2A4B, Infix, 4, 4, 0}, { 0x2A4C, Infix, 4, 4, 0}, { 0x2A4D, Infix, 4, 4, 0}, { 0x2A4E, Infix, 4, 4, 0}, { 0x2A4F, Infix, 4, 4, 0}, { 0x2A50, Infix, 4, 4, 0}, { 0x2A51, Infix, 4, 4, 0}, { 0x2A52, Infix, 4, 4, 0}, { 0x2A53, Infix, 4, 4, 0}, { 0x2A54, Infix, 4, 4, 0}, { 0x2A55, Infix, 4, 4, 0}, { 0x2A56, Infix, 4, 4, 0}, { 0x2A57, Infix, 4, 4, 0}, { 0x2A58, Infix, 4, 4, 0}, { 0x2A59, Infix, 5, 5, 0}, { 0x2A5A, Infix, 4, 4, 0}, { 0x2A5B, Infix, 4, 4, 0}, { 0x2A5C, Infix, 4, 4, 0}, { 0x2A5D, Infix, 4, 4, 0}, { 0x2A5E, Infix, 4, 4, 0}, { 0x2A5F, Infix, 4, 4, 0}, { 0x2A60, Infix, 4, 4, 0}, { 0x2A61, Infix, 4, 4, 0}, { 0x2A62, Infix, 4, 4, 0}, { 0x2A63, Infix, 4, 4, 0}, { 0x2A64, Infix, 4, 4, 0}, { 0x2A65, Infix, 4, 4, 0}, { 0x2A66, Infix, 5, 5, 0}, { 0x2A67, Infix, 5, 5, 0}, { 0x2A68, Infix, 5, 5, 0}, { 0x2A69, Infix, 5, 5, 0}, { 0x2A6A, Infix, 5, 5, 0}, { 0x2A6B, Infix, 5, 5, 0}, { 0x2A6C, Infix, 5, 5, 0}, { 0x2A6D, Infix, 5, 5, 0}, { 0x2A6E, Infix, 5, 5, 0}, { 0x2A6F, Infix, 5, 5, 0}, { 0x2A70, Infix, 5, 5, 0}, { 0x2A71, Infix, 4, 4, 0}, { 0x2A72, Infix, 4, 4, 0}, { 0x2A73, Infix, 5, 5, 0}, { 0x2A74, Infix, 5, 5, 0}, { 0x2A75, Infix, 5, 5, 0}, { 0x2A76, Infix, 5, 5, 0}, { 0x2A77, Infix, 5, 5, 0}, { 0x2A78, Infix, 5, 5, 0}, { 0x2A79, Infix, 5, 5, 0}, { 0x2A7A, Infix, 5, 5, 0}, { 0x2A7B, Infix, 5, 5, 0}, { 0x2A7C, Infix, 5, 5, 0}, { 0x2A7D, Infix, 5, 5, 0}, { 0x2A7E, Infix, 5, 5, 0}, { 0x2A7F, Infix, 5, 5, 0}, { 0x2A80, Infix, 5, 5, 0}, { 0x2A81, Infix, 5, 5, 0}, { 0x2A82, Infix, 5, 5, 0}, { 0x2A83, Infix, 5, 5, 0}, { 0x2A84, Infix, 5, 5, 0}, { 0x2A85, Infix, 5, 5, 0}, { 0x2A86, Infix, 5, 5, 0}, { 0x2A87, Infix, 5, 5, 0}, { 0x2A88, Infix, 5, 5, 0}, { 0x2A89, Infix, 5, 5, 0}, { 0x2A8A, Infix, 5, 5, 0}, { 0x2A8B, Infix, 5, 5, 0}, { 0x2A8C, Infix, 5, 5, 0}, { 0x2A8D, Infix, 5, 5, 0}, { 0x2A8E, Infix, 5, 5, 0}, { 0x2A8F, Infix, 5, 5, 0}, { 0x2A90, Infix, 5, 5, 0}, { 0x2A91, Infix, 5, 5, 0}, { 0x2A92, Infix, 5, 5, 0}, { 0x2A93, Infix, 5, 5, 0}, { 0x2A94, Infix, 5, 5, 0}, { 0x2A95, Infix, 5, 5, 0}, { 0x2A96, Infix, 5, 5, 0}, { 0x2A97, Infix, 5, 5, 0}, { 0x2A98, Infix, 5, 5, 0}, { 0x2A99, Infix, 5, 5, 0}, { 0x2A9A, Infix, 5, 5, 0}, { 0x2A9B, Infix, 5, 5, 0}, { 0x2A9C, Infix, 5, 5, 0}, { 0x2A9D, Infix, 5, 5, 0}, { 0x2A9E, Infix, 5, 5, 0}, { 0x2A9F, Infix, 5, 5, 0}, { 0x2AA0, Infix, 5, 5, 0}, { 0x2AA1, Infix, 5, 5, 0}, { 0x2AA2, Infix, 5, 5, 0}, { 0x2AA3, Infix, 5, 5, 0}, { 0x2AA4, Infix, 5, 5, 0}, { 0x2AA5, Infix, 5, 5, 0}, { 0x2AA6, Infix, 5, 5, 0}, { 0x2AA7, Infix, 5, 5, 0}, { 0x2AA8, Infix, 5, 5, 0}, { 0x2AA9, Infix, 5, 5, 0}, { 0x2AAA, Infix, 5, 5, 0}, { 0x2AAB, Infix, 5, 5, 0}, { 0x2AAC, Infix, 5, 5, 0}, { 0x2AAD, Infix, 5, 5, 0}, { 0x2AAE, Infix, 5, 5, 0}, { 0x2AAF, Infix, 5, 5, 0}, { 0x2AB0, Infix, 5, 5, 0}, { 0x2AB1, Infix, 5, 5, 0}, { 0x2AB2, Infix, 5, 5, 0}, { 0x2AB3, Infix, 5, 5, 0}, { 0x2AB4, Infix, 5, 5, 0}, { 0x2AB5, Infix, 5, 5, 0}, { 0x2AB6, Infix, 5, 5, 0}, { 0x2AB7, Infix, 5, 5, 0}, { 0x2AB8, Infix, 5, 5, 0}, { 0x2AB9, Infix, 5, 5, 0}, { 0x2ABA, Infix, 5, 5, 0}, { 0x2ABB, Infix, 5, 5, 0}, { 0x2ABC, Infix, 5, 5, 0}, { 0x2ABD, Infix, 5, 5, 0}, { 0x2ABE, Infix, 5, 5, 0}, { 0x2ABF, Infix, 5, 5, 0}, { 0x2AC0, Infix, 5, 5, 0}, { 0x2AC1, Infix, 5, 5, 0}, { 0x2AC2, Infix, 5, 5, 0}, { 0x2AC3, Infix, 5, 5, 0}, { 0x2AC4, Infix, 5, 5, 0}, { 0x2AC5, Infix, 5, 5, 0}, { 0x2AC6, Infix, 5, 5, 0}, { 0x2AC7, Infix, 5, 5, 0}, { 0x2AC8, Infix, 5, 5, 0}, { 0x2AC9, Infix, 5, 5, 0}, { 0x2ACA, Infix, 5, 5, 0}, { 0x2ACB, Infix, 5, 5, 0}, { 0x2ACC, Infix, 5, 5, 0}, { 0x2ACD, Infix, 5, 5, 0}, { 0x2ACE, Infix, 5, 5, 0}, { 0x2ACF, Infix, 5, 5, 0}, { 0x2AD0, Infix, 5, 5, 0}, { 0x2AD1, Infix, 5, 5, 0}, { 0x2AD2, Infix, 5, 5, 0}, { 0x2AD3, Infix, 5, 5, 0}, { 0x2AD4, Infix, 5, 5, 0}, { 0x2AD5, Infix, 5, 5, 0}, { 0x2AD6, Infix, 5, 5, 0}, { 0x2AD7, Infix, 5, 5, 0}, { 0x2AD8, Infix, 5, 5, 0}, { 0x2AD9, Infix, 5, 5, 0}, { 0x2ADA, Infix, 5, 5, 0}, { 0x2ADB, Infix, 5, 5, 0}, { 0x2ADD, Infix, 5, 5, 0}, { 0x2ADE, Infix, 5, 5, 0}, { 0x2ADF, Infix, 5, 5, 0}, { 0x2AE0, Infix, 5, 5, 0}, { 0x2AE1, Infix, 5, 5, 0}, { 0x2AE2, Infix, 5, 5, 0}, { 0x2AE3, Infix, 5, 5, 0}, { 0x2AE4, Infix, 5, 5, 0}, { 0x2AE5, Infix, 5, 5, 0}, { 0x2AE6, Infix, 5, 5, 0}, { 0x2AE7, Infix, 5, 5, 0}, { 0x2AE8, Infix, 5, 5, 0}, { 0x2AE9, Infix, 5, 5, 0}, { 0x2AEA, Infix, 5, 5, 0}, { 0x2AEB, Infix, 5, 5, 0}, { 0x2AEC, Infix, 5, 5, 0}, { 0x2AED, Infix, 5, 5, 0}, { 0x2AEE, Infix, 5, 5, 0}, { 0x2AEF, Infix, 5, 5, 0}, { 0x2AF0, Infix, 5, 5, 0}, { 0x2AF1, Infix, 5, 5, 0}, { 0x2AF2, Infix, 5, 5, 0}, { 0x2AF3, Infix, 5, 5, 0}, { 0x2AF4, Infix, 4, 4, 0}, { 0x2AF5, Infix, 4, 4, 0}, { 0x2AF6, Infix, 4, 4, 0}, { 0x2AF7, Infix, 5, 5, 0}, { 0x2AF8, Infix, 5, 5, 0}, { 0x2AF9, Infix, 5, 5, 0}, { 0x2AFA, Infix, 5, 5, 0}, { 0x2AFB, Infix, 4, 4, 0}, { 0x2AFC, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2AFD, Infix, 4, 4, 0}, { 0x2AFE, Infix, 3, 3, 0}, { 0x2AFF, Prefix, 1, 2, Symmetric | LargeOp | MovableLimits}, { 0x2B45, Infix, 5, 5, Stretchy}, { 0x2B46, Infix, 5, 5, Stretchy} };
inline UChar ExtractKeyHorizontal(const UChar* entry) { return *entry; }
static const UChar horizontalOperators[] = {
0x003D, 0x005E, 0x005F, 0x007E, 0x00AF, 0x02C6, 0x02C7, 0x02C9, 0x02CD, 0x02DC, 0x02F7, 0x0302, 0x0332, 0x203E, 0x20D0, 0x20D1, 0x20D6, 0x20D7, 0x20E1, 0x2190, 0x2192, 0x2194, 0x2198, 0x2199, 0x219C, 0x219D, 0x219E, 0x21A0, 0x21A2, 0x21A3, 0x21A4, 0x21A6, 0x21A9, 0x21AA, 0x21AB, 0x21AC, 0x21AD, 0x21B4, 0x21B9, 0x21BC, 0x21BD, 0x21C0, 0x21C1, 0x21C4, 0x21C6, 0x21C7, 0x21C9, 0x21CB, 0x21CC, 0x21D0, 0x21D2, 0x21D4, 0x21DA, 0x21DB, 0x21DC, 0x21DD, 0x21E0, 0x21E2, 0x21E4, 0x21E5, 0x21E6, 0x21E8, 0x21F0, 0x21F6, 0x21FD, 0x21FE, 0x21FF, 0x23B4, 0x23B5, 0x23DC, 0x23DD, 0x23DE, 0x23DF, 0x23E0, 0x23E1, 0x2500, 0x27F5, 0x27F6, 0x27F7, 0x27F8, 0x27F9, 0x27FA, 0x27FB, 0x27FC, 0x27FD, 0x27FE, 0x27FF, 0x290C, 0x290D, 0x290E, 0x290F, 0x2910, 0x294E, 0x2950, 0x2952, 0x2953, 0x2956, 0x2957, 0x295A, 0x295B, 0x295E, 0x295F, 0x2B45, 0x2B46, 0xFE35, 0xFE36, 0xFE37, 0xFE38
};
}
RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, PassRef<RenderStyle> style)
: RenderMathMLToken(element, WTF::move(style))
, m_stretchHeightAboveBaseline(0)
, m_stretchDepthBelowBaseline(0)
, m_operator(0)
, m_isVertical(true)
{
updateTokenContent();
}
RenderMathMLOperator::RenderMathMLOperator(Document& document, PassRef<RenderStyle> style, const String& operatorString, MathMLOperatorDictionary::Form form, unsigned short flags)
: RenderMathMLToken(document, WTF::move(style))
, m_stretchHeightAboveBaseline(0)
, m_stretchDepthBelowBaseline(0)
, m_operator(0)
, m_isVertical(true)
, m_operatorForm(form)
, m_operatorFlags(flags)
{
updateTokenContent(operatorString);
}
void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name)
{
ASSERT(!isAnonymous());
const AtomicString& attributeValue = element().fastGetAttribute(name);
if (attributeValue == "true")
m_operatorFlags |= flag;
else if (attributeValue == "false")
m_operatorFlags &= ~flag;
}
void RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry* entry)
{
if (isAnonymous())
m_operatorFlags = (m_operatorFlags & (MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator)) | entry->flags;
else
m_operatorFlags = entry->flags;
m_leadingSpace = entry->lspace * style().font().size() / 18;
m_trailingSpace = entry->rspace * style().font().size() / 18;
}
void RenderMathMLOperator::SetOperatorProperties()
{
m_isVertical = !(tryBinarySearch<const UChar, UChar>(MathMLOperatorDictionary::horizontalOperators, WTF_ARRAY_LENGTH(MathMLOperatorDictionary::horizontalOperators), m_operator, MathMLOperatorDictionary::ExtractKeyHorizontal));
bool explicitForm = true;
if (!isAnonymous()) {
const AtomicString& form = element().fastGetAttribute(MathMLNames::formAttr);
if (form == "prefix")
m_operatorForm = MathMLOperatorDictionary::Prefix;
else if (form == "infix")
m_operatorForm = MathMLOperatorDictionary::Infix;
else if (form == "postfix")
m_operatorForm = MathMLOperatorDictionary::Postfix;
else {
explicitForm = false;
if (!element().previousSibling() && element().nextSibling())
m_operatorForm = MathMLOperatorDictionary::Prefix;
else if (element().previousSibling() && !element().nextSibling())
m_operatorForm = MathMLOperatorDictionary::Postfix;
else
m_operatorForm = MathMLOperatorDictionary::Infix;
}
}
if (isAnonymous())
m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator; else
m_operatorFlags = 0; m_leadingSpace = 5 * style().font().size() / 18; m_trailingSpace = 5 * style().font().size() / 18; m_minSize = style().font().size(); m_maxSize = intMaxForLayoutUnit;
if (m_operator) {
if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch<const MathMLOperatorDictionary::Entry, MathMLOperatorDictionary::Key>(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, MathMLOperatorDictionary::Key(m_operator, m_operatorForm), MathMLOperatorDictionary::ExtractKey))
setOperatorPropertiesFromOpDictEntry(entry);
else if (!explicitForm) {
if (const MathMLOperatorDictionary::Entry* entry = tryBinarySearch<const MathMLOperatorDictionary::Entry, UChar>(MathMLOperatorDictionary::dictionary, MATHML_OPDICT_SIZE, m_operator, MathMLOperatorDictionary::ExtractChar)) {
if (entry != MathMLOperatorDictionary::dictionary && (entry-1)->character == m_operator)
entry--;
m_operatorForm = entry->form; setOperatorPropertiesFromOpDictEntry(entry);
}
}
}
#undef MATHML_OPDICT_SIZE
if (!isAnonymous()) {
setOperatorFlagFromAttribute(MathMLOperatorDictionary::Fence, MathMLNames::fenceAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::Separator, MathMLNames::separatorAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::Stretchy, MathMLNames::stretchyAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::Symmetric, MathMLNames::symmetricAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::LargeOp, MathMLNames::largeopAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::MovableLimits, MathMLNames::movablelimitsAttr);
setOperatorFlagFromAttribute(MathMLOperatorDictionary::Accent, MathMLNames::accentAttr);
parseMathMLLength(element().fastGetAttribute(MathMLNames::lspaceAttr), m_leadingSpace, &style(), false); parseMathMLLength(element().fastGetAttribute(MathMLNames::rspaceAttr), m_trailingSpace, &style(), false);
parseMathMLLength(element().fastGetAttribute(MathMLNames::minsizeAttr), m_minSize, &style(), false);
const AtomicString& maxsize = element().fastGetAttribute(MathMLNames::maxsizeAttr);
if (maxsize != "infinity")
parseMathMLLength(maxsize, m_maxSize, &style(), false);
}
}
bool RenderMathMLOperator::isChildAllowed(const RenderObject&, const RenderStyle&) const
{
return false;
}
void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
{
if (!m_isVertical || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline))
return;
m_stretchHeightAboveBaseline = heightAboveBaseline;
m_stretchDepthBelowBaseline = depthBelowBaseline;
SetOperatorProperties();
if (hasOperatorFlag(MathMLOperatorDictionary::Symmetric)) {
LayoutUnit axis = style().fontMetrics().xHeight() / 2;
LayoutUnit halfStretchSize = std::max(m_stretchHeightAboveBaseline - axis, m_stretchDepthBelowBaseline + axis);
m_stretchHeightAboveBaseline = halfStretchSize + axis;
m_stretchDepthBelowBaseline = halfStretchSize - axis;
}
LayoutUnit size = stretchSize();
float aspect = 1.0;
if (size > 0) {
if (size < m_minSize)
aspect = float(m_minSize) / size;
else if (m_maxSize < size)
aspect = float(m_maxSize) / size;
}
m_stretchHeightAboveBaseline *= aspect;
m_stretchDepthBelowBaseline *= aspect;
updateStyle();
}
void RenderMathMLOperator::stretchTo(LayoutUnit width)
{
if (m_isVertical || m_stretchWidth == width)
return;
m_stretchWidth = width;
SetOperatorProperties();
updateStyle();
}
void RenderMathMLOperator::resetStretchSize()
{
if (m_isVertical) {
m_stretchHeightAboveBaseline = 0;
m_stretchDepthBelowBaseline = 0;
} else
m_stretchWidth = 0;
}
FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData& data) const
{
return data.fontData->boundsForGlyph(data.glyph);
}
float RenderMathMLOperator::heightForGlyph(const GlyphData& data) const
{
return boundsForGlyph(data).height();
}
float RenderMathMLOperator::advanceForGlyph(const GlyphData& data) const
{
return data.fontData->widthForGlyph(data.glyph);
}
void RenderMathMLOperator::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty());
SetOperatorProperties();
if (!shouldAllowStretching()) {
RenderMathMLToken::computePreferredLogicalWidths();
if (isInvisibleOperator()) {
GlyphData data = style().font().glyphDataForCharacter(m_operator, false);
float glyphWidth = advanceForGlyph(data);
ASSERT(glyphWidth <= m_minPreferredLogicalWidth);
m_minPreferredLogicalWidth -= glyphWidth;
m_maxPreferredLogicalWidth -= glyphWidth;
}
return;
}
GlyphData data = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
float maximumGlyphWidth = advanceForGlyph(data);
if (!m_isVertical) {
if (maximumGlyphWidth < stretchSize())
maximumGlyphWidth = stretchSize();
m_maxPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace;
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
return;
}
if (isLargeOperatorInDisplayStyle()) {
StretchyData largeOperator = getDisplayStyleLargeOperator(m_operator);
if (largeOperator.mode() == DrawSizeVariant)
maximumGlyphWidth = boundsForGlyph(largeOperator.variant()).width();
} else {
findStretchyData(m_operator, &maximumGlyphWidth);
}
m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace;
}
void RenderMathMLOperator::rebuildTokenContent(const String& operatorString)
{
AtomicString textContent = operatorString.stripWhiteSpace().simplifyWhiteSpace().replace(hyphenMinus, minusSign).impl();
if (firstChild())
toRenderElement(firstChild())->destroy();
createWrapperIfNeeded();
RenderPtr<RenderText> text = createRenderer<RenderText>(document(), textContent);
toRenderElement(firstChild())->addChild(text.leakPtr());
m_operator = textContent.length() == 1 ? textContent[0] : 0;
SetOperatorProperties();
updateStyle();
setNeedsLayoutAndPrefWidthsRecalc();
}
void RenderMathMLOperator::updateTokenContent(const String& operatorString)
{
ASSERT(isAnonymous());
rebuildTokenContent(operatorString);
}
void RenderMathMLOperator::updateTokenContent()
{
ASSERT(!isAnonymous());
rebuildTokenContent(element().textContent());
}
void RenderMathMLOperator::updateFromElement()
{
SetOperatorProperties();
RenderMathMLToken::updateFromElement();
}
void RenderMathMLOperator::updateOperatorProperties()
{
SetOperatorProperties();
if (!isEmpty())
updateStyle();
setNeedsLayoutAndPrefWidthsRecalc();
}
bool RenderMathMLOperator::shouldAllowStretching() const
{
return m_operator && (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle());
}
bool RenderMathMLOperator::getGlyphAssemblyFallBack(Vector<OpenTypeMathData::AssemblyPart> assemblyParts, StretchyData& stretchyData) const
{
GlyphData top;
GlyphData extension;
GlyphData bottom;
GlyphData middle;
int nonExtenderCount = 0;
for (auto& part : assemblyParts) {
if (!part.isExtender)
nonExtenderCount++;
}
if (nonExtenderCount > 3)
return false;
unsigned state = 1;
extension.glyph = 0;
middle.glyph = 0;
for (auto& part : assemblyParts) {
if ((state == 2 || state == 3) && nonExtenderCount < 3) {
state += 2;
}
if (part.isExtender) {
if (!extension.glyph)
extension.glyph = part.glyph;
else if (extension.glyph != part.glyph)
return false;
if (state == 1) {
state = 2;
} else if (state == 3) {
state = 4;
} else if (state >= 5)
return false; continue;
}
if (state == 1) {
bottom.glyph = part.glyph;
state = 2;
continue;
}
if (state == 2 || state == 3) {
middle.glyph = part.glyph;
state = 4;
continue;
}
if (state == 4 || state == 5) {
top.glyph = part.glyph;
state = 6;
}
}
if (!extension.glyph)
return false;
if (!top.glyph)
top.glyph = extension.glyph;
if (!bottom.glyph)
bottom.glyph = extension.glyph;
top.fontData = style().font().primaryFont();
extension.fontData = top.fontData;
bottom.fontData = top.fontData;
if (middle.glyph)
middle.fontData = top.fontData;
stretchyData.setGlyphAssemblyMode(top, extension, bottom, middle);
return true;
}
RenderMathMLOperator::StretchyData RenderMathMLOperator::getDisplayStyleLargeOperator(UChar character) const
{
StretchyData data;
ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
const auto& primaryFontData = style().font().primaryFont();
GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
if (!primaryFontData || !primaryFontData->mathData() || baseGlyph.fontData != primaryFontData)
return data;
Vector<Glyph> sizeVariants;
Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
float displayOperatorMinHeight = std::max(baseGlyph.fontData->boundsForGlyph(baseGlyph.glyph).height() * float(M_SQRT2), primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight));
primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);
for (auto& variant : sizeVariants) {
GlyphData sizeVariant;
sizeVariant.glyph = variant;
sizeVariant.fontData = primaryFontData;
data.setSizeVariantMode(sizeVariant);
if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight)
return data;
}
return data;
}
RenderMathMLOperator::StretchyData RenderMathMLOperator::findStretchyData(UChar character, float* maximumGlyphWidth)
{
ASSERT(!maximumGlyphWidth || m_isVertical);
StretchyData data;
StretchyData assemblyData;
const auto& primaryFontData = style().font().primaryFont();
GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
if (primaryFontData && primaryFontData->mathData() && baseGlyph.fontData == primaryFontData) {
Vector<Glyph> sizeVariants;
Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
for (auto& variant : sizeVariants) {
GlyphData sizeVariant;
sizeVariant.glyph = variant;
sizeVariant.fontData = primaryFontData;
if (maximumGlyphWidth)
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(sizeVariant));
else {
data.setSizeVariantMode(sizeVariant);
float size = m_isVertical ? heightForGlyph(sizeVariant) : advanceForGlyph(sizeVariant);
if (size >= stretchSize())
return data;
}
}
if (!getGlyphAssemblyFallBack(assemblyParts, assemblyData))
return data;
} else {
if (!m_isVertical)
return data;
const StretchyCharacter* stretchyCharacter = nullptr;
const unsigned maxIndex = WTF_ARRAY_LENGTH(stretchyCharacters);
for (unsigned index = 0; index < maxIndex; ++index) {
if (stretchyCharacters[index].character == character) {
stretchyCharacter = &stretchyCharacters[index];
if (!style().isLeftToRightDirection() && index < leftRightPairsCount * 2) {
index += index % 2 ? -1 : 1;
}
break;
}
}
if (!stretchyCharacter)
return data;
GlyphData top = style().font().glyphDataForCharacter(stretchyCharacter->topChar, false);
GlyphData extension = style().font().glyphDataForCharacter(stretchyCharacter->extensionChar, false);
GlyphData bottom = style().font().glyphDataForCharacter(stretchyCharacter->bottomChar, false);
GlyphData middle;
if (stretchyCharacter->middleChar)
middle = style().font().glyphDataForCharacter(stretchyCharacter->middleChar, false);
assemblyData.setGlyphAssemblyMode(top, extension, bottom, middle);
}
ASSERT(assemblyData.mode() == DrawGlyphAssembly);
if (maximumGlyphWidth) {
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(assemblyData.top()));
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(assemblyData.extension()));
if (assemblyData.middle().glyph)
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(assemblyData.middle()));
*maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(assemblyData.bottom()));
return assemblyData;
}
float size;
if (m_isVertical) {
size = heightForGlyph(assemblyData.top()) + heightForGlyph(assemblyData.bottom());
if (assemblyData.middle().glyph)
size += heightForGlyph(assemblyData.middle());
} else {
size = advanceForGlyph(assemblyData.left()) + advanceForGlyph(assemblyData.right());
if (assemblyData.middle().glyph)
size += advanceForGlyph(assemblyData.middle());
}
if (size > stretchSize())
return data;
return assemblyData;
}
void RenderMathMLOperator::updateStyle()
{
FontCachePurgePreventer fontCachePurgePreventer;
ASSERT(firstChild());
if (!firstChild())
return;
m_stretchyData.setNormalMode();
const auto& wrapper = toRenderElement(firstChild());
auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
newStyle.get().setMarginStart(Length(m_leadingSpace, Fixed));
newStyle.get().setMarginEnd(Length(m_trailingSpace, Fixed));
wrapper->setStyle(WTF::move(newStyle));
wrapper->setNeedsLayoutAndPrefWidthsRecalc();
if (!shouldAllowStretching())
return;
if (m_isVertical && isLargeOperatorInDisplayStyle())
m_stretchyData = getDisplayStyleLargeOperator(m_operator);
else {
GlyphData baseGlyph = style().font().glyphDataForCharacter(m_operator, !style().isLeftToRightDirection());
float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceForGlyph(baseGlyph);
if (stretchSize() <= baseSize)
return;
m_stretchyData = findStretchyData(m_operator, nullptr);
}
if (m_isVertical && m_stretchyData.mode() == DrawSizeVariant) {
if (isLargeOperatorInDisplayStyle()) {
FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant());
m_stretchHeightAboveBaseline = -glyphBounds.y();
m_stretchDepthBelowBaseline = glyphBounds.maxY();
} else {
float variantSize = heightForGlyph(m_stretchyData.variant());
float size = stretchSize();
float aspect = size > 0 ? variantSize / size : 1.0;
m_stretchHeightAboveBaseline *= aspect;
m_stretchDepthBelowBaseline *= aspect;
}
}
if (!m_isVertical) {
if (m_stretchyData.mode() == DrawSizeVariant) {
FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant());
m_stretchHeightAboveBaseline = -glyphBounds.y();
m_stretchDepthBelowBaseline = glyphBounds.maxY();
m_stretchWidth = advanceForGlyph(m_stretchyData.variant());
} else if (m_stretchyData.mode() == DrawGlyphAssembly) {
FloatRect glyphBounds;
m_stretchHeightAboveBaseline = 0;
m_stretchDepthBelowBaseline = 0;
glyphBounds = boundsForGlyph(m_stretchyData.left());
m_stretchHeightAboveBaseline = std::max<LayoutUnit>(m_stretchHeightAboveBaseline, -glyphBounds.y());
m_stretchDepthBelowBaseline = std::max<LayoutUnit>(m_stretchDepthBelowBaseline, glyphBounds.maxY());
glyphBounds = boundsForGlyph(m_stretchyData.right());
m_stretchHeightAboveBaseline = std::max<LayoutUnit>(m_stretchHeightAboveBaseline, -glyphBounds.y());
m_stretchDepthBelowBaseline = std::max<LayoutUnit>(m_stretchDepthBelowBaseline, glyphBounds.maxY());
glyphBounds = boundsForGlyph(m_stretchyData.extension());
m_stretchHeightAboveBaseline = std::max<LayoutUnit>(m_stretchHeightAboveBaseline, -glyphBounds.y());
m_stretchDepthBelowBaseline = std::max<LayoutUnit>(m_stretchDepthBelowBaseline, glyphBounds.maxY());
if (m_stretchyData.middle().glyph) {
glyphBounds = boundsForGlyph(m_stretchyData.middle());
m_stretchHeightAboveBaseline = std::max<LayoutUnit>(m_stretchHeightAboveBaseline, -glyphBounds.y());
m_stretchDepthBelowBaseline = std::max<LayoutUnit>(m_stretchDepthBelowBaseline, glyphBounds.maxY());
}
}
}
}
int RenderMathMLOperator::firstLineBaseline() const
{
if (m_stretchyData.mode() != DrawNormal)
return m_stretchHeightAboveBaseline;
return RenderMathMLToken::firstLineBaseline();
}
void RenderMathMLOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
if (m_stretchyData.mode() != DrawNormal)
logicalHeight = m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline;
RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
}
LayoutRect RenderMathMLOperator::paintGlyph(PaintInfo& info, const GlyphData& data, const LayoutPoint& origin, GlyphPaintTrimming trim)
{
FloatRect glyphBounds = boundsForGlyph(data);
LayoutRect glyphPaintRect(origin, LayoutSize(glyphBounds.x() + glyphBounds.width(), glyphBounds.height()));
glyphPaintRect.setY(origin.y() + glyphBounds.y());
FloatRect clipBounds = info.rect;
switch (trim) {
case TrimTop:
glyphPaintRect.shiftYEdgeTo(glyphPaintRect.y().ceil() + 1);
clipBounds.shiftYEdgeTo(glyphPaintRect.y());
break;
case TrimBottom:
glyphPaintRect.shiftMaxYEdgeTo(glyphPaintRect.maxY().floor() - 1);
clipBounds.shiftMaxYEdgeTo(glyphPaintRect.maxY());
break;
case TrimTopAndBottom: {
LayoutUnit temp = glyphPaintRect.y() + 1;
glyphPaintRect.shiftYEdgeTo(temp.ceil());
glyphPaintRect.shiftMaxYEdgeTo(glyphPaintRect.maxY().floor() - 1);
clipBounds.shiftYEdgeTo(glyphPaintRect.y());
clipBounds.shiftMaxYEdgeTo(glyphPaintRect.maxY());
}
break;
case TrimLeft:
glyphPaintRect.shiftXEdgeTo(glyphPaintRect.x().ceil() + 1);
clipBounds.shiftXEdgeTo(glyphPaintRect.x());
break;
case TrimRight:
glyphPaintRect.shiftMaxXEdgeTo(glyphPaintRect.maxX().floor() - 1);
clipBounds.shiftMaxXEdgeTo(glyphPaintRect.maxX());
break;
case TrimLeftAndRight: {
LayoutUnit temp = glyphPaintRect.x() + 1;
glyphPaintRect.shiftXEdgeTo(temp.ceil());
glyphPaintRect.shiftMaxXEdgeTo(glyphPaintRect.maxX().floor() - 1);
clipBounds.shiftXEdgeTo(glyphPaintRect.x());
clipBounds.shiftMaxXEdgeTo(glyphPaintRect.maxX());
}
}
GraphicsContextStateSaver stateSaver(*info.context);
info.context->clip(clipBounds);
GlyphBuffer buffer;
buffer.add(data.glyph, data.fontData, advanceForGlyph(data));
info.context->drawGlyphs(style().font(), *data.fontData, buffer, 0, 1, origin);
return glyphPaintRect;
}
void RenderMathMLOperator::fillWithVerticalExtensionGlyph(PaintInfo& info, const LayoutPoint& from, const LayoutPoint& to)
{
ASSERT(m_isVertical);
ASSERT(m_stretchyData.mode() == DrawGlyphAssembly);
ASSERT(m_stretchyData.extension().glyph);
ASSERT(from.y() <= to.y());
if (from.y() == to.y())
return;
GraphicsContextStateSaver stateSaver(*info.context);
FloatRect glyphBounds = boundsForGlyph(m_stretchyData.extension());
LayoutRect clipBounds = info.rect;
clipBounds.shiftYEdgeTo(from.y());
clipBounds.shiftMaxYEdgeTo(to.y());
info.context->clip(clipBounds);
float offsetToGlyphTop = glyphBounds.y() + 2;
LayoutPoint glyphOrigin = LayoutPoint(from.x(), from.y() - offsetToGlyphTop);
FloatRect lastPaintedGlyphRect(from, FloatSize());
while (lastPaintedGlyphRect.maxY() < to.y()) {
lastPaintedGlyphRect = paintGlyph(info, m_stretchyData.extension(), glyphOrigin, TrimTopAndBottom);
glyphOrigin.setY(glyphOrigin.y() + lastPaintedGlyphRect.height());
if (lastPaintedGlyphRect.isEmpty())
break;
}
}
void RenderMathMLOperator::fillWithHorizontalExtensionGlyph(PaintInfo& info, const LayoutPoint& from, const LayoutPoint& to)
{
ASSERT(!m_isVertical);
ASSERT(m_stretchyData.mode() == DrawGlyphAssembly);
ASSERT(m_stretchyData.extension().glyph);
ASSERT(from.x() <= to.x());
if (from.x() == to.x())
return;
GraphicsContextStateSaver stateSaver(*info.context);
LayoutRect clipBounds = info.rect;
clipBounds.shiftXEdgeTo(from.x());
clipBounds.shiftMaxXEdgeTo(to.x());
info.context->clip(clipBounds);
float offsetToGlyphLeft = -2;
LayoutPoint glyphOrigin = LayoutPoint(from.x() + offsetToGlyphLeft, std::min(from.y(), to.y()) + m_stretchHeightAboveBaseline);
FloatRect lastPaintedGlyphRect(from, FloatSize());
while (lastPaintedGlyphRect.maxX() < to.x()) {
lastPaintedGlyphRect = paintGlyph(info, m_stretchyData.extension(), glyphOrigin, TrimLeftAndRight);
glyphOrigin.setX(glyphOrigin.x() + lastPaintedGlyphRect.width());
if (lastPaintedGlyphRect.isEmpty())
break;
}
}
void RenderMathMLOperator::paint(PaintInfo& info, const LayoutPoint& paintOffset)
{
RenderMathMLToken::paint(info, paintOffset);
if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE || m_stretchyData.mode() == DrawNormal)
return;
GraphicsContextStateSaver stateSaver(*info.context);
info.context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace());
if (m_stretchyData.mode() == DrawSizeVariant) {
ASSERT(m_stretchyData.variant().glyph);
GlyphBuffer buffer;
buffer.add(m_stretchyData.variant().glyph, m_stretchyData.variant().fontData, advanceForGlyph(m_stretchyData.variant()));
LayoutPoint operatorTopLeft = ceiledIntPoint(paintOffset + location());
FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant());
LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y());
info.context->drawGlyphs(style().font(), *m_stretchyData.variant().fontData, buffer, 0, 1, operatorOrigin);
return;
}
if (m_isVertical)
paintVerticalGlyphAssembly(info, paintOffset);
else
paintHorizontalGlyphAssembly(info, paintOffset);
}
void RenderMathMLOperator::paintVerticalGlyphAssembly(PaintInfo& info, const LayoutPoint& paintOffset)
{
ASSERT(m_isVertical);
ASSERT(m_stretchyData.mode() == DrawGlyphAssembly);
ASSERT(m_stretchyData.top().glyph);
ASSERT(m_stretchyData.bottom().glyph);
LayoutPoint operatorTopLeft = paintOffset + location();
operatorTopLeft.move(style().isLeftToRightDirection() ? m_leadingSpace : m_trailingSpace, 0);
operatorTopLeft = ceiledIntPoint(operatorTopLeft);
FloatRect topGlyphBounds = boundsForGlyph(m_stretchyData.top());
LayoutPoint topGlyphOrigin(operatorTopLeft.x(), operatorTopLeft.y() - topGlyphBounds.y());
LayoutRect topGlyphPaintRect = paintGlyph(info, m_stretchyData.top(), topGlyphOrigin, TrimBottom);
FloatRect bottomGlyphBounds = boundsForGlyph(m_stretchyData.bottom());
LayoutPoint bottomGlyphOrigin(operatorTopLeft.x(), operatorTopLeft.y() + offsetHeight() - (bottomGlyphBounds.height() + bottomGlyphBounds.y()));
LayoutRect bottomGlyphPaintRect = paintGlyph(info, m_stretchyData.bottom(), bottomGlyphOrigin, TrimTop);
if (m_stretchyData.middle().glyph) {
FloatRect middleGlyphBounds = boundsForGlyph(m_stretchyData.middle());
LayoutPoint middleGlyphOrigin(operatorTopLeft.x(), topGlyphOrigin.y());
middleGlyphOrigin.moveBy(LayoutPoint(0, (bottomGlyphPaintRect.y() - topGlyphPaintRect.maxY()) / 2.0));
middleGlyphOrigin.moveBy(LayoutPoint(0, middleGlyphBounds.height() / 2.0));
LayoutRect middleGlyphPaintRect = paintGlyph(info, m_stretchyData.middle(), middleGlyphOrigin, TrimTopAndBottom);
fillWithVerticalExtensionGlyph(info, topGlyphPaintRect.minXMaxYCorner(), middleGlyphPaintRect.minXMinYCorner());
fillWithVerticalExtensionGlyph(info, middleGlyphPaintRect.minXMaxYCorner(), bottomGlyphPaintRect.minXMinYCorner());
} else
fillWithVerticalExtensionGlyph(info, topGlyphPaintRect.minXMaxYCorner(), bottomGlyphPaintRect.minXMinYCorner());
}
void RenderMathMLOperator::paintHorizontalGlyphAssembly(PaintInfo& info, const LayoutPoint& paintOffset)
{
ASSERT(!m_isVertical);
ASSERT(m_stretchyData.mode() == DrawGlyphAssembly);
ASSERT(m_stretchyData.left().glyph);
ASSERT(m_stretchyData.right().glyph);
LayoutPoint operatorTopLeft = paintOffset + location();
operatorTopLeft.move(m_leadingSpace, 0);
operatorTopLeft = ceiledIntPoint(operatorTopLeft);
LayoutPoint leftGlyphOrigin(operatorTopLeft.x(), operatorTopLeft.y() + m_stretchHeightAboveBaseline);
LayoutRect leftGlyphPaintRect = paintGlyph(info, m_stretchyData.left(), leftGlyphOrigin, TrimRight);
FloatRect rightGlyphBounds = boundsForGlyph(m_stretchyData.right());
LayoutPoint rightGlyphOrigin(operatorTopLeft.x() + offsetWidth() - rightGlyphBounds.width(), operatorTopLeft.y() + m_stretchHeightAboveBaseline);
LayoutRect rightGlyphPaintRect = paintGlyph(info, m_stretchyData.right(), rightGlyphOrigin, TrimLeft);
if (m_stretchyData.middle().glyph) {
LayoutPoint middleGlyphOrigin(operatorTopLeft.x(), leftGlyphOrigin.y());
middleGlyphOrigin.moveBy(LayoutPoint((rightGlyphPaintRect.x() - leftGlyphPaintRect.maxX()) / 2.0, 0));
LayoutRect middleGlyphPaintRect = paintGlyph(info, m_stretchyData.middle(), middleGlyphOrigin, TrimLeftAndRight);
fillWithHorizontalExtensionGlyph(info, leftGlyphPaintRect.maxXMinYCorner(), middleGlyphPaintRect.minXMinYCorner());
fillWithHorizontalExtensionGlyph(info, middleGlyphPaintRect.maxXMinYCorner(), rightGlyphPaintRect.minXMinYCorner());
} else
fillWithHorizontalExtensionGlyph(info, leftGlyphPaintRect.maxXMinYCorner(), rightGlyphPaintRect.minXMinYCorner());
}
void RenderMathMLOperator::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)
{
if (m_stretchyData.mode() != DrawNormal || isInvisibleOperator())
return;
RenderMathMLToken::paintChildren(paintInfo, paintOffset, paintInfoForChild, usePrintRect);
}
}
#endif