<?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>32904</bug_id>
          
          <creation_ts>2009-12-23 10:34:38 -0800</creation_ts>
          <short_desc>Mismatched textField editing callbacks are sent after window loses &amp; regains focus</short_desc>
          <delta_ts>2009-12-23 10:36:19 -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>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="John Sullivan">sullivan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>arv</cc>
    
    <cc>darin</cc>
    
    <cc>dbates</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>174604</commentid>
    <comment_count>0</comment_count>
    <who name="John Sullivan">sullivan</who>
    <bug_when>2009-12-23 10:34:38 -0800</bug_when>
    <thetext>To reproduce:

1. Put breakpoints on Frame::textFieldDidBeginEditing(), Frame::textFieldDidEndEditing(), and Frame::textDidChangeInTextField()
2. In Safari, visit a page with a simple form textfield (e.g., a Bugzilla page like this one) and click in an empty textfield
3. type a character -&gt; this hits the textFieldDidBeginEditing() breakpoint
4. continue in the debugger -&gt; this hits the textDidChangeInTextField() breakpoint
5. continue in the debugger -&gt; this hits the textFieldDidEndEditing() breakpoint as a side effect of switching to the debugger, which makes the Safari window lose key status, which makes the text field go through the &quot;blur&quot; codepath
6. continue in the debugger
7. switch back to Safari -&gt; the form field still appears focused, as it should
8. type a character

Since a textFieldDidEndEditing() callback was most recently sent, the text field should be in the &quot;not editing&quot; state, and the next callback should be textFieldDidBeginEditing(), followed by textDidChangeInTextField(). But the textFieldDidBeginEditing() callback is not sent. The client receives a textDidChangeInTextField() callback without having received a previous textFieldDidBeginEditing() callback.

This is a regression from earlier WebKit behavior. I believe it is caused by &lt;http://trac.webkit.org/changeset/48257&gt;, which introduced the &quot;blur&quot; codepath when the window loses key status in step 5. RenderTextControlSingleLine::subtreeHasChanged() is the code that calls textFieldDidBeginEditing() and textDidChangeInTextField() for form fields. In step 8, wasChangedSinceLastChangeEvent() returns true, so RenderTextControlSingleLine::subtreeHasChanged() does not send the textFieldDidBeginEditing() function.

This could be fixed in at least three ways:

(1) revoking the change in 48257
(2) redoing that change to avoid sending the textFieldDidEndEditing() callback while still performing other blur-related work
(3) redoing that change to also change whatever state is causing &quot;wasChangedSinceLastChangeEvent()&quot; to return true after step 8

I found this issue while tracking down a Safari autocompletion regression that was also affected by &lt;http://trac.webkit.org/changeset/50618&gt;. However, I will work around this issue in Safari, so I don&apos;t know of any actual symptoms caused by these mismatched callbacks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>