<!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>[168358] 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/168358">168358</a></dd>
<dt>Author</dt> <dd>krit@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-06 07:04:13 -0700 (Tue, 06 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[SVG2] Share &quot;on&quot;- event attributes with HTMLElement
https://bugs.webkit.org/show_bug.cgi?id=132604

Reviewed by Mihnea Ovidenie.

Source/WebCore:
Share &quot;on&quot; event attribute parsing between SVGElement and HTMLElement.

Tests: fast/dom/script-tests/event-attribute-availability.js:

* html/HTMLElement.cpp:
(WebCore::HTMLElement::populateEventNameForAttributeLocalNameMap):
(WebCore::populateEventNameForAttributeLocalNameMap): Deleted.
* html/HTMLElement.h: Make populateEventNameForAttributeLocalNameMap
    public for use in SVGElement.
* svg/SVGElement.cpp: Use HTMLElement code to parse &quot;on&quot; event
    attributes.
(WebCore::SVGElement::parseAttribute):

LayoutTests:
Test that the &quot;on&quot; event attributes supported by HTMLElement are
supported by SVGElement as well.

* fast/dom/event-attribute-availability-expected.txt:
* fast/dom/script-tests/event-attribute-availability.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomeventattributeavailabilityexpectedtxt">trunk/LayoutTests/fast/dom/event-attribute-availability-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomscripttestseventattributeavailabilityjs">trunk/LayoutTests/fast/dom/script-tests/event-attribute-availability.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementcpp">trunk/Source/WebCore/html/HTMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLElementh">trunk/Source/WebCore/html/HTMLElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementcpp">trunk/Source/WebCore/svg/SVGElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/LayoutTests/ChangeLog        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-05-06  Dirk Schulze  &lt;krit@webkit.org&gt;
+
+        [SVG2] Share &quot;on&quot;- event attributes with HTMLElement
+        https://bugs.webkit.org/show_bug.cgi?id=132604
+
+        Reviewed by Mihnea Ovidenie.
+
+        Test that the &quot;on&quot; event attributes supported by HTMLElement are
+        supported by SVGElement as well.
+
+        * fast/dom/event-attribute-availability-expected.txt:
+        * fast/dom/script-tests/event-attribute-availability.js:
+
</ins><span class="cx"> 2014-05-06  Ion Rosca  &lt;rosca@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Blending] Rename all the tests css3/compositing to css3/blending
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomeventattributeavailabilityexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/event-attribute-availability-expected.txt (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/event-attribute-availability-expected.txt        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/LayoutTests/fast/dom/event-attribute-availability-expected.txt        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -42,6 +42,45 @@
</span><span class="cx"> PASS 'onreset' in element is true
</span><span class="cx"> PASS 'onsearch' in element is true
</span><span class="cx"> PASS 'onselectstart' in element is true
</span><ins>+Test SVGElement
+PASS 'onabort' in svgelement is true
+PASS 'onblur' in svgelement is true
+PASS 'onchange' in svgelement is true
+PASS 'onclick' in svgelement is true
+PASS 'oncontextmenu' in svgelement is true
+PASS 'ondblclick' in svgelement is true
+PASS 'ondrag' in svgelement is true
+PASS 'ondragend' in svgelement is true
+PASS 'ondragenter' in svgelement is true
+PASS 'ondragleave' in svgelement is true
+PASS 'ondragover' in svgelement is true
+PASS 'ondragstart' in svgelement is true
+PASS 'ondrop' in svgelement is true
+PASS 'onerror' in svgelement is true
+PASS 'onfocus' in svgelement is true
+PASS 'oninput' in svgelement is true
+PASS 'onkeydown' in svgelement is true
+PASS 'onkeypress' in svgelement is true
+PASS 'onkeyup' in svgelement is true
+PASS 'onload' in svgelement is true
+PASS 'onmousedown' in svgelement is true
+PASS 'onmousemove' in svgelement is true
+PASS 'onmouseout' in svgelement is true
+PASS 'onmouseover' in svgelement is true
+PASS 'onmouseup' in svgelement is true
+PASS 'onmousewheel' in svgelement is true
+PASS 'onscroll' in svgelement is true
+PASS 'onselect' in svgelement is true
+PASS 'onsubmit' in svgelement is true
+PASS 'onbeforecut' in svgelement is true
+PASS 'oncut' in svgelement is true
+PASS 'onbeforecopy' in svgelement is true
+PASS 'oncopy' in svgelement is true
+PASS 'onbeforepaste' in svgelement is true
+PASS 'onpaste' in svgelement is true
+PASS 'onreset' in svgelement is true
+PASS 'onsearch' in svgelement is true
+PASS 'onselectstart' in svgelement is true
</ins><span class="cx"> 
</span><span class="cx"> Test Document
</span><span class="cx"> PASS 'onabort' in document is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomscripttestseventattributeavailabilityjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/script-tests/event-attribute-availability.js (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/script-tests/event-attribute-availability.js        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/LayoutTests/fast/dom/script-tests/event-attribute-availability.js        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -32,6 +32,12 @@
</span><span class="cx">     shouldBeTrue(&quot;'&quot; + elementAndDocumentProperties[i] + &quot;' in element&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+debug(&quot;Test SVGElement&quot;);
+var svgelement = document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;svg&quot;);
+for (var i = 0; i &lt; elementAndDocumentProperties.length; ++i) {
+    shouldBeTrue(&quot;'&quot; + elementAndDocumentProperties[i] + &quot;' in svgelement&quot;);
+}
+
</ins><span class="cx"> debug(&quot;\nTest Document&quot;);
</span><span class="cx"> for (var i = 0; i &lt; elementAndDocumentProperties.length; ++i) {
</span><span class="cx">     shouldBeTrue(&quot;'&quot; + elementAndDocumentProperties[i] + &quot;' in document&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/Source/WebCore/ChangeLog        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-05-06  Dirk Schulze  &lt;krit@webkit.org&gt;
+
+        [SVG2] Share &quot;on&quot;- event attributes with HTMLElement
+        https://bugs.webkit.org/show_bug.cgi?id=132604
+
+        Reviewed by Mihnea Ovidenie.
+
+        Share &quot;on&quot; event attribute parsing between SVGElement and HTMLElement.
+
+        Tests: fast/dom/script-tests/event-attribute-availability.js:
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::populateEventNameForAttributeLocalNameMap):
+        (WebCore::populateEventNameForAttributeLocalNameMap): Deleted.
+        * html/HTMLElement.h: Make populateEventNameForAttributeLocalNameMap
+            public for use in SVGElement.
+        * svg/SVGElement.cpp: Use HTMLElement code to parse &quot;on&quot; event
+            attributes.
+        (WebCore::SVGElement::parseAttribute):
+
</ins><span class="cx"> 2014-05-05  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Soup] Use std::unique_ptr&lt;char[]&gt; for the read buffer in SocketStreamHandle
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.cpp (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.cpp        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/Source/WebCore/html/HTMLElement.cpp        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx">         StyledElement::collectStyleForPresentationAttribute(name, value, style);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NEVER_INLINE void populateEventNameForAttributeLocalNameMap(HashMap&lt;AtomicStringImpl*, AtomicString&gt;&amp; map)
</del><ins>+void HTMLElement::populateEventNameForAttributeLocalNameMap(HashMap&lt;AtomicStringImpl*, AtomicString&gt;&amp; map)
</ins><span class="cx"> {
</span><span class="cx">     static const QualifiedName* const simpleTable[] = {
</span><span class="cx">         &amp;onabortAttr,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLElement.h (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLElement.h        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/Source/WebCore/html/HTMLElement.h        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -98,6 +98,8 @@
</span><span class="cx">     virtual bool isLabelable() const { return false; }
</span><span class="cx">     virtual FormNamedItem* asFormNamedItem() { return 0; }
</span><span class="cx"> 
</span><ins>+    static void populateEventNameForAttributeLocalNameMap(HashMap&lt;AtomicStringImpl*, AtomicString&gt;&amp;);
+
</ins><span class="cx">     bool hasTagName(const HTMLQualifiedName&amp; name) const { return hasLocalName(name.localName()); }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (168357 => 168358)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2014-05-06 13:34:58 UTC (rev 168357)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2014-05-06 14:04:13 UTC (rev 168358)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx">  * Copyright (C) 2008 Alp Toker &lt;alp@atoker.com&gt;
</span><span class="cx">  * Copyright (C) 2009 Cameron McCormack &lt;cam@mcc.id.au&gt;
</span><span class="cx">  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
</span><ins>+ * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -33,6 +34,7 @@
</span><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><ins>+#include &quot;HTMLElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><span class="cx"> #include &quot;RenderObject.h&quot;
</span><span class="lines">@@ -471,51 +473,8 @@
</span><span class="cx"> 
</span><span class="cx"> void SVGElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><del>-    // standard events
-    if (name == onloadAttr)
-        setAttributeEventListener(eventNames().loadEvent, name, value);
-    else if (name == onclickAttr)
-        setAttributeEventListener(eventNames().clickEvent, name, value);
-    else if (name == onmousedownAttr)
-        setAttributeEventListener(eventNames().mousedownEvent, name, value);
-    else if (name == onmouseenterAttr)
-        setAttributeEventListener(eventNames().mouseenterEvent, name, value);
-    else if (name == onmouseleaveAttr)
-        setAttributeEventListener(eventNames().mouseleaveEvent, name, value);
-    else if (name == onmousemoveAttr)
-        setAttributeEventListener(eventNames().mousemoveEvent, name, value);
-    else if (name == onmouseoutAttr)
-        setAttributeEventListener(eventNames().mouseoutEvent, name, value);
-    else if (name == onmouseoverAttr)
-        setAttributeEventListener(eventNames().mouseoverEvent, name, value);
-    else if (name == onmouseupAttr)
-        setAttributeEventListener(eventNames().mouseupEvent, name, value);
-    else if (name == SVGNames::onfocusinAttr)
-        setAttributeEventListener(eventNames().focusinEvent, name, value);
-    else if (name == SVGNames::onfocusoutAttr)
-        setAttributeEventListener(eventNames().focusoutEvent, name, value);
-    else if (name == SVGNames::onactivateAttr)
-        setAttributeEventListener(eventNames().DOMActivateEvent, name, value);
-    else if (name == HTMLNames::classAttr)
</del><ins>+    if (name == HTMLNames::classAttr)
</ins><span class="cx">         setClassNameBaseValue(value);
</span><del>-#if ENABLE(TOUCH_EVENTS)
-    else if (name == ontouchstartAttr)
-        setAttributeEventListener(eventNames().touchstartEvent, name, value);
-    else if (name == ontouchmoveAttr)
-        setAttributeEventListener(eventNames().touchmoveEvent, name, value);
-    else if (name == ontouchendAttr)
-        setAttributeEventListener(eventNames().touchendEvent, name, value);
-    else if (name == ontouchcancelAttr)
-        setAttributeEventListener(eventNames().touchcancelEvent, name, value);
-#endif
-#if ENABLE(IOS_GESTURE_EVENTS)
-    else if (name == ongesturestartAttr)
-        setAttributeEventListener(eventNames().gesturestartEvent, name, value);
-    else if (name == ongesturechangeAttr)
-        setAttributeEventListener(eventNames().gesturechangeEvent, name, value);
-    else if (name == ongestureendAttr)
-        setAttributeEventListener(eventNames().gestureendEvent, name, value);
-#endif
</del><span class="cx">     else if (name == tabindexAttr) {
</span><span class="cx">         int tabindex = 0;
</span><span class="cx">         if (value.isEmpty())
</span><span class="lines">@@ -524,9 +483,21 @@
</span><span class="cx">             // Clamp tabindex to the range of 'short' to match Firefox's behavior.
</span><span class="cx">             setTabIndexExplicitly(std::max(static_cast&lt;int&gt;(std::numeric_limits&lt;short&gt;::min()), std::min(tabindex, static_cast&lt;int&gt;(std::numeric_limits&lt;short&gt;::max()))));
</span><span class="cx">         }
</span><del>-    } else if (SVGLangSpace::parseAttribute(name, value)) {
-    } else
-        StyledElement::parseAttribute(name, value);
</del><ins>+    } else if (SVGLangSpace::parseAttribute(name, value))
+        return;
+    else {
+        // FIXME: Can we do this even faster by checking the local name &quot;on&quot; prefix before we do anything with the map?
+        // See HTMLElement::parseAttribute().
+        static NeverDestroyed&lt;HashMap&lt;AtomicStringImpl*, AtomicString&gt;&gt; eventNamesGlobal;
+        auto&amp; eventNames = eventNamesGlobal.get();
+        if (eventNames.isEmpty())
+            HTMLElement::populateEventNameForAttributeLocalNameMap(eventNames);
+        const AtomicString&amp; eventName = eventNames.get(name.localName().impl());
+        if (!eventName.isNull())
+            setAttributeEventListener(eventName, name, value);
+        else
+            StyledElement::parseAttribute(name, value);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGElement::animatedPropertyTypeForAttribute(const QualifiedName&amp; attributeName, Vector&lt;AnimatedPropertyType&gt;&amp; propertyTypes)
</span></span></pre>
</div>
</div>

</body>
</html>