<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>23060</bug_id>
          
          <creation_ts>2008-12-31 14:41:07 -0800</creation_ts>
          <short_desc>REGRESSION (r38629): Cannot scroll a WebHTMLView using Home/End/Page up/Page down</short_desc>
          <delta_ts>2009-01-02 07:18:50 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cameron Zwarich (cpst)">zwarich</reporter>
          <assigned_to name="Cameron Zwarich (cpst)">zwarich</assigned_to>
          <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>103933</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 14:41:07 -0800</bug_when>
    <thetext>After r38629, all keyboard events get sent by Editor to the EditorClient, even if the selection is not editable. If the event&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103934</commentid>
    <comment_count>1</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 14:41:31 -0800</bug_when>
    <thetext>&lt;rdar://problem/6467830&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103935</commentid>
    <comment_count>2</comment_count>
      <attachid>26339</attachid>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 14:45:08 -0800</bug_when>
    <thetext>Created attachment 26339
Proposed patch

Here&apos;s a patch that fixes the problem. This is probably testable in DRT, but I&apos;d rather get the fix out of the way before deciding how to test it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103936</commentid>
    <comment_count>3</comment_count>
      <attachid>26339</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-12-31 14:57:55 -0800</bug_when>
    <thetext>Comment on attachment 26339
Proposed patch

Typo &quot;mistakenly&quot; rather than &quot;mistakingly&quot;.

&gt; -        bool eventWasHandled = true;
&gt; +        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?

&gt; -            else {
&gt; +            else if ([self _canEdit]) {
&gt;                  _private-&gt;selectorForDoCommandBySelector = selector;
&gt;                  [super doCommandBySelector:selector];
&gt;                  _private-&gt;selectorForDoCommandBySelector = 0;
&gt; +                eventWasHandled = true;
&gt;              }

What this really amounts to is:

   if _canEdit returns false, then set eventWasHandled to false and don&apos;t call super&apos;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&apos;t understand the rationale here. Maybe we should never treat calling [super doCommandBySelector:] as &quot;eventWasHandled true&quot; -- I don&apos;t see what _canEdit has to do with it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103937</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 15:02:00 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 26339 [review])
&gt; Typo &quot;mistakenly&quot; rather than &quot;mistakingly&quot;.
&gt; 
&gt; &gt; -        bool eventWasHandled = true;
&gt; &gt; +        bool eventWasHandled = false;
&gt; 
&gt; This changes the value when the delegate returns YES and when coreFrame is 0.
&gt; Did you really mean to change it in those cases? Why?
&gt; 
&gt; &gt; -            else {
&gt; &gt; +            else if ([self _canEdit]) {
&gt; &gt;                  _private-&gt;selectorForDoCommandBySelector = selector;
&gt; &gt;                  [super doCommandBySelector:selector];
&gt; &gt;                  _private-&gt;selectorForDoCommandBySelector = 0;
&gt; &gt; +                eventWasHandled = true;
&gt; &gt;              }
&gt; 
&gt; What this really amounts to is:
&gt; 
&gt;    if _canEdit returns false, then set eventWasHandled to false and don&apos;t call
&gt; super&apos;s doCommandBySelector
&gt; 
&gt; So for one thing, you can write it that way:
&gt; 
&gt;     else if (![self_canEdit])
&gt;         eventWasHandled = false;
&gt;     else
&gt;         ...
&gt; 
&gt; 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. ;-)

&gt; But for another, I don&apos;t understand the rationale here. Maybe we should never
&gt; treat calling [super doCommandBySelector:] as &quot;eventWasHandled true&quot; -- I don&apos;t
&gt; see what _canEdit has to do with it.

I would have thought about doing that, but I couldn&apos;t answer this question: when does [super doCommandBySelector:] ever handle an event? Presumedly there is some case if the code was added long ago.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103938</commentid>
    <comment_count>5</comment_count>
      <attachid>26339</attachid>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 15:02:23 -0800</bug_when>
    <thetext>Comment on attachment 26339
Proposed patch

Clearing review flag pending a new patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103939</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-12-31 15:06:01 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; I would have thought about doing that, but I couldn&apos;t answer this question:
&gt; when does [super doCommandBySelector:] ever handle an event? Presumedly there
&gt; 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&apos;t know.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103940</commentid>
    <comment_count>7</comment_count>
      <attachid>26340</attachid>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2008-12-31 15:16:59 -0800</bug_when>
    <thetext>Created attachment 26340
Proposed patch

Here is the revised patch. I don&apos;t want to change the default in the editable case if you don&apos;t know exactly why the message is passed to super. Also, &apos;mistakingly&apos; is valid English, just a bit out of use. I changed it though. ;-)

The same comment stands about the test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104003</commentid>
    <comment_count>8</comment_count>
      <attachid>26340</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-01-01 17:39:58 -0800</bug_when>
    <thetext>Comment on attachment 26340
Proposed patch

r=me

I think this would be slightly better if it had a comment explaining what&apos;s going on.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104081</commentid>
    <comment_count>9</comment_count>
    <who name="Cameron Zwarich (cpst)">zwarich</who>
    <bug_when>2009-01-02 07:18:50 -0800</bug_when>
    <thetext>Fixed in r39549, with a comment added like Darin suggested.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>26339</attachid>
            <date>2008-12-31 14:45:08 -0800</date>
            <delta_ts>2008-12-31 15:16:59 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>pagedown.diff</filename>
            <type>text/plain</type>
            <size>2369</size>
            <attacher name="Cameron Zwarich (cpst)">zwarich</attacher>
            
              <data encoding="base64">SW5kZXg6IENoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBDaGFuZ2VMb2cJKHJldmlzaW9uIDM5NTMy
KQorKysgQ2hhbmdlT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ZWJWaWV3ID0gW3NlbGYgX3dlYlZpZXddOwogICAgICAg
ICBGcmFtZSogY29yZUZyYW1lID0gY29yZShbc2VsZiBfZnJhbWVdKTsKQEAgLTUxOTUsMTAgKzUx
OTUsMTEgQEAgc3RhdGljIHZvaWQgZXh0cmFjdFVuZGVybGluZXMoTlNBdHRyaWJ1dAogICAgICAg
ICAgICAgRWRpdG9yOjpDb21tYW5kIGNvbW1hbmQgPSBbc2VsZiBjb3JlQ29tbWFuZEJ5U2VsZWN0
b3I6c2VsZWN0b3JdOwogICAgICAgICAgICAgaWYgKGNvbW1hbmQuaXNTdXBwb3J0ZWQoKSkKICAg
ICAgICAgICAgICAgICBldmVudFdhc0hhbmRsZWQgPSBjb21tYW5kLmV4ZWN1dGUoZXZlbnQpOwot
ICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBlbHNlIGlmIChbc2VsZiBfY2FuRWRpdF0p
IHsKICAgICAgICAgICAgICAgICBfcHJpdmF0ZS0+c2VsZWN0b3JGb3JEb0NvbW1hbmRCeVNlbGVj
dG9yID0gc2VsZWN0b3I7CiAgICAgICAgICAgICAgICAgW3N1cGVyIGRvQ29tbWFuZEJ5U2VsZWN0
b3I6c2VsZWN0b3JdOwogICAgICAgICAgICAgICAgIF9wcml2YXRlLT5zZWxlY3RvckZvckRvQ29t
bWFuZEJ5U2VsZWN0b3IgPSAwOworICAgICAgICAgICAgICAgIGV2ZW50V2FzSGFuZGxlZCA9IHRy
dWU7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>26340</attachid>
            <date>2008-12-31 15:16:59 -0800</date>
            <delta_ts>2009-01-01 17:39:58 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>pagedown.diff</filename>
            <type>text/plain</type>
            <size>2018</size>
            <attacher name="Cameron Zwarich (cpst)">zwarich</attacher>
            
              <data encoding="base64">SW5kZXg6IENoYW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A9IGNvbW1hbmQuZXhlY3V0ZShldmVudCk7
Ci0gICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIGVsc2UgaWYgKFtzZWxmIF9jYW5FZGl0
XSkgewogICAgICAgICAgICAgICAgIF9wcml2YXRlLT5zZWxlY3RvckZvckRvQ29tbWFuZEJ5U2Vs
ZWN0b3IgPSBzZWxlY3RvcjsKICAgICAgICAgICAgICAgICBbc3VwZXIgZG9Db21tYW5kQnlTZWxl
Y3RvcjpzZWxlY3Rvcl07CiAgICAgICAgICAgICAgICAgX3ByaXZhdGUtPnNlbGVjdG9yRm9yRG9D
b21tYW5kQnlTZWxlY3RvciA9IDA7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UK
KyAgICAgICAgICAgICAgICBldmVudFdhc0hhbmRsZWQgPSBmYWxzZTsKICAgICAgICAgfQogCiAg
ICAgICAgIGlmIChwYXJhbWV0ZXJzKQo=
</data>
<flag name="review"
          id="12485"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>