Add support for menclose element
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2014 16:34:52 +0000 (16:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2014 16:34:52 +0000 (16:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85729

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2014-01-28
Reviewed by Chris Fleizach.

Source/WebCore:

Added support for menclose element. MathML <menclose> element renders
its content inside an enclosing notation specified by the notation
attribute. The notation attribute can have values longdiv, box, left,
right, top, bottom , radical, madruwb, actuarial, roundedbox, circle,
updiagonalstrike, downdiagonalstrike, verticalstrike and
horizontalstrike.

Tests: mathml/presentation/menclose-add-children.html
       mathml/presentation/menclose-notation-attribute-add.html
       mathml/presentation/menclose-notation-attribute-change-value.html
       mathml/presentation/menclose-notation-attribute-remove.html
       mathml/presentation/menclose-notation-attribute-set1.html
       mathml/presentation/menclose-notation-attribute-set2.html
       mathml/presentation/menclose-notation-no-overlap.html
       mathml/presentation/menclose-notation-radical.html
       mathml/presentation/menclose-remove-children.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/mathml.css:
(mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose):
(math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose):
* mathml/MathMLAllInOne.cpp:
* mathml/MathMLElement.h:
* mathml/MathMLInlineContainerElement.cpp:
* mathml/MathMLMencloseElement.cpp: Added.
(WebCore::MathMLMencloseElement::MathMLMencloseElement):
(WebCore::MathMLMencloseElement::create):
(WebCore::MathMLMencloseElement::createElementRenderer):
(WebCore::MathMLMencloseElement::isPresentationAttribute):
(WebCore::MathMLMencloseElement::finishParsingChildren):
(WebCore::MathMLMencloseElement::collectStyleForPresentationAttribute):
(WebCore::MathMLMencloseElement::longDivLeftPadding):
* mathml/MathMLMencloseElement.h: Added.
(WebCore::toMathMLMencloseElement):
* mathml/mathattrs.in:
* mathml/mathtags.in:
* rendering/mathml/RenderMathMLMenclose.cpp: Added.
(WebCore::RenderMathMLMenclose::RenderMathMLMenclose):
(WebCore::RenderMathMLMenclose::addChild):
(WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
(WebCore::RenderMathMLMenclose::updateLogicalHeight):
(WebCore::RenderMathMLMenclose::paint):
(WebCore::RenderMathMLMenclose::checkNotationalValuesValidity):
* rendering/mathml/RenderMathMLMenclose.h: Added.
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::RenderMathMLRoot):
* rendering/mathml/RenderMathMLRoot.h:
* rendering/mathml/RenderMathMLSquareRoot.cpp:
(WebCore::RenderMathMLSquareRoot::RenderMathMLSquareRoot):
(WebCore::RenderMathMLSquareRoot::createAnonymousWithParentRenderer):
* rendering/mathml/RenderMathMLSquareRoot.h:
Added new file related to menclose element implementation. Menclose
element is created and while parsing its notation attribute based on
its values like top, left CSSBorder properties are applied and for
values like circle, verticalstrike, longidv its taken care in paint.
For radical value an anonymous RenderMathMLSquareRoot is created as
a child of menclose.

LayoutTests:

* mathml/presentation/inferred-mrow-baseline-expected.txt:
* mathml/presentation/inferred-mrow-baseline.html:
* mathml/presentation/inferred-mrow-stretchy-expected.txt:
* mathml/presentation/inferred-mrow-stretchy.html:
Rebaselining existing tests as per the new behavior.

* mathml/presentation/menclose-add-children-expected.html: Added.
* mathml/presentation/menclose-add-children.html: Added.
* mathml/presentation/menclose-notation-attribute-add-expected.html: Added.
* mathml/presentation/menclose-notation-attribute-add.html: Added.
* mathml/presentation/menclose-notation-attribute-change-value-expected.html: Added.
* mathml/presentation/menclose-notation-attribute-change-value.html: Added.
* mathml/presentation/menclose-notation-attribute-remove-expected.html: Added.
* mathml/presentation/menclose-notation-attribute-remove.html: Added.
* mathml/presentation/menclose-notation-attribute-set1-expected.txt: Added.
* mathml/presentation/menclose-notation-attribute-set1.html: Added.
* mathml/presentation/menclose-notation-attribute-set2-expected-mismatch.html: Added.
* mathml/presentation/menclose-notation-attribute-set2.html: Added.
* mathml/presentation/menclose-notation-no-overlap-expected.txt: Added.
* mathml/presentation/menclose-notation-no-overlap.html: Added.
* mathml/presentation/menclose-notation-radical-expected.html: Added.
* mathml/presentation/menclose-notation-radical.html: Added.
* mathml/presentation/menclose-remove-children-expected.html: Added.
* mathml/presentation/menclose-remove-children.html: Added.
Added new test cases for verifying the behaviour of menclose element
with different values of notation attribute and removing/changing/adding
notation attribute.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 files changed:
LayoutTests/ChangeLog
LayoutTests/mathml/presentation/inferred-mrow-baseline-expected.txt
LayoutTests/mathml/presentation/inferred-mrow-baseline.html
LayoutTests/mathml/presentation/inferred-mrow-stretchy-expected.txt
LayoutTests/mathml/presentation/inferred-mrow-stretchy.html
LayoutTests/mathml/presentation/menclose-add-children-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-add-children.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-add-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-add.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-change-value-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-change-value.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-remove-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-remove.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-set1-expected.txt [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-set1.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-set2-expected-mismatch.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-attribute-set2.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-no-overlap-expected.txt [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-no-overlap.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-radical-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-notation-radical.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-remove-children-expected.html [new file with mode: 0755]
LayoutTests/mathml/presentation/menclose-remove-children.html [new file with mode: 0755]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/mathml.css
Source/WebCore/mathml/MathMLAllInOne.cpp
Source/WebCore/mathml/MathMLElement.h
Source/WebCore/mathml/MathMLInlineContainerElement.cpp
Source/WebCore/mathml/MathMLMencloseElement.cpp [new file with mode: 0755]
Source/WebCore/mathml/MathMLMencloseElement.h [new file with mode: 0755]
Source/WebCore/mathml/mathattrs.in
Source/WebCore/mathml/mathtags.in
Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp [new file with mode: 0755]
Source/WebCore/rendering/mathml/RenderMathMLMenclose.h [new file with mode: 0755]
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.h
Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h

index 52602b9..460ae67 100644 (file)
@@ -1,3 +1,38 @@
+2014-01-28  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        Add support for menclose element
+        https://bugs.webkit.org/show_bug.cgi?id=85729
+
+        Reviewed by Chris Fleizach.
+
+        * mathml/presentation/inferred-mrow-baseline-expected.txt:
+        * mathml/presentation/inferred-mrow-baseline.html:
+        * mathml/presentation/inferred-mrow-stretchy-expected.txt:
+        * mathml/presentation/inferred-mrow-stretchy.html:
+        Rebaselining existing tests as per the new behavior.
+
+        * mathml/presentation/menclose-add-children-expected.html: Added.
+        * mathml/presentation/menclose-add-children.html: Added.
+        * mathml/presentation/menclose-notation-attribute-add-expected.html: Added.
+        * mathml/presentation/menclose-notation-attribute-add.html: Added.
+        * mathml/presentation/menclose-notation-attribute-change-value-expected.html: Added.
+        * mathml/presentation/menclose-notation-attribute-change-value.html: Added.
+        * mathml/presentation/menclose-notation-attribute-remove-expected.html: Added.
+        * mathml/presentation/menclose-notation-attribute-remove.html: Added.
+        * mathml/presentation/menclose-notation-attribute-set1-expected.txt: Added.
+        * mathml/presentation/menclose-notation-attribute-set1.html: Added.
+        * mathml/presentation/menclose-notation-attribute-set2-expected-mismatch.html: Added.
+        * mathml/presentation/menclose-notation-attribute-set2.html: Added.
+        * mathml/presentation/menclose-notation-no-overlap-expected.txt: Added.
+        * mathml/presentation/menclose-notation-no-overlap.html: Added.
+        * mathml/presentation/menclose-notation-radical-expected.html: Added.
+        * mathml/presentation/menclose-notation-radical.html: Added.
+        * mathml/presentation/menclose-remove-children-expected.html: Added.
+        * mathml/presentation/menclose-remove-children.html: Added.
+        Added new test cases for verifying the behaviour of menclose element
+        with different values of notation attribute and removing/changing/adding
+        notation attribute.
+
 2014-01-27  Brian Burg  <bburg@apple.com>
 
         Web Inspector: clean up initialization of managers and observers in InspectorTest
index 1ebee2e..813d9ed 100644 (file)
@@ -5,6 +5,7 @@ This test passes if rectangles are correctly aligned with respect to the baselin
  
  
  
 
 Mrow: PASS
 Sqrt: PASS
@@ -12,4 +13,5 @@ Style: PASS
 Error: PASS
 Phantom: PASS
 Math: PASS
+Menclose: PASS
 
index fe577e6..fd65774 100644 (file)
@@ -5,7 +5,7 @@
     <script type="text/javascript">
       function test()
       {
-        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math"];
+        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose"];
         var result = "";
         for (var i in tags) {
           var tag = tags[i];
@@ -36,6 +36,8 @@
       <math><mphantom><mspace style="visibility: visible;" id="abovePhantom" width="10px" height="30px" mathbackground="red"></mspace><mspace style="visibility: visible;" id="belowPhantom" width="10px" depth="30px" mathbackground="blue"></mspace></mphantom></math>
 
       <math><mspace id="aboveMath" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowMath" width="10px" depth="30px" mathbackground="blue"></mspace></math>
+         
+      <math><menclose notation="box"><mspace id="aboveMenclose" width="10px" height="30px" mathbackground="red"></mspace><mspace id="belowMenclose" width="10px" depth="30px" mathbackground="blue"></mspace></menclose></math>
     </p>
 
     <div id="result"></div>
index 27f6546..d6881fb 100644 (file)
@@ -5,6 +5,7 @@ This test passes if all the vertical bars stretch.
  
  
  
 
 Mrow: PASS
 Sqrt: PASS
@@ -12,4 +13,5 @@ Style: PASS
 Error: PASS
 Phantom: PASS
 Math: PASS
+Menclose: PASS
 
index b0595f1..a6c574c 100644 (file)
@@ -5,7 +5,7 @@
     <script type="text/javascript">
       function test()
       {
-        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math"];
+        var tags = ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose"];
         var result = "";
         for (var i in tags) {
           var tag = tags[i];
@@ -30,6 +30,7 @@
       <math><merror><mo id="moError">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></merror></math>
       <math><mphantom><mo style="visibilty: visible;" id="moPhantom">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></mphantom></math>
       <math><mo id="moMath">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></math>
+      <math><menclose notation="box"><mo id="moMenclose">|</mo><mspace width="1px" height="30px" depth="30px" mathbackground="red"></mspace></menclose></math>
     </p>
 
     <div id="result"></div>
diff --git a/LayoutTests/mathml/presentation/menclose-add-children-expected.html b/LayoutTests/mathml/presentation/menclose-add-children-expected.html
new file mode 100755 (executable)
index 0000000..90615b0
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            <math><menclose notation="box"><mspace width="100px" height="100px" mathbackground="red"/></menclose></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-add-children.html b/LayoutTests/mathml/presentation/menclose-add-children.html
new file mode 100755 (executable)
index 0000000..f7d75c0
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+    <head>
+        <script type="text/javascript">
+            function runTest() {
+                var mathmlNS = "http://www.w3.org/1998/Math/MathML";
+                var node = document.createElementNS(mathmlNS, "mspace");
+                               node.setAttribute("width","100px");
+                               node.setAttribute("height","100px");
+                               node.setAttribute("mathbackground","red");
+                               document.getElementById('testMenclose').appendChild(node);
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math><menclose id="testMenclose" notation="box"></menclose></math>
+               </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-add-expected.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-add-expected.html
new file mode 100755 (executable)
index 0000000..1a5496f
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            <math><menclose notation="box"><mspace width="100px" height="50px" mathbackground="red"/></menclose></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-add.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-add.html
new file mode 100755 (executable)
index 0000000..818d3dc
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script type="text/javascript">
+            function runTest() {
+                               document.getElementById('testMenclose').setAttribute("notation","box");
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math><menclose id="testMenclose"><mspace width="100px" height="50px" mathbackground="red"></mspace></menclose></math>
+               </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-change-value-expected.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-change-value-expected.html
new file mode 100755 (executable)
index 0000000..d23b4e2
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            <math><menclose notation="longdiv"><mspace width="100px" height="50px" mathbackground="red"/></menclose></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-change-value.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-change-value.html
new file mode 100755 (executable)
index 0000000..6dd41ac
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script type="text/javascript">
+            function runTest() {
+                               document.getElementById('testMenclose').setAttribute("notation","longdiv");
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math><menclose id="testMenclose" notation="box"><mspace width="100px" height="50px" mathbackground="red"></mspace></menclose></math>
+               </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-remove-expected.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-remove-expected.html
new file mode 100755 (executable)
index 0000000..9a76559
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            <math><menclose><mspace width="100px" height="50px" mathbackground="red"></mspace></menclose></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-remove.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-remove.html
new file mode 100755 (executable)
index 0000000..336e74f
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script type="text/javascript">
+            function runTest() {
+                document.getElementById('testMenclose').removeAttribute("notation");
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math><menclose id="testMenclose" notation="box"><mspace width="100px" height="50px" mathbackground="red"></mspace></menclose></math>
+               </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-set1-expected.txt b/LayoutTests/mathml/presentation/menclose-notation-attribute-set1-expected.txt
new file mode 100755 (executable)
index 0000000..cbc12ea
--- /dev/null
@@ -0,0 +1,47 @@
+Tests that left, right, top, bottom, box, roundedbox, madruwb, actuarial attribute value is applied for menclose
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-left-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-left-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-right-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-right-width') is "0px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-right-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-right-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-left-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-left-width') is "0px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-top-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-top-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-bottom-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-bottom-width') is "0px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-bottom-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-bottom-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-top-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-top-width') is "0px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose5'),null).getPropertyValue('border') is "1px solid rgb(0, 0, 0)"
+PASS window.getComputedStyle(document.getElementById('mathmenclose6'),null).getPropertyValue('border') is "1px solid rgb(0, 0, 0)"
+PASS window.getComputedStyle(document.getElementById('mathmenclose6'),null).getPropertyValue('border-radius') is "5px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-right-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-right-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-bottom-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-bottom-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-top-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-top-width') is "0px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-right-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-right-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-top-style') is "solid"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-top-width') is "1px"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-bottom-style') is "none"
+PASS window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-bottom-width') is "0px"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
+
+
+
+
+
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-set1.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-set1.html
new file mode 100755 (executable)
index 0000000..bf834a9
--- /dev/null
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script>
+            function runTest() {
+                description('Tests that left, right, top, bottom, box, roundedbox, madruwb, actuarial attribute value is applied for menclose');
+
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-left-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-left-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-right-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose1'),null).getPropertyValue('border-right-width')","0px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-right-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-right-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-left-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose2'),null).getPropertyValue('border-left-width')","0px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-top-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-top-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-bottom-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose3'),null).getPropertyValue('border-bottom-width')","0px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-bottom-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-bottom-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-top-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose4'),null).getPropertyValue('border-top-width')","0px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose5'),null).getPropertyValue('border')","1px solid rgb(0, 0, 0)");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose6'),null).getPropertyValue('border')","1px solid rgb(0, 0, 0)");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose6'),null).getPropertyValue('border-radius')","5px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-right-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-right-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-bottom-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-bottom-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-top-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose7'),null).getPropertyValue('border-top-width')","0px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-right-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-right-width')","1px");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-top-style')","solid");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-top-width')","1px");
+                               shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-bottom-style')","none");
+                shouldBeEqualToString("window.getComputedStyle(document.getElementById('mathmenclose8'),null).getPropertyValue('border-bottom-width')","0px");              
+                isSuccessfullyParsed();                                
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math>
+                <menclose notation="left" id="mathmenclose1"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="right" id="mathmenclose2"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="top" id="mathmenclose3"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="bottom" id="mathmenclose4"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="box" id="mathmenclose5"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="roundedbox" id="mathmenclose6"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="madruwb" id="mathmenclose7"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+        <p>
+            <math>
+                <menclose notation="actuarial" id="mathmenclose8"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-set2-expected-mismatch.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-set2-expected-mismatch.html
new file mode 100755 (executable)
index 0000000..e17a6b3
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            <math>
+                <mrow><mspace width="100px" height="50px" mathbackground="red"/></mrow>
+            </math>
+        <p>        
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-attribute-set2.html b/LayoutTests/mathml/presentation/menclose-notation-attribute-set2.html
new file mode 100755 (executable)
index 0000000..82257d2
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>menclose notation downdiagonalstrike test</title>
+    </head>
+    <body>
+        <p>
+            <math>
+                <menclose notation="downdiagonalstrike"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>           
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-no-overlap-expected.txt b/LayoutTests/mathml/presentation/menclose-notation-no-overlap-expected.txt
new file mode 100755 (executable)
index 0000000..f83ea64
--- /dev/null
@@ -0,0 +1,11 @@
+Tests that menclose with notation value as circle is sqrt(2) times the inner width/height.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('mathmenclose1').offsetWidth >= 141 is true
+PASS document.getElementById('mathmenclose1').offsetHeight >= 70 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/mathml/presentation/menclose-notation-no-overlap.html b/LayoutTests/mathml/presentation/menclose-notation-no-overlap.html
new file mode 100755 (executable)
index 0000000..2c54aad
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script>
+            function runTest() {
+                description('Tests that menclose with notation value as circle is sqrt(2) times the inner width/height.');
+
+                shouldBeTrue("document.getElementById('mathmenclose1').offsetWidth >= 141");
+                shouldBeTrue("document.getElementById('mathmenclose1').offsetHeight >= 70");
+                               isSuccessfullyParsed();
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math>
+                <menclose notation="circle" id="mathmenclose1"><mspace width="100px" height="50px" mathbackground="red"/></menclose>
+            </math>
+        </p>        
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-radical-expected.html b/LayoutTests/mathml/presentation/menclose-notation-radical-expected.html
new file mode 100755 (executable)
index 0000000..19c2cca
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>msqrt test</title>
+    </head>
+    <body>
+        <p>
+            <math><mrow><msqrt><mspace width="100px" height="50px" mathbackground="red"/></msqrt></mrow></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-notation-radical.html b/LayoutTests/mathml/presentation/menclose-notation-radical.html
new file mode 100755 (executable)
index 0000000..2b00a09
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>menclose notation radical test</title>
+    </head>
+    <body>
+        <p>
+            <math><mrow><menclose notation="radical"><mspace width="100px" height="50px" mathbackground="red"/></menclose></mrow></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-remove-children-expected.html b/LayoutTests/mathml/presentation/menclose-remove-children-expected.html
new file mode 100755 (executable)
index 0000000..edf74ee
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+    <body>
+        <p>
+            <math><menclose notation="box"></menclose></math>
+        </p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/mathml/presentation/menclose-remove-children.html b/LayoutTests/mathml/presentation/menclose-remove-children.html
new file mode 100755 (executable)
index 0000000..664753a
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+    <head>   
+        <script type="text/javascript">
+            function runTest() {
+                var node=document.getElementById('testMenclose').firstChild;
+                               document.getElementById('testMenclose').removeChild(node);
+            }
+        </script>
+    </head>
+    <body onload="runTest()">
+        <p>
+            <math><menclose id="testMenclose" notation="box"><mspace width="100px" height="50px" mathbackground="red"></mspace></menclose></math>
+               </p>
+    </body>
+</html>
\ No newline at end of file
index 2ef47a4..8b01638 100644 (file)
@@ -1701,6 +1701,7 @@ set(WebCore_SOURCES
     mathml/MathMLElement.cpp
     mathml/MathMLInlineContainerElement.cpp
     mathml/MathMLMathElement.cpp
+    mathml/MathMLMencloseElement.cpp
     mathml/MathMLSelectElement.cpp
     mathml/MathMLTextElement.cpp
 
@@ -2213,6 +2214,7 @@ set(WebCore_SOURCES
     rendering/mathml/RenderMathMLFenced.cpp
     rendering/mathml/RenderMathMLFraction.cpp
     rendering/mathml/RenderMathMLMath.cpp
+    rendering/mathml/RenderMathMLMenclose.cpp
     rendering/mathml/RenderMathMLOperator.cpp
     rendering/mathml/RenderMathMLRoot.cpp
     rendering/mathml/RenderMathMLRow.cpp
index e6b434c..2bf8f29 100644 (file)
@@ -1,3 +1,72 @@
+2014-01-28  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        Add support for menclose element
+        https://bugs.webkit.org/show_bug.cgi?id=85729
+
+        Reviewed by Chris Fleizach.
+
+        Added support for menclose element. MathML <menclose> element renders
+        its content inside an enclosing notation specified by the notation
+        attribute. The notation attribute can have values longdiv, box, left,
+        right, top, bottom , radical, madruwb, actuarial, roundedbox, circle,
+        updiagonalstrike, downdiagonalstrike, verticalstrike and
+        horizontalstrike.
+
+        Tests: mathml/presentation/menclose-add-children.html
+               mathml/presentation/menclose-notation-attribute-add.html
+               mathml/presentation/menclose-notation-attribute-change-value.html
+               mathml/presentation/menclose-notation-attribute-remove.html
+               mathml/presentation/menclose-notation-attribute-set1.html
+               mathml/presentation/menclose-notation-attribute-set2.html
+               mathml/presentation/menclose-notation-no-overlap.html
+               mathml/presentation/menclose-notation-radical.html
+               mathml/presentation/menclose-remove-children.html
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/mathml.css:
+        (mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose):
+        (math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose):
+        * mathml/MathMLAllInOne.cpp:
+        * mathml/MathMLElement.h:
+        * mathml/MathMLInlineContainerElement.cpp:
+        * mathml/MathMLMencloseElement.cpp: Added.
+        (WebCore::MathMLMencloseElement::MathMLMencloseElement):
+        (WebCore::MathMLMencloseElement::create):
+        (WebCore::MathMLMencloseElement::createElementRenderer):
+        (WebCore::MathMLMencloseElement::isPresentationAttribute):
+        (WebCore::MathMLMencloseElement::finishParsingChildren):
+        (WebCore::MathMLMencloseElement::collectStyleForPresentationAttribute):
+        (WebCore::MathMLMencloseElement::longDivLeftPadding):
+        * mathml/MathMLMencloseElement.h: Added.
+        (WebCore::toMathMLMencloseElement):
+        * mathml/mathattrs.in:
+        * mathml/mathtags.in:
+        * rendering/mathml/RenderMathMLMenclose.cpp: Added.
+        (WebCore::RenderMathMLMenclose::RenderMathMLMenclose):
+        (WebCore::RenderMathMLMenclose::addChild):
+        (WebCore::RenderMathMLMenclose::computePreferredLogicalWidths):
+        (WebCore::RenderMathMLMenclose::updateLogicalHeight):
+        (WebCore::RenderMathMLMenclose::paint):
+        (WebCore::RenderMathMLMenclose::checkNotationalValuesValidity):
+        * rendering/mathml/RenderMathMLMenclose.h: Added.
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::RenderMathMLRoot):
+        * rendering/mathml/RenderMathMLRoot.h:
+        * rendering/mathml/RenderMathMLSquareRoot.cpp:
+        (WebCore::RenderMathMLSquareRoot::RenderMathMLSquareRoot):
+        (WebCore::RenderMathMLSquareRoot::createAnonymousWithParentRenderer):
+        * rendering/mathml/RenderMathMLSquareRoot.h:
+        Added new file related to menclose element implementation. Menclose
+        element is created and while parsing its notation attribute based on
+        its values like top, left CSSBorder properties are applied and for
+        values like circle, verticalstrike, longidv its taken care in paint.
+        For radical value an anonymous RenderMathMLSquareRoot is created as
+        a child of menclose.
+
 2014-01-28  Krzysztof Czech  <k.czech@samsung.com>
 
         [ATK] accessibility/range-alter-by-percent.html is failing after r162587.
index 9bdc99e..20e971b 100644 (file)
@@ -4030,6 +4030,8 @@ webcore_sources += \
        Source/WebCore/mathml/MathMLInlineContainerElement.h  \
        Source/WebCore/mathml/MathMLMathElement.cpp \
        Source/WebCore/mathml/MathMLMathElement.h \
+       Source/WebCore/mathml/MathMLMencloseElement.cpp \
+       Source/WebCore/mathml/MathMLMencloseElement.h \
        Source/WebCore/mathml/MathMLSelectElement.cpp \
        Source/WebCore/mathml/MathMLSelectElement.h  \
        Source/WebCore/mathml/MathMLTextElement.cpp \
@@ -4519,6 +4521,8 @@ webcore_sources += \
        Source/WebCore/rendering/mathml/RenderMathMLFraction.h \
        Source/WebCore/rendering/mathml/RenderMathMLMath.cpp \
        Source/WebCore/rendering/mathml/RenderMathMLMath.h \
+       Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp \
+       Source/WebCore/rendering/mathml/RenderMathMLMenclose.h \
        Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp \
        Source/WebCore/rendering/mathml/RenderMathMLOperator.h \
        Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp \
index a1385b8..4524cf8 100644 (file)
     <ClCompile Include="..\rendering\mathml\RenderMathMLFenced.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLFraction.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLMath.cpp" />
+    <ClCompile Include="..\rendering\mathml\RenderMathMLMenclose.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLOperator.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLRoot.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp" />
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\mathml\MathMLMencloseElement.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     <ClInclude Include="..\rendering\mathml\RenderMathMLFenced.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLFraction.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLMath.h" />
+    <ClInclude Include="..\rendering\mathml\RenderMathMLMenclose.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLOperator.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLRoot.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h" />
     <ClInclude Include="..\mathml\MathMLElement.h" />
     <ClInclude Include="..\mathml\MathMLInlineContainerElement.h" />
     <ClInclude Include="..\mathml\MathMLMathElement.h" />
+    <ClInclude Include="..\mathml\MathMLMencloseElement.h" />
     <ClInclude Include="..\mathml\MathMLSelectElement.h" />
     <ClInclude Include="..\mathml\MathMLTextElement.h" />
     <ClInclude Include="..\editing\AlternativeTextController.h" />
index 9006721..afc5c12 100644 (file)
     <ClCompile Include="..\rendering\mathml\RenderMathMLMath.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
+       <ClCompile Include="..\rendering\mathml\RenderMathMLMenclose.cpp">
+      <Filter>rendering\mathml</Filter>
+    </ClCompile>
     <ClCompile Include="..\rendering\mathml\RenderMathMLOperator.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
     <ClCompile Include="..\mathml\MathMLMathElement.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
+    <ClCompile Include="..\mathml\MathMLMencloseElement.cpp">
+      <Filter>rendering\mathml</Filter>
+    </ClCompile>
     <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
     <ClInclude Include="..\rendering\mathml\RenderMathMLMath.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
+    <ClInclude Include="..\rendering\mathml\RenderMathMLMenclose.h">
+      <Filter>rendering\mathml</Filter>
+    </ClInclude>
     <ClInclude Include="..\rendering\mathml\RenderMathMLOperator.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
     <ClInclude Include="..\mathml\MathMLMathElement.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
+    <ClInclude Include="..\mathml\MathMLMencloseElement.h">
+      <Filter>rendering\mathml</Filter>
+    </ClInclude>
     <ClInclude Include="..\mathml\MathMLSelectElement.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
index 964ab77..4d21e81 100644 (file)
@@ -65,6 +65,7 @@
                01D3CF8714BD0A3000FE9970 /* WebGLSharedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 01D3CF8114BD0A3000FE9970 /* WebGLSharedObject.h */; };
                01E6C2E41194B2820050821C /* SpellingDot@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01E6C2E31194B2820050821C /* SpellingDot@2x.png */; };
                0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9601573F88F0031CA16 /* PlatformLayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               05D913CEEAB2A60534218ACF /* MathMLMencloseElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */; };
                05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
                06027CAD0B1CBFC000884B2D /* ContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
                06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */; };
                3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA520FFC157B00921962 /* NotificationCenter.h */; };
                339B5B63131DAA3200F48D02 /* CookiesStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 339B5B62131DAA3200F48D02 /* CookiesStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                33D0212D131DB37B004091A8 /* CookieStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = E13F01EA1270E10D00DFBA71 /* CookieStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               3571883EEF618793751E4089 /* RenderMathMLMenclose.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */; };
                3717D7E817ECC591003C276D /* extract-localizable-strings.pl in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */; };
                371941961566B37200A276D8 /* WebCoreNSCellExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 371941941566B37200A276D8 /* WebCoreNSCellExtras.m */; };
                371941971566B37200A276D8 /* WebCoreNSCellExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 371941951566B37200A276D8 /* WebCoreNSCellExtras.h */; };
                3390CA520FFC157B00921962 /* NotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationCenter.h; sourceTree = "<group>"; };
                3390CA530FFC157B00921962 /* NotificationCenter.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NotificationCenter.idl; sourceTree = "<group>"; };
                339B5B62131DAA3200F48D02 /* CookiesStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookiesStrategy.h; sourceTree = "<group>"; };
+               3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLMenclose.cpp; path = rendering/mathml/RenderMathMLMenclose.cpp; sourceTree = SOURCE_ROOT; };
                3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "extract-localizable-strings.pl"; sourceTree = "<group>"; };
                371941941566B37200A276D8 /* WebCoreNSCellExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreNSCellExtras.m; sourceTree = "<group>"; };
                371941951566B37200A276D8 /* WebCoreNSCellExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreNSCellExtras.h; sourceTree = "<group>"; };
                A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DistantLightSource.cpp; path = filters/DistantLightSource.cpp; sourceTree = "<group>"; };
                A1E1154513015C4E0054AC8C /* PointLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PointLightSource.cpp; path = filters/PointLightSource.cpp; sourceTree = "<group>"; };
                A1E1154713015C5D0054AC8C /* SpotLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpotLightSource.cpp; path = filters/SpotLightSource.cpp; sourceTree = "<group>"; };
+               A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLMenclose.h; path = rendering/mathml/RenderMathMLMenclose.h; sourceTree = SOURCE_ROOT; };
                A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = "<group>"; };
                A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESTextureHalfFloat.cpp; path = canvas/OESTextureHalfFloat.cpp; sourceTree = "<group>"; };
                A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESTextureHalfFloat.h; path = canvas/OESTextureHalfFloat.h; sourceTree = "<group>"; };
                C3CF17A115B0063F00276D39 /* IdTargetObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserver.h; sourceTree = "<group>"; };
                C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserverRegistry.cpp; sourceTree = "<group>"; };
                C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; };
+               C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLMencloseElement.cpp; sourceTree = "<group>"; };
                C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = "<group>"; };
                C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = "<group>"; };
                C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
                CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlternativeTextController.cpp; sourceTree = "<group>"; };
                CE08C3D0152B599A0021B8C2 /* AlternativeTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlternativeTextController.h; sourceTree = "<group>"; };
                CE5CB1B314EDAB6F00BB2795 /* EventSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSender.h; sourceTree = "<group>"; };
+               CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLMencloseElement.h; sourceTree = "<group>"; };
                CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AlternativeTextUIController.h; path = mac/AlternativeTextUIController.h; sourceTree = "<group>"; };
                CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AlternativeTextUIController.mm; path = mac/AlternativeTextUIController.mm; sourceTree = "<group>"; };
                CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextAlternativeWithRange.h; path = mac/TextAlternativeWithRange.h; sourceTree = "<group>"; };
                                034768DFFF38A50411DB9C8B /* Products */,
                                1CDD44660BA9C80000F90147 /* Configurations */,
                                449195900FBE175B00D9F824 /* Exports */,
+                               3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */,
+                               A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */,
                        );
                        name = WebKit;
                        sourceTree = "<group>";
                                FABE72F01059C1EB00D999DD /* MathMLInlineContainerElement.h */,
                                FABE72F11059C1EB00D999DD /* MathMLMathElement.cpp */,
                                FABE72F21059C1EB00D999DD /* MathMLMathElement.h */,
+                               C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */,
+                               CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */,
                                F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */,
                                59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
                                FA654A691108ABED002615E0 /* MathMLTextElement.cpp */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               05D913CEEAB2A60534218ACF /* MathMLMencloseElement.cpp in Sources */,
+                               3571883EEF618793751E4089 /* RenderMathMLMenclose.cpp in Sources */,
                                7A29BA6A187B7C1D00F29CEB /* TemporaryOpenGLSetting.cpp in Sources */,
                                41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
                                0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */,
index 08bdbb7..22d6b61 100644 (file)
@@ -42,11 +42,11 @@ math[display="block"] {
     -webkit-margin-after: 1em;
 }
 
-mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle {
+mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
     display: -webkit-inline-flex !important;
 }
 
-math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle {
+math, mrow, mfenced, msqrt, mroot, merror, mphantom, mstyle, menclose {
     -webkit-align-items: baseline;
 }
 msqrt > * { /* This rule is needed because of <msqrt>'s anonymous <mrow>. */
index 4176473..0185e1c 100644 (file)
@@ -28,6 +28,7 @@
 #include "MathMLElement.cpp"
 #include "MathMLInlineContainerElement.cpp"
 #include "MathMLMathElement.cpp"
+#include "MathMLMencloseElement.cpp"
 #include "MathMLSelectElement.cpp"
 #include "MathMLTextElement.cpp"
 
index dd80e6a..02f14a2 100644 (file)
@@ -61,9 +61,9 @@ protected:
     virtual bool childShouldCreateRenderer(const Node&) const override;
     virtual void attributeChanged(const QualifiedName&, const AtomicString& newValue, AttributeModificationReason) override;
 
-private:    
     virtual bool isPresentationAttribute(const QualifiedName&) const override;
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
+private:    
 
     virtual void updateSelectedChild() { };
 };
index 1d942ac..edc809c 100644 (file)
@@ -34,6 +34,7 @@
 #include "RenderMathMLBlock.h"
 #include "RenderMathMLFenced.h"
 #include "RenderMathMLFraction.h"
+#include "RenderMathMLMenclose.h"
 #include "RenderMathMLRoot.h"
 #include "RenderMathMLRow.h"
 #include "RenderMathMLScripts.h"
diff --git a/Source/WebCore/mathml/MathMLMencloseElement.cpp b/Source/WebCore/mathml/MathMLMencloseElement.cpp
new file mode 100755 (executable)
index 0000000..4013d88
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2014 Gurpreet Kaur (k.gurpreet@samsung.com). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MATHML)
+#include "MathMLMencloseElement.h"
+
+#include "MathMLNames.h"
+#include "RenderElement.h"
+#include "RenderMathMLMenclose.h"
+#include "RenderObject.h"
+#include "TextRun.h"
+#include <wtf/Ref.h>
+#include <wtf/text/StringBuilder.h>
+
+
+namespace WebCore {
+
+MathMLMencloseElement::MathMLMencloseElement(const QualifiedName& tagName, Document& document)
+    : MathMLInlineContainerElement(tagName, document)
+    , m_isRadicalValue(false)
+{
+}
+
+PassRefPtr<MathMLMencloseElement> MathMLMencloseElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(new MathMLMencloseElement(tagName, document));
+}
+
+RenderPtr<RenderElement> MathMLMencloseElement::createElementRenderer(PassRef<RenderStyle> style)
+{    
+    return createRenderer<RenderMathMLMenclose>(*this, std::move(style));
+}
+
+bool MathMLMencloseElement::isPresentationAttribute(const QualifiedName& name) const
+{
+    if (name == MathMLNames::notationAttr)
+        return true;
+    return MathMLElement::isPresentationAttribute(name);
+}
+
+void MathMLMencloseElement::finishParsingChildren()
+{
+    MathMLInlineContainerElement::finishParsingChildren();
+    // When notation value is a radical and menclose does not have any child 
+    // then we add anonymous squareroot child to menclose so that square root
+    // symbol can be rendered.
+    if (m_isRadicalValue && !firstElementChild())
+        renderer()->addChild(nullptr, nullptr);
+}
+
+void MathMLMencloseElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
+{
+    String val = value;
+    if (val.isEmpty())
+        return;
+    if (name == MathMLNames::notationAttr) {
+        val.split(" ", m_notationValues);
+        size_t notationValueSize = m_notationValues.size();
+        for (size_t i = 0; i < notationValueSize; i++) {
+            if (m_notationValues[i] == "top" || m_notationValues[i] == "longdiv") {
+                if (m_notationValues[i] == "longdiv")
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingLeft, longDivLeftPadding());
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderTopStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderTopWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingTop, ".3ex");
+            } else if (m_notationValues[i] == "bottom") {
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingBottom, ".3ex");
+            } else if (m_notationValues[i] == "left") {
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderLeftStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderLeftWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingLeft, ".3ex");
+            } else if (m_notationValues[i] == "right") {
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRightStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRightWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingRight, ".3ex");
+            } else if (m_notationValues[i] == "box" || m_notationValues[i] == "roundedbox") {
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPadding, ".3ex");
+                if (m_notationValues[i] == "roundedbox")
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRadius, ASCIILiteral("5px"));
+            } else if (m_notationValues[i] == "actuarial" || m_notationValues[i] == "madruwb") {
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRightStyle, "solid");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderRightWidth, "thin");
+                addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingRight, ".3ex");
+                if (m_notationValues[i] == "actuarial") {
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderTopStyle, "solid");
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderTopWidth, "thin");
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingTop, ".3ex");
+                } else if (m_notationValues[i] == "madruwb") {
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomStyle, "solid");
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderBottomWidth, "thin");
+                    addPropertyToPresentationAttributeStyle(style, CSSPropertyPaddingBottom, ".3ex");
+                }
+            } else if (m_notationValues[i] == "radical")
+                m_isRadicalValue = true;
+        }
+    } else
+        MathMLInlineContainerElement::collectStyleForPresentationAttribute(name, value, style);
+}
+
+
+String MathMLMencloseElement::longDivLeftPadding() const
+{
+    StringBuilder padding;
+    float fontSize = 0;
+    String closingBrace = ")";
+    TextRun run(closingBrace.impl(), closingBrace.length());
+    Node* node = parentNode();
+    if (node && node->renderer()) {
+        const Font& font = node->renderer()->style().font();
+        fontSize = font.width(run);
+        padding.append(String::number(fontSize));
+        padding.append("px");
+    }
+    return padding.toString();
+}
+
+}
+#endif // ENABLE(MATHML)
diff --git a/Source/WebCore/mathml/MathMLMencloseElement.h b/Source/WebCore/mathml/MathMLMencloseElement.h
new file mode 100755 (executable)
index 0000000..3c0ee90
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 Gurpreet Kaur (k.gurpreet@samsung.com). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MathMLMencloseElement_h
+#define MathMLMencloseElement_h
+
+#if ENABLE(MATHML)
+#include "MathMLInlineContainerElement.h"
+
+namespace WebCore {
+
+class MathMLMencloseElement final: public MathMLInlineContainerElement {
+public:
+    static PassRefPtr<MathMLMencloseElement> create(const QualifiedName& tagName, Document&);
+    const Vector<String>& notationValues() const { return m_notationValues; }
+    bool isRadical() const { return m_isRadicalValue; }
+
+private:
+    MathMLMencloseElement(const QualifiedName&, Document&);
+    virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
+    virtual bool isPresentationAttribute(const QualifiedName&) const override;
+    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
+    virtual void finishParsingChildren() override;
+    String longDivLeftPadding() const;
+
+    Vector<String> m_notationValues;
+    bool m_isRadicalValue;
+};
+
+inline MathMLMencloseElement* toMathMLMencloseElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->isElementNode() && toElement(node)->hasTagName(MathMLNames::mencloseTag)));
+    return static_cast<MathMLMencloseElement*>(node);
+}
+
+}
+
+#endif // ENABLE(MATHML)
+#endif // MathMLMencloseElement_h
index ba1deb6..abfdbb5 100644 (file)
@@ -24,6 +24,7 @@ mathbackground
 mathcolor
 mathsize
 mathvariant
+notation
 numalign
 open
 rowspan
index 61a48c9..7cce6d7 100644 (file)
@@ -31,12 +31,12 @@ mtr interfaceName=MathMLElement
 mtd interfaceName=MathMLElement
 mmultiscripts interfaceName=MathMLInlineContainerElement
 mprescripts interfaceName=MathMLInlineContainerElement
+menclose interfaceName=MathMLMencloseElement
 none interfaceName=MathMLInlineContainerElement
 semantics interfaceName=MathMLSelectElement
 
 maligngroup interfaceName=MathMLElement
 malignmark interfaceName=MathMLElement
-menclose interfaceName=MathMLElement
 mglyph interfaceName=MathMLElement
 mlabeledtr interfaceName=MathMLElement
 mlongdiv interfaceName=MathMLElement
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp b/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp
new file mode 100755 (executable)
index 0000000..f28ce7b
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2014 Gurpreet Kaur (k.gurpreet@samsung.com). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define _USE_MATH_DEFINES 1
+#include "config.h"
+
+#if ENABLE(MATHML)
+#include "RenderMathMLMenclose.h"
+
+#include "GraphicsContext.h"
+#include "MathMLMencloseElement.h"
+#include "PaintInfo.h"
+#include "RenderMathMLSquareRoot.h"
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+RenderMathMLMenclose::RenderMathMLMenclose(Element& element, PassRef<RenderStyle> style)
+    : RenderMathMLRow(element, std::move(style))
+{
+}
+
+void RenderMathMLMenclose::addChild(RenderObject* newChild, RenderObject* beforeChild)
+{
+    MathMLMencloseElement* menclose = toMathMLMencloseElement(element());
+    // Allow an anonymous RenderMathMLSquareRoot to handle drawing the radical
+    // notation, rather than duplicating the code needed to paint a root.
+    if (!firstChild() && menclose->isRadical())        
+        RenderMathMLBlock::addChild(RenderMathMLSquareRoot::createAnonymousWithParentRenderer(*this).leakPtr());
+    
+    if (newChild) {
+        if (firstChild() && menclose->isRadical())
+            toRenderElement(firstChild())->addChild(newChild, beforeChild && beforeChild->parent() == firstChild() ? beforeChild : nullptr);
+        else
+            RenderMathMLBlock::addChild(newChild, beforeChild);
+    }
+}
+
+void RenderMathMLMenclose::computePreferredLogicalWidths()
+{
+    ASSERT(preferredLogicalWidthsDirty());
+
+    RenderMathMLBlock::computePreferredLogicalWidths();
+
+    MathMLMencloseElement* menclose = toMathMLMencloseElement(element());
+    const Vector<String>& notationValues = menclose->notationValues();
+    size_t notationalValueSize = notationValues.size();
+    for (size_t i = 0; i < notationalValueSize; i++) {
+        if (notationValues[i] == "circle") {
+            m_minPreferredLogicalWidth = minPreferredLogicalWidth() * float(M_SQRT2);
+            m_maxPreferredLogicalWidth = maxPreferredLogicalWidth() * float(M_SQRT2);
+        }
+    }
+
+    setPreferredLogicalWidthsDirty(false);
+}
+
+void RenderMathMLMenclose::updateLogicalHeight()
+{
+    MathMLMencloseElement* menclose = toMathMLMencloseElement(element());
+    const Vector<String>& notationValues = menclose->notationValues();
+    size_t notationalValueSize = notationValues.size();
+    for (size_t i = 0; i < notationalValueSize; i++)
+        if (notationValues[i] == "circle")
+            setLogicalHeight(logicalHeight() * float(M_SQRT2));
+}
+
+void RenderMathMLMenclose::paint(PaintInfo& info, const LayoutPoint& paintOffset)
+{
+    RenderMathMLBlock::paint(info, paintOffset);
+
+    if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE)
+        return;
+    
+    MathMLMencloseElement* menclose = toMathMLMencloseElement(element());
+    const Vector<String>& notationValues = menclose->notationValues();
+    size_t notationalValueSize = notationValues.size();
+    bool isDefaultLongDiv = !notationalValueSize;
+    if (notationalValueSize && checkNotationalValuesValidity(notationValues)) {
+        IntRect rect = absoluteBoundingBoxRect();
+        int left = rect.x();
+        int top = rect.y();
+        int boxWidth = rect.width();
+        int boxHeight = rect.height();
+        int halfboxWidth = rect.width() / 2;
+        int halfboxHeight = rect.height() / 2;
+
+        GraphicsContextStateSaver stateSaver(*info.context);
+        info.context->setStrokeThickness(1);
+        info.context->setStrokeStyle(SolidStroke);
+        info.context->setStrokeColor(style().visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB);
+        // TODO add support for notation value updiagonalarrow https://bugs.webkit.org/show_bug.cgi?id=127466
+        for (size_t i = 0; i < notationalValueSize; i++) {
+            if (notationValues[i] == "updiagonalstrike")
+                info.context->drawLine(IntPoint(left, top + boxHeight), IntPoint(left + boxWidth, top));
+            else if (notationValues[i] == "downdiagonalstrike")
+                info.context->drawLine(IntPoint(left, top), IntPoint(left + boxWidth, top + boxHeight));
+            else if (notationValues[i] == "verticalstrike")
+                info.context->drawLine(IntPoint(left + halfboxWidth, top), IntPoint(left + halfboxWidth, top + boxHeight));
+            else if (notationValues[i] == "horizontalstrike")
+                info.context->drawLine(IntPoint(left, top + halfboxHeight), IntPoint(left + boxWidth, top + halfboxHeight));
+            else if (notationValues[i] == "circle") {
+                info.context->setFillColor(Color::transparent, ColorSpaceDeviceRGB);
+                info.context->drawEllipse(rect);
+            } else if (notationValues[i] == "longdiv")
+                isDefaultLongDiv = true;
+        }
+        if (isDefaultLongDiv) {
+            Path root;
+            int midxPoint = 0;
+            root.moveTo(FloatPoint(left, top));
+            int childLeft = firstChild() ? firstChild()->absoluteBoundingBoxRect().x() : 0;
+            if (childLeft)
+                midxPoint= childLeft - left;
+            else
+                midxPoint = style().paddingLeft().value();
+            root.addBezierCurveTo(FloatPoint(left, top), FloatPoint(left + midxPoint, top + halfboxHeight), FloatPoint(left, top + boxHeight));
+            info.context->strokePath(root);
+        }
+    }
+}
+
+bool RenderMathMLMenclose::checkNotationalValuesValidity(const Vector<String>& attr) const
+{
+    size_t attrSize = attr.size();
+    for (size_t i = 0; i < attrSize; i++) {
+        if (attr[i] == "updiagonalstrike" || attr[i] == "downdiagonalstrike" || attr[i] == "horizontalstrike" || attr[i] == "verticalstrike"
+            || attr[i] == "circle" || attr[i] == "longdiv")
+            return true;
+    }
+    return false;
+}
+
+}
+#endif // ENABLE(MATHML)
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h b/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h
new file mode 100755 (executable)
index 0000000..43b4634
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2014 Gurpreet Kaur (k.gurpreet@samsung.com). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderMathMLMenclose_h
+#define RenderMathMLMenclose_h
+
+#if ENABLE(MATHML)
+#include "RenderMathMLRow.h"
+
+namespace WebCore {
+    
+class RenderMathMLMenclose final: public RenderMathMLRow {
+public:
+    RenderMathMLMenclose(Element&, PassRef<RenderStyle>);
+
+private:
+    virtual const char* renderName() const { return "RenderMathMLMenclose"; }
+    virtual void paint(PaintInfo&, const LayoutPoint&) override;
+    virtual void updateLogicalHeight() override;
+    virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = nullptr) override;
+    virtual void computePreferredLogicalWidths() override;
+    bool checkNotationalValuesValidity(const Vector<String>&) const;
+};
+    
+}
+
+#endif // ENABLE(MATHML)
+#endif // RenderMathMLMenclose_h
index 6bf0567..0e975c7 100644 (file)
@@ -74,6 +74,14 @@ RenderMathMLRoot::RenderMathMLRoot(Element& element, PassRef<RenderStyle> style)
 {
 }
 
+RenderMathMLRoot::RenderMathMLRoot(Document& document, PassRef<RenderStyle> style)
+    : RenderMathMLBlock(document, std::move(style))
+    , m_intrinsicPaddingBefore(0)
+    , m_intrinsicPaddingAfter(0)
+    , m_intrinsicPaddingStart(0)
+    , m_intrinsicPaddingEnd(0)
+{
+}
 LayoutUnit RenderMathMLRoot::paddingTop() const
 {
     LayoutUnit result = computedCSSPaddingTop();
index de3391d..4d5d731 100644 (file)
@@ -36,6 +36,7 @@ namespace WebCore {
 class RenderMathMLRoot : public RenderMathMLBlock {
 public:
     RenderMathMLRoot(Element&, PassRef<RenderStyle>);
+    RenderMathMLRoot(Document&, PassRef<RenderStyle>);
 
     virtual LayoutUnit paddingTop() const override;
     virtual LayoutUnit paddingBottom() const override;
index e42ea1d..6a8bceb 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "RenderMathMLSquareRoot.h"
 
+#include "RenderMathMLMenclose.h"
+
 namespace WebCore {
     
 RenderMathMLSquareRoot::RenderMathMLSquareRoot(Element& element, PassRef<RenderStyle> style)
@@ -37,6 +39,17 @@ RenderMathMLSquareRoot::RenderMathMLSquareRoot(Element& element, PassRef<RenderS
 {
 }
 
+RenderMathMLSquareRoot::RenderMathMLSquareRoot(Document& document, PassRef<RenderStyle> style)
+    : RenderMathMLRoot(document, std::move(style))
+{
+}
+
+RenderPtr<RenderMathMLSquareRoot> RenderMathMLSquareRoot::createAnonymousWithParentRenderer(RenderMathMLMenclose& parent)
+{
+    RenderPtr<RenderMathMLSquareRoot> squareRoot = createRenderer<RenderMathMLSquareRoot>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX));
+    squareRoot->initializeStyle();
+    return squareRoot;
 }
 
+}
 #endif // ENABLE(MATHML)
index 5ea0e5b..a9e3cff 100644 (file)
 
 #include "RenderMathMLRoot.h"
 
+
 namespace WebCore {
-    
+
+class RenderMathMLMenclose;
+
 // Render sqrt(base), using radical notation.
 class RenderMathMLSquareRoot final : public RenderMathMLRoot {
 public:
     RenderMathMLSquareRoot(Element&, PassRef<RenderStyle>);
+    RenderMathMLSquareRoot(Document&, PassRef<RenderStyle>);
+    static RenderPtr<RenderMathMLSquareRoot> createAnonymousWithParentRenderer(RenderMathMLMenclose&);
     
 private:
     virtual bool isRenderMathMLSquareRoot() const override { return true; }