<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174637] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174637">174637</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-12 01:35:34 -0700 (Sun, 12 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Support activation behavior of link element
https://bugs.webkit.org/show_bug.cgi?id=137597

Patch by Dhi Aurrahman &lt;diorahman@rockybars.com&gt; on 2014-10-12
Reviewed by Benjamin Poulain.

Source/WebCore:

Support activation behavior of link elements as defined in [1],
i.e. to follow the hyperlink created by the link element when it is fully active.

[1] https://html.spec.whatwg.org/multipage/semantics.html#the-link-element

Tests: fast/dom/html-link-element-activation-behavior-on-element-click.html
       fast/dom/html-link-element-activation-behavior-on-mouse-click.html
       fast/dom/html-link-element-activation-behavior-url-is-null.html

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::triggerActivationBehavior):
* dom/MouseEvent.h:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::defaultEventHandler):
(WebCore::isLinkClick): Deleted.
* html/HTMLAnchorElement.h:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::defaultEventHandler):
(WebCore::HTMLLinkElement::handleClick):
* html/HTMLLinkElement.h:
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):

LayoutTests:

Add test cases for link element activation behavior.

* fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt: Added.
* fast/dom/html-link-element-activation-behavior-on-element-click.html: Added.
* fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt: Added.
* fast/dom/html-link-element-activation-behavior-on-mouse-click.html: Added.
* fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt: Added.
* fast/dom/html-link-element-activation-behavior-url-is-null.html: Added.
* fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html: Added.
* fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html: Added.
* fast/dom/resources/html-link-element-activation-behavior-target.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomMouseEventcpp">trunk/Source/WebCore/dom/MouseEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomMouseEventh">trunk/Source/WebCore/dom/MouseEvent.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementcpp">trunk/Source/WebCore/html/HTMLAnchorElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementh">trunk/Source/WebCore/html/HTMLAnchorElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementh">trunk/Source/WebCore/html/HTMLLinkElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAElementcpp">trunk/Source/WebCore/svg/SVGAElement.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronelementclickexpectedtxt">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronelementclickhtml">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click.html</a></li>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronmouseclickexpectedtxt">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronmouseclickhtml">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click.html</a></li>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehaviorurlisnullexpectedtxt">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomhtmllinkelementactivationbehaviorurlisnullhtml">trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null.html</a></li>
<li><a href="#trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehavioronelementclickstep1html">trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html</a></li>
<li><a href="#trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehavioronmouseclickstep1html">trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html</a></li>
<li><a href="#trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehaviortargethtml">trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-target.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/LayoutTests/ChangeLog        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-10-12  Dhi Aurrahman  &lt;diorahman@rockybars.com&gt;
+
+        Support activation behavior of link element
+        https://bugs.webkit.org/show_bug.cgi?id=137597
+
+        Reviewed by Benjamin Poulain.
+
+        Add test cases for link element activation behavior.
+
+        * fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt: Added.
+        * fast/dom/html-link-element-activation-behavior-on-element-click.html: Added.
+        * fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt: Added.
+        * fast/dom/html-link-element-activation-behavior-on-mouse-click.html: Added.
+        * fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt: Added.
+        * fast/dom/html-link-element-activation-behavior-url-is-null.html: Added.
+        * fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html: Added.
+        * fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html: Added.
+        * fast/dom/resources/html-link-element-activation-behavior-target.html: Added.
+
</ins><span class="cx"> 2014-10-11  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mark some more tests as sometimes passing.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronelementclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click-expected.txt        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests html link element activation behavior on DOM click
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS event.data is &quot;test:ok&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronelementclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-element-click.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;master&quot;&gt;&lt;/div&gt;
+&lt;iframe id=&quot;frame&quot; src=&quot;resources/html-link-element-activation-behavior-on-element-click-step1.html&quot;&gt;&lt;/iframe&gt;
+&lt;script&gt;
+description(&quot;This tests html link element activation behavior on DOM click&quot;);
+function start(){
+    frame.postMessage(&quot;element:click&quot;, &quot;*&quot;);
+}
+function listener(event){
+    shouldBeEqualToString(&quot;event.data&quot;, &quot;test:ok&quot;)
+    finishJSTest();
+}
+var frame = document.getElementById(&quot;frame&quot;).contentWindow;
+window.addEventListener(&quot;message&quot;, listener);
+frame.onload = start;
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronmouseclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click-expected.txt        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests html link element activation behavior on mouse click
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS event.data is &quot;test:ok&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehavioronmouseclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-on-mouse-click.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;master&quot;&gt;&lt;/div&gt;
+&lt;iframe id=&quot;frame&quot; src=&quot;resources/html-link-element-activation-behavior-on-mouse-click-step1.html&quot;&gt;&lt;/iframe&gt;
+&lt;script&gt;
+description(&quot;This tests html link element activation behavior on mouse click&quot;);
+function start(){
+    frame.postMessage(&quot;mouse:click&quot;, &quot;*&quot;);
+}
+function listener(event){
+    shouldBeEqualToString(&quot;event.data&quot;, &quot;test:ok&quot;)
+    finishJSTest();
+}
+var frame = document.getElementById(&quot;frame&quot;).contentWindow;
+window.addEventListener(&quot;message&quot;, listener);
+frame.onload = start;
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehaviorurlisnullexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null-expected.txt        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests html link element activation behavior when url is null
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS target.dispatchEvent(mouseEvent) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomhtmllinkelementactivationbehaviorurlisnullhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/html-link-element-activation-behavior-url-is-null.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;link id=&quot;target&quot;&gt;
+&lt;script&gt;
+description(&quot;This tests html link element activation behavior when url is null&quot;);
+function notNavigatedAnywhere(){
+    finishJSTest();
+}
+var mouseEvent = new MouseEvent(&quot;click&quot;);
+var target = document.getElementById(&quot;target&quot;);
+shouldBeTrue(&quot;target.dispatchEvent(mouseEvent)&quot;);
+setTimeout(notNavigatedAnywhere, 100);
+window.jsTestIsAsync = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehavioronelementclickstep1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-element-click-step1.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;head&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+link {
+    display: block;
+    width: 100px;
+    height: 100px;
+    border: 1px solid red;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;link id=&quot;target&quot; href=&quot;html-link-element-activation-behavior-target.html&quot;&gt;
+&lt;script&gt;
+function elementClick(){
+    document.getElementById(&quot;target&quot;).click();
+}
+window.addEventListener(&quot;message&quot;, elementClick);
+&lt;/script&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehavioronmouseclickstep1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-on-mouse-click-step1.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;head&gt;
+&lt;style type=&quot;text/css&quot;&gt;
+link {
+    display: block;
+    width: 100px;
+    height: 100px;
+    border: 1px solid red;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;link id=&quot;target&quot; href=&quot;html-link-element-activation-behavior-target.html&quot;&gt;
+&lt;script&gt;
+function mouseClick() {
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 140);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }        
+}
+window.addEventListener(&quot;message&quot;, mouseClick);
+&lt;/script&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomresourceshtmllinkelementactivationbehaviortargethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-target.html (0 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-target.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/html-link-element-activation-behavior-target.html        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;head&gt;
+&lt;script&gt;
+function ok(){
+    window.parent.postMessage(&quot;test:ok&quot;, &quot;*&quot;);
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;ok()&quot;&gt;
+&lt;h1&gt;target&lt;/h1&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/ChangeLog        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-10-12  Dhi Aurrahman  &lt;diorahman@rockybars.com&gt;
+
+        Support activation behavior of link element
+        https://bugs.webkit.org/show_bug.cgi?id=137597
+
+        Reviewed by Benjamin Poulain.
+
+        Support activation behavior of link elements as defined in [1],
+        i.e. to follow the hyperlink created by the link element when it is fully active.
+
+        [1] https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
+
+        Tests: fast/dom/html-link-element-activation-behavior-on-element-click.html
+               fast/dom/html-link-element-activation-behavior-on-mouse-click.html
+               fast/dom/html-link-element-activation-behavior-url-is-null.html
+
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::triggerActivationBehavior):
+        * dom/MouseEvent.h:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::defaultEventHandler):
+        (WebCore::isLinkClick): Deleted.
+        * html/HTMLAnchorElement.h:
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::defaultEventHandler):
+        (WebCore::HTMLLinkElement::handleClick):
+        * html/HTMLLinkElement.h:
+        * svg/SVGAElement.cpp:
+        (WebCore::SVGAElement::defaultEventHandler):
+
</ins><span class="cx"> 2014-10-11  KwangHyuk Kim  &lt;hyuki.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Enable WebP support.
</span></span></pre></div>
<a id="trunkSourceWebCoredomMouseEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MouseEvent.cpp        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -190,6 +190,11 @@
</span><span class="cx">                || t == eventNames().dragstartEvent|| t == eventNames().dragEvent || t == eventNames().dragendEvent;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MouseEvent::canTriggerActivationBehavior(const Event&amp; event)
+{
+    return event.type() == eventNames().clickEvent &amp;&amp; (!is&lt;MouseEvent&gt;(event) || downcast&lt;MouseEvent&gt;(event).button() != RightButton);
+}
+
</ins><span class="cx"> int MouseEvent::which() const
</span><span class="cx"> {
</span><span class="cx">     // For the DOM, the return values for left, middle and right mouse buttons are 0, 1, 2, respectively.
</span></span></pre></div>
<a id="trunkSourceWebCoredomMouseEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MouseEvent.h (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MouseEvent.h        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/dom/MouseEvent.h        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -99,6 +99,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isMouseEvent() const override;
</span><span class="cx">     virtual bool isDragEvent() const override;
</span><ins>+    static bool canTriggerActivationBehavior(const Event&amp;); 
+
</ins><span class="cx">     virtual int which() const override;
</span><span class="cx"> 
</span><span class="cx">     virtual PassRefPtr&lt;Event&gt; cloneFor(HTMLIFrameElement*) const override;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -189,7 +189,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (isLinkClick(event) &amp;&amp; treatLinkAsLiveForEventType(eventType(event))) {
</del><ins>+        if (MouseEvent::canTriggerActivationBehavior(*event) &amp;&amp; treatLinkAsLiveForEventType(eventType(event))) {
</ins><span class="cx">             handleClick(event);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -597,11 +597,6 @@
</span><span class="cx">     return event-&gt;type() == eventNames().keydownEvent &amp;&amp; is&lt;KeyboardEvent&gt;(*event) &amp;&amp; downcast&lt;KeyboardEvent&gt;(*event).keyIdentifier() == &quot;Enter&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isLinkClick(Event* event)
-{
-    return event-&gt;type() == eventNames().clickEvent &amp;&amp; (!is&lt;MouseEvent&gt;(*event) || downcast&lt;MouseEvent&gt;(*event).button() != RightButton);
-}
-
</del><span class="cx"> bool shouldProhibitLinks(Element* element)
</span><span class="cx"> {
</span><span class="cx">     return isInSVGImage(element);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.h (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.h        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.h        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -152,7 +152,6 @@
</span><span class="cx"> // Functions shared with the other anchor elements (i.e., SVG).
</span><span class="cx"> 
</span><span class="cx"> bool isEnterKeyKeydownEvent(Event*);
</span><del>-bool isLinkClick(Event*);
</del><span class="cx"> bool shouldProhibitLinks(Element*);
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="cx"> #include &quot;MediaQueryEvaluator.h&quot;
</span><ins>+#include &quot;MouseEvent.h&quot;
</ins><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="lines">@@ -396,6 +397,28 @@
</span><span class="cx">     return attribute.name().localName() == hrefAttr || HTMLElement::isURLAttribute(attribute);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HTMLLinkElement::defaultEventHandler(Event* event)
+{
+    ASSERT(event);
+    if (MouseEvent::canTriggerActivationBehavior(*event)) {
+        handleClick(*event);
+        return;
+    }
+    HTMLElement::defaultEventHandler(event);
+}
+
+void HTMLLinkElement::handleClick(Event&amp; event)
+{
+    event.setDefaultHandled();
+    URL url = href();
+    if (url.isNull())
+        return;
+    Frame* frame = document().frame();
+    if (!frame)
+        return;
+    frame-&gt;loader().urlSelected(url, target(), PassRefPtr&lt;Event&gt;(&amp;event), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer);
+}
+
</ins><span class="cx"> URL HTMLLinkElement::href() const
</span><span class="cx"> {
</span><span class="cx">     return document().completeURL(getAttribute(hrefAttr));
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.h        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -97,6 +97,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isURLAttribute(const Attribute&amp;) const override;
</span><span class="cx"> 
</span><ins>+    virtual void defaultEventHandler(Event*) override;
+    void handleClick(Event&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     HTMLLinkElement(const QualifiedName&amp;, Document&amp;, bool createdByParser);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (174636 => 174637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAElement.cpp        2014-10-12 07:15:25 UTC (rev 174636)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp        2014-10-12 08:35:34 UTC (rev 174637)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (isLinkClick(event)) {
</del><ins>+        if (MouseEvent::canTriggerActivationBehavior(*event)) {
</ins><span class="cx">             String url = stripLeadingAndTrailingHTMLSpaces(href());
</span><span class="cx"> 
</span><span class="cx">             if (url[0] == '#') {
</span></span></pre>
</div>
</div>

</body>
</html>