RESOLVED FIXED 23060
REGRESSION (r38629): Cannot scroll a WebHTMLView using Home/End/Page up/Page down
https://bugs.webkit.org/show_bug.cgi?id=23060
Summary REGRESSION (r38629): Cannot scroll a WebHTMLView using Home/End/Page up/Page ...
Cameron Zwarich (cpst)
Reported 2008-12-31 14:41:07 PST
After r38629, all keyboard events get sent by Editor to the EditorClient, even if the selection is not editable. If the event's command is unsupported by WebHTMLView, WebHTMLView mistakingly thinks that the event was handled when it was not. When using the page up / page down keys, the events generated are of the form scrollPageUp rather than movePageUp, so they are unsupported by WebHTMLView and cause this bug to occur.
Attachments
Proposed patch (2.31 KB, patch)
2008-12-31 14:45 PST, Cameron Zwarich (cpst)
no flags
Proposed patch (1.97 KB, patch)
2008-12-31 15:16 PST, Cameron Zwarich (cpst)
darin: review+
Cameron Zwarich (cpst)
Comment 1 2008-12-31 14:41:31 PST
Cameron Zwarich (cpst)
Comment 2 2008-12-31 14:45:08 PST
Created attachment 26339 [details] Proposed patch Here's a patch that fixes the problem. This is probably testable in DRT, but I'd rather get the fix out of the way before deciding how to test it.
Darin Adler
Comment 3 2008-12-31 14:57:55 PST
Comment on attachment 26339 [details] Proposed patch Typo "mistakenly" rather than "mistakingly". > - bool eventWasHandled = true; > + bool eventWasHandled = false; This changes the value when the delegate returns YES and when coreFrame is 0. Did you really mean to change it in those cases? Why? > - else { > + else if ([self _canEdit]) { > _private->selectorForDoCommandBySelector = selector; > [super doCommandBySelector:selector]; > _private->selectorForDoCommandBySelector = 0; > + eventWasHandled = true; > } What this really amounts to is: if _canEdit returns false, then set eventWasHandled to false and don't call super's doCommandBySelector So for one thing, you can write it that way: else if (![self_canEdit]) eventWasHandled = false; else ... Without changing the surrounding code, if you like. But for another, I don't understand the rationale here. Maybe we should never treat calling [super doCommandBySelector:] as "eventWasHandled true" -- I don't see what _canEdit has to do with it.
Cameron Zwarich (cpst)
Comment 4 2008-12-31 15:02:00 PST
(In reply to comment #3) > (From update of attachment 26339 [details] [review]) > Typo "mistakenly" rather than "mistakingly". > > > - bool eventWasHandled = true; > > + bool eventWasHandled = false; > > This changes the value when the delegate returns YES and when coreFrame is 0. > Did you really mean to change it in those cases? Why? > > > - else { > > + else if ([self _canEdit]) { > > _private->selectorForDoCommandBySelector = selector; > > [super doCommandBySelector:selector]; > > _private->selectorForDoCommandBySelector = 0; > > + eventWasHandled = true; > > } > > What this really amounts to is: > > if _canEdit returns false, then set eventWasHandled to false and don't call > super's doCommandBySelector > > So for one thing, you can write it that way: > > else if (![self_canEdit]) > eventWasHandled = false; > else > ... > > Without changing the surrounding code, if you like. Yeah, I accidentally changed the delegate case. I originally had it like you said, but thought it would be better to make the default false rather than true. I should never doubt my instincts. ;-) > But for another, I don't understand the rationale here. Maybe we should never > treat calling [super doCommandBySelector:] as "eventWasHandled true" -- I don't > see what _canEdit has to do with it. I would have thought about doing that, but I couldn't answer this question: when does [super doCommandBySelector:] ever handle an event? Presumedly there is some case if the code was added long ago.
Cameron Zwarich (cpst)
Comment 5 2008-12-31 15:02:23 PST
Comment on attachment 26339 [details] Proposed patch Clearing review flag pending a new patch.
Darin Adler
Comment 6 2008-12-31 15:06:01 PST
(In reply to comment #4) > I would have thought about doing that, but I couldn't answer this question: > when does [super doCommandBySelector:] ever handle an event? Presumedly there > is some case if the code was added long ago. I think the case has something to do with input methods, but I really don't know.
Cameron Zwarich (cpst)
Comment 7 2008-12-31 15:16:59 PST
Created attachment 26340 [details] Proposed patch Here is the revised patch. I don't want to change the default in the editable case if you don't know exactly why the message is passed to super. Also, 'mistakingly' is valid English, just a bit out of use. I changed it though. ;-) The same comment stands about the test.
Darin Adler
Comment 8 2009-01-01 17:39:58 PST
Comment on attachment 26340 [details] Proposed patch r=me I think this would be slightly better if it had a comment explaining what's going on.
Cameron Zwarich (cpst)
Comment 9 2009-01-02 07:18:50 PST
Fixed in r39549, with a comment added like Darin suggested.
Note You need to log in before you can comment on or make changes to this bug.