1/*
2 * Copyright (C) 2014 Gurpreet Kaur (k.gurpreet@samsung.com). All rights reserved.
3 * Copyright (C) 2016 Igalia S.L.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#pragma once
28
29#if ENABLE(MATHML)
30
31#include "Element.h"
32#include "MathMLRowElement.h"
33
34namespace WebCore {
35
36class MathMLMencloseElement final: public MathMLRowElement {
37 WTF_MAKE_ISO_ALLOCATED(MathMLMencloseElement);
38public:
39 static Ref<MathMLMencloseElement> create(const QualifiedName& tagName, Document&);
40
41 enum MencloseNotationFlag {
42 LongDiv = 1 << 1,
43 RoundedBox = 1 << 2,
44 Circle = 1 << 3,
45 Left = 1 << 4,
46 Right = 1 << 5,
47 Top = 1 << 6,
48 Bottom = 1 << 7,
49 UpDiagonalStrike = 1 << 8,
50 DownDiagonalStrike = 1 << 9,
51 VerticalStrike = 1 << 10,
52 HorizontalStrike = 1 << 11,
53 UpDiagonalArrow = 1 << 12, // FIXME: updiagonalarrow is not implemented. See http://wkb.ug/127466
54 PhasorAngle = 1 << 13 // FIXME: phasorangle is not implemented. See http://wkb.ug/127466
55 // We do not implement the Radical notation. Authors should instead use the <msqrt> element.
56 };
57 bool hasNotation(MencloseNotationFlag);
58
59private:
60 MathMLMencloseElement(const QualifiedName&, Document&);
61 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
62 void parseAttribute(const QualifiedName&, const AtomicString&) final;
63 void parseNotationAttribute();
64 void clearNotations() { m_notationFlags = 0; }
65 void addNotation(MencloseNotationFlag notationFlag) { m_notationFlags.value() |= notationFlag; }
66 void addNotationFlags(StringView notation);
67 Optional<uint16_t> m_notationFlags;
68};
69
70}
71
72#endif // ENABLE(MATHML)
73