<!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>[196888] trunk/Source</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/196888">196888</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-02-21 18:33:29 -0800 (Sun, 21 Feb 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Refactor LazyEventListener creation to separate Element and Document cases
https://bugs.webkit.org/show_bug.cgi?id=154231
Reviewed by Andreas Kling.
Source/WebCore:
* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::create): Added. Newly factored to separate
Element, Document, and DOMWindow with overloading.
(WebCore::JSLazyEventListener::createForNode): Deleted.
(WebCore::JSLazyEventListener::createForDOMWindow): Deleted.
* bindings/js/JSLazyEventListener.h: Replaced the separate createForNode
and createForDOMWindow functions with a single overloaded function create,
which takes an Element, Document, or DOMWindow. Also changed indentation
to match the style guide.
* dom/Attr.h: Added newly needed forward class declaration.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::setAttributeEventListener): Deleted.
* dom/ContainerNode.h: Deleted setAttributeEventListener override; it's now
done separately by Element and Document.
* dom/Document.cpp:
(WebCore::Document::setAttributeEventListener): Added. Makes the lazy event
listener and calls through to the base class's setAttributeEventListener.
(WebCore::Document::setWindowAttributeEventListener): Updated to call just
create instead of createForDOMWindow.
* dom/Document.h: Removed some unneeded forward declarations. Added the
overload for setAttributeEventListener. Removed a no longer useful comment.
* dom/Element.cpp:
(WebCore::Element::setAttributeEventListener): Added. Makes the lazy event
listener and calls through to the base class's setAttributeEventListener.
* dom/Element.h: Removed some unneeded forward declarations. Added the
overload for setAttributeEventListener.
* dom/Node.h: Removed many unneeded forward declarations.
* dom/NodeRareData.h: Added one forward declaration.
* editing/Editor.h: Added one forward declaration.
Source/WebKit/win:
* WebView.h: Forward declare KeyboardEvent.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSLazyEventListenercpp">trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSLazyEventListenerh">trunk/Source/WebCore/bindings/js/JSLazyEventListener.h</a></li>
<li><a href="#trunkSourceWebCoredomAttrh">trunk/Source/WebCore/dom/Attr.h</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeh">trunk/Source/WebCore/dom/ContainerNode.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeRareDatah">trunk/Source/WebCore/dom/NodeRareData.h</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorh">trunk/Source/WebCore/editing/Editor.h</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebViewh">trunk/Source/WebKit/win/WebView.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/ChangeLog        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2016-02-21 Darin Adler <darin@apple.com>
+
+ Refactor LazyEventListener creation to separate Element and Document cases
+ https://bugs.webkit.org/show_bug.cgi?id=154231
+
+ Reviewed by Andreas Kling.
+
+ * bindings/js/JSLazyEventListener.cpp:
+ (WebCore::JSLazyEventListener::create): Added. Newly factored to separate
+ Element, Document, and DOMWindow with overloading.
+ (WebCore::JSLazyEventListener::createForNode): Deleted.
+ (WebCore::JSLazyEventListener::createForDOMWindow): Deleted.
+
+ * bindings/js/JSLazyEventListener.h: Replaced the separate createForNode
+ and createForDOMWindow functions with a single overloaded function create,
+ which takes an Element, Document, or DOMWindow. Also changed indentation
+ to match the style guide.
+
+ * dom/Attr.h: Added newly needed forward class declaration.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::setAttributeEventListener): Deleted.
+ * dom/ContainerNode.h: Deleted setAttributeEventListener override; it's now
+ done separately by Element and Document.
+
+ * dom/Document.cpp:
+ (WebCore::Document::setAttributeEventListener): Added. Makes the lazy event
+ listener and calls through to the base class's setAttributeEventListener.
+ (WebCore::Document::setWindowAttributeEventListener): Updated to call just
+ create instead of createForDOMWindow.
+
+ * dom/Document.h: Removed some unneeded forward declarations. Added the
+ overload for setAttributeEventListener. Removed a no longer useful comment.
+
+ * dom/Element.cpp:
+ (WebCore::Element::setAttributeEventListener): Added. Makes the lazy event
+ listener and calls through to the base class's setAttributeEventListener.
+
+ * dom/Element.h: Removed some unneeded forward declarations. Added the
+ overload for setAttributeEventListener.
+
+ * dom/Node.h: Removed many unneeded forward declarations.
+
+ * dom/NodeRareData.h: Added one forward declaration.
+
+ * editing/Editor.h: Added one forward declaration.
+
</ins><span class="cx"> 2016-02-21 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> CSP: Violation report should include column number
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSLazyEventListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/bindings/js/JSLazyEventListener.cpp        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -142,40 +142,53 @@
</span><span class="cx"> return isSVGEvent ? evtString : eventString;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<JSLazyEventListener> JSLazyEventListener::createForNode(ContainerNode& node, const QualifiedName& attributeName, const AtomicString& attributeValue)
</del><ins>+struct JSLazyEventListener::CreationArguments {
+ const QualifiedName& attributeName;
+ const AtomicString& attributeValue;
+ Document& document;
+ ContainerNode* node;
+ JSC::JSObject* wrapper;
+ bool shouldUseSVGEventName;
+};
+
+RefPtr<JSLazyEventListener> JSLazyEventListener::create(const CreationArguments& arguments)
</ins><span class="cx"> {
</span><del>- if (attributeValue.isNull())
</del><ins>+ if (arguments.attributeValue.isNull())
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- TextPosition position = TextPosition::minimumPosition();
</del><ins>+ // FIXME: We should be able to provide source information for frameless documents too (e.g. for importing nodes from XMLHttpRequest.responseXML).
+ TextPosition position;
</ins><span class="cx"> String sourceURL;
</span><del>-
- // FIXME: We should be able to provide source information for frameless documents too (e.g. for importing nodes from XMLHttpRequest.responseXML).
- if (Frame* frame = node.document().frame()) {
</del><ins>+ if (Frame* frame = arguments.document.frame()) {
</ins><span class="cx"> if (!frame->script().canExecuteScripts(AboutToExecuteScript))
</span><span class="cx"> return nullptr;
</span><del>-
</del><span class="cx"> position = frame->script().eventHandlerPosition();
</span><del>- sourceURL = node.document().url().string();
</del><ins>+ sourceURL = arguments.document.url().string();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return adoptRef(*new JSLazyEventListener(attributeName.localName().string(),
- eventParameterName(node.isSVGElement()), attributeValue,
- &node, sourceURL, position, nullptr, mainThreadNormalWorld()));
</del><ins>+ return adoptRef(*new JSLazyEventListener(arguments.attributeName.localName().string(),
+ eventParameterName(arguments.shouldUseSVGEventName), arguments.attributeValue,
+ arguments.node, sourceURL, position, arguments.wrapper, mainThreadNormalWorld()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<JSLazyEventListener> JSLazyEventListener::createForDOMWindow(Frame& frame, const QualifiedName& attributeName, const AtomicString& attributeValue)
</del><ins>+RefPtr<JSLazyEventListener> JSLazyEventListener::create(Element& element, const QualifiedName& attributeName, const AtomicString& attributeValue)
</ins><span class="cx"> {
</span><del>- if (attributeValue.isNull())
- return nullptr;
</del><ins>+ return create({ attributeName, attributeValue, element.document(), &element, nullptr, element.isSVGElement() });
+}
</ins><span class="cx">
</span><del>- if (!frame.script().canExecuteScripts(AboutToExecuteScript))
- return nullptr;
</del><ins>+RefPtr<JSLazyEventListener> JSLazyEventListener::create(Document& document, const QualifiedName& attributeName, const AtomicString& attributeValue)
+{
+ // FIXME: This always passes false for "shouldUseSVGEventName". Is that correct for events dispatched to SVG documents?
+ // This has been this way for a long time, but became more obvious when refactoring to separate the Element and Document code paths.
+ return create({ attributeName, attributeValue, document, &document, nullptr, false });
+}
</ins><span class="cx">
</span><del>- return adoptRef(*new JSLazyEventListener(attributeName.localName().string(),
- eventParameterName(frame.document()->isSVGDocument()), attributeValue,
- nullptr, frame.document()->url().string(), frame.script().eventHandlerPosition(),
- toJSDOMWindow(&frame, mainThreadNormalWorld()), mainThreadNormalWorld()));
</del><ins>+RefPtr<JSLazyEventListener> JSLazyEventListener::create(DOMWindow& window, const QualifiedName& attributeName, const AtomicString& attributeValue)
+{
+ ASSERT(window.document());
+ auto& document = *window.document();
+ ASSERT(document.frame());
+ return create({ attributeName, attributeValue, document, nullptr, toJSDOMWindow(document.frame(), mainThreadNormalWorld()), document.isSVGDocument() });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSLazyEventListenerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSLazyEventListener.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSLazyEventListener.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/bindings/js/JSLazyEventListener.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -26,32 +26,36 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>- class ContainerNode;
- class Frame;
- class QualifiedName;
</del><ins>+class ContainerNode;
+class DOMWindow;
+class Document;
+class Element;
+class QualifiedName;
</ins><span class="cx">
</span><del>- class JSLazyEventListener final : public JSEventListener {
- public:
- static RefPtr<JSLazyEventListener> createForNode(ContainerNode&, const QualifiedName& attributeName, const AtomicString& attributeValue);
- static RefPtr<JSLazyEventListener> createForDOMWindow(Frame&, const QualifiedName& attributeName, const AtomicString& attributeValue);
</del><ins>+class JSLazyEventListener final : public JSEventListener {
+public:
+ static RefPtr<JSLazyEventListener> create(Element&, const QualifiedName& attributeName, const AtomicString& attributeValue);
+ static RefPtr<JSLazyEventListener> create(Document&, const QualifiedName& attributeName, const AtomicString& attributeValue);
+ static RefPtr<JSLazyEventListener> create(DOMWindow&, const QualifiedName& attributeName, const AtomicString& attributeValue);
</ins><span class="cx">
</span><del>- virtual ~JSLazyEventListener();
</del><ins>+ virtual ~JSLazyEventListener();
</ins><span class="cx">
</span><del>- private:
- JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, ContainerNode*, const String& sourceURL, const TextPosition&, JSC::JSObject* wrapper, DOMWrapperWorld& isolatedWorld);
</del><ins>+private:
+ struct CreationArguments;
+ static RefPtr<JSLazyEventListener> create(const CreationArguments&);
</ins><span class="cx">
</span><del>- virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const override;
- virtual bool wasCreatedFromMarkup() const override { return true; }
</del><ins>+ JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, ContainerNode*, const String& sourceURL, const TextPosition&, JSC::JSObject* wrapper, DOMWrapperWorld& isolatedWorld);
</ins><span class="cx">
</span><del>- static void create() = delete;
</del><ins>+ virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const override;
+ virtual bool wasCreatedFromMarkup() const override { return true; }
</ins><span class="cx">
</span><del>- mutable String m_functionName;
- mutable String m_eventParameterName;
- mutable String m_code;
- mutable String m_sourceURL;
- TextPosition m_position;
- ContainerNode* m_originalNode;
- };
</del><ins>+ mutable String m_functionName;
+ mutable String m_eventParameterName;
+ mutable String m_code;
+ mutable String m_sourceURL;
+ TextPosition m_position;
+ ContainerNode* m_originalNode;
+};
</ins><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomAttrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Attr.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Attr.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Attr.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class Attribute;
</ins><span class="cx"> class CSSStyleDeclaration;
</span><span class="cx"> class MutableStyleProperties;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> #include "HTMLSlotElement.h"
</span><span class="cx"> #include "HTMLTableRowsCollection.h"
</span><span class="cx"> #include "InlineTextBox.h"
</span><del>-#include "JSLazyEventListener.h"
</del><span class="cx"> #include "JSNode.h"
</span><span class="cx"> #include "LabelsNodeList.h"
</span><span class="cx"> #include "MutationEvent.h"
</span><span class="lines">@@ -828,11 +827,6 @@
</span><span class="cx"> dispatchChildInsertionEvents(child);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ContainerNode::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
-{
- setAttributeEventListener(eventType, JSLazyEventListener::createForNode(*this, attributeName, attributeValue));
-}
-
</del><span class="cx"> Element* ContainerNode::querySelector(const String& selectors, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> if (SelectorQuery* selectorQuery = document().selectorQueryForString(selectors, ec))
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/ContainerNode.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -31,9 +31,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class HTMLCollection;
</span><del>-class NodeList;
-class NodeOrString;
-class QualifiedName;
</del><ins>+class RadioNodeList;
</ins><span class="cx"> class RenderElement;
</span><span class="cx">
</span><span class="cx"> class NoEventDispatchAssertion {
</span><span class="lines">@@ -124,9 +122,6 @@
</span><span class="cx">
</span><span class="cx"> void disconnectDescendantFrames();
</span><span class="cx">
</span><del>- using Node::setAttributeEventListener;
- void setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value);
-
</del><span class="cx"> RenderElement* renderer() const;
</span><span class="cx">
</span><span class="cx"> // Return a bounding box in absolute coordinates enclosing this node and all its descendants.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -4078,6 +4078,11 @@
</span><span class="cx"> ASSERT(m_domWindow->frame() == m_frame);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Document::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
+{
+ setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue));
+}
+
</ins><span class="cx"> void Document::setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener)
</span><span class="cx"> {
</span><span class="cx"> if (!m_domWindow)
</span><span class="lines">@@ -4087,9 +4092,9 @@
</span><span class="cx">
</span><span class="cx"> void Document::setWindowAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
</span><span class="cx"> {
</span><del>- if (!m_frame)
</del><ins>+ if (!m_domWindow)
</ins><span class="cx"> return;
</span><del>- setWindowAttributeEventListener(eventType, JSLazyEventListener::createForDOMWindow(*m_frame, attributeName, attributeValue));
</del><ins>+ setWindowAttributeEventListener(eventType, JSLazyEventListener::create(*m_domWindow, attributeName, attributeValue));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> EventListener* Document::getWindowAttributeEventListener(const AtomicString& eventType)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Document.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -93,10 +93,7 @@
</span><span class="cx"> class DocumentParser;
</span><span class="cx"> class DocumentSharedObjectPool;
</span><span class="cx"> class DocumentType;
</span><del>-class Element;
</del><span class="cx"> class EntityReference;
</span><del>-class Event;
-class EventListener;
</del><span class="cx"> class ExtensionStyleSheets;
</span><span class="cx"> class FloatRect;
</span><span class="cx"> class FloatQuad;
</span><span class="lines">@@ -141,7 +138,6 @@
</span><span class="cx"> class ProcessingInstruction;
</span><span class="cx"> class QualifiedName;
</span><span class="cx"> class Range;
</span><del>-class RegisteredEventListener;
</del><span class="cx"> class RenderView;
</span><span class="cx"> class RenderFullScreen;
</span><span class="cx"> class ScriptableDocumentParser;
</span><span class="lines">@@ -726,10 +722,6 @@
</span><span class="cx">
</span><span class="cx"> MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const LayoutPoint&, const PlatformMouseEvent&);
</span><span class="cx">
</span><del>- /* Newly proposed CSS3 mechanism for selecting alternate
- stylesheets using the DOM. May be subject to change as
- spec matures. - dwh
- */
</del><span class="cx"> String preferredStylesheetSet() const;
</span><span class="cx"> String selectedStylesheetSet() const;
</span><span class="cx"> void setSelectedStylesheetSet(const String&);
</span><span class="lines">@@ -1322,6 +1314,9 @@
</span><span class="cx"> bool hasHadActiveMediaStreamTrack() const { return m_hasHadActiveMediaStreamTrack; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ using ContainerNode::setAttributeEventListener;
+ void setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value);
+
</ins><span class="cx"> protected:
</span><span class="cx"> enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
</span><span class="cx"> Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> #include "HTMLTemplateElement.h"
</span><span class="cx"> #include "IdChangeInvalidation.h"
</span><span class="cx"> #include "IdTargetObserverRegistry.h"
</span><ins>+#include "JSLazyEventListener.h"
</ins><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MutationObserverInterestGroup.h"
</span><span class="lines">@@ -1830,6 +1831,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Element::setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& attributeValue)
+{
+ setAttributeEventListener(eventType, JSLazyEventListener::create(*this, attributeName, attributeValue));
+}
+
</ins><span class="cx"> void Element::removeAllEventListeners()
</span><span class="cx"> {
</span><span class="cx"> ContainerNode::removeAllEventListeners();
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Element.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> class ElementRareData;
</span><span class="cx"> class HTMLDocument;
</span><span class="cx"> class IntSize;
</span><ins>+class KeyboardEvent;
</ins><span class="cx"> class Locale;
</span><span class="cx"> class PlatformKeyboardEvent;
</span><span class="cx"> class PlatformMouseEvent;
</span><span class="lines">@@ -51,7 +52,6 @@
</span><span class="cx"> class PseudoElement;
</span><span class="cx"> class RenderNamedFlowFragment;
</span><span class="cx"> class RenderTreePosition;
</span><del>-class ShadowRoot;
</del><span class="cx">
</span><span class="cx"> enum SpellcheckAttributeState {
</span><span class="cx"> SpellcheckAttributeTrue,
</span><span class="lines">@@ -499,6 +499,9 @@
</span><span class="cx">
</span><span class="cx"> virtual void isVisibleInViewportChanged() { }
</span><span class="cx">
</span><ins>+ using ContainerNode::setAttributeEventListener;
+ void setAttributeEventListener(const AtomicString& eventType, const QualifiedName& attributeName, const AtomicString& value);
+
</ins><span class="cx"> protected:
</span><span class="cx"> Element(const QualifiedName&, Document&, ConstructionType);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/Node.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -41,50 +41,28 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class Attribute;
-class ClassCollection;
</del><span class="cx"> class ContainerNode;
</span><del>-class DOMTokenList;
</del><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><del>-class Event;
-class EventListener;
</del><span class="cx"> class FloatPoint;
</span><del>-class Frame;
-class HTMLInputElement;
</del><span class="cx"> class HTMLQualifiedName;
</span><span class="cx"> class HTMLSlotElement;
</span><del>-class IntRect;
-class KeyboardEvent;
</del><span class="cx"> class MathMLQualifiedName;
</span><del>-class NSResolver;
-class NameNodeList;
</del><span class="cx"> class NamedNodeMap;
</span><span class="cx"> class NodeList;
</span><span class="cx"> class NodeListsNodeData;
</span><span class="cx"> class NodeOrString;
</span><span class="cx"> class NodeRareData;
</span><span class="cx"> class QualifiedName;
</span><del>-class RadioNodeList;
-class RegisteredEventListener;
</del><span class="cx"> class RenderBox;
</span><span class="cx"> class RenderBoxModelObject;
</span><span class="cx"> class RenderObject;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class SVGQualifiedName;
</span><span class="cx"> class ShadowRoot;
</span><del>-class TagCollection;
-
-#if ENABLE(INDIE_UI)
-class UIRequestEvent;
-#endif
-
-#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
</del><span class="cx"> class TouchEvent;
</span><del>-#endif
</del><ins>+class UIRequestEvent;
</ins><span class="cx">
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> const int nodeStyleChangeShift = 14;
</span><span class="cx">
</span><span class="cx"> // SyntheticStyleChange means that we need to go through the entire style change logic even though
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeRareDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NodeRareData.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NodeRareData.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/dom/NodeRareData.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class LabelsNodeList;
</span><ins>+class NameNodeList;
</ins><span class="cx"> class RadioNodeList;
</span><span class="cx"> class TreeScope;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebCore/editing/Editor.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> class Frame;
</span><span class="cx"> class HTMLElement;
</span><span class="cx"> class HitTestResult;
</span><ins>+class KeyboardEvent;
</ins><span class="cx"> class KillRing;
</span><span class="cx"> class Pasteboard;
</span><span class="cx"> class SharedBuffer;
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebKit/win/ChangeLog        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-02-21 Darin Adler <darin@apple.com>
+
+ Refactor LazyEventListener creation to separate Element and Document cases
+ https://bugs.webkit.org/show_bug.cgi?id=154231
+
+ Reviewed by Andreas Kling.
+
+ * WebView.h: Forward declare KeyboardEvent.
+
</ins><span class="cx"> 2016-02-16 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Drop StyleResolver and SelectorQueryCache when entering PageCache.
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebView.h (196887 => 196888)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebView.h        2016-02-22 01:55:41 UTC (rev 196887)
+++ trunk/Source/WebKit/win/WebView.h        2016-02-22 02:33:29 UTC (rev 196888)
</span><span class="lines">@@ -59,10 +59,8 @@
</span><span class="cx"> struct GraphicsDeviceAdapter;
</span><span class="cx"> #endif
</span><span class="cx"> class HTMLVideoElement;
</span><del>-}
-
-namespace WebCore {
</del><span class="cx"> class HistoryItem;
</span><ins>+ class KeyboardEvent;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class FullscreenVideoController;
</span></span></pre>
</div>
</div>
</body>
</html>