Title: [149974] trunk/Source/WebCore
Revision
149974
Author
[email protected]
Date
2013-05-12 19:00:28 -0700 (Sun, 12 May 2013)

Log Message

Node: Use FINAL instead of the non-virtual shadowing hack.
<http://webkit.org/b/115995>

Reviewed by Anders Carlsson.

Decorate Element/Attr implementations of prefix/localName/namespaceURI getters with FINAL
so that call sites with a more specific pointer type than Node* can avoid the virtual dispatch.

* dom/Attr.h:
* dom/Element.h:
* dom/Node.cpp:
* dom/Node.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149973 => 149974)


--- trunk/Source/WebCore/ChangeLog	2013-05-13 01:31:50 UTC (rev 149973)
+++ trunk/Source/WebCore/ChangeLog	2013-05-13 02:00:28 UTC (rev 149974)
@@ -1,3 +1,18 @@
+2013-05-12  Andreas Kling  <[email protected]>
+
+        Node: Use FINAL instead of the non-virtual shadowing hack.
+        <http://webkit.org/b/115995>
+
+        Reviewed by Anders Carlsson.
+
+        Decorate Element/Attr implementations of prefix/localName/namespaceURI getters with FINAL
+        so that call sites with a more specific pointer type than Node* can avoid the virtual dispatch.
+
+        * dom/Attr.h:
+        * dom/Element.h:
+        * dom/Node.cpp:
+        * dom/Node.h:
+
 2013-05-11  Darin Adler  <[email protected]>
 
         [Mac] Give every Clipboard an underlying Pasteboard

Modified: trunk/Source/WebCore/dom/Attr.h (149973 => 149974)


--- trunk/Source/WebCore/dom/Attr.h	2013-05-13 01:31:50 UTC (rev 149973)
+++ trunk/Source/WebCore/dom/Attr.h	2013-05-13 02:00:28 UTC (rev 149974)
@@ -73,9 +73,9 @@
     virtual String nodeName() const OVERRIDE { return name(); }
     virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; }
 
-    const AtomicString& localName() const { return m_name.localName(); }
-    const AtomicString& namespaceURI() const { return m_name.namespaceURI(); }
-    const AtomicString& prefix() const { return m_name.prefix(); }
+    virtual const AtomicString& localName() const OVERRIDE { return m_name.localName(); }
+    virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.namespaceURI(); }
+    virtual const AtomicString& prefix() const OVERRIDE { return m_name.prefix(); }
 
     virtual void setPrefix(const AtomicString&, ExceptionCode&);
 
@@ -88,10 +88,6 @@
 
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-    virtual const AtomicString& virtualPrefix() const { return prefix(); }
-    virtual const AtomicString& virtualLocalName() const { return localName(); }
-    virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
-
     Attribute& elementAttribute();
 
     // Attr wraps either an element/name, or a name/value pair (when it's a standalone Node.)

Modified: trunk/Source/WebCore/dom/Element.h (149973 => 149974)


--- trunk/Source/WebCore/dom/Element.h	2013-05-13 01:31:50 UTC (rev 149973)
+++ trunk/Source/WebCore/dom/Element.h	2013-05-13 02:00:28 UTC (rev 149974)
@@ -356,9 +356,9 @@
     bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
     bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
 
-    const AtomicString& localName() const { return m_tagName.localName(); }
-    const AtomicString& prefix() const { return m_tagName.prefix(); }
-    const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
+    virtual const AtomicString& localName() const OVERRIDE FINAL { return m_tagName.localName(); }
+    virtual const AtomicString& prefix() const OVERRIDE FINAL { return m_tagName.prefix(); }
+    virtual const AtomicString& namespaceURI() const OVERRIDE FINAL { return m_tagName.namespaceURI(); }
 
     virtual KURL baseURI() const OVERRIDE FINAL;
 
@@ -699,9 +699,6 @@
 
     void cancelFocusAppearanceUpdate();
 
-    virtual const AtomicString& virtualPrefix() const OVERRIDE FINAL { return prefix(); }
-    virtual const AtomicString& virtualLocalName() const OVERRIDE FINAL { return localName(); }
-    virtual const AtomicString& virtualNamespaceURI() const OVERRIDE FINAL { return namespaceURI(); }
     virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return computedStyle(pseudoElementSpecifier); }
     
     // cloneNode is private so that non-virtual cloneElementWithChildren and cloneElementWithoutChildren

Modified: trunk/Source/WebCore/dom/Node.cpp (149973 => 149974)


--- trunk/Source/WebCore/dom/Node.cpp	2013-05-13 01:31:50 UTC (rev 149973)
+++ trunk/Source/WebCore/dom/Node.cpp	2013-05-13 02:00:28 UTC (rev 149974)
@@ -638,7 +638,7 @@
     }
 }
 
-const AtomicString& Node::virtualPrefix() const
+const AtomicString& Node::prefix() const
 {
     // For nodes other than elements and attributes, the prefix is always null
     return nullAtom;
@@ -652,12 +652,12 @@
     ec = NAMESPACE_ERR;
 }
 
-const AtomicString& Node::virtualLocalName() const
+const AtomicString& Node::localName() const
 {
     return nullAtom;
 }
 
-const AtomicString& Node::virtualNamespaceURI() const
+const AtomicString& Node::namespaceURI() const
 {
     return nullAtom;
 }

Modified: trunk/Source/WebCore/dom/Node.h (149973 => 149974)


--- trunk/Source/WebCore/dom/Node.h	2013-05-13 01:31:50 UTC (rev 149973)
+++ trunk/Source/WebCore/dom/Node.h	2013-05-13 02:00:28 UTC (rev 149974)
@@ -213,9 +213,9 @@
     void remove(ExceptionCode&);
     bool hasChildNodes() const { return firstChild(); }
     virtual PassRefPtr<Node> cloneNode(bool deep) = 0;
-    const AtomicString& localName() const { return virtualLocalName(); }
-    const AtomicString& namespaceURI() const { return virtualNamespaceURI(); }
-    const AtomicString& prefix() const { return virtualPrefix(); }
+    virtual const AtomicString& localName() const;
+    virtual const AtomicString& namespaceURI() const;
+    virtual const AtomicString& prefix() const;
     virtual void setPrefix(const AtomicString&, ExceptionCode&);
     void normalize();
 
@@ -803,10 +803,6 @@
     virtual void derefEventTarget();
 
     virtual RenderStyle* nonRendererStyle() const { return 0; }
-
-    virtual const AtomicString& virtualPrefix() const;
-    virtual const AtomicString& virtualLocalName() const;
-    virtual const AtomicString& virtualNamespaceURI() const;
     virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO);
 
     Element* ancestorElement() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to