Changeset 20072 in webkit


Ignore:
Timestamp:
Mar 8, 2007 6:12:43 PM (17 years ago)
Author:
mjs
Message:

LayoutTests:

Reviewed by Adele.

<rdar://problem/4646563> REGRESSION: Unable to send text message from Verizon text message website: vtext.com (12588)
http://bugs.webkit.org/show_bug.cgi?id=12588

Carefully revised which focus operations restore previous selection, which clear it, and which
select the whole control contents, these test cases cover every focus call I could find.


  • fast/forms/focus-selection-input-expected.txt: Added.
  • fast/forms/focus-selection-input.html: Added.
  • fast/forms/focus-selection-textarea-expected.txt: Added.
  • fast/forms/focus-selection-textarea.html: Added.
  • fast/forms/onselect-textfield-expected.txt:

WebCore:

Reviewed by Adele.


<rdar://problem/4646563> REGRESSION: Unable to send text message from Verizon text message website: vtext.com (12588)
http://bugs.webkit.org/show_bug.cgi?id=12588

Carefully revised which focus operations restore previous selection, which clear it, and which
select the whole control contents.


Tests:
fast/forms/focus-selection-input.html
fast/forms/focus-selection-textarea.html


  • dom/Element.cpp: (WebCore::Element::focus):
  • dom/Element.h:
  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::focus): (WebCore::HTMLInputElement::accessKeyAction):
  • html/HTMLInputElement.h:
  • html/HTMLLabelElement.cpp: (WebCore::HTMLLabelElement::focus): (WebCore::HTMLLabelElement::accessKeyAction):
  • html/HTMLLabelElement.h:
  • html/HTMLLegendElement.cpp: (WebCore::HTMLLegendElement::focus):
  • html/HTMLLegendElement.h:
  • html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::focus):
  • html/HTMLTextAreaElement.h:
  • page/FocusController.cpp: (WebCore::FocusController::advanceFocus):
Location:
trunk
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20071 r20072  
     12007-03-08  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Adele.
     4
     5        <rdar://problem/4646563> REGRESSION: Unable to send text message from Verizon text message website: vtext.com (12588)
     6        http://bugs.webkit.org/show_bug.cgi?id=12588
     7
     8        Carefully revised which focus operations restore previous selection, which clear it, and which
     9        select the whole control contents, these test cases cover every focus call I could find.
     10       
     11        * fast/forms/focus-selection-input-expected.txt: Added.
     12        * fast/forms/focus-selection-input.html: Added.
     13        * fast/forms/focus-selection-textarea-expected.txt: Added.
     14        * fast/forms/focus-selection-textarea.html: Added.
     15        * fast/forms/onselect-textfield-expected.txt:
     16
    1172007-03-08  Justin Garcia  <justin.garcia@apple.com>
    218
  • trunk/LayoutTests/fast/forms/onselect-textfield-expected.txt

    r17562 r20072  
    1717
    1818Calling focus on text field
    19 After focus: text field selection start: 0 end: 10
     19After focus: text field selection start: 6 end: 10
    2020
  • trunk/WebCore/ChangeLog

    r20071 r20072  
     12007-03-08  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Adele.
     4       
     5        <rdar://problem/4646563> REGRESSION: Unable to send text message from Verizon text message website: vtext.com (12588)
     6        http://bugs.webkit.org/show_bug.cgi?id=12588
     7
     8        Carefully revised which focus operations restore previous selection, which clear it, and which
     9        select the whole control contents.
     10       
     11        Tests:
     12        fast/forms/focus-selection-input.html
     13        fast/forms/focus-selection-textarea.html
     14       
     15        * dom/Element.cpp:
     16        (WebCore::Element::focus):
     17        * dom/Element.h:
     18        * html/HTMLInputElement.cpp:
     19        (WebCore::HTMLInputElement::focus):
     20        (WebCore::HTMLInputElement::accessKeyAction):
     21        * html/HTMLInputElement.h:
     22        * html/HTMLLabelElement.cpp:
     23        (WebCore::HTMLLabelElement::focus):
     24        (WebCore::HTMLLabelElement::accessKeyAction):
     25        * html/HTMLLabelElement.h:
     26        * html/HTMLLegendElement.cpp:
     27        (WebCore::HTMLLegendElement::focus):
     28        * html/HTMLLegendElement.h:
     29        * html/HTMLTextAreaElement.cpp:
     30        (WebCore::HTMLTextAreaElement::focus):
     31        * html/HTMLTextAreaElement.h:
     32        * page/FocusController.cpp:
     33        (WebCore::FocusController::advanceFocus):
     34
    1352007-03-08  Justin Garcia  <justin.garcia@apple.com>
    236
  • trunk/WebCore/dom/Element.cpp

    r20028 r20072  
    890890}
    891891
    892 void Element::focus()
     892void Element::focus(bool restorePreviousSelection)
    893893{
    894894    Document* doc = document();
     
    906906    }
    907907       
    908     updateFocusAppearance();
     908    updateFocusAppearance(restorePreviousSelection);
    909909}
    910910
  • trunk/WebCore/dom/Element.h

    r20028 r20072  
    159159    virtual String target() const { return String(); }
    160160       
    161     virtual void focus();
     161    virtual void focus(bool restorePreviousSelection = true);
    162162    virtual void updateFocusAppearance(bool restorePreviousSelection = false);
    163163    void blur();
  • trunk/WebCore/html/HTMLInputElement.cpp

    r19672 r20072  
    183183}
    184184
    185 void HTMLInputElement::focus()
     185void HTMLInputElement::focus(bool restorePreviousSelection)
    186186{
    187187    if (isTextField()) {
     
    199199            return;
    200200        }
    201         updateFocusAppearance();
     201        updateFocusAppearance(restorePreviousSelection);
    202202        return;
    203203    }
    204     HTMLGenericFormElement::focus();
     204    HTMLGenericFormElement::focus(restorePreviousSelection);
    205205}
    206206
     
    535535        case RESET:
    536536        case SUBMIT:
    537             // focus
    538             focus();
     537            focus(false);
    539538            // send the mouse button events iff the caller specified sendToAnyElement
    540539            dispatchSimulatedClick(0, sendToAnyElement);
     
    547546        case SEARCH:
    548547        case TEXT:
    549             focus();
     548            // should never restore previous selection here
     549            focus(false);
    550550            break;
    551551    }
  • trunk/WebCore/html/HTMLInputElement.h

    r19662 r20072  
    6262    virtual bool isMouseFocusable() const;
    6363    virtual bool isEnumeratable() const { return inputType() != IMAGE; }
    64     virtual void focus();
     64    virtual void focus(bool restorePreviousSelection = true);
    6565    virtual void dispatchFocusEvent();
    6666    virtual void dispatchBlurEvent();
  • trunk/WebCore/html/HTMLLabelElement.cpp

    r18293 r20072  
    2727#include "config.h"
    2828#include "HTMLLabelElement.h"
     29
     30#include "Document.h"
     31#include "Event.h"
     32#include "EventNames.h"
    2933#include "HTMLFormElement.h"
    30 
    3134#include "HTMLNames.h"
    32 #include "EventNames.h"
    33 #include "Event.h"
    34 #include "Document.h"
    3535
    3636namespace WebCore {
     
    131131}
    132132
    133 void HTMLLabelElement::focus()
     133void HTMLLabelElement::focus(bool)
    134134{
     135    // to match other browsers, always restore previous selection
    135136    if (Element* element = formElement())
    136137        element->focus();
     
    139140void HTMLLabelElement::accessKeyAction(bool sendToAnyElement)
    140141{
    141     Element *element = formElement();
    142     if (element)
     142    if (Element* element = formElement())
    143143        element->accessKeyAction(sendToAnyElement);
    144144}
  • trunk/WebCore/html/HTMLLabelElement.h

    r18874 r20072  
    6565    void setHtmlFor(const String &);
    6666
    67     void focus();
     67    void focus(bool restorePreviousSelection = true);
    6868
    6969 private:
  • trunk/WebCore/html/HTMLLegendElement.cpp

    r15299 r20072  
    106106}
    107107
    108 void HTMLLegendElement::focus()
     108void HTMLLegendElement::focus(bool)
    109109{
     110    // to match other browsers, never restore previous selection
    110111    if (Element *element = formElement())
    111         element->focus();
     112        element->focus(false);
    112113}
    113114
  • trunk/WebCore/html/HTMLLegendElement.h

    r18874 r20072  
    5252    void setAlign(const String &);
    5353   
    54     void focus();
     54    void focus(bool restorePreviousSelection = true);
    5555};
    5656
  • trunk/WebCore/html/HTMLTextAreaElement.cpp

    r19662 r20072  
    201201}
    202202
    203 void HTMLTextAreaElement::focus()
     203void HTMLTextAreaElement::focus(bool)
    204204{
    205205    Document* doc = document();
  • trunk/WebCore/html/HTMLTextAreaElement.h

    r19662 r20072  
    7373    virtual bool isMouseFocusable() const;
    7474    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
    75     virtual void focus();
     75    virtual void focus(bool restorePreviousSelection = true);
    7676    virtual void updateFocusAppearance(bool restorePreviousSelection = true);
    7777
  • trunk/WebCore/page/FocusController.cpp

    r19636 r20072  
    204204        setFocusedFrame(newDocument->frame());
    205205
    206     static_cast<Element*>(node)->focus();
     206    static_cast<Element*>(node)->focus(false);
    207207    return true;
    208208}
Note: See TracChangeset for help on using the changeset viewer.