RESOLVED FIXED 62295
Fix a ?: precedence error in ScrollbarThemeMac and ScrollbarThemeChromium
https://bugs.webkit.org/show_bug.cgi?id=62295
Summary Fix a ?: precedence error in ScrollbarThemeMac and ScrollbarThemeChromium
Nico Weber
Reported 2011-06-08 10:01:22 PDT
Fix a ?: precedence error in ScrollbarThemeMac and ScrollbarThemeChromium
Attachments
Patch (3.55 KB, patch)
2011-06-08 10:02 PDT, Nico Weber
no flags
Patch (3.55 KB, patch)
2011-06-08 10:25 PDT, Nico Weber
no flags
Nico Weber
Comment 1 2011-06-08 10:02:33 PDT
Darin Adler
Comment 2 2011-06-08 10:18:31 PDT
Comment on attachment 96438 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=96438&action=review Please post a new patch that gets the ScrollbarThemeMac.mm part right. Anyone got information on what the symptom of this was? Clearly the old code was incorrect. But we normally want regression testing too. > Source/WebCore/platform/mac/ScrollbarThemeMac.mm:295 > - result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + painting ? cOuterButtonOverlap : 0, thickness); > + result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + painting ? (cOuterButtonOverlap : 0), thickness); This looks wrong. The parentheses are added in the wrong place here!
Nico Weber
Comment 3 2011-06-08 10:21:08 PDT
Comment on attachment 96438 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=96438&action=review >> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:295 >> + result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + painting ? (cOuterButtonOverlap : 0), thickness); > > This looks wrong. The parentheses are added in the wrong place here! |painting| is a bool. What this code did before I added the parens was |(int + bool) ? overlap : 0|. I would have thought it's supposed to be |int + (bool ? overlap : 0)|, which is what this patch does. Am I misunderstanding the code?
Nico Weber
Comment 4 2011-06-08 10:21:53 PDT
Thanks for your comment, Darin. I replied to it – I'm afraid I don't get it :-/
Darin Adler
Comment 5 2011-06-08 10:22:48 PDT
(In reply to comment #3) > (From update of attachment 96438 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=96438&action=review > > >> Source/WebCore/platform/mac/ScrollbarThemeMac.mm:295 > >> + result = IntRect(scrollbar->x(), scrollbar->y(), cOuterButtonLength[scrollbar->controlSize()] + painting ? (cOuterButtonOverlap : 0), thickness); > > > > This looks wrong. The parentheses are added in the wrong place here! > > |painting| is a bool. What this code did before I added the parens was |(int + bool) ? overlap : 0|. I would have thought it's supposed to be |int + (bool ? overlap : 0)|, which is what this patch does. > > Am I misunderstanding the code? The above says: painting ? (cOuterButtonOverlap : 0) But you need to say: (painting ? cOuterButtonOverlap : 0) Maybe you just had trouble seeing it.
Nico Weber
Comment 6 2011-06-08 10:25:48 PDT
Nico Weber
Comment 7 2011-06-08 10:26:06 PDT
9_9 Sorry.
Darin Adler
Comment 8 2011-06-08 10:27:35 PDT
Still would be good to find out what the symptom of this was.
Nico Weber
Comment 9 2011-06-08 10:33:40 PDT
This codepath was hit only when (buttonsPlacement() == ScrollbarButtonsDoubleStart || buttonsPlacement() == ScrollbarButtonsDoubleBoth is true which I think isn't true for most people in practice. The only interesting called of this function is RenderScrollbarTheme::trackRect(), so from reading the code it looks like for doublestart / doubleboth scrollbars, the track would appear slightly too large.
WebKit Review Bot
Comment 10 2011-06-08 11:20:31 PDT
Comment on attachment 96439 [details] Patch Clearing flags on attachment: 96439 Committed r88364: <http://trac.webkit.org/changeset/88364>
WebKit Review Bot
Comment 11 2011-06-08 11:20:36 PDT
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.