Changeset 25251 in webkit


Ignore:
Timestamp:
Aug 25, 2007 7:16:42 PM (17 years ago)
Author:
oliver
Message:

Reviewed by Adam and Sam


<rdar://problem/5269732> Safari 3.0 for Windows cuts off text in textarea boxes during sending forms (14562)
<http://bugs.webkit.org/show_bug.cgi?id=14562> [Win] Textarea contents partially eaten on submit/copy


WebView::handleEditingKeyboardEvent assumed all keycodes that did not trigger a named command were
to be inserted. This could cause unexpected behaviour when control characters (eg. escape) are sent,
or could cause data loss when sent a null character (as happens when dead keys are used for international
input).


This patch corrects WebView::handleEditingKeyboardEvent to prevent such characters from being sent
to Editor::insertText. This behaviour matches Firefox.

  • WebView.cpp: (WebView::handleEditingKeyboardEvent):
Location:
trunk/WebKit/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r25231 r25251  
     12007-08-25  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Adam and Sam
     4       
     5        <rdar://problem/5269732> Safari 3.0 for Windows cuts off text in textarea boxes during sending forms (14562)
     6        <http://bugs.webkit.org/show_bug.cgi?id=14562> [Win] Textarea contents partially eaten on submit/copy
     7       
     8        WebView::handleEditingKeyboardEvent assumed all keycodes that did not trigger a named command were
     9        to be inserted.  This could cause unexpected behaviour when control characters (eg. escape) are sent,
     10        or could cause data loss when sent a null character (as happens when dead keys are used for international
     11        input).
     12       
     13        This patch corrects WebView::handleEditingKeyboardEvent to prevent such characters from being sent
     14        to Editor::insertText.  This behaviour matches Firefox.
     15
     16        * WebView.cpp:
     17        (WebView::handleEditingKeyboardEvent):
     18
    1192007-08-24  Sam Weinig  <sam@webkit.org>
    220
  • trunk/WebKit/win/WebView.cpp

    r25231 r25251  
    987987            return true;
    988988
    989     if (evt->keyEvent())
    990         if (frame->editor()->insertText(evt->keyEvent()->text(), evt))
    991             return true;
    992 
    993     return false;
     989    if (!evt->keyEvent())
     990        return false;
     991
     992    if (evt->keyEvent()->text().length() == 1) {
     993        UChar ch = evt->keyEvent()->text()[0];
     994        // Don't insert null or control characters as they can reslt in unexpected behaviour
     995        if (ch < ' ')
     996            return false;
     997    }
     998
     999    return frame->editor()->insertText(evt->keyEvent()->text(), evt);
    9941000}
    9951001
Note: See TracChangeset for help on using the changeset viewer.