[webkit-changes] cvs commit: WebCore/manual-tests input-type-text-unconfirmed-inline-input.html

Darin darin at opensource.apple.com
Sun Sep 4 20:43:04 PDT 2005


darin       05/09/04 20:43:03

  Modified:    .        ChangeLog
               kwq      KWQTextField.mm
  Added:       manual-tests input-type-text-unconfirmed-inline-input.html
  Log:
          Reviewed by John Sullivan.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4393
            REGRESSION: Unconfirmed text ignored in input type=text
  
          Test cases added:
          * manual-tests/input-type-text-unconfirmed-inline-input.html: Added.
  
          * kwq/KWQTextField.mm:
          (-[KWQTextFieldController controlTextDidBeginEditing:]): Call
          setWantsNotificationForMarkedText:YES on the field editor so we get
          "text did change" calls even for changes to the marked text.
          (-[KWQTextFieldController controlTextDidChange:]): Only call the bridge
          when we have changes and there is no marked text -- this is good because
          the bridge is used to implement form auto-fill and preserves the existing
          behavior. A more elegant future fix would be to notify the bridge more often
          and have the auto-fill code itself implement the "don't auto-fill when there
          is marked text" rule.
          (-[NSTextField _KWQ_currentEditor]): Change type to NSTextView so we can
          use this function to code NSTextView-specific stuff. The field editors are
          always subclasses of NSTextView.
  
  Revision  Changes    Path
  1.90      +24 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- ChangeLog	4 Sep 2005 20:56:31 -0000	1.89
  +++ ChangeLog	5 Sep 2005 03:43:02 -0000	1.90
  @@ -1,5 +1,29 @@
   2005-09-04  Darin Adler  <darin at apple.com>
   
  +        Reviewed by John Sullivan.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4393
  +          REGRESSION: Unconfirmed text ignored in input type=text
  +
  +        Test cases added:
  +        * manual-tests/input-type-text-unconfirmed-inline-input.html: Added.
  +
  +        * kwq/KWQTextField.mm:
  +        (-[KWQTextFieldController controlTextDidBeginEditing:]): Call
  +        setWantsNotificationForMarkedText:YES on the field editor so we get
  +        "text did change" calls even for changes to the marked text.
  +        (-[KWQTextFieldController controlTextDidChange:]): Only call the bridge
  +        when we have changes and there is no marked text -- this is good because
  +        the bridge is used to implement form auto-fill and preserves the existing
  +        behavior. A more elegant future fix would be to notify the bridge more often
  +        and have the auto-fill code itself implement the "don't auto-fill when there
  +        is marked text" rule.
  +        (-[NSTextField _KWQ_currentEditor]): Change type to NSTextView so we can
  +        use this function to code NSTextView-specific stuff. The field editors are
  +        always subclasses of NSTextView.
  +
  +2005-09-04  Darin Adler  <darin at apple.com>
  +
           - added a layout test from Bugzilla for a bug that was fixed a while back
   
           * layout-tests/fast/parser/script-tag-with-trailing-slash-expected.txt: Added.
  
  
  
  1.86      +14 -7     WebCore/kwq/KWQTextField.mm
  
  Index: KWQTextField.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQTextField.mm,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- KWQTextField.mm	16 Aug 2005 19:03:19 -0000	1.85
  +++ KWQTextField.mm	5 Sep 2005 03:43:03 -0000	1.86
  @@ -38,13 +38,17 @@
   @end
   
   @interface NSTextField (KWQTextField)
  -- (NSText *)_KWQ_currentEditor;
  +- (NSTextView *)_KWQ_currentEditor;
   @end
   
   @interface NSCell (KWQTextFieldKnowsAppKitSecrets)
   - (NSMutableDictionary *)_textAttributes;
   @end
   
  + at interface NSTextView (KWQTextFieldAppKitSecrets)
  +- (void)setWantsNotificationForMarkedText:(BOOL)wantsNotification;
  + at end
  +
   // The three cell subclasses allow us to tell when we get focus without an editor subclass,
   // and override the base writing direction.
   @interface KWQTextFieldCell : NSTextFieldCell
  @@ -158,6 +162,8 @@
       if (!widget)
   	return;
       
  +    [[field _KWQ_currentEditor] setWantsNotificationForMarkedText:YES];
  +
       WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
       [bridge textFieldDidBeginEditing:(DOMHTMLInputElement *)[bridge elementForView:field]];
   }
  @@ -182,13 +188,14 @@
       if (KWQKHTMLPart::handleKeyboardOptionTabInView(field))
           return;
       
  -    WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
  -    [bridge textDidChangeInTextField:(DOMHTMLInputElement *)[bridge elementForView:field]];
  +    if (![[field _KWQ_currentEditor] hasMarkedText]) {
  +        WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
  +        [bridge textDidChangeInTextField:(DOMHTMLInputElement *)[bridge elementForView:field]];
  +    }
       
       edited = YES;
  -    if (widget) {
  +    if (widget)
           widget->textChanged();
  -    }
   }
   
   - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
  @@ -1145,10 +1152,10 @@
   
   // The currentEditor method does not work for secure text fields.
   // This works around that limitation.
  -- (NSText *)_KWQ_currentEditor
  +- (NSTextView *)_KWQ_currentEditor
   {
       NSResponder *firstResponder = [[self window] firstResponder];
  -    if ([firstResponder isKindOfClass:[NSText class]]) {
  +    if ([firstResponder isKindOfClass:[NSTextView class]]) {
           NSText *editor = (NSText *)firstResponder;
           id delegate = [editor delegate];
           if (delegate == self)
  
  
  
  1.1                  WebCore/manual-tests/input-type-text-unconfirmed-inline-input.html
  
  Index: input-type-text-unconfirmed-inline-input.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <html>
  <head><title>Unconfirmed inline input in <input type=text></title></head>
  
  <script>
  
  function dump(s) {
      if (s == "")
          alert("Field appears empty");
      else
          alert("Field contents: " + s);
  }
  
  </script>
  
  <p>Enter some text using inline input (e.g. Kotoeri Hiragana) and click the button without closing the input area.</p>
  <p><input type=text id=input value="" size=57><input type=button value="test" onClick="dump(document.getElementById('input').value)"></div>
  <p>The alert should show the inline input text, but without the bug fix it shows empty text.</p>
  
  </body></html>
  
  
  



More information about the webkit-changes mailing list