Add support for non-BMP operators U+1EEF0 and U+1EEF1
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Aug 2016 06:55:59 +0000 (06:55 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Aug 2016 06:55:59 +0000 (06:55 +0000)
commitb414e3a0ce2c6699da1e3cb88004c68e9dce60b0
tree87fe1c7bd7fa565f6ab54959bc960916e54b522c
parent69460e77891bc36b7aaf59f52089e486776b364c
Add support for non-BMP operators U+1EEF0 and U+1EEF1
https://bugs.webkit.org/show_bug.cgi?id=153984

Source/WebCore:

Patch by Frederic Wang <fwang@igalia.com> on 2016-08-25
Reviewed by Darin Adler.

Tests: mathml/presentation/non-bmp-operators-spacing.html
       mathml/presentation/non-bmp-operators-stretching.html

* mathml/MathMLOperatorDictionary.cpp: We move the definition of operator dictionary Entry
here as it is not used by external code.
We now also accept non-BMP operators and add entries for U+1EEF0 and U+1EEF1.
(WebCore::extractProperty): Helper function to convert from Entry structure to a Property
structure.
(WebCore::MathMLOperatorDictionary::search): This function now accepts a non-BMP parameter
and returns a Property structure.
(WebCore::MathMLOperatorDictionary::isVertical): This function now accepts a non-BMP parameter.
* mathml/MathMLOperatorDictionary.h: Replace the Entry structure with a Property structure
which was used by MathMLOperatorElement. Update the signatures of search and isVertical.
* mathml/MathMLOperatorElement.cpp:
(WebCore::MathMLOperatorElement::parseOperatorChar): Remove the special case that excludes
non-BMP operators.
(WebCore::MathMLOperatorElement::computeDictionaryProperty): Rename the property structure
to use the one moved into MathMLOperatorDictionary.h. We no longer need to convert the result
of the search call.
(WebCore::MathMLOperatorElement::dictionaryProperty): Rename the property structure.
* mathml/MathMLOperatorElement.h: Make OperatorChar accept non-BMP operators.
MathMLOperatorElement::DictionaryProperty is now moved into MathMLOperatorDictionary
and renamed Property.
* rendering/mathml/MathOperator.cpp: Accept non-BMP operators.
* rendering/mathml/MathOperator.h: Ditto.
* rendering/mathml/RenderMathMLFencedOperator.cpp:
(WebCore::RenderMathMLFencedOperator::updateOperatorContent):  Adjust code to use the new
return type of MathMLOperatorDictionary::search.
* rendering/mathml/RenderMathMLFencedOperator.h: Accept non-BMP operators.
* rendering/mathml/RenderMathMLOperator.cpp: Ditto.
* rendering/mathml/RenderMathMLOperator.h: Ditto.

LayoutTests:

We add two reftests to check that the non-BMP operators are properly
handled by the MathML dictionary (form, properties, direction) as well
as the rendering code (spacing, stretching). We test the new horizontal
strechy operators U+1EEF0 and U+1EEF1 as well as the letter U+1D400
which is not a real mathematical operator. We add a minimal test
font which contains a black square for U+005F, U+1EEF0, U+1EEF1, U+1D400
and the data that can be used to stretch them horizontally.

Patch by Frederic Wang <fwang@igalia.com> on 2016-08-25
Reviewed by Darin Adler.

* mathml/presentation/non-bmp-operators-spacing-expected.html: Added.
* mathml/presentation/non-bmp-operators-spacing.html: Added.
* mathml/presentation/non-bmp-operators-stretching-expected.html: Added.
* mathml/presentation/non-bmp-operators-stretching.html: Added.
* mathml/presentation/non-bmp-operators.woff: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/mathml/presentation/non-bmp-operators-spacing-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/non-bmp-operators-spacing.html [new file with mode: 0644]
LayoutTests/mathml/presentation/non-bmp-operators-stretching-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/non-bmp-operators-stretching.html [new file with mode: 0644]
LayoutTests/mathml/presentation/non-bmp-operators.woff [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/mathml/MathMLOperatorDictionary.cpp
Source/WebCore/mathml/MathMLOperatorDictionary.h
Source/WebCore/mathml/MathMLOperatorElement.cpp
Source/WebCore/mathml/MathMLOperatorElement.h
Source/WebCore/rendering/mathml/MathOperator.cpp
Source/WebCore/rendering/mathml/MathOperator.h
Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.h
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h