From 0d1609c4823c9d0c51bdc35728991d56aa63caac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Fri, 6 Aug 2021 12:23:09 -0700 Subject: [PATCH] [mathml] Fix parsing of text content. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently MathMLOperatorElement::ParseOperatorContent() relies on Node::HasOneTextChild() to check and parse the text content of an element. This does not work well if the element contains a comment (e.g. �x2211;) or was constructed dynamically by appending two characters (e.g. ==). This CL fixes that issue by letting ParseOperatorContent() check the node children directly. Bug: 6606 Change-Id: I5642f2cef254ee0e005b4a0b7e45624a8066e2fe Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3076234 Reviewed-by: Mason Freed Commit-Queue: Frédéric Wang Cr-Commit-Position: refs/heads/master@{#909399} --- .../operators/mo-single-char-and-children-ref.html | 8 +++++++- .../operators/mo-single-char-and-children.html | 14 +++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mathml/presentation-markup/operators/mo-single-char-and-children-ref.html b/mathml/presentation-markup/operators/mo-single-char-and-children-ref.html index 5a290283396d4f..6b4ccc775c345d 100644 --- a/mathml/presentation-markup/operators/mo-single-char-and-children-ref.html +++ b/mathml/presentation-markup/operators/mo-single-char-and-children-ref.html @@ -5,7 +5,7 @@ <mo> with a single character and children (reference) @@ -20,5 +20,11 @@

pXp

pXp

+

pXp

+ +

There should be 4/18em horizontal gaps around the middle rectangles:

+

pXXp

+

pXXp

+ diff --git a/mathml/presentation-markup/operators/mo-single-char-and-children.html b/mathml/presentation-markup/operators/mo-single-char-and-children.html index 6174f4c7367a3f..a911c44411867e 100644 --- a/mathml/presentation-markup/operators/mo-single-char-and-children.html +++ b/mathml/presentation-markup/operators/mo-single-char-and-children.html @@ -8,7 +8,7 @@ @@ -17,12 +17,17 @@

p(p

p(p

p(p

-

p|p

+

p=p

There should be no horizontal gap around the middle rectangles:

p(p

p(p

+

p(p

+ +

There should be 4/18em horizontal gaps around the middle rectangles:

+

p&&p

+

p&p