Title: [198952] trunk
Revision
198952
Author
commit-qu...@webkit.org
Date
2016-04-01 12:15:05 -0700 (Fri, 01 Apr 2016)

Log Message

Reset CSS spacing rules on the <math> element.
https://bugs.webkit.org/show_bug.cgi?id=155433

Patch by Frederic Wang <fw...@igalia.com> on 2016-04-01
Reviewed by Brent Fulgham.

Source/WebCore:

Test: mathml/presentation/css-spacing.html

When the authors has changed some CSS spacing rules on a page, they are currently inherited on MathML too, potentially causing broken math rendering.
For example, this caused a bug in Firefox on Wikipedia in the past. Hence we align on Gecko and just reset the CSS spacing rules by default. We also import Mozilla's test.

* css/mathml.css:
(math): Set line-height, word-spacing and letter-spacing to normal.

LayoutTests:

We import a test from Mozilla to ensure that CSS spacing rules line-height, word-spacing and letter-spacing are by default reset to normal on the <math> element.

* mathml/presentation/css-spacing-expected.html: Added.
* mathml/presentation/css-spacing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198951 => 198952)


--- trunk/LayoutTests/ChangeLog	2016-04-01 18:40:21 UTC (rev 198951)
+++ trunk/LayoutTests/ChangeLog	2016-04-01 19:15:05 UTC (rev 198952)
@@ -1,3 +1,15 @@
+2016-04-01  Frederic Wang  <fw...@igalia.com>
+
+        Reset CSS spacing rules on the <math> element.
+        https://bugs.webkit.org/show_bug.cgi?id=155433
+
+        Reviewed by Brent Fulgham.
+
+        We import a test from Mozilla to ensure that CSS spacing rules line-height, word-spacing and letter-spacing are by default reset to normal on the <math> element.
+
+        * mathml/presentation/css-spacing-expected.html: Added.
+        * mathml/presentation/css-spacing.html: Added.
+
 2016-04-01  Daniel Bates  <daba...@apple.com>
 
         CSP: child-src violations reported as frame-src violation

Added: trunk/LayoutTests/mathml/presentation/css-spacing-expected.html (0 => 198952)


--- trunk/LayoutTests/mathml/presentation/css-spacing-expected.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/css-spacing-expected.html	2016-04-01 19:15:05 UTC (rev 198952)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>CSS spacing properties</title>
+    <style type="text/css">
+      math {
+        line-height: normal;
+        word-spacing: normal;
+        letter-spacing: normal;
+      }
+    </style>
+  </head>
+
+  <body>
+    <p style="line-height: 30pt;
+              word-spacing: 2em;
+              letter-spacing: 2em;">
+      <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+        <mrow>
+          <mo>(</mo>
+          <mtable rowspacing="0pt" columnspacing="0em">
+            <mtr>
+              <mtd><mtext>row 1 column 1</mtext></mtd>
+              <mtd><mtext>row 1 column 2</mtext></mtd>
+            </mtr>
+            <mtr>
+              <mtd><mtext>row 2 column 1</mtext></mtd>
+              <mtd><mtext>row 2 column 2</mtext></mtd>
+            </mtr>
+          </mtable>
+          <mo>)</mo>
+        </mrow>
+      </math>
+    </p>
+  </body>
+</html>

Added: trunk/LayoutTests/mathml/presentation/css-spacing.html (0 => 198952)


--- trunk/LayoutTests/mathml/presentation/css-spacing.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/css-spacing.html	2016-04-01 19:15:05 UTC (rev 198952)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>CSS spacing properties</title>
+  </head>
+
+  <body>
+    <p style="line-height: 30pt;
+              word-spacing: 2em;
+              letter-spacing: 2em;">
+      <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
+        <mrow>
+          <mo>(</mo>
+          <mtable rowspacing="0pt" columnspacing="0em">
+            <mtr>
+              <mtd><mtext>row 1 column 1</mtext></mtd>
+              <mtd><mtext>row 1 column 2</mtext></mtd>
+            </mtr>
+            <mtr>
+              <mtd><mtext>row 2 column 1</mtext></mtd>
+              <mtd><mtext>row 2 column 2</mtext></mtd>
+            </mtr>
+          </mtable>
+          <mo>)</mo>
+        </mrow>
+      </math>
+    </p>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (198951 => 198952)


--- trunk/Source/WebCore/ChangeLog	2016-04-01 18:40:21 UTC (rev 198951)
+++ trunk/Source/WebCore/ChangeLog	2016-04-01 19:15:05 UTC (rev 198952)
@@ -1,3 +1,18 @@
+2016-04-01  Frederic Wang  <fw...@igalia.com>
+
+        Reset CSS spacing rules on the <math> element.
+        https://bugs.webkit.org/show_bug.cgi?id=155433
+
+        Reviewed by Brent Fulgham.
+
+        Test: mathml/presentation/css-spacing.html
+
+        When the authors has changed some CSS spacing rules on a page, they are currently inherited on MathML too, potentially causing broken math rendering.
+        For example, this caused a bug in Firefox on Wikipedia in the past. Hence we align on Gecko and just reset the CSS spacing rules by default. We also import Mozilla's test.
+
+        * css/mathml.css:
+        (math): Set line-height, word-spacing and letter-spacing to normal.
+
 2016-04-01  Daniel Bates  <daba...@apple.com>
 
         CSP: child-src violations reported as frame-src violation

Modified: trunk/Source/WebCore/css/mathml.css (198951 => 198952)


--- trunk/Source/WebCore/css/mathml.css	2016-04-01 18:40:21 UTC (rev 198951)
+++ trunk/Source/WebCore/css/mathml.css	2016-04-01 19:15:05 UTC (rev 198952)
@@ -3,6 +3,9 @@
 math {
     -webkit-line-box-contain: glyphs replaced;
     text-indent: 0;
+    line-height: normal;
+    word-spacing: normal;
+    letter-spacing: normal;
     direction: ltr;
 }
 mtext {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to