Changeset 19672 in webkit


Ignore:
Timestamp:
Feb 16, 2007 5:15:48 PM (17 years ago)
Author:
darin
Message:

Reviewed by Adele.

  • fix <rdar://problem/4990864> ASSERT in FormDelegate.m while dragging text between frames

This symptom is specific to Safari, so no layout test.

  • editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::doApply): Only call textWillBeDeletedInTextField if the text field is focused.
  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::aboutToUnload): Only call textFieldDidEndEditing if the text field is focused. (WebCore::HTMLInputElement::dispatchBlurEvent): Remove unneeded type cast. (WebCore::HTMLInputElement::defaultEventHandler): Only call doTextFieldCommandFromEvent if the text field is focused.
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::subtreeHasChanged): Only call textDidChangeInTextArea, textFieldDidBeginEditing, and textDidChangeInTextField if the element is focused.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19667 r19672  
     12007-02-16  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Adele.
     4
     5        - fix <rdar://problem/4990864> ASSERT in FormDelegate.m while dragging text between frames
     6
     7        This symptom is specific to Safari, so no layout test.
     8
     9        * editing/DeleteSelectionCommand.cpp:
     10        (WebCore::DeleteSelectionCommand::doApply): Only call textWillBeDeletedInTextField if the
     11        text field is focused.
     12        * html/HTMLInputElement.cpp:
     13        (WebCore::HTMLInputElement::aboutToUnload): Only call textFieldDidEndEditing if the text
     14        field is focused.
     15        (WebCore::HTMLInputElement::dispatchBlurEvent): Remove unneeded type cast.
     16        (WebCore::HTMLInputElement::defaultEventHandler): Only call doTextFieldCommandFromEvent if
     17        the text field is focused.
     18        * rendering/RenderTextControl.cpp:
     19        (WebCore::RenderTextControl::subtreeHasChanged): Only call textDidChangeInTextArea,
     20        textFieldDidBeginEditing, and textDidChangeInTextField if the element is focused.
     21
    1222007-02-16  Anders Carlsson  <acarlsson@apple.com>
    223
  • trunk/WebCore/editing/DeleteSelectionCommand.cpp

    r19088 r19672  
    559559        Node* startNode = m_selectionToDelete.start().node();
    560560        Node* ancestorNode = startNode ? startNode->shadowAncestorNode() : 0;
    561         if (ancestorNode && ancestorNode->hasTagName(inputTag) && static_cast<HTMLInputElement*>(ancestorNode)->isTextField())
     561        if (ancestorNode && ancestorNode->hasTagName(inputTag)
     562                && static_cast<HTMLInputElement*>(ancestorNode)->isTextField()
     563                && ancestorNode->focused())
    562564            document()->frame()->textWillBeDeletedInTextField(static_cast<Element*>(ancestorNode));
    563565    }
  • trunk/WebCore/html/HTMLInputElement.cpp

    r19662 r19672  
    224224void HTMLInputElement::aboutToUnload()
    225225{
    226     if (isTextField() && document()->frame())
     226    if (isTextField() && focused() && document()->frame())
    227227        document()->frame()->textFieldDidEndEditing(this);
    228228}
     
    243243        if (inputType() == PASSWORD)
    244244            document()->frame()->setSecureKeyboardEntry(false);
    245         document()->frame()->textFieldDidEndEditing(static_cast<Element*>(this));
     245        document()->frame()->textFieldDidEndEditing(this);
    246246    }
    247247    HTMLGenericFormElement::dispatchBlurEvent();
     
    11691169        bool clickElement = false;
    11701170
    1171         if (isTextField() && document()->frame()
     1171        if (isTextField() && focused() && document()->frame()
    11721172                && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
    11731173            evt->setDefaultHandled();
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r19620 r19672  
    488488    if (m_multiLine) {
    489489        element->setValueMatchesRenderer(false);
    490         if (Frame* frame = document()->frame())
    491             frame->textDidChangeInTextArea(element);
     490        if (element->focused())
     491            if (Frame* frame = document()->frame())
     492                frame->textDidChangeInTextArea(element);
    492493    } else {
    493494        HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
     
    501502
    502503        if (!wasDirty) {
     504            if (input->focused())
     505                if (Frame* frame = document()->frame())
     506                    frame->textFieldDidBeginEditing(input);
     507        }
     508        if (input->focused())
    503509            if (Frame* frame = document()->frame())
    504                 frame->textFieldDidBeginEditing(input);
    505         }
    506         if (Frame* frame = document()->frame())
    507             frame->textDidChangeInTextField(input);
     510                frame->textDidChangeInTextField(input);
    508511    }
    509512}
Note: See TracChangeset for help on using the changeset viewer.