RESOLVED WONTFIX 42098
The WebCore::Document::head() method should be const.
https://bugs.webkit.org/show_bug.cgi?id=42098
Summary The WebCore::Document::head() method should be const.
Jay Civelli
Reported 2010-07-12 11:50:53 PDT
The WebCore::Document::head() method is not const, it should.
Attachments
Initial patch (1.50 KB, patch)
2010-07-12 11:52 PDT, Jay Civelli
no flags
Jay Civelli
Comment 1 2010-07-12 11:52:29 PDT
Created attachment 61251 [details] Initial patch
Darin Adler
Comment 2 2010-07-12 12:38:23 PDT
Comment on attachment 61251 [details] Initial patch Why should this be const? You have a const pointer to a document and you get a non-const pointer to one of the elements of that document? I think we should not use const so much on classes like Document* that are part of a tree. It doesn't make sense to have a const pointer to something but then call firstChild()->parent() and get back a non-const pointer to the same thing. I suggest going the opposite direction and phasing out use of const Document*.
Jay Civelli
Comment 3 2010-07-12 13:36:56 PDT
I came up across this using the Chromium WebKit API (trying to pass a WebDocument as a const& and then call head() on it which ends up calling Document::head()) and thought the const had somehow been forgotten since body() was const. You are right, it does not make sense if the constness can be circumvented. Closing the bug.
Note You need to log in before you can comment on or make changes to this bug.