Commit beaa0025 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make editing/pasteboard/mathml-sanitizer-bypass.html to check MathML enabled

This patch changes "mathml-sanitizer-bypass.html" to check whether MathML
enabled or not to choose valid expectation.

As of May 2020, MathML is experimental feature and implemented on LayoutNG.
When enabling EditingNG and pasting clipboard content into editable, MathML
contents are rendered as MathML layout instead of non-MathML.

For <math>B</math>, we have following layout tree:

MathML enabled:
      LayoutNGMathMLBlock {math} at (0,0) size 0x0
      LayoutText {#text} at (0,0) size 0x0

MathML disabled:
      LayoutInline {math} at (0,0) size 10x19
        LayoutText {#text} at (0,0) size 10x19
          text run at (0,0) width 10: "B"

Bug: 707656
Change-Id: I722541655322cedda7ada53fa09e08d78fd2db5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217758
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772572}
parent a7350988
...@@ -3,6 +3,21 @@ ...@@ -3,6 +3,21 @@
<script src="../../resources/testharnessreport.js"></script> <script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script> <script src="../assert_selection.js"></script>
<script> <script>
let supportsEditableMathML =
window.internals && internals.runtimeFlags.editingNGEnabled;
if (supportsEditableMathML) {
selection_test(
'<math id="target">a</math>',
selection => {
const target = selection.document.getElementById('target');
const style = selection.window.getComputedStyle(target);
supportsEditableMathML = style.display === 'inline-math';
},
'<math id="target">a</math>',
'Check whether we have MathML or not');
}
// crbug.com/1011950 // crbug.com/1011950
selection_test( selection_test(
'<div contenteditable>te|st</div>', '<div contenteditable>te|st</div>',
...@@ -30,6 +45,8 @@ selection_test( ...@@ -30,6 +45,8 @@ selection_test(
selection.setClipboardData('A<math>B<a style=display:block>C<title>D<a id="</title><svg><style>*{background:red}</style>">c'); selection.setClipboardData('A<math>B<a style=display:block>C<title>D<a id="</title><svg><style>*{background:red}</style>">c');
selection.document.execCommand('paste'); selection.document.execCommand('paste');
}, },
'<div contenteditable>teA<math>B<br></math>C|<svg></svg>st</div>', supportsEditableMathML
? '<div contenteditable>teA<br>C|<svg></svg>st</div>'
: '<div contenteditable>teA<math>B<br></math>C|<svg></svg>st</div>',
'Paste blocks SVG style injection'); 'Paste blocks SVG style injection');
</script> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment