[webkit-dev] Namespace changes

Maciej Stachowiak mjs at apple.com
Tue Jan 10 15:13:33 PST 2006


As part of reorganizing WebCore, we'd like to change some of our  
namespacing conventions. Currently we use a mix of naming schemes:

remnants of the KDE C++ DOM API are in namespace DOM::
implementation files for the DOM are in namespace DOM::
many layout engine internal files (such as the render tree) are in  
namespace khtml::
some classes are in no namespace, but with a KHTML prefix
some classes are in no namespace but with a KWQ prefix
some classes are in no namespace and use the Q or K prefixes from KDE
some classes are in no namespace but with a WebCore prefix
the JS DOM bindings code is in namespace KJS:: (despite not being  
part of KJS itself)
SVG code uses various other namespaces and prefixes (KSVG, KCanvas, etc)

As an alternative to this scheme, we came up with the following:

- Use WebCore:: as the single namespace in WebCore. This will let us  
avoid namespace gunk in the core code.
- Drop KWQ and KHTML prefixes from classes that have them, use plain  
names
- For K and Q classes, we could leave the K or Q if they are still  
much like the original, otherwise rename to plain name in WebCore::
- Platform API code could use a different namespace (for example C++  
DOM API could be in namespace DOM, autogenerated JS bindings might be  
in its own namespace to avoid conflicts eventually, ObjC classes for  
OS X could use WebCore prefix instead)

Basically the short version of this is, use namespace WebCore for  
everuthing internal.

We also considered other possibilities for the namespace to use for  
everything:

- khtml
- KHTML
- WebKit
- KXML

So far, WebCore:: has been the opinion leader.

Any thoughts in this?

Regards,
Maciej




More information about the webkit-dev mailing list