Title: [151323] trunk
Revision
151323
Author
[email protected]
Date
2013-06-07 08:57:17 -0700 (Fri, 07 Jun 2013)

Log Message

MathML line fraction needs to parse number values
https://bugs.webkit.org/show_bug.cgi?id=117305

Reviewed by Darin Adler.

Source/WebCore: 

The line fraction thickness was not handling arbitrary thickness numbers.
The accessibility code was not handling default values for line thickness, so
it made sense to have AX rely on the RenderFraction object to retrive the thickness.

Modified existing tests to cover new behavior.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::mathLineThickness):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::updateFromElement):
* rendering/mathml/RenderMathMLFraction.h:
(WebCore::RenderMathMLFraction::lineThickness):
(WebCore::toRenderMathMLFraction):

LayoutTests: 

Math fractions test now encodes for an arbitrary thickness number.
Accessibility test handles the default line thickness.

* mathml/presentation/fractions.xhtml:
* platform/mac/accessibility/mathml-line-fraction-expected.txt:
* platform/mac/accessibility/mathml-line-fraction.html:
* platform/mac/mathml/presentation/fractions-expected.png:
* platform/mac/mathml/presentation/fractions-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151322 => 151323)


--- trunk/LayoutTests/ChangeLog	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/LayoutTests/ChangeLog	2013-06-07 15:57:17 UTC (rev 151323)
@@ -1,3 +1,19 @@
+2013-06-07  Chris Fleizach  <[email protected]>
+
+        MathML line fraction needs to parse number values
+        https://bugs.webkit.org/show_bug.cgi?id=117305
+
+        Reviewed by Darin Adler.
+
+        Math fractions test now encodes for an arbitrary thickness number.
+        Accessibility test handles the default line thickness.
+
+        * mathml/presentation/fractions.xhtml:
+        * platform/mac/accessibility/mathml-line-fraction-expected.txt:
+        * platform/mac/accessibility/mathml-line-fraction.html:
+        * platform/mac/mathml/presentation/fractions-expected.png:
+        * platform/mac/mathml/presentation/fractions-expected.txt:
+
 2013-06-07  Kihong Kwon  <[email protected]>
 
         REGRESSION: r149001 made proximity test fail.

Modified: trunk/LayoutTests/mathml/presentation/fractions.xhtml (151322 => 151323)


--- trunk/LayoutTests/mathml/presentation/fractions.xhtml	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/LayoutTests/mathml/presentation/fractions.xhtml	2013-06-07 15:57:17 UTC (rev 151323)
@@ -25,6 +25,7 @@
     <mfrac linethickness='thin'><mn>1</mn><mn>2</mn></mfrac>
     <mfrac linethickness='medium'><mn>1</mn><mn>2</mn></mfrac>
     <mfrac linethickness='thick'><mn>1</mn><mn>2</mn></mfrac>
+    <mfrac linethickness='5'><mn>1</mn><mn>2</mn></mfrac>
 </math>
 </p>
 <p id='t5'>numerator alignment:

Modified: trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction-expected.txt (151322 => 151323)


--- trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction-expected.txt	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction-expected.txt	2013-06-07 15:57:17 UTC (rev 151323)
@@ -12,6 +12,9 @@
 PASS fraction2.subrole is 'AXSubrole: AXMathFraction'
 PASS fraction2.isAttributeSupported('AXMathLineThickness') is true
 PASS fraction2.numberAttributeValue('AXMathLineThickness') is 4
+
+Verify missing line thickness returns default of 1 is reported correctly.
+PASS fraction3.numberAttributeValue('AXMathLineThickness') is 1
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction.html (151322 => 151323)


--- trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction.html	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/LayoutTests/platform/mac/accessibility/mathml-line-fraction.html	2013-06-07 15:57:17 UTC (rev 151323)
@@ -19,6 +19,13 @@
 </mfrac>
 </math>
 
+<math id="math3">
+<mfrac>
+    <mi>n</mi>
+    <mi>k</mi>
+</mfrac>
+</math>
+
 </div>
 
 <div id="console"></div>
@@ -40,6 +47,10 @@
    shouldBeTrue("fraction2.isAttributeSupported('AXMathLineThickness')");
    shouldBe("fraction2.numberAttributeValue('AXMathLineThickness')", "4");
 
+   debug("\nVerify missing line thickness returns default of 1 is reported correctly.");
+   var fraction3 = accessibilityController.accessibleElementById("math3").childAtIndex(0);
+   shouldBe("fraction3.numberAttributeValue('AXMathLineThickness')", "1");
+
    document.getElementById("content").style.visibility = 'hidden';
 }
 

Modified: trunk/LayoutTests/platform/mac/mathml/presentation/fractions-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt (151322 => 151323)


--- trunk/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/LayoutTests/platform/mac/mathml/presentation/fractions-expected.txt	2013-06-07 15:57:17 UTC (rev 151323)
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x330
-  RenderBlock {html} at (0,0) size 800x330
-    RenderBody {body} at (8,16) size 784x298
+layer at (0,0) size 800x332
+  RenderBlock {html} at (0,0) size 800x332
+    RenderBody {body} at (8,16) size 784x300
       RenderBlock {p} at (0,0) size 784x31
         RenderText {#text} at (0,5) size 49x18
           text run at (0,5) width 49: "simple: "
@@ -62,11 +62,11 @@
                 RenderText {#text} at (0,-6) size 120x24
                   text run at (0,-6) width 120: "number of changes"
         RenderText {#text} at (0,0) size 0x0
-      RenderBlock {p} at (0,147) size 784x61
-        RenderText {#text} at (0,25) size 173x18
-          text run at (0,25) width 173: "line thickness by keyword: "
-        RenderMathMLMath {math} at (173,0) size 56x61 [padding: 0 1 0 1]
-          RenderMathMLFraction {mfrac} at (2,2) size 16x58
+      RenderBlock {p} at (0,147) size 784x63
+        RenderText {#text} at (0,27) size 173x18
+          text run at (0,27) width 173: "line thickness by keyword: "
+        RenderMathMLMath {math} at (173,0) size 74x63 [padding: 0 1 0 1]
+          RenderMathMLFraction {mfrac} at (2,4) size 16x58
             RenderMathMLBlock (anonymous, flex) at (0,0) size 16x29
               RenderBlock {mn} at (0,0) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
@@ -75,7 +75,7 @@
               RenderBlock {mn} at (0,6) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
                   text run at (0,-12) width 16: "2"
-          RenderMathMLFraction {mfrac} at (20,2) size 16x59
+          RenderMathMLFraction {mfrac} at (20,4) size 16x59
             RenderMathMLBlock (anonymous, flex) at (0,0) size 16x29
               RenderBlock {mn} at (0,0) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
@@ -84,7 +84,7 @@
               RenderBlock {mn} at (0,7) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
                   text run at (0,-12) width 16: "2"
-          RenderMathMLFraction {mfrac} at (38,0) size 16x61
+          RenderMathMLFraction {mfrac} at (38,2) size 16x61
             RenderMathMLBlock (anonymous, flex) at (0,0) size 16x29
               RenderBlock {mn} at (0,0) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
@@ -93,8 +93,17 @@
               RenderBlock {mn} at (0,9) size 16x23
                 RenderText {#text} at (0,-12) size 16x49
                   text run at (0,-12) width 16: "2"
+          RenderMathMLFraction {mfrac} at (56,0) size 16x63
+            RenderMathMLBlock (anonymous, flex) at (0,0) size 16x29
+              RenderBlock {mn} at (0,0) size 16x23
+                RenderText {#text} at (0,-12) size 16x49
+                  text run at (0,-12) width 16: "1"
+            RenderMathMLBlock (anonymous, flex) at (0,29) size 16x34 [padding: 5 0 0 0]
+              RenderBlock {mn} at (0,11) size 16x23
+                RenderText {#text} at (0,-12) size 16x49
+                  text run at (0,-12) width 16: "2"
         RenderText {#text} at (0,0) size 0x0
-      RenderBlock {p} at (0,224) size 784x29
+      RenderBlock {p} at (0,226) size 784x29
         RenderText {#text} at (0,2) size 138x18
           text run at (0,2) width 138: "numerator alignment: "
         RenderMathMLMath {math} at (138,0) size 112x29 [padding: 0 1 0 1]
@@ -231,7 +240,7 @@
                   RenderText {#text} at (0,-5) size 8x24
                     text run at (0,-5) width 8: "5"
         RenderText {#text} at (0,0) size 0x0
-      RenderBlock {p} at (0,269) size 784x29
+      RenderBlock {p} at (0,271) size 784x29
         RenderText {#text} at (0,6) size 153x18
           text run at (0,6) width 153: "denominator alignment: "
         RenderMathMLMath {math} at (153,0) size 112x29 [padding: 0 1 0 1]

Modified: trunk/Source/WebCore/ChangeLog (151322 => 151323)


--- trunk/Source/WebCore/ChangeLog	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/Source/WebCore/ChangeLog	2013-06-07 15:57:17 UTC (rev 151323)
@@ -1,3 +1,24 @@
+2013-06-07  Chris Fleizach  <[email protected]>
+
+        MathML line fraction needs to parse number values
+        https://bugs.webkit.org/show_bug.cgi?id=117305
+
+        Reviewed by Darin Adler.
+
+        The line fraction thickness was not handling arbitrary thickness numbers.
+        The accessibility code was not handling default values for line thickness, so
+        it made sense to have AX rely on the RenderFraction object to retrive the thickness.
+
+        Modified existing tests to cover new behavior.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::mathLineThickness):
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::updateFromElement):
+        * rendering/mathml/RenderMathMLFraction.h:
+        (WebCore::RenderMathMLFraction::lineThickness):
+        (WebCore::toRenderMathMLFraction):
+
 2013-06-07  Claudio Saavedra  <[email protected]>
 
         [rendering] Use foreground color to render the overtype caret

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (151322 => 151323)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2013-06-07 15:57:17 UTC (rev 151323)
@@ -74,6 +74,7 @@
 #include "RenderListBox.h"
 #include "RenderListMarker.h"
 #include "RenderMathMLBlock.h"
+#include "RenderMathMLFraction.h"
 #include "RenderMathMLOperator.h"
 #include "RenderMenuList.h"
 #include "RenderSVGShape.h"
@@ -3787,7 +3788,10 @@
 
 int AccessibilityRenderObject::mathLineThickness() const
 {
-    return getAttribute(MathMLNames::linethicknessAttr).toInt();
+    if (!isMathFraction())
+        return -1;
+    
+    return toRenderMathMLFraction(m_renderer)->lineThickness();
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (151322 => 151323)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2013-06-07 15:57:17 UTC (rev 151323)
@@ -70,7 +70,6 @@
     if (!denominatorWrapper)
         return;
     
-    // FIXME: parse units
     String thickness = fraction->getAttribute(MathMLNames::linethicknessAttr);
     m_lineThickness = gLineMedium;
     if (equalIgnoringCase(thickness, "thin"))
@@ -79,8 +78,12 @@
         m_lineThickness = gLineMedium;
     else if (equalIgnoringCase(thickness, "thick"))
         m_lineThickness = gLineThick;
-    else if (equalIgnoringCase(thickness, "0"))
-        m_lineThickness = 0;
+    else {
+        bool converted = false;
+        int thicknessIntValue = thickness.toIntStrict(&converted);
+        if (converted)
+            m_lineThickness = thicknessIntValue;
+    }
 
     // Update the style for the padding of the denominator for the line thickness
     lastChild()->style()->setPaddingTop(Length(static_cast<int>(m_lineThickness), Fixed));

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h (151322 => 151323)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h	2013-06-07 15:36:15 UTC (rev 151322)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h	2013-06-07 15:57:17 UTC (rev 151323)
@@ -42,6 +42,7 @@
     virtual RenderMathMLOperator* unembellishedOperator();
     
     virtual int firstLineBoxBaseline() const OVERRIDE;
+    float lineThickness() const { return m_lineThickness; }
     virtual void paint(PaintInfo&, const LayoutPoint&);
 protected:
     virtual void layout();
@@ -55,9 +56,21 @@
     
     float m_lineThickness;
 };
+    
+inline RenderMathMLFraction* toRenderMathMLFraction(RenderObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || (object->isRenderMathMLBlock() && toRenderMathMLBlock(object)->isRenderMathMLFraction()));
+    return static_cast<RenderMathMLFraction*>(object);
+}
 
+inline const RenderMathMLFraction* toRenderMathMLFraction(const RenderObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || (object->isRenderMathMLBlock() && toRenderMathMLBlock(object)->isRenderMathMLFraction()));
+    return static_cast<const RenderMathMLFraction*>(object);
 }
 
+}
+
 #endif // ENABLE(MATHML)
 
 #endif // RenderMathMLFraction_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to