RESOLVED FIXED Bug 49578
ScriptElementData should be a private member of ScriptElement
https://bugs.webkit.org/show_bug.cgi?id=49578
Summary ScriptElementData should be a private member of ScriptElement
Ryosuke Niwa
Reported 2010-11-15 22:14:04 PST
ScriptElementData is a protected membre variable of ScriptElement but it should be a private member variable since HTMLScriptElement and SVGScriptElement only use a small subset of ScriptElementData's methods.
Attachments
cleanup (10.08 KB, patch)
2010-11-15 22:29 PST, Ryosuke Niwa
no flags
fixed haveFiredLoadEvent (10.09 KB, patch)
2010-11-16 09:45 PST, Ryosuke Niwa
darin: review+
Ryosuke Niwa
Comment 1 2010-11-15 22:29:31 PST
Created attachment 73963 [details] cleanup
Build Bot
Comment 2 2010-11-16 05:31:42 PST
Ryosuke Niwa
Comment 3 2010-11-16 09:45:17 PST
Created attachment 74005 [details] fixed haveFiredLoadEvent
Darin Adler
Comment 4 2010-11-16 10:29:00 PST
Comment on attachment 74005 [details] fixed haveFiredLoadEvent View in context: https://bugs.webkit.org/attachment.cgi?id=74005&action=review > WebCore/dom/ScriptElement.h:95 > protected: > + bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); } Why are any members of ScriptElementData protected? Is there a class that derives from ScriptElementData? If not, then protected and private mean the same thing, and these should be private rather than protected. > WebCore/html/HTMLScriptElement.h:41 > - bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); } > + bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); } You can accomplish the same thing here by just removing this function altogether.
Ryosuke Niwa
Comment 5 2010-11-16 10:48:35 PST
Comment on attachment 74005 [details] fixed haveFiredLoadEvent View in context: https://bugs.webkit.org/attachment.cgi?id=74005&action=review >> WebCore/dom/ScriptElement.h:95 >> + bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); } > > Why are any members of ScriptElementData protected? Is there a class that derives from ScriptElementData? If not, then protected and private mean the same thing, and these should be private rather than protected. On this isn't a part of ScriptElementData. It's a part of ScriptElement, which is inherited by HTMLScriptElement and SVGScriptElement. >> WebCore/html/HTMLScriptElement.h:41 >> + bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); } > > You can accomplish the same thing here by just removing this function altogether. SVGScriptElement doesn't define this function so making haveFiredLoadEvent() public in ScriptElement means we're adding haveFiredLoadEvent to SVGScriptElement as well. If that's desirable, I'll do.
Ryosuke Niwa
Comment 6 2010-11-16 21:56:56 PST
Darin Adler
Comment 7 2010-11-17 12:22:48 PST
(In reply to comment #5) > >> WebCore/html/HTMLScriptElement.h:41 > >> + bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); } > > > > You can accomplish the same thing here by just removing this function altogether. > > SVGScriptElement doesn't define this function so making haveFiredLoadEvent() public in ScriptElement means we're adding haveFiredLoadEvent to SVGScriptElement as well. If that's desirable, I'll do. It’s fine to add it to SVGScriptElement. If we did not want it public in SVGScriptElement, there are two solutions: 1) Make this protected in ScriptElement, and put "using ScriptElement::haveFiredLoadingEvent" in the public section of HTMLScriptElement. 2) Make this public in ScriptElement, and put "using ScriptElement::haveFiredLoadingEvent" in the private section of SVGScriptElement.
Note You need to log in before you can comment on or make changes to this bug.