Re: [webkit-dev] [chromium] using WEBKIT_API properly

2010-12-03 Thread Jeremy Orlow
You forgot to mention virtual functions, which is another case where you do _not_ use WEBKIT_API. J On Thu, Dec 2, 2010 at 9:27 PM, Darin Fisher da...@chromium.org wrote: If you do not work on the Chromium port of WebKit, you can stop reading now. I've noticed that there is some confusion

Re: [webkit-dev] [chromium] using WEBKIT_API properly

2010-12-03 Thread Darin Fisher
Yes, indeed. Thanks Jeremy! On Fri, Dec 3, 2010 at 3:13 AM, Jeremy Orlow jor...@chromium.org wrote: You forgot to mention virtual functions, which is another case where you do _not_ use WEBKIT_API. J On Thu, Dec 2, 2010 at 9:27 PM, Darin Fisher da...@chromium.org wrote: If you do not

Re: [webkit-dev] Webkit-Javascript-Objc problem

2010-12-03 Thread Darin Adler
This is the wrong mailing list for this question. This is a question for discussion of the development of WebKit, not discussion of programming with WebKit. This page http://webkit.org/contact.html lists some options and places you might ask this question. If you suspect this is a bug and want

[webkit-dev] how to write layout test to test mouse wheeling on document

2010-12-03 Thread Xiaomei Ji
Webkit now supports horizontal scrolling for pages with left overflow. But it has a bug in cross-platform that the backward mouse wheel does not work (you can not scroll backward below (0,0)). https://bugs.webkit.org/show_bug.cgi?id=50370 I tested the fix posted in the above bug, and I can

[webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Eric Seidel
It seems to me, that using bool types for function arguments is strictly worse than using an enum. An enum is always clearer and can be easily casted to a bool if needed. doSomething(something, false); Is much less readable than: doSomething(something, AllowNetworkLoads); Do any C++ gurus

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Darin Fisher
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote: It seems to me, that using bool types for function arguments is strictly worse than using an enum. An enum is always clearer and can be easily casted to a bool if needed. doSomething(something, false); Is much less

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Peter Kasting
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote: It seems to me, that using bool types for function arguments is strictly worse than using an enum. An enum is always clearer and can be easily casted to a bool if needed. doSomething(something, false); Is much less

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread David Hyatt
On Dec 3, 2010, at 3:33 PM, Darin Fisher wrote: On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote: It seems to me, that using bool types for function arguments is strictly worse than using an enum. An enum is always clearer and can be easily casted to a bool if needed.

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Eric Seidel
Dave, I'm not sure I understand your exception. Could you give an example? On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote: On Dec 3, 2010, at 3:33 PM, Darin Fisher wrote: On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote: It seems to me, that using bool

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Eric Seidel
That would be so unbelievably fantastic! On Fri, Dec 3, 2010 at 1:35 PM, David Levin le...@google.com wrote: On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote: It seems to me, that using bool types for function arguments is strictly worse than using an enum. An enum is

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Ryosuke Niwa
On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote: The only exception I would make to this rule is if all the call sites use variables and never pass in raw true or false. In that case there's no loss of readability, and whether you use an enum vs. a bool is irrelevant. I

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Eric Seidel
I'm not sure we have any examples of bool passing like that in real code. The case I'm concerned about is not one of single argument bools: doSoemthing(bool) but more of multi-argument functions: doSomething(something, bool) I'm trying to write a rule which can be easily automated by

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Nico Weber
On Fri, Dec 3, 2010 at 1:45 PM, Ryosuke Niwa rn...@webkit.org wrote: On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote: The only exception I would make to this rule is if all the call sites use variables and never pass in raw true or false.  In that case there's no loss of

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Antonio Gomes
I do not think that XXX:repaint(true /* immediate */) is so bad either, if I understood Hyatt's comment correctly, and I agree with him on it. Having a enum is ideal, but no need for it to be mandatory, as other also pointed out. On Fri, Dec 3, 2010 at 4:54 PM, Eric Seidel e...@webkit.org wrote:

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Eric Seidel
I think /* explanation of what I'm doing */ is strictly worse than readableCode(UnderstandableParameter). I'd rather have readable code than comments attempting to excuse unreadable code. -eric On Fri, Dec 3, 2010 at 1:57 PM, Antonio Gomes toniki...@gmail.com wrote: I do not think that

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Antonio Gomes
Again, I think enum is better. I am just saying that method(true /* xxx */) is not as bad as method(true, true, true, false); On Fri, Dec 3, 2010 at 5:01 PM, Eric Seidel e...@webkit.org wrote: I think /* explanation of what I'm doing */ is strictly worse than

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Alexey Proskuryakov
03.12.2010, в 13:54, Eric Seidel написал(а): I'm not sure we have any examples of bool passing like that in real code. We do, although I can't provide one now. I just remember this being discussed in bug review. I think that Dave's rule is best here, even if it meant that we couldn't check

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Ryosuke Niwa
On Fri, Dec 3, 2010 at 1:55 PM, Nico Weber tha...@chromium.org wrote: Out of curiosity, what do people think of doSomethingElse(/*paramName=*/true); when calling an existing function that takes a bool? Why don't we just change it to take enum instead? Adding a comment to repeat the

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Ryosuke Niwa
On Fri, Dec 3, 2010 at 2:08 PM, Alexey Proskuryakov a...@webkit.org wrote: I think that Dave's rule is best here I second that. - Ryosuke ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Darin Adler
On Dec 3, 2010, at 1:37 PM, David Hyatt wrote: The only exception I would make to this rule is if all the call sites use variables and never pass in raw true or false. In that case there's no loss of readability, and whether you use an enum vs. a bool is irrelevant. That’s right. There are

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread David Hyatt
An example of nice boolean usage is: paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth 0, isHorizontal()); GOOD! The last parameter is a boolean indicating whether or not the text run is vertical text or horizontal text. It would

[webkit-dev] Fwd: Bools are strictly worse than enums

2010-12-03 Thread Ryosuke Niwa
On Fri, Dec 3, 2010 at 2:30 PM, Darin Adler da...@apple.com wrote: I think in general the rule should be Keep your call sites readable, and convert to enums if you find that the call sites are becoming inscrutable. Beyond the enum guidelines, it’s also true that functions with these

Re: [webkit-dev] Bools are strictly worse than enums

2010-12-03 Thread Peter Kasting
On Fri, Dec 3, 2010 at 2:42 PM, David Hyatt hy...@apple.com wrote: An example of nice boolean usage is: paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth 0, isHorizontal()); GOOD! The last parameter is a boolean indicating