Bug 115995 - Node: Use FINAL instead of the non-virtual shadowing hack.
Summary: Node: Use FINAL instead of the non-virtual shadowing hack.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-12 16:28 PDT by Andreas Kling
Modified: 2013-05-13 06:22 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.76 KB, patch)
2013-05-12 16:37 PDT, Andreas Kling
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2013-05-12 16:28:40 PDT
WebCore::Node currently has:

const AtomicString& localName() const { return virtualLocalName(); }
const AtomicString& namespaceURI() const { return virtualNamespaceURI(); }
const AtomicString& prefix() const { return virtualPrefix(); }

These are then shadowed on Element to avoid virtual dispatch when calling through on subclass pointers.
While this is pretty neat, we should just use FINAL instead. Yup.
Comment 1 Andreas Kling 2013-05-12 16:29:43 PDT
Oh, also this:

RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return virtualComputedStyle(pseudoElementSpecifier); }
Comment 2 Andreas Kling 2013-05-12 16:37:38 PDT
Created attachment 201511 [details]
Patch

Actually, never mind computedStyle(), we want that to be fast for non-SVG elements and we can't make it FINAL on Element since SVGElement overrides it.
This patch changes prefix/namespaceURI/localName to use FINAL.
Comment 3 Andreas Kling 2013-05-12 18:59:55 PDT
Committed r149974: <http://trac.webkit.org/changeset/149974>
Comment 4 Darin Adler 2013-05-12 21:40:53 PDT
The non-virtual shadowing *design pattern*. Hack, my foot ;-)
Comment 5 Andreas Kling 2013-05-13 06:22:59 PDT
(In reply to comment #4)
> The non-virtual shadowing *design pattern*. Hack, my foot ;-)

<http://i.imgur.com/sXXky9V.jpg>