Diff
Modified: trunk/LayoutTests/ChangeLog (203103 => 203104)
--- trunk/LayoutTests/ChangeLog 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/LayoutTests/ChangeLog 2016-07-12 04:28:16 UTC (rev 203104)
@@ -1,5 +1,35 @@
2016-07-11 Frederic Wang <[email protected]>
+ Add support for @href attribute in MathML
+ https://bugs.webkit.org/show_bug.cgi?id=85733
+
+ Reviewed by Brent Fulgham.
+
+ 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.
+
+2016-07-11 Frederic Wang <[email protected]>
+
Replace reftest mathml/presentation/fractions-positions.html with script tests
https://bugs.webkit.org/show_bug.cgi?id=159558
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1-expected.html (0 => 203104)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1-expected.html (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href click (reference)</title>
+</head>
+<body>
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; background: green">
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1.html (0 => 203104)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1.html (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href click</title>
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="assert" content="Verify that a click on a link moves to the target.">
+<script type="text/_javascript_">
+ function test()
+ {
+ var event = new MouseEvent('click', {bubbles: true, cancelable: true});
+ document.getElementById('link').dispatchEvent(event);
+ }
+</script>
+</head>
+<body _onload_="test()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; overflow: hidden">
+ <math style="padding: 0">
+ <mrow id="link" href=""
+ <mspace id="space" width="150px" height="150px" mathbackground="red"/>
+ </mrow>
+ </math>
+ <div style="height: 500px;"></div>
+ <math id="target" style="padding: 0">
+ <mspace width="150px" height="150px" mathbackground="green"/>
+ </math>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-1.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2-expected.html (0 => 203104)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2-expected.html (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href click (reference)</title>
+</head>
+<body>
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; background: green">
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2.html (0 => 203104)
--- trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2.html (rev 0)
+++ trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href click</title>
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="assert" content="Test that a click on an element bubbles to an ancestor link.">
+<script type="text/_javascript_">
+ function test()
+ {
+ var event = new MouseEvent('click', {bubbles: true, cancelable: true});
+ document.getElementById('space').dispatchEvent(event);
+ }
+</script>
+</head>
+<body _onload_="test()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; overflow: hidden">
+ <math style="padding: 0">
+ <mrow href=""
+ <mrow>
+ <mrow>
+ <mspace id="space" width="150px" height="150px" mathbackground="red"/>
+ </mrow>
+ </mrow>
+ </mrow>
+ </math>
+ <div style="height: 500px;"></div>
+ <math id="target" style="padding: 0">
+ <mspace width="150px" height="150px" mathbackground="green"/>
+ </math>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/imported/mathml-in-html5/mathml/relations/html5-tree/href-click-2.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/href-enter-expected.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/href-enter-expected.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/href-enter-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href enter</title>
+</head>
+<body _onload_="runTest()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; background: green">
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/href-enter-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/href-enter.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/href-enter.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/href-enter.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="utf-8"/>
+<title>href enter</title>
+<script>
+ function runTest() {
+ if (window.eventSender) {
+ eventSender.keyDown('\t'); // focus the link
+ eventSender.keyDown('\r'); // press enter
+ document.documentElement.removeAttribute("class");
+ }
+ }
+</script>
+</head>
+<body _onload_="runTest()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; overflow: hidden">
+ <math style="padding: 0">
+ <mrow id="link" href=""
+ <mspace id="space" width="150px" height="150px" mathbackground="red"/>
+ </mrow>
+ </math>
+ <div style="height: 500px;"></div>
+ <math id="target" style="padding: 0">
+ <mspace width="150px" height="150px" mathbackground="green"/>
+ </math>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/href-enter.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/href-style-expected.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/href-style-expected.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/href-style-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+ <head>
+ <title>href style</title>
+ <meta charset="utf-8"/>
+ <style>
+ #Link {
+ color: -webkit-link;
+ }
+ #FocusedLink {
+ outline: auto 5px -webkit-focus-ring-color;
+ color: -webkit-link;
+ }
+ </style>
+ </head>
+ <body>
+
+ <math>
+ <mrow><mtext>Non-Link</mtext></mrow>
+ <mrow id="Link"><mtext>Link</mtext></mrow>
+ <mrow id="FocusedLink"><mtext>Focused Link</mtext></mrow>
+ </math>
+
+ </body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/href-style-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/href-style.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/href-style.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/href-style.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,25 @@
+<!doctype html>
+<html class="reftest-wait">
+ <head>
+ <title>href style</title>
+ <meta charset="utf-8"/>
+ <script>
+ function runTest() {
+ if (window.eventSender) {
+ eventSender.keyDown('\t'); // focus #Link
+ eventSender.keyDown('\t'); // focus #FocusedLink
+ document.documentElement.removeAttribute("class");
+ }
+ }
+ </script>
+ </head>
+ <body _onload_="runTest()">
+
+ <math>
+ <mrow><mtext>Non-Link</mtext></mrow>
+ <mrow href=""
+ <mrow href="" Link</mtext></mrow>
+ </math>
+
+ </body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/href-style.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/maction-toggle-href-expected.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/maction-toggle-href-expected.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/maction-toggle-href-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href on a maction toggle</title>
+</head>
+<body>
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; background: green">
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/maction-toggle-href-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/maction-toggle-href.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/maction-toggle-href.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/maction-toggle-href.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href on a maction toggle</title>
+<script type="text/_javascript_">
+ function test()
+ {
+ var event = new MouseEvent('click', {bubbles: true, cancelable: true});
+ document.getElementById('link').dispatchEvent(event);
+ }
+</script>
+</head>
+<body _onload_="test()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; overflow: hidden">
+ <math style="padding: 0">
+ <!-- Initially, the maction element displays its second child which is a red mspace.
+ After the click, the selection moves to the third child which is a green mspace.
+ We should not follow the link, whose target is a red space.
+ -->
+ <maction id="link" href="" actiontype="toggle" selection="2">
+ <mspace width="150px" height="150px" mathbackground="red"/>
+ <mspace width="150px" height="150px" mathbackground="red"/>
+ <mspace width="150px" height="150px" mathbackground="green"/>
+ </semantics>
+ </math>
+ <div style="height: 500px;"></div>
+ <math id="target" style="padding: 0">
+ <mspace id="space" width="150px" height="150px" mathbackground="red"/>
+ </math>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/maction-toggle-href.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/semantics-href-expected.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/semantics-href-expected.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-href-expected.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href on a semantics element (expected)</title>
+</head>
+<body>
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; background: green">
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/semantics-href-expected.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/mathml/presentation/semantics-href.html (0 => 203104)
--- trunk/LayoutTests/mathml/presentation/semantics-href.html (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-href.html 2016-07-12 04:28:16 UTC (rev 203104)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>href on a semantics element</title>
+<script type="text/_javascript_">
+ function test()
+ {
+ var event = new MouseEvent('click', {bubbles: true, cancelable: true});
+ document.getElementById('link').dispatchEvent(event);
+ }
+</script>
+</head>
+<body _onload_="test()">
+
+ <p>This test passes if you see a green square.</p>
+
+ <div style="width: 150px; height: 150px; overflow: hidden">
+ <math style="padding: 0">
+ <semantics id="link" href=""
+ <mspace id="space" width="150px" height="150px" mathbackground="red"/>
+ <annotation>red square</annotation>
+ </semantics>
+ </math>
+ <div style="height: 500px;"></div>
+ <math id="target" style="padding: 0">
+ <mspace width="150px" height="150px" mathbackground="green"/>
+ </math>
+ </div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/mathml/presentation/semantics-href.html
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (203103 => 203104)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-07-12 04:28:16 UTC (rev 203104)
@@ -680,6 +680,10 @@
# The web font loading & relayout seems to be performed too late.
imported/mathml-in-html5/mathml/relations/css-styling/mathvariant-transforms-1.html [ Pass ImageOnlyFailure ]
+# These tests use key navigation to test MathML links but do not seem to work on iOS simulator.
+webkit.org/b/159662 mathml/presentation/href-enter.html [ Skip ]
+webkit.org/b/159662 mathml/presentation/href-style.html [ Skip ]
+
# <rdar://problem/19215305> ASSERT(m_cgFont.get()) fails in FontPlatformData::ctFont()
svg/text/svg-fallback-font-crash.html
svg/css/font-face-variant-crash.html
Modified: trunk/LayoutTests/platform/mac/TestExpectations (203103 => 203104)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-07-12 04:28:16 UTC (rev 203104)
@@ -805,6 +805,10 @@
mathml/presentation/fractions-linethickness.html [ Skip ]
mathml/opentype/large-operators-italic-correction.html [ Skip ]
+# These tests use key navigation to test MathML links but do not seem to work on Mac.
+webkit.org/b/159662 mathml/presentation/href-enter.html [ Skip ]
+webkit.org/b/159662 mathml/presentation/href-style.html [ Skip ]
+
webkit.org/b/128255 compositing/columns/composited-lr-paginated-repaint.html [ Pass Failure ]
webkit.org/b/128255 compositing/columns/composited-rl-paginated-repaint.html [ Pass Failure ]
Modified: trunk/Source/WebCore/ChangeLog (203103 => 203104)
--- trunk/Source/WebCore/ChangeLog 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/ChangeLog 2016-07-12 04:28:16 UTC (rev 203104)
@@ -1,3 +1,43 @@
+2016-07-11 Frederic Wang <[email protected]>
+
+ Add support for @href attribute in MathML
+ https://bugs.webkit.org/show_bug.cgi?id=85733
+
+ Reviewed by Brent Fulgham.
+
+ 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.
+
2016-07-11 Sam Weinig <[email protected]>
Speech Synthesis: getting list of voices no longer works
Modified: trunk/Source/WebCore/css/mathml.css (203103 => 203104)
--- trunk/Source/WebCore/css/mathml.css 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/css/mathml.css 2016-07-12 04:28:16 UTC (rev 203104)
@@ -1,5 +1,18 @@
@namespace "http://www.w3.org/1998/Math/MathML";
+:any-link {
+ color: -webkit-link;
+ cursor: auto;
+}
+
+:any-link:active {
+ color: -webkit-activelink;
+}
+
+:focus {
+ outline: auto 5px -webkit-focus-ring-color
+}
+
math {
/*
We use the exact bounding boxes of glyphs to avoid excessive gaps in mathematical formulas.
Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (203103 => 203104)
--- trunk/Source/WebCore/mathml/MathMLElement.cpp 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp 2016-07-12 04:28:16 UTC (rev 203104)
@@ -32,6 +32,9 @@
#include "MathMLElement.h"
#include "ElementIterator.h"
+#include "Event.h"
+#include "EventHandler.h"
+#include "HTMLAnchorElement.h"
#include "HTMLElement.h"
#include "HTMLHtmlElement.h"
#include "HTMLMapElement.h"
@@ -40,10 +43,12 @@
#include "MathMLMathElement.h"
#include "MathMLNames.h"
#include "MathMLSelectElement.h"
+#include "MouseEvent.h"
#include "RenderTableCell.h"
#include "SVGElement.h"
#include "SVGNames.h"
#include "SVGSVGElement.h"
+#include "XLinkNames.h"
namespace WebCore {
@@ -216,7 +221,12 @@
void MathMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
- if (name == rowspanAttr) {
+ if (name == hrefAttr) {
+ bool wasLink = isLink();
+ setIsLink(!value.isNull() && !shouldProhibitLinks(this));
+ if (wasLink != isLink())
+ setNeedsStyleRecalc();
+ } else if (name == rowspanAttr) {
if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag))
downcast<RenderTableCell>(*renderer()).colSpanOrRowSpanChanged();
} else if (name == columnspanAttr) {
@@ -305,6 +315,88 @@
StyledElement::attributeChanged(name, oldValue, newValue, reason);
}
+bool MathMLElement::willRespondToMouseClickEvents()
+{
+ return isLink() || StyledElement::willRespondToMouseClickEvents();
}
+void MathMLElement::defaultEventHandler(Event* event)
+{
+ if (isLink()) {
+ if (focused() && isEnterKeyKeydownEvent(event)) {
+ event->setDefaultHandled();
+ dispatchSimulatedClick(event);
+ return;
+ }
+ if (MouseEvent::canTriggerActivationBehavior(*event)) {
+ const AtomicString& href = ""
+ String url = ""
+ event->setDefaultHandled();
+ if (Frame* frame = document().frame())
+ frame->loader().urlSelected(document().completeURL(url), "_self", event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());
+ return;
+ }
+ }
+
+ StyledElement::defaultEventHandler(event);
+}
+
+bool MathMLElement::canStartSelection() const
+{
+ if (!isLink())
+ return StyledElement::canStartSelection();
+
+ return hasEditableStyle();
+}
+
+bool MathMLElement::isFocusable() const
+{
+ if (renderer() && renderer()->absoluteClippedOverflowRect().isEmpty())
+ return false;
+
+ return StyledElement::isFocusable();
+}
+
+bool MathMLElement::isKeyboardFocusable(KeyboardEvent* event) const
+{
+ if (isFocusable() && StyledElement::supportsFocus())
+ return StyledElement::isKeyboardFocusable(event);
+
+ if (isLink())
+ return document().frame()->eventHandler().tabsToLinks(event);
+
+ return StyledElement::isKeyboardFocusable(event);
+}
+
+bool MathMLElement::isMouseFocusable() const
+{
+ // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable.
+ // https://bugs.webkit.org/show_bug.cgi?id=26856
+ if (isLink())
+ return StyledElement::supportsFocus();
+
+ return StyledElement::isMouseFocusable();
+}
+
+bool MathMLElement::isURLAttribute(const Attribute& attribute) const
+{
+ return attribute.name().localName() == hrefAttr || StyledElement::isURLAttribute(attribute);
+}
+
+bool MathMLElement::supportsFocus() const
+{
+ if (hasEditableStyle())
+ return StyledElement::supportsFocus();
+ // If not a link we should still be able to focus the element if it has tabIndex.
+ return isLink() || StyledElement::supportsFocus();
+}
+
+int MathMLElement::tabIndex() const
+{
+ // Skip the supportsFocus check in StyledElement.
+ return Element::tabIndex();
+}
+
+}
+
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/mathml/MathMLElement.h (203103 => 203104)
--- trunk/Source/WebCore/mathml/MathMLElement.h 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/mathml/MathMLElement.h 2016-07-12 04:28:16 UTC (rev 203104)
@@ -69,8 +69,19 @@
bool isPhrasingContent(const Node&) const;
bool isFlowContent(const Node&) const;
+ bool willRespondToMouseClickEvents() override;
+ void defaultEventHandler(Event*) override;
+
private:
virtual void updateSelectedChild() { }
+
+ bool canStartSelection() const final;
+ bool isFocusable() const final;
+ bool isKeyboardFocusable(KeyboardEvent*) const final;
+ bool isMouseFocusable() const final;
+ bool isURLAttribute(const Attribute&) const final;
+ bool supportsFocus() const final;
+ int tabIndex() const final;
};
inline bool Node::hasTagName(const MathMLQualifiedName& name) const
Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.cpp (203103 => 203104)
--- trunk/Source/WebCore/mathml/MathMLSelectElement.cpp 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.cpp 2016-07-12 04:28:16 UTC (rev 203104)
@@ -224,7 +224,7 @@
bool MathMLSelectElement::willRespondToMouseClickEvents()
{
- return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle";
+ return fastGetAttribute(MathMLNames::actiontypeAttr) == "toggle" || MathMLInlineContainerElement::willRespondToMouseClickEvents();
}
void MathMLSelectElement::toggle()
Modified: trunk/Source/WebCore/mathml/mathattrs.in (203103 => 203104)
--- trunk/Source/WebCore/mathml/mathattrs.in 2016-07-12 04:03:43 UTC (rev 203103)
+++ trunk/Source/WebCore/mathml/mathattrs.in 2016-07-12 04:28:16 UTC (rev 203104)
@@ -25,6 +25,7 @@
fontweight
form
height
+href
largeop
linethickness
lspace