[webkit-dev] Do we have a style preference about const member functions?
Ryosuke Niwa
rniwa at webkit.org
Thu Jun 2 01:32:01 PDT 2011
On Thu, Jun 2, 2011 at 12:38 AM, Maciej Stachowiak <mjs at apple.com> wrote:
>
> Looks to me like these fulfill the requirement of "do we ever use const
> pointers to these objects". So the next step is to fix up const member
> functions that inappropriately return non-const pointers to objects in the
> same tree (or that can otherwise get a back pointer). Make the functions
> non-const, then add const variants returning a const pointer if needed.
>
> I'm curious if there are any clients for const pointers to DOM nodes.
>
All functions passed to enclosingNodeOfType in htmlediting.cpp are such
clients:
Node* enclosingNodeOfType(const Position& p, bool (*nodeIsOfType)(const Node
*), EditingBoundaryCrossingRule rule)
It takes a boolean function that takes const pointer to a DOM node. It is *
critical *that nodeIsOfType does not modify DOM because we use a raw pointer
to keep track of the current node when walking up the tree.
- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110602/fdfa9c1d/attachment.html>
More information about the webkit-dev
mailing list