<!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>[173723] trunk/Source/WebCore</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/173723">173723</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-09-18 09:32:41 -0700 (Thu, 18 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
https://bugs.webkit.org/show_bug.cgi?id=136902
Reviewed by Darin Adler.
Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
in argument instead of a pointer as the Element can never be null.
No new tests, no behavior change.
* dom/ClassNodeList.h:
(WebCore::ClassNodeList::elementMatches):
* dom/DocumentOrderedMap.cpp:
(WebCore::keyMatchesWindowNamedItem):
(WebCore::keyMatchesDocumentNamedItem):
* dom/Element.cpp:
(WebCore::Element::updateNameForDocument):
(WebCore::Element::updateIdForDocument):
* dom/LiveNodeList.cpp:
(WebCore::LiveNodeList::namedItem):
* dom/LiveNodeList.h:
(WebCore::CachedLiveNodeList<NodeListType>::collectionBegin):
(WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
* dom/NameNodeList.h:
(WebCore::NameNodeList::elementMatches):
* dom/TagNodeList.h:
(WebCore::TagNodeList::elementMatches):
(WebCore::HTMLTagNodeList::elementMatches):
* html/HTMLCollection.cpp:
(WebCore::isMatchingElement):
* html/HTMLNameCollection.cpp:
(WebCore::WindowNameCollection::elementMatchesIfNameAttributeMatch):
(WebCore::WindowNameCollection::elementMatches):
(WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
(WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
(WebCore::DocumentNameCollection::elementMatches):
* html/HTMLNameCollection.h:
* html/LabelsNodeList.cpp:
(WebCore::LabelsNodeList::elementMatches):
* html/LabelsNodeList.h:
* html/RadioNodeList.cpp:
(WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
(WebCore::RadioNodeList::elementMatches):
* html/RadioNodeList.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomClassNodeListh">trunk/Source/WebCore/dom/ClassNodeList.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentOrderedMapcpp">trunk/Source/WebCore/dom/DocumentOrderedMap.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLiveNodeListcpp">trunk/Source/WebCore/dom/LiveNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLiveNodeListh">trunk/Source/WebCore/dom/LiveNodeList.h</a></li>
<li><a href="#trunkSourceWebCoredomNameNodeListh">trunk/Source/WebCore/dom/NameNodeList.h</a></li>
<li><a href="#trunkSourceWebCoredomTagNodeListh">trunk/Source/WebCore/dom/TagNodeList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLCollectioncpp">trunk/Source/WebCore/html/HTMLCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLNameCollectioncpp">trunk/Source/WebCore/html/HTMLNameCollection.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLNameCollectionh">trunk/Source/WebCore/html/HTMLNameCollection.h</a></li>
<li><a href="#trunkSourceWebCorehtmlLabelsNodeListcpp">trunk/Source/WebCore/html/LabelsNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlLabelsNodeListh">trunk/Source/WebCore/html/LabelsNodeList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlRadioNodeListcpp">trunk/Source/WebCore/html/RadioNodeList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlRadioNodeListh">trunk/Source/WebCore/html/RadioNodeList.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/ChangeLog        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2014-09-18 Chris Dumez <cdumez@apple.com>
+
+ Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
+ https://bugs.webkit.org/show_bug.cgi?id=136902
+
+ Reviewed by Darin Adler.
+
+ Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
+ in argument instead of a pointer as the Element can never be null.
+
+ No new tests, no behavior change.
+
+ * dom/ClassNodeList.h:
+ (WebCore::ClassNodeList::elementMatches):
+ * dom/DocumentOrderedMap.cpp:
+ (WebCore::keyMatchesWindowNamedItem):
+ (WebCore::keyMatchesDocumentNamedItem):
+ * dom/Element.cpp:
+ (WebCore::Element::updateNameForDocument):
+ (WebCore::Element::updateIdForDocument):
+ * dom/LiveNodeList.cpp:
+ (WebCore::LiveNodeList::namedItem):
+ * dom/LiveNodeList.h:
+ (WebCore::CachedLiveNodeList<NodeListType>::collectionBegin):
+ (WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
+ (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
+ (WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
+ * dom/NameNodeList.h:
+ (WebCore::NameNodeList::elementMatches):
+ * dom/TagNodeList.h:
+ (WebCore::TagNodeList::elementMatches):
+ (WebCore::HTMLTagNodeList::elementMatches):
+ * html/HTMLCollection.cpp:
+ (WebCore::isMatchingElement):
+ * html/HTMLNameCollection.cpp:
+ (WebCore::WindowNameCollection::elementMatchesIfNameAttributeMatch):
+ (WebCore::WindowNameCollection::elementMatches):
+ (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
+ (WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
+ (WebCore::DocumentNameCollection::elementMatches):
+ * html/HTMLNameCollection.h:
+ * html/LabelsNodeList.cpp:
+ (WebCore::LabelsNodeList::elementMatches):
+ * html/LabelsNodeList.h:
+ * html/RadioNodeList.cpp:
+ (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
+ (WebCore::RadioNodeList::elementMatches):
+ * html/RadioNodeList.h:
+
</ins><span class="cx"> 2014-09-18 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> Remove unused methods from MediaPlayerClient
</span></span></pre></div>
<a id="trunkSourceWebCoredomClassNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ClassNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClassNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/ClassNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~ClassNodeList();
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return false; }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -60,17 +60,17 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline bool ClassNodeList::elementMatches(Element* element) const
</del><ins>+inline bool ClassNodeList::elementMatches(Element& element) const
</ins><span class="cx"> {
</span><del>- if (!element->hasClass())
</del><ins>+ if (!element.hasClass())
</ins><span class="cx"> return false;
</span><span class="cx"> if (!m_classNames.size())
</span><span class="cx"> return false;
</span><span class="cx"> // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=94718
</span><del>- if (!element->isStyledElement())
</del><ins>+ if (!element.isStyledElement())
</ins><span class="cx"> return false;
</span><del>- return element->classNames().containsAll(m_classNames);
</del><ins>+ return element.classNames().containsAll(m_classNames);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentOrderedMapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentOrderedMap.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/DocumentOrderedMap.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -74,12 +74,12 @@
</span><span class="cx">
</span><span class="cx"> inline bool keyMatchesWindowNamedItem(const AtomicStringImpl& key, const Element& element)
</span><span class="cx"> {
</span><del>- return WindowNameCollection::elementMatches(const_cast<Element*>(&element), &key);
</del><ins>+ return WindowNameCollection::elementMatches(element, &key);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool keyMatchesDocumentNamedItem(const AtomicStringImpl& key, const Element& element)
</span><span class="cx"> {
</span><del>- return DocumentNameCollection::elementMatches(const_cast<Element*>(&element), &key);
</del><ins>+ return DocumentNameCollection::elementMatches(element, &key);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DocumentOrderedMap::clear()
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/Element.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -2606,16 +2606,16 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(oldName != newName);
</span><span class="cx">
</span><del>- if (WindowNameCollection::elementMatchesIfNameAttributeMatch(this)) {
- const AtomicString& id = WindowNameCollection::elementMatchesIfIdAttributeMatch(this) ? getIdAttribute() : nullAtom;
</del><ins>+ if (WindowNameCollection::elementMatchesIfNameAttributeMatch(*this)) {
+ const AtomicString& id = WindowNameCollection::elementMatchesIfIdAttributeMatch(*this) ? getIdAttribute() : nullAtom;
</ins><span class="cx"> if (!oldName.isEmpty() && oldName != id)
</span><span class="cx"> document.removeWindowNamedItem(*oldName.impl(), *this);
</span><span class="cx"> if (!newName.isEmpty() && newName != id)
</span><span class="cx"> document.addWindowNamedItem(*newName.impl(), *this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (DocumentNameCollection::elementMatchesIfNameAttributeMatch(this)) {
- const AtomicString& id = DocumentNameCollection::elementMatchesIfIdAttributeMatch(this) ? getIdAttribute() : nullAtom;
</del><ins>+ if (DocumentNameCollection::elementMatchesIfNameAttributeMatch(*this)) {
+ const AtomicString& id = DocumentNameCollection::elementMatchesIfIdAttributeMatch(*this) ? getIdAttribute() : nullAtom;
</ins><span class="cx"> if (!oldName.isEmpty() && oldName != id)
</span><span class="cx"> document.removeDocumentNamedItem(*oldName.impl(), *this);
</span><span class="cx"> if (!newName.isEmpty() && newName != id)
</span><span class="lines">@@ -2656,16 +2656,16 @@
</span><span class="cx"> ASSERT(inDocument());
</span><span class="cx"> ASSERT(oldId != newId);
</span><span class="cx">
</span><del>- if (WindowNameCollection::elementMatchesIfIdAttributeMatch(this)) {
- const AtomicString& name = condition == UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute && WindowNameCollection::elementMatchesIfNameAttributeMatch(this) ? getNameAttribute() : nullAtom;
</del><ins>+ if (WindowNameCollection::elementMatchesIfIdAttributeMatch(*this)) {
+ const AtomicString& name = condition == UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute && WindowNameCollection::elementMatchesIfNameAttributeMatch(*this) ? getNameAttribute() : nullAtom;
</ins><span class="cx"> if (!oldId.isEmpty() && oldId != name)
</span><span class="cx"> document.removeWindowNamedItem(*oldId.impl(), *this);
</span><span class="cx"> if (!newId.isEmpty() && newId != name)
</span><span class="cx"> document.addWindowNamedItem(*newId.impl(), *this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (DocumentNameCollection::elementMatchesIfIdAttributeMatch(this)) {
- const AtomicString& name = condition == UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute && DocumentNameCollection::elementMatchesIfNameAttributeMatch(this) ? getNameAttribute() : nullAtom;
</del><ins>+ if (DocumentNameCollection::elementMatchesIfIdAttributeMatch(*this)) {
+ const AtomicString& name = condition == UpdateHTMLDocumentNamedItemMapsOnlyIfDiffersFromNameAttribute && DocumentNameCollection::elementMatchesIfNameAttributeMatch(*this) ? getNameAttribute() : nullAtom;
</ins><span class="cx"> if (!oldId.isEmpty() && oldId != name)
</span><span class="cx"> document.removeDocumentNamedItem(*oldId.impl(), *this);
</span><span class="cx"> if (!newId.isEmpty() && newId != name)
</span></span></pre></div>
<a id="trunkSourceWebCoredomLiveNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LiveNodeList.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LiveNodeList.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/LiveNodeList.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx"> if (rootNode.inDocument()) {
</span><span class="cx"> Element* element = rootNode.treeScope().getElementById(elementId);
</span><del>- if (element && elementMatches(element) && element->isDescendantOf(&rootNode))
</del><ins>+ if (element && elementMatches(*element) && element->isDescendantOf(&rootNode))
</ins><span class="cx"> return element;
</span><span class="cx"> if (!element)
</span><span class="cx"> return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoredomLiveNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/LiveNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LiveNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/LiveNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">
</span><span class="cx"> virtual Node* namedItem(const AtomicString&) const override final;
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const = 0;
</del><ins>+ virtual bool elementMatches(Element&) const = 0;
</ins><span class="cx"> virtual bool isRootedAtDocument() const = 0;
</span><span class="cx">
</span><span class="cx"> ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); }
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> auto descendants = elementDescendants(rootNode());
</span><span class="cx"> auto end = descendants.end();
</span><span class="cx"> for (auto it = descendants.begin(); it != end; ++it) {
</span><del>- if (nodeList.elementMatches(&*it))
</del><ins>+ if (nodeList.elementMatches(*it))
</ins><span class="cx"> return it;
</span><span class="cx"> }
</span><span class="cx"> return end;
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> auto descendants = elementDescendants(rootNode());
</span><span class="cx"> auto end = descendants.end();
</span><span class="cx"> for (auto it = descendants.last(); it != end; --it) {
</span><del>- if (nodeList.elementMatches(&*it))
</del><ins>+ if (nodeList.elementMatches(*it))
</ins><span class="cx"> return it;
</span><span class="cx"> }
</span><span class="cx"> return end;
</span><span class="lines">@@ -182,14 +182,14 @@
</span><span class="cx"> void CachedLiveNodeList<NodeListType>::collectionTraverseForward(ElementDescendantIterator& current, unsigned count, unsigned& traversedCount) const
</span><span class="cx"> {
</span><span class="cx"> auto& nodeList = static_cast<const NodeListType&>(*this);
</span><del>- ASSERT(nodeList.elementMatches(&*current));
</del><ins>+ ASSERT(nodeList.elementMatches(*current));
</ins><span class="cx"> auto end = collectionEnd();
</span><span class="cx"> for (traversedCount = 0; traversedCount < count; ++traversedCount) {
</span><span class="cx"> do {
</span><span class="cx"> ++current;
</span><span class="cx"> if (current == end)
</span><span class="cx"> return;
</span><del>- } while (!nodeList.elementMatches(&*current));
</del><ins>+ } while (!nodeList.elementMatches(*current));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -197,14 +197,14 @@
</span><span class="cx"> void CachedLiveNodeList<NodeListType>::collectionTraverseBackward(ElementDescendantIterator& current, unsigned count) const
</span><span class="cx"> {
</span><span class="cx"> auto& nodeList = static_cast<const NodeListType&>(*this);
</span><del>- ASSERT(nodeList.elementMatches(&*current));
</del><ins>+ ASSERT(nodeList.elementMatches(*current));
</ins><span class="cx"> auto end = collectionEnd();
</span><span class="cx"> for (; count; --count) {
</span><span class="cx"> do {
</span><span class="cx"> --current;
</span><span class="cx"> if (current == end)
</span><span class="cx"> return;
</span><del>- } while (!nodeList.elementMatches(&*current));
</del><ins>+ } while (!nodeList.elementMatches(*current));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomNameNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/NameNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/NameNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/NameNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~NameNodeList();
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return false; }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -49,9 +49,9 @@
</span><span class="cx"> AtomicString m_name;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-inline bool NameNodeList::elementMatches(Element* element) const
</del><ins>+inline bool NameNodeList::elementMatches(Element& element) const
</ins><span class="cx"> {
</span><del>- return element->getNameAttribute() == m_name;
</del><ins>+ return element.getNameAttribute() == m_name;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomTagNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TagNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TagNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/dom/TagNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~TagNodeList();
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return false; }
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="lines">@@ -56,13 +56,13 @@
</span><span class="cx"> AtomicString m_localName;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-inline bool TagNodeList::elementMatches(Element* element) const
</del><ins>+inline bool TagNodeList::elementMatches(Element& element) const
</ins><span class="cx"> {
</span><span class="cx"> // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagnamens
</span><del>- if (m_localName != starAtom && m_localName != element->localName())
</del><ins>+ if (m_localName != starAtom && m_localName != element.localName())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- return m_namespaceURI == starAtom || m_namespaceURI == element->namespaceURI();
</del><ins>+ return m_namespaceURI == starAtom || m_namespaceURI == element.namespaceURI();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class HTMLTagNodeList final : public CachedLiveNodeList<HTMLTagNodeList> {
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~HTMLTagNodeList();
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return false; }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -84,13 +84,13 @@
</span><span class="cx"> AtomicString m_loweredLocalName;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-inline bool HTMLTagNodeList::elementMatches(Element* element) const
</del><ins>+inline bool HTMLTagNodeList::elementMatches(Element& element) const
</ins><span class="cx"> {
</span><span class="cx"> // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagname
</span><span class="cx"> if (m_localName == starAtom)
</span><span class="cx"> return true;
</span><del>- const AtomicString& localName = element->isHTMLElement() ? m_loweredLocalName : m_localName;
- return localName == element->localName();
</del><ins>+ const AtomicString& localName = element.isHTMLElement() ? m_loweredLocalName : m_localName;
+ return localName == element.localName();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLCollection.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -213,9 +213,9 @@
</span><span class="cx"> case NodeChildren:
</span><span class="cx"> return true;
</span><span class="cx"> case DocumentNamedItems:
</span><del>- return static_cast<const DocumentNameCollection&>(htmlCollection).elementMatches(&element);
</del><ins>+ return static_cast<const DocumentNameCollection&>(htmlCollection).elementMatches(element);
</ins><span class="cx"> case WindowNamedItems:
</span><del>- return static_cast<const WindowNameCollection&>(htmlCollection).elementMatches(&element);
</del><ins>+ return static_cast<const WindowNameCollection&>(htmlCollection).elementMatches(element);
</ins><span class="cx"> case FormControls:
</span><span class="cx"> case TableRows:
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLNameCollectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLNameCollection.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLNameCollection.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/HTMLNameCollection.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -49,46 +49,46 @@
</span><span class="cx"> document().nodeLists()->removeCachedCollection(this, m_name);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WindowNameCollection::elementMatchesIfNameAttributeMatch(Element* element)
</del><ins>+bool WindowNameCollection::elementMatchesIfNameAttributeMatch(const Element& element)
</ins><span class="cx"> {
</span><del>- return isHTMLImageElement(element) || isHTMLFormElement(element) || element->hasTagName(appletTag)
- || element->hasTagName(embedTag) || element->hasTagName(objectTag);
</del><ins>+ return isHTMLImageElement(element) || isHTMLFormElement(element) || element.hasTagName(appletTag)
+ || element.hasTagName(embedTag) || element.hasTagName(objectTag);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool WindowNameCollection::elementMatches(Element* element, const AtomicStringImpl* name)
</del><ins>+bool WindowNameCollection::elementMatches(const Element& element, const AtomicStringImpl* name)
</ins><span class="cx"> {
</span><span class="cx"> // Find only images, forms, applets, embeds and objects by name, but anything by id
</span><del>- if (elementMatchesIfNameAttributeMatch(element) && element->getNameAttribute().impl() == name)
</del><ins>+ if (elementMatchesIfNameAttributeMatch(element) && element.getNameAttribute().impl() == name)
</ins><span class="cx"> return true;
</span><del>- return element->getIdAttribute().impl() == name;
</del><ins>+ return element.getIdAttribute().impl() == name;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool DocumentNameCollection::elementMatchesIfIdAttributeMatch(Element* element)
</del><ins>+bool DocumentNameCollection::elementMatchesIfIdAttributeMatch(const Element& element)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: we need to fix HTMLImageElement to update the hash map for us when name attribute has been removed.
</span><del>- return element->hasTagName(appletTag) || (element->hasTagName(objectTag) && toHTMLObjectElement(element)->isDocNamedItem())
- || (isHTMLImageElement(element) && element->hasName());
</del><ins>+ return element.hasTagName(appletTag) || (element.hasTagName(objectTag) && toHTMLObjectElement(element).isDocNamedItem())
+ || (isHTMLImageElement(element) && element.hasName());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool DocumentNameCollection::elementMatchesIfNameAttributeMatch(Element* element)
</del><ins>+bool DocumentNameCollection::elementMatchesIfNameAttributeMatch(const Element& element)
</ins><span class="cx"> {
</span><del>- return isHTMLFormElement(element) || element->hasTagName(embedTag) || element->hasTagName(iframeTag)
- || element->hasTagName(appletTag) || (element->hasTagName(objectTag) && toHTMLObjectElement(element)->isDocNamedItem())
</del><ins>+ return isHTMLFormElement(element) || element.hasTagName(embedTag) || element.hasTagName(iframeTag)
+ || element.hasTagName(appletTag) || (element.hasTagName(objectTag) && toHTMLObjectElement(element).isDocNamedItem())
</ins><span class="cx"> || isHTMLImageElement(element);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool DocumentNameCollection::elementMatches(Element* element, const AtomicStringImpl* name)
</del><ins>+bool DocumentNameCollection::elementMatches(const Element& element, const AtomicStringImpl* name)
</ins><span class="cx"> {
</span><span class="cx"> // Find images, forms, applets, embeds, objects and iframes by name, applets and object by id, and images by id
</span><span class="cx"> // but only if they have a name attribute (this very strange rule matches IE)
</span><del>- if (isHTMLFormElement(element) || element->hasTagName(embedTag) || element->hasTagName(iframeTag))
- return element->getNameAttribute().impl() == name;
- if (element->hasTagName(appletTag))
- return element->getNameAttribute().impl() == name || element->getIdAttribute().impl() == name;
- if (element->hasTagName(objectTag))
- return (element->getNameAttribute().impl() == name || element->getIdAttribute().impl() == name) && toHTMLObjectElement(element)->isDocNamedItem();
</del><ins>+ if (isHTMLFormElement(element) || element.hasTagName(embedTag) || element.hasTagName(iframeTag))
+ return element.getNameAttribute().impl() == name;
+ if (element.hasTagName(appletTag))
+ return element.getNameAttribute().impl() == name || element.getIdAttribute().impl() == name;
+ if (element.hasTagName(objectTag))
+ return (element.getNameAttribute().impl() == name || element.getIdAttribute().impl() == name) && toHTMLObjectElement(element).isDocNamedItem();
</ins><span class="cx"> if (isHTMLImageElement(element))
</span><del>- return element->getNameAttribute().impl() == name || (element->getIdAttribute().impl() == name && element->hasName());
</del><ins>+ return element.getNameAttribute().impl() == name || (element.getIdAttribute().impl() == name && element.hasName());
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLNameCollectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLNameCollection.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLNameCollection.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/HTMLNameCollection.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -50,11 +50,11 @@
</span><span class="cx"> return adoptRef(*new WindowNameCollection(document, type, name));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool elementMatches(Element* element) const { return elementMatches(element, m_name.impl()); }
</del><ins>+ bool elementMatches(const Element& element) const { return elementMatches(element, m_name.impl()); }
</ins><span class="cx">
</span><del>- static bool elementMatchesIfIdAttributeMatch(Element*) { return true; }
- static bool elementMatchesIfNameAttributeMatch(Element*);
- static bool elementMatches(Element*, const AtomicStringImpl*);
</del><ins>+ static bool elementMatchesIfIdAttributeMatch(const Element&) { return true; }
+ static bool elementMatchesIfNameAttributeMatch(const Element&);
+ static bool elementMatches(const Element&, const AtomicStringImpl*);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WindowNameCollection(Document& document, CollectionType type, const AtomicString& name)
</span><span class="lines">@@ -71,11 +71,11 @@
</span><span class="cx"> return adoptRef(*new DocumentNameCollection(document, type, name));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static bool elementMatchesIfIdAttributeMatch(Element*);
- static bool elementMatchesIfNameAttributeMatch(Element*);
- bool elementMatches(Element* element) const { return elementMatches(element, m_name.impl()); }
</del><ins>+ static bool elementMatchesIfIdAttributeMatch(const Element&);
+ static bool elementMatchesIfNameAttributeMatch(const Element&);
+ bool elementMatches(const Element& element) const { return elementMatches(element, m_name.impl()); }
</ins><span class="cx">
</span><del>- static bool elementMatches(Element*, const AtomicStringImpl*);
</del><ins>+ static bool elementMatches(const Element&, const AtomicStringImpl*);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DocumentNameCollection(Document& document, CollectionType type, const AtomicString& name)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLabelsNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LabelsNodeList.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LabelsNodeList.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/LabelsNodeList.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -43,9 +43,9 @@
</span><span class="cx"> ownerNode().nodeLists()->removeCacheWithAtomicName(this, starAtom);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool LabelsNodeList::elementMatches(Element* testNode) const
</del><ins>+bool LabelsNodeList::elementMatches(Element& testNode) const
</ins><span class="cx"> {
</span><del>- return isHTMLLabelElement(testNode) && toHTMLLabelElement(testNode)->control() == &ownerNode();
</del><ins>+ return isHTMLLabelElement(testNode) && toHTMLLabelElement(testNode).control() == &ownerNode();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLabelsNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LabelsNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LabelsNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/LabelsNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> }
</span><span class="cx"> ~LabelsNodeList();
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return true; }
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlRadioNodeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/RadioNodeList.cpp (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/RadioNodeList.cpp        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/RadioNodeList.cpp        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -83,28 +83,28 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const
</del><ins>+bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testElement) const
</ins><span class="cx"> {
</span><del>- ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlElement());
</del><ins>+ ASSERT(testElement.hasTagName(objectTag) || testElement.isFormControlElement());
</ins><span class="cx"> if (isHTMLFormElement(ownerNode())) {
</span><span class="cx"> HTMLFormElement* formElement = 0;
</span><del>- if (testElement->hasTagName(objectTag))
- formElement = toHTMLObjectElement(testElement)->form();
</del><ins>+ if (testElement.hasTagName(objectTag))
+ formElement = toHTMLObjectElement(testElement).form();
</ins><span class="cx"> else
</span><del>- formElement = toHTMLFormControlElement(testElement)->form();
</del><ins>+ formElement = toHTMLFormControlElement(testElement).form();
</ins><span class="cx"> if (!formElement || formElement != &ownerNode())
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return testElement->getIdAttribute() == m_name || testElement->getNameAttribute() == m_name;
</del><ins>+ return testElement.getIdAttribute() == m_name || testElement.getNameAttribute() == m_name;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool RadioNodeList::elementMatches(Element* testElement) const
</del><ins>+bool RadioNodeList::elementMatches(Element& testElement) const
</ins><span class="cx"> {
</span><del>- if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElement())
</del><ins>+ if (!testElement.hasTagName(objectTag) && !testElement.isFormControlElement())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (HTMLInputElement* inputElement = testElement->toInputElement()) {
</del><ins>+ if (HTMLInputElement* inputElement = testElement.toInputElement()) {
</ins><span class="cx"> if (inputElement->isImageButton())
</span><span class="cx"> return false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlRadioNodeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/RadioNodeList.h (173722 => 173723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/RadioNodeList.h        2014-09-18 16:26:27 UTC (rev 173722)
+++ trunk/Source/WebCore/html/RadioNodeList.h        2014-09-18 16:32:41 UTC (rev 173723)
</span><span class="lines">@@ -45,12 +45,12 @@
</span><span class="cx"> String value() const;
</span><span class="cx"> void setValue(const String&);
</span><span class="cx">
</span><del>- virtual bool elementMatches(Element*) const override;
</del><ins>+ virtual bool elementMatches(Element&) const override;
</ins><span class="cx"> virtual bool isRootedAtDocument() const override { return m_isRootedAtDocument; }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> RadioNodeList(ContainerNode&, const AtomicString& name);
</span><del>- bool checkElementMatchesRadioNodeListFilter(Element*) const;
</del><ins>+ bool checkElementMatchesRadioNodeListFilter(const Element&) const;
</ins><span class="cx">
</span><span class="cx"> AtomicString m_name;
</span><span class="cx"> bool m_isRootedAtDocument;
</span></span></pre>
</div>
</div>
</body>
</html>