RESOLVED FIXED 53575
[chromium] Avoid #ifdefs in code that constructs a GraphicsContext by adding a helper class.
https://bugs.webkit.org/show_bug.cgi?id=53575
Summary [chromium] Avoid #ifdefs in code that constructs a GraphicsContext by adding ...
Darin Fisher (:fishd, Google)
Reported 2011-02-01 22:06:21 PST
[chromium] Avoid #ifdefs in code that constructs a GraphicsContext by adding a helper class.
Attachments
v1 patch (10.31 KB, patch)
2011-02-01 22:10 PST, Darin Fisher (:fishd, Google)
kbr: review+
Darin Fisher (:fishd, Google)
Comment 1 2011-02-01 22:10:12 PST
Created attachment 80890 [details] v1 patch A couple notes about this patch: 1- This introduces the src/painting directory. I plan to add some more files to that directory shortly. I feel like src/ has reached the point where it badly needs subdirectories! (This is just a start.) 2- GraphicsContextBuilder allocates a LocalCurrentGraphicsContext object on the Mac, even though this is not always needed. I'm not too concerned about this. I think the simplification to the code is worth it.
Kenneth Russell
Comment 2 2011-02-02 10:05:49 PST
Comment on attachment 80890 [details] v1 patch View in context: https://bugs.webkit.org/attachment.cgi?id=80890&action=review Looks like a good cleanup. One question that comes up in a few places. > Source/WebKit/chromium/src/WebFontImpl.cpp:98 > + GraphicsContextBuilder builder(canvas); The new code implicitly instantiates a LocalCurrentGraphicsContext here; is there any issue with doing this? > Source/WebKit/chromium/src/WebPopupMenuImpl.cpp:168 > + m_widget->paint(&GraphicsContextBuilder(canvas).context(), rect); Same question here. > Source/WebKit/chromium/src/WebScrollbarImpl.cpp:122 > + m_scrollbar->paint(&GraphicsContextBuilder(canvas).context(), rect); And here.
Darin Fisher (:fishd, Google)
Comment 3 2011-02-02 10:12:45 PST
> > Source/WebKit/chromium/src/WebFontImpl.cpp:98 > > + GraphicsContextBuilder builder(canvas); > > The new code implicitly instantiates a LocalCurrentGraphicsContext here; is there any issue with doing this? See point 2 in comment #1 :-)
Kenneth Russell
Comment 4 2011-02-02 10:17:05 PST
(In reply to comment #3) > > > Source/WebKit/chromium/src/WebFontImpl.cpp:98 > > > + GraphicsContextBuilder builder(canvas); > > > > The new code implicitly instantiates a LocalCurrentGraphicsContext here; is there any issue with doing this? > > See point 2 in comment #1 :-) Oops, sorry, I didn't see that comment at all before looking at the patch.
Kenneth Russell
Comment 5 2011-02-02 10:19:52 PST
Comment on attachment 80890 [details] v1 patch I think painting/GraphicsContextBuilder.h should be added to webkit/sources in Source/WebKit/chromium/WebKit.gyp; looks good otherwise. Leaving cq? so you can decide whether to make this change upon landing.
Darin Fisher (:fishd, Google)
Comment 6 2011-02-02 10:26:21 PST
(In reply to comment #5) > (From update of attachment 80890 [details]) > I think painting/GraphicsContextBuilder.h should be added to webkit/sources in Source/WebKit/chromium/WebKit.gyp; looks good otherwise. Leaving cq? so you can decide whether to make this change upon landing. Oops, yes.. I have that in my tree. I just created the patch from the wrong level :-(
Kenneth Russell
Comment 7 2011-02-02 10:29:45 PST
(In reply to comment #6) > (In reply to comment #5) > > (From update of attachment 80890 [details] [details]) > > I think painting/GraphicsContextBuilder.h should be added to webkit/sources in Source/WebKit/chromium/WebKit.gyp; looks good otherwise. Leaving cq? so you can decide whether to make this change upon landing. > > Oops, yes.. I have that in my tree. I just created the patch from the wrong level :-( No, as you pointed out to me I completely missed the fact that the gyp change was already in your patch. Sorry about that. Looks good to me.
Darin Fisher (:fishd, Google)
Comment 8 2011-02-02 10:41:04 PST
James Robinson
Comment 9 2011-02-02 12:05:24 PST
Comment on attachment 80890 [details] v1 patch View in context: https://bugs.webkit.org/attachment.cgi?id=80890&action=review > Source/WebKit/chromium/src/WebFontImpl.cpp:37 > +#include "painting/GraphicsContextBuilder.h" Is this pattern intentional (including by paths rather than adding new crap to the include path)? I prefer this way myself but it's unusual for WebKit
Darin Fisher (:fishd, Google)
Comment 10 2011-02-02 12:34:09 PST
(In reply to comment #9) > (From update of attachment 80890 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=80890&action=review > > > Source/WebKit/chromium/src/WebFontImpl.cpp:37 > > +#include "painting/GraphicsContextBuilder.h" > > Is this pattern intentional (including by paths rather than adding new crap to the include path)? I prefer this way myself but it's unusual for WebKit Yeah, it is intentional. I was concerned that if a header file does not appear directly in src/ that someone might waste time looking for the header in WebCore/. The painting/ prefix gives you a clue that it is actually local to WebKit/chromium/src/. Also, there is also some convention for this. We include {win,mac,linux}/WebThemeEngine.h in some places.
Note You need to log in before you can comment on or make changes to this bug.