Title: [157416] trunk/Source/WebCore
- Revision
- 157416
- Author
- [email protected]
- Date
- 2013-10-14 13:11:51 -0700 (Mon, 14 Oct 2013)
Log Message
CTTE: NamedNodeMap always has a corresponding Element.
<https://webkit.org/b/122769>
Reviewed by Anders Carlsson.
Made NamedNodeMap::m_element a reference and remove an assertion
that it's never null.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (157415 => 157416)
--- trunk/Source/WebCore/ChangeLog 2013-10-14 19:53:01 UTC (rev 157415)
+++ trunk/Source/WebCore/ChangeLog 2013-10-14 20:11:51 UTC (rev 157416)
@@ -1,5 +1,15 @@
2013-10-14 Andreas Kling <[email protected]>
+ CTTE: NamedNodeMap always has a corresponding Element.
+ <https://webkit.org/b/122769>
+
+ Reviewed by Anders Carlsson.
+
+ Made NamedNodeMap::m_element a reference and remove an assertion
+ that it's never null.
+
+2013-10-14 Andreas Kling <[email protected]>
+
REGRESSION(r157408): Crashes in RenderFullScreen::wrapRenderer().
Unreviewed crash fix for these two tests:
Modified: trunk/Source/WebCore/dom/Element.cpp (157415 => 157416)
--- trunk/Source/WebCore/dom/Element.cpp 2013-10-14 19:53:01 UTC (rev 157415)
+++ trunk/Source/WebCore/dom/Element.cpp 2013-10-14 20:11:51 UTC (rev 157416)
@@ -384,7 +384,7 @@
if (NamedNodeMap* attributeMap = rareData.attributeMap())
return attributeMap;
- rareData.setAttributeMap(NamedNodeMap::create(const_cast<Element*>(this)));
+ rareData.setAttributeMap(NamedNodeMap::create(const_cast<Element&>(*this)));
return rareData.attributeMap();
}
Modified: trunk/Source/WebCore/dom/NamedNodeMap.cpp (157415 => 157416)
--- trunk/Source/WebCore/dom/NamedNodeMap.cpp 2013-10-14 19:53:01 UTC (rev 157415)
+++ trunk/Source/WebCore/dom/NamedNodeMap.cpp 2013-10-14 20:11:51 UTC (rev 157416)
@@ -42,42 +42,42 @@
void NamedNodeMap::ref()
{
- m_element->ref();
+ m_element.ref();
}
void NamedNodeMap::deref()
{
- m_element->deref();
+ m_element.deref();
}
PassRefPtr<Node> NamedNodeMap::getNamedItem(const AtomicString& name) const
{
- return m_element->getAttributeNode(name);
+ return m_element.getAttributeNode(name);
}
PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const
{
- return m_element->getAttributeNodeNS(namespaceURI, localName);
+ return m_element.getAttributeNodeNS(namespaceURI, localName);
}
PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionCode& ec)
{
- unsigned index = m_element->hasAttributes() ? m_element->findAttributeIndexByName(name, shouldIgnoreAttributeCase(*m_element)) : ElementData::attributeNotFound;
+ unsigned index = m_element.hasAttributes() ? m_element.findAttributeIndexByName(name, shouldIgnoreAttributeCase(m_element)) : ElementData::attributeNotFound;
if (index == ElementData::attributeNotFound) {
ec = NOT_FOUND_ERR;
return 0;
}
- return m_element->detachAttribute(index);
+ return m_element.detachAttribute(index);
}
PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode& ec)
{
- unsigned index = m_element->hasAttributes() ? m_element->findAttributeIndexByName(QualifiedName(nullAtom, localName, namespaceURI)) : ElementData::attributeNotFound;
+ unsigned index = m_element.hasAttributes() ? m_element.findAttributeIndexByName(QualifiedName(nullAtom, localName, namespaceURI)) : ElementData::attributeNotFound;
if (index == ElementData::attributeNotFound) {
ec = NOT_FOUND_ERR;
return 0;
}
- return m_element->detachAttribute(index);
+ return m_element.detachAttribute(index);
}
PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionCode& ec)
@@ -93,7 +93,7 @@
return 0;
}
- return m_element->setAttributeNode(toAttr(node), ec);
+ return m_element.setAttributeNode(toAttr(node), ec);
}
PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionCode& ec)
@@ -105,14 +105,14 @@
{
if (index >= length())
return 0;
- return m_element->ensureAttr(m_element->attributeAt(index).name());
+ return m_element.ensureAttr(m_element.attributeAt(index).name());
}
unsigned NamedNodeMap::length() const
{
- if (!m_element->hasAttributes())
+ if (!m_element.hasAttributes())
return 0;
- return m_element->attributeCount();
+ return m_element.attributeCount();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/NamedNodeMap.h (157415 => 157416)
--- trunk/Source/WebCore/dom/NamedNodeMap.h 2013-10-14 19:53:01 UTC (rev 157415)
+++ trunk/Source/WebCore/dom/NamedNodeMap.h 2013-10-14 20:11:51 UTC (rev 157416)
@@ -41,7 +41,7 @@
WTF_MAKE_FAST_ALLOCATED;
friend class Element;
public:
- static PassOwnPtr<NamedNodeMap> create(Element* element)
+ static PassOwnPtr<NamedNodeMap> create(Element& element)
{
return adoptPtr(new NamedNodeMap(element));
}
@@ -63,17 +63,17 @@
PassRefPtr<Node> item(unsigned index) const;
unsigned length() const;
- Element* element() const { return m_element; }
+ // FIXME: It's lame that the bindings generator chokes if we return Element& here.
+ Element* element() const { return &m_element; }
private:
- explicit NamedNodeMap(Element* element)
+ explicit NamedNodeMap(Element& element)
: m_element(element)
{
// Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.
- ASSERT(m_element);
}
- Element* m_element;
+ Element& m_element;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes