RESOLVED FIXED 71644
Change ColorChooser from singleton to ordinary object
https://bugs.webkit.org/show_bug.cgi?id=71644
Summary Change ColorChooser from singleton to ordinary object
Keishi Hattori
Reported 2011-11-06 16:36:12 PST
Changing WebCore::ColorChooser from a singleton to an ordinary object can broaden how browsers implement the color chooser interface.
Attachments
Patch (19.88 KB, patch)
2011-11-06 17:58 PST, Keishi Hattori
no flags
Patch (18.96 KB, patch)
2011-11-06 23:10 PST, Keishi Hattori
no flags
Patch (19.41 KB, patch)
2011-11-07 00:18 PST, Keishi Hattori
no flags
Patch (19.41 KB, patch)
2011-11-07 03:00 PST, Keishi Hattori
no flags
Keishi Hattori
Comment 1 2011-11-06 17:58:27 PST
Kent Tamura
Comment 2 2011-11-06 22:13:23 PST
Comment on attachment 113817 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113817&action=review > Source/WebCore/page/Chrome.h:161 > + void openColorChooser(PassRefPtr<ColorChooser>, const Color&); > + void cleanupColorChooser(PassRefPtr<ColorChooser>); > + void setSelectedColorInColorChooser(PassRefPtr<ColorChooser>, const Color&); Passing PassRefPtr<> as a function argument is wrong in many cases. If an implementation of these function want to have an ownership of this ColorChooser, these function should have a ColorChooser* argument, and the implementation should assign the raw pointer to RefPtr<ColorChooser>. RefPtr<ColorChooser> m_colorChooser; ChromeClientFoo::openColorChooser(ColorChooser* chooser, const Color&) { m_colorChooser = chooser; ... } > Source/WebCore/platform/ColorChooser.cpp:56 > + m_chooser->disconnectClient(); > + m_chooser.clear(); Wrong indentation. > Source/WebCore/platform/ColorChooser.h:48 > + PassRefPtr<ColorChooser> chooser() { return m_chooser; } Returning PassRefPtr<> from non-factory method is wrong in many cases. ColorChooser* is enough in this case. You have code like the following in this patch: if (chrome && chooser()) chrome->setSelectedColorInColorChooser(chooser(), valueAsColor()); This calls ref() twice and deref() twice, and they are unnecessary at all.
Keishi Hattori
Comment 3 2011-11-06 23:10:34 PST
Keishi Hattori
Comment 4 2011-11-06 23:12:31 PST
(In reply to comment #2) > Passing PassRefPtr<> as a function argument is wrong in many cases. > If an implementation of these function want to have an ownership of this ColorChooser, these function should have a ColorChooser* argument, and the implementation should assign the raw pointer to RefPtr<ColorChooser>. I removed PassRefPtr everywhere except ColorChooser::create > Wrong indentation. Done.
Kent Tamura
Comment 5 2011-11-06 23:34:24 PST
Comment on attachment 113825 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113825&action=review > Source/WebCore/ChangeLog:30 > + * platform/ColorChooser.cpp: Styled after FileChooser What does this mean? > Source/WebCore/html/ColorInputType.h:61 > virtual void didChooseColor(const Color&); > - virtual bool isColorInputType() const; > + virtual void didCleanup(); nit: We had better add OVERRIDE. > LayoutTests/fast/forms/color/input-color-onchange-event.html:29 > +eventSender.mouseMoveTo(10, 10); > +eventSender.mouseDown(); > +eventSender.mouseUp(); We had better show a manual testing instruction if there is no eventSender.
Keishi Hattori
Comment 6 2011-11-07 00:17:33 PST
(In reply to comment #5) > (From update of attachment 113825 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=113825&action=review > > > Source/WebCore/ChangeLog:30 > > + * platform/ColorChooser.cpp: Styled after FileChooser > > What does this mean? I was trying to say that I named the methods similar to FileChooser. It was unnecessary, I removed this. > > Source/WebCore/html/ColorInputType.h:61 > > virtual void didChooseColor(const Color&); > > - virtual bool isColorInputType() const; > > + virtual void didCleanup(); > > nit: We had better add OVERRIDE. Done. > > LayoutTests/fast/forms/color/input-color-onchange-event.html:29 > > +eventSender.mouseMoveTo(10, 10); > > +eventSender.mouseDown(); > > +eventSender.mouseUp(); > > We had better show a manual testing instruction if there is no eventSender. Done.
Keishi Hattori
Comment 7 2011-11-07 00:18:20 PST
WebKit Review Bot
Comment 8 2011-11-07 02:54:50 PST
Comment on attachment 113831 [details] Patch Rejecting attachment 113831 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1 NOBODY (OOPS!) found in /mnt/git/webkit-commit-queue/LayoutTests/ChangeLog does not appear to be a valid reviewer according to committers.py. ERROR: /mnt/git/webkit-commit-queue/LayoutTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive). Full output: http://queues.webkit.org/results/10338614
Keishi Hattori
Comment 9 2011-11-07 03:00:01 PST
WebKit Review Bot
Comment 10 2011-11-07 03:39:50 PST
Comment on attachment 113839 [details] Patch Clearing flags on attachment: 113839 Committed r99403: <http://trac.webkit.org/changeset/99403>
WebKit Review Bot
Comment 11 2011-11-07 03:39:55 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.