Diff
Modified: trunk/LayoutTests/ChangeLog (159679 => 159680)
--- trunk/LayoutTests/ChangeLog 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/LayoutTests/ChangeLog 2013-11-22 05:03:26 UTC (rev 159680)
@@ -1,3 +1,17 @@
+2013-11-21 Frédéric Wang <[email protected]>
+
+ Map the dir attribute to the CSS direction property.
+ https://bugs.webkit.org/show_bug.cgi?id=124572.
+
+ Reviewed by Darin Adler.
+
+ * mathml/presentation/direction-overall-expected.html: test that dir does not apply to msqrt
+ * mathml/presentation/direction-overall.html:
+ * mathml/presentation/mstyle-css-attributes-expected.html: Added.
+ * mathml/presentation/mstyle-css-attributes.html: Added.
+
+ Add more tests for presentation attributes on mstyle.
+
2013-11-21 Bear Travis <[email protected]>
Web Inspector: [CSS Shapes] Refactor highlighting code to decrease Shapes API surface
Modified: trunk/LayoutTests/mathml/presentation/direction-overall-expected.html (159679 => 159680)
--- trunk/LayoutTests/mathml/presentation/direction-overall-expected.html 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/LayoutTests/mathml/presentation/direction-overall-expected.html 2013-11-22 05:03:26 UTC (rev 159680)
@@ -33,5 +33,16 @@
</math>
</p>
+ <p>
+ msqrt:
+ <math>
+ <msqrt>
+ <mspace width="25px" height="25px" mathbackground="red"/>
+ <mspace width="25px" height="25px" mathbackground="green"/>
+ <mspace width="25px" height="25px" mathbackground="blue"/>
+ </msqrt>
+ </math>
+ </p>
+
</body>
</html>
Modified: trunk/LayoutTests/mathml/presentation/direction-overall.html (159679 => 159680)
--- trunk/LayoutTests/mathml/presentation/direction-overall.html 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/LayoutTests/mathml/presentation/direction-overall.html 2013-11-22 05:03:26 UTC (rev 159680)
@@ -37,5 +37,19 @@
</math>
</p>
+ <!-- dir="rtl" on <msqrt> should be ignored. The rectangle
+ inside this element should be displayed left-to-right. -->
+
+ <p>
+ msqrt:
+ <math>
+ <msqrt dir="rtl">
+ <mspace width="25px" height="25px" mathbackground="red"/>
+ <mspace width="25px" height="25px" mathbackground="green"/>
+ <mspace width="25px" height="25px" mathbackground="blue"/>
+ </msqrt>
+ </math>
+ </p>
+
</body>
</html>
Added: trunk/LayoutTests/mathml/presentation/mstyle-css-attributes-expected.html (0 => 159680)
--- trunk/LayoutTests/mathml/presentation/mstyle-css-attributes-expected.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mstyle-css-attributes-expected.html 2013-11-22 05:03:26 UTC (rev 159680)
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+ <head>
+ <title>mstyle css attributes</title>
+ <meta charset="utf-8"/>
+ </head>
+ <body>
+
+ <p><math><mstyle style="background: red;"><mtext>rgb(255, 0, 0)</mtext></mstyle></math></p>
+ <p><math><mstyle style="font-size: 32px;"><mtext>32px</mtext></mstyle></math></p>
+ <p><math><mstyle style="color: green;"><mtext>rgb(0, 128, 0)</mtext></mstyle></math></p>
+ <p><math><mstyle style="font-size: 64px;"><mtext>64px</mtext></mstyle></math></p>
+ <p><math><mstyle style="background: blue;"><mtext>rgb(0, 0, 255)</mtext></mstyle></math></p>
+ <p><math><mstyle style="color: magenta;"><mtext>rgb(255, 0, 255)</mtext></mstyle></math></p>
+ <p><math><mstyle style="font-style: italic;"><mtext>italic</mtext></mstyle></math></p>
+ <p><math><mstyle style="font-weight: bold;"><mtext>bold</mtext></mstyle></math></p>
+ <p><math><mstyle style="font-family: courier;"><mtext>courier</mtext></mstyle></math></p>
+ <p><math><mstyle><mspace width="5em"/><mtext>rtl</mtext></mstyle></math></p>
+
+ </body>
+</html>
Added: trunk/LayoutTests/mathml/presentation/mstyle-css-attributes.html (0 => 159680)
--- trunk/LayoutTests/mathml/presentation/mstyle-css-attributes.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mstyle-css-attributes.html 2013-11-22 05:03:26 UTC (rev 159680)
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+ <head>
+ <title>mstyle css attributes</title>
+ <meta charset="utf-8"/>
+ <script type="text/_javascript_">
+ function computeCSS(i, property)
+ {
+ var mstyle = document.getElementById('x'+i);
+ var text = document.createTextNode(window.getComputedStyle(mstyle)[property]);
+ mstyle.firstChild.appendChild(text);
+ }
+
+ function init()
+ {
+ computeCSS(1, 'backgroundColor');
+ computeCSS(2, 'fontSize');
+ computeCSS(3, 'color');
+ computeCSS(4, 'fontSize');
+ computeCSS(5, 'backgroundColor');
+ computeCSS(6, 'color');
+ computeCSS(7, 'fontStyle');
+ computeCSS(8, 'fontWeight');
+ computeCSS(9, 'fontFamily');
+ computeCSS(10, 'direction');
+ }
+ </script>
+ </head>
+ <body _onload_="init()">
+
+ <!-- These test CSS mapping of presentation attributes on the <mstyle> element. -->
+
+ <p><math><mstyle id="x1" mathbackground="red"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x2" mathsize="32px"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x3" mathcolor="green"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x4" fontsize="64px"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x5" background=""
+ <p><math><mstyle id="x6" color="magenta"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x7" fontstyle="italic"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x8" fontweight="bold"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x9" fontfamily="courier"><mtext></mtext></mstyle></math></p>
+ <p><math><mstyle id="x10" dir="rtl"><mtext></mtext><mspace width="5em"/></mstyle></math></p>
+
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (159679 => 159680)
--- trunk/Source/WebCore/ChangeLog 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/Source/WebCore/ChangeLog 2013-11-22 05:03:26 UTC (rev 159680)
@@ -1,3 +1,20 @@
+2013-11-21 Frédéric Wang <[email protected]>
+
+ Map the dir attribute to the CSS direction property.
+ https://bugs.webkit.org/show_bug.cgi?id=124572.
+
+ Reviewed by Darin Adler.
+
+ Test: mathml/presentation/mstyle-css-attributes.html
+
+ * mathml/MathMLElement.cpp:
+ (WebCore::MathMLElement::isPresentationAttribute): reorder attributes
+ (WebCore::MathMLElement::collectStyleForPresentationAttribute): reorder tags that accept dir
+ (WebCore::MathMLElement::isMathMLToken): add an inline function to test that a tag corresponds to a MathML Token Element.
+ * mathml/MathMLElement.h:
+
+ Follow-up work to address Darin's comments.
+
2013-11-21 Peter Molnar <[email protected]>
Remove ENABLE_WORKERS
Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (159679 => 159680)
--- trunk/Source/WebCore/mathml/MathMLElement.cpp 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp 2013-11-22 05:03:26 UTC (rev 159680)
@@ -78,7 +78,7 @@
bool MathMLElement::isPresentationAttribute(const QualifiedName& name) const
{
- if (name == mathbackgroundAttr || name == mathsizeAttr || name == mathcolorAttr || name == fontsizeAttr || name == backgroundAttr || name == colorAttr || name == fontstyleAttr || name == fontweightAttr || name == fontfamilyAttr || name == dirAttr)
+ if (name == backgroundAttr || name == colorAttr || name == dirAttr || name == fontfamilyAttr || name == fontsizeAttr || name == fontstyleAttr || name == fontweightAttr || name == mathbackgroundAttr || name == mathcolorAttr || name == mathsizeAttr)
return true;
return StyledElement::isPresentationAttribute(name);
}
@@ -107,7 +107,7 @@
else if (name == fontfamilyAttr)
addPropertyToPresentationAttributeStyle(style, CSSPropertyFontFamily, value);
else if (name == dirAttr) {
- if (hasTagName(mathTag) || hasTagName(mstyleTag) || hasTagName(mrowTag) || hasTagName(mtextTag) || hasTagName(msTag) || hasTagName(moTag) || hasTagName(miTag) || hasTagName(mnTag))
+ if (hasTagName(mathTag) || hasTagName(mrowTag) || hasTagName(mstyleTag) || isMathMLToken())
addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, value);
} else {
ASSERT(!isPresentationAttribute(name));
@@ -122,6 +122,11 @@
return child.isTextNode() || child.isMathMLElement();
}
+bool MathMLElement::isMathMLToken() const
+{
+ return hasTagName(miTag) || hasTagName(mnTag) || hasTagName(moTag) || hasTagName(msTag) || hasTagName(mtextTag);
}
+}
+
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/mathml/MathMLElement.h (159679 => 159680)
--- trunk/Source/WebCore/mathml/MathMLElement.h 2013-11-22 05:01:46 UTC (rev 159679)
+++ trunk/Source/WebCore/mathml/MathMLElement.h 2013-11-22 05:03:26 UTC (rev 159680)
@@ -51,6 +51,8 @@
virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet&) OVERRIDE;
virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
+
+ inline bool isMathMLToken() const;
};
void isMathMLElement(const MathMLElement&); // Catch unnecessary runtime check of type known at compile time.