Reset CSS spacing rules on the <math> element.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 19:15:05 +0000 (19:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Apr 2016 19:15:05 +0000 (19:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155433

Patch by Frederic Wang <fwang@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.

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

LayoutTests/ChangeLog
LayoutTests/mathml/presentation/css-spacing-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/css-spacing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/mathml.css

index df9bb34..b057a66 100644 (file)
@@ -1,3 +1,15 @@
+2016-04-01  Frederic Wang  <fwang@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  <dabates@apple.com>
 
         CSP: child-src violations reported as frame-src violation
diff --git a/LayoutTests/mathml/presentation/css-spacing-expected.html b/LayoutTests/mathml/presentation/css-spacing-expected.html
new file mode 100644 (file)
index 0000000..22969f3
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/css-spacing.html b/LayoutTests/mathml/presentation/css-spacing.html
new file mode 100644 (file)
index 0000000..59de4b5
--- /dev/null
@@ -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>
index 187e058..da5ff86 100644 (file)
@@ -1,3 +1,18 @@
+2016-04-01  Frederic Wang  <fwang@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  <dabates@apple.com>
 
         CSP: child-src violations reported as frame-src violation
index 186881c..7270ba4 100644 (file)
@@ -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 {