Changeset 24336 in webkit


Ignore:
Timestamp:
Jul 16, 2007 4:21:11 PM (17 years ago)
Author:
justing
Message:

Correctly check for input fields and text areas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/page/FocusController.cpp

    r24334 r24336  
    3939#include "FrameTree.h"
    4040#include "HTMLFrameOwnerElement.h"
     41#include "HTMLNames.h"
    4142#include "KeyboardEvent.h"
    4243#include "Page.h"
     
    5152
    5253using namespace EventNames;
     54using namespace HTMLNames;
    5355
    5456FocusController::FocusController(Page* page)
     
    239241    if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode())
    240242        if (mousePressNode->renderer() && mousePressNode->renderer()->style()->userSelect() == SELECT_IGNORE)
    241             // Don't do this for textareas and text fields, when they lose focus their selections should be cleared
    242             // and then restored when they regain focus, to match other browsers.
    243             if (!s->rootEditableElement()->shadowAncestorNode())
    244                 return;
     243            if (Node* root = s->rootEditableElement())
     244                if (Node* shadowAncestorNode = root->shadowAncestorNode())
     245                    // Don't do this for textareas and text fields, when they lose focus their selections should be cleared
     246                    // and then restored when they regain focus, to match other browsers.
     247                    if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag))
     248                        return;
    245249   
    246250    s->clear();
Note: See TracChangeset for help on using the changeset viewer.