Add support for @href attribute in MathML
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jul 2016 04:28:16 +0000 (04:28 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jul 2016 04:28:16 +0000 (04:28 +0000)
commit42f3f19687e1d688b33c59bdc7dfcc8cf6c08cc7
tree909bc92165254605ccab7b3817faa3345e6bd6f4
parentb231f9ad9523e7c1ac11e9f69dca1545de6cb5bd
Add support for @href attribute in MathML
https://bugs.webkit.org/show_bug.cgi?id=85733

Patch by Frederic Wang <fwang@igalia.com> on 2016-07-11
Reviewed by Brent Fulgham.

Source/WebCore:

We add support for the href attribute from MathML 3 but ignore the deprecated XLink version.
We also use the code from HTMLAnchorElement SVGAElement to make MathMLElement with a href
attribute behave as a link.
Finally, we adjust mathml.css based on rules from the html and svg user agent stylesheets.

Tests: mathml/mathml-in-html5/href-click-1.html
       mathml/mathml-in-html5/href-click-2.html
       mathml/presentation/href-enter.html
       mathml/presentation/href-style.html
       mathml/presentation/maction-toggle-href.html
       mathml/presentation/semantics-href.html

* css/mathml.css:
(:any-link): Set color and mouse cursor of links.
(:any-link:active): Set color of active links.
(:focus): Set outline of focused links.
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::parseAttribute): Parse the href attribute.
(WebCore::MathMLElement::willRespondToMouseClickEvents): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::defaultEventHandler): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::canStartSelection): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::isFocusable): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::isKeyboardFocusable): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::isMouseFocusable): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::isURLAttribute): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::supportsFocus): Based on HTMLAnchorElement/SVGAElement.
(WebCore::MathMLElement::tabIndex): Based on HTMLAnchorElement/SVGAElement.
* mathml/MathMLElement.h: Define new members.
* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::willRespondToMouseClickEvents): We also verify whether
the parent class will respond.
* mathml/mathattrs.in: Add href attribute.

LayoutTests:

We import some tests from the MathML in HTML5 test suite to
test clicks on href attributes and write similar tests.
We also test tab/enter keys and user agent style with links.

* mathml/mathml-in-html5/href-click-1.html: Added. Verify mouse click on a MathML link.
* mathml/mathml-in-html5/href-click-1-expected.html: Added.
* mathml/mathml-in-html5/href-click-2.html: Added.
Verify mouse click on a descendant of a MathML link.
* mathml/mathml-in-html5/href-click-2-expected.html: Added.
* mathml/presentation/href-enter.html: Added.
Verify tab navigation and activing link with enter.
* mathml/presentation/href-enter-expected.html: Added.
* mathml/presentation/href-style.html: Added.
Verify default style of links and of focused links.
* mathml/presentation/href-style-expected.html: Added.
* mathml/presentation/maction-toggle-href.html: Added.
Verify conflicts between maction toggle and href link.
* mathml/presentation/maction-toggle-href-expected.html: Added.
* mathml/presentation/semantics-href.html: Added. Verify mouse click on a <semantics> link.
* mathml/presentation/semantics-href-expected.html: Added.
* platform/mac/TestExpectations: Disable MathML link tests that rely on keyboard events.
* platform/ios-simulator/TestExpectations: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1-expected.html [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1.html [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2-expected.html [new file with mode: 0644]
LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2.html [new file with mode: 0644]
LayoutTests/mathml/presentation/href-enter-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/href-enter.html [new file with mode: 0644]
LayoutTests/mathml/presentation/href-style-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/href-style.html [new file with mode: 0644]
LayoutTests/mathml/presentation/maction-toggle-href-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/maction-toggle-href.html [new file with mode: 0644]
LayoutTests/mathml/presentation/semantics-href-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/semantics-href.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/mathml.css
Source/WebCore/mathml/MathMLElement.cpp
Source/WebCore/mathml/MathMLElement.h
Source/WebCore/mathml/MathMLSelectElement.cpp
Source/WebCore/mathml/mathattrs.in