Changeset 19595 in webkit


Ignore:
Timestamp:
Feb 12, 2007 8:49:26 PM (17 years ago)
Author:
hyatt
Message:

Fix for bug 12149 (Radar Bug#4928692), external CSS causes incomplete
text field focus.

Make sure to clear out the focus node in willRemove() rather than in
detach(), since detach/attach caused by style recalc should not affect
the focused node.

Reviewed by aroben

  • dom/ContainerNode.cpp: (WebCore::ContainerNode::willRemove):
  • dom/Document.cpp: (WebCore::Document::focusedNodeRemoved): (WebCore::Document::setFocusedNode):
  • dom/Document.h:
  • dom/Element.cpp: (WebCore::Element::updateFocusAppearance):
  • dom/Node.cpp: (WebCore::Node::willRemove): (WebCore::Node::detach):
  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::updateFocusAppearance):
Location:
trunk/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r19590 r19595  
     12007-02-12  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for bug 12149 (Radar Bug#4928692), external CSS causes incomplete
     4        text field focus.
     5
     6        Make sure to clear out the focus node in willRemove() rather than in
     7        detach(), since detach/attach caused by style recalc should not affect
     8        the focused node.
     9
     10        Reviewed by aroben
     11
     12        * dom/ContainerNode.cpp:
     13        (WebCore::ContainerNode::willRemove):
     14        * dom/Document.cpp:
     15        (WebCore::Document::focusedNodeRemoved):
     16        (WebCore::Document::setFocusedNode):
     17        * dom/Document.h:
     18        * dom/Element.cpp:
     19        (WebCore::Element::updateFocusAppearance):
     20        * dom/Node.cpp:
     21        (WebCore::Node::willRemove):
     22        (WebCore::Node::detach):
     23        * html/HTMLInputElement.cpp:
     24        (WebCore::HTMLInputElement::updateFocusAppearance):
     25
    1262007-02-12  Kevin McCullough  <kmccullough@apple.com>
    227
  • trunk/WebCore/dom/ContainerNode.cpp

    r19584 r19595  
    331331    for (Node *n = m_firstChild; n != 0; n = n->nextSibling())
    332332        n->willRemove();
     333    EventTargetNode::willRemove();
    333334}
    334335
  • trunk/WebCore/dom/Document.cpp

    r19584 r19595  
    20482048}
    20492049
    2050 void Document::focusedNodeDetached(Node* node)
     2050void Document::focusedNodeRemoved(Node* node)
    20512051{
    20522052    setFocusedNode(0);
     
    21692169        }
    21702170        m_focusedNode->setFocus();
    2171        
    2172         if (m_focusedNode.get() == m_focusedNode->rootEditableElement())
    2173             frame()->editor()->didBeginEditing();
    2174        
     2171
    21752172        // eww, I suck. set the qt focus correctly
    21762173        // ### find a better place in the code for this
  • trunk/WebCore/dom/Document.h

    r19584 r19595  
    420420    Node* activeNode() const { return m_activeNode.get(); }
    421421
    422     void focusedNodeDetached(Node*);
     422    void focusedNodeRemoved(Node*);
    423423    void hoveredNodeDetached(Node*);
    424424    void activeChainNodeDetached(Node*);
  • trunk/WebCore/dom/Element.cpp

    r19400 r19595  
    2929#include "cssstyleselector.h"
    3030#include "Document.h"
     31#include "Editor.h"
    3132#include "ExceptionCode.h"
    3233#include "Frame.h"
     
    890891            return;
    891892       
     893        frame->editor()->didBeginEditing();
     894
    892895        // FIXME: We should restore the previous selection if there is one.
    893896        Selection newSelection = hasTagName(htmlTag) || hasTagName(bodyTag) ? Selection(Position(this, 0), DOWNSTREAM) : Selection::selectionFromContentsOfNode(this);
  • trunk/WebCore/dom/Node.cpp

    r19584 r19595  
    813813void Node::willRemove()
    814814{
     815    if (m_focused)
     816        document()->focusedNodeRemoved(this);
    815817}
    816818
     
    824826
    825827    Document* doc = document();
    826     if (m_focused)
    827         doc->focusedNodeDetached(this);
    828828    if (m_hovered)
    829829        doc->hoveredNodeDetached(this);
  • trunk/WebCore/html/HTMLInputElement.cpp

    r19579 r19595  
    3030#include "CSSPropertyNames.h"
    3131#include "Document.h"
     32#include "Editor.h"
    3233#include "Event.h"
    3334#include "EventHandler.h"
     
    205206    if (isTextField()) {
    206207        select();
    207         if (document() && document()->frame())
     208        if (document() && document()->frame()) {
     209            document()->frame()->editor()->didBeginEditing();
    208210            document()->frame()->revealSelection();
     211        }
    209212    } else
    210213        HTMLGenericFormElement::updateFocusAppearance();
Note: See TracChangeset for help on using the changeset viewer.