LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 02:00:10 +0000 (02:00 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 02:00:10 +0000 (02:00 +0000)
        Reviewed by Anders.

        - added test for option-tab

        * fast/events/option-tab.html: Added.
        * fast/events/option-tab-expected.txt: Added.

WebCore:

        Reviewed by Anders.

        - added event parameters to focus-related functions so we can
          implement the "option-tab to all links" behavior without relying
          on a global "current event" -- also makes it work with DOM events

        * page/Frame.h: Removed unneeded includes. Moved some functions
        that were misplaced into the appropriate sections.
        * page/Frame.cpp:
        (WebCore::Frame::doTextFieldCommandFromEvent): Changed parameter from
        PlatformKeyboardEvent to the DOM keyboard event class.
        (WebCore::Frame::tabsToLinks): Added event parameter.
        (WebCore::Frame::tabsToAllControls): Ditto.
        (WebCore::scanForForm): Fixed code that incorrectly assumes
        that an iframe is an HTMLFrameElement (no longer true since Geoff
        changed the class hierarchy a bit).
        (WebCore::Frame::hitTestResultAtPoint): Ditto.

        * bridge/mac/FrameMac.h: Removed unneeded includes. Moved some functions
        that were misplaced into the appropriate sections.
        * bridge/mac/FrameMac.mm:
        (WebCore::selectorForKeyEvent): Changed to use a DOM event instead of
        a PlatformKeyboardEvent.
        (WebCore::FrameMac::nextKeyViewInFrame): Changed to use currentKeyboardEvent()
        and pass event into next/previousFocusNode.
        (WebCore::FrameMac::currentKeyboardEvent): Added. Creates a DOM event from
        the AppKit current event, if it's a keyboard event. Really just a hack that's
        needed to preserve some code we can remove once we deal with the last NSView-
        based form control.
        (WebCore::isKeyboardOptionTab): Added.
        (WebCore::FrameMac::tabsToLinks): Added event parameter, used to check if the
        option (alt) key is down.
        (WebCore::FrameMac::tabsToAllControls): Ditto.
        (WebCore::FrameMac::keyEvent): Changed call to prepareForUserAction() to just
        call resetMultipleFormSubmissionProtection() explicitly instead.
        (WebCore::FrameMac::mouseDown): Ditto.

        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject accessibilityDescription]): Fixed code that incorrectly
        assumes that an iframe is an HTMLFrameElement (no longer true since Geoff
        changed the class hierarchy a bit).
        (-[WebCoreAXObject accessibilityPerformAction:]): Changed call to
        prepareForUserAction() to call resetMultipleFormSubmissionProtection()
        explicitly instead.

        * page/FrameView.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::advanceFocus): Changed function to take an
        event parameter, and decide the direction based on the shift key
        modifier instead of a passed-in boolean.

        * dom/Document.h:
        * dom/Document.cpp:
        (WebCore::Document::nextFocusNode): Added event parameter.
        (WebCore::Document::previousFocusNode): Ditto.
        * dom/Node.h:
        * dom/Node.cpp:
        (WebCore::Node::isKeyboardFocusable): Ditto.
        * html/HTMLAnchorElement.h:
        * html/HTMLAnchorElement.cpp:
        (WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto.
        * html/HTMLGenericFormElement.h:
        * html/HTMLGenericFormElement.cpp:
        (WebCore::HTMLGenericFormElement::isKeyboardFocusable): Ditto.
        * html/HTMLInputElement.h:
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::isKeyboardFocusable): Ditto.
        (WebCore::HTMLInputElement::defaultEventHandler): Ditto.
        * html/HTMLSelectElement.h:
        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::isKeyboardFocusable): Ditto.
        * html/HTMLTextAreaElement.h:
        * html/HTMLTextAreaElement.cpp:
        (WebCore::HTMLTextAreaElement::isKeyboardFocusable): Ditto.

        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::defaultEventHandler): Pass event to the
        advanceFocus function.

        * platform/TextField.h:
        * platform/mac/TextFieldMac.mm: Removed the non-search field code.

        * platform/mac/WebCoreTextField.h:
        * platform/mac/WebCoreTextField.mm: Removed the non-search field code.
        (-[WebCoreTextFieldController controlTextDidChange:]): Removed the
        call to FrameMac::handleKeyboardOptionTabInView, which is no longer
        needed since the default handler in HTMLInputElement takes care of
        option-tab.

        * platform/mac/SliderMac.mm:
        (-[WebCoreSlider canBecomeKeyView]): Changed to use currentKeyboardEvent()
        and pass event into tabsToAllControls.
        (Slider::focusPolicy): Ditto.

        * rendering/RenderLineEdit.cpp:
        (WebCore::RenderLineEdit::RenderLineEdit): Removed the non-search field code.
        (WebCore::RenderLineEdit::updateFromElement): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17674 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/option-tab-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/option-tab.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/EventTargetNode.cpp
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/html/HTMLAnchorElement.cpp
WebCore/html/HTMLAnchorElement.h
WebCore/html/HTMLGenericFormElement.cpp
WebCore/html/HTMLGenericFormElement.h
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLInputElement.h
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLSelectElement.h
WebCore/html/HTMLTextAreaElement.cpp
WebCore/html/HTMLTextAreaElement.h
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/platform/TextField.h
WebCore/platform/mac/SliderMac.mm
WebCore/platform/mac/TextFieldMac.mm
WebCore/platform/mac/WebCoreTextField.h
WebCore/platform/mac/WebCoreTextField.mm
WebCore/rendering/RenderLineEdit.cpp

index 2d9a41793b3d2eda240c5ec3a94e741a7d7c73f9..c15802f7886b001f6fc94c93df3e9cc2fd277bc9 100644 (file)
@@ -1,3 +1,12 @@
+2006-11-08  Darin Adler  <darin@apple.com>
+
+        Reviewed by Anders.
+
+        - added test for option-tab
+
+        * fast/events/option-tab.html: Added.
+        * fast/events/option-tab-expected.txt: Added.
+
 2006-11-08  Brady Eidson <beidson@apple.com>
 
         Reviewed by Maciej
diff --git a/LayoutTests/fast/events/option-tab-expected.txt b/LayoutTests/fast/events/option-tab-expected.txt
new file mode 100644 (file)
index 0000000..d1f90b5
--- /dev/null
@@ -0,0 +1,10 @@
+This tests that option-tab moves you from a text field to a link, but plain old tab does not.
+
+Note: Option is the Mac name for what other platforms call Alt.
+
+ link  link
+SUCCESS: Option-tab did tab to the link (textField).
+SUCCESS: Plain old tab did not tab to the link (textField).
+SUCCESS: Option-tab did tab to the link (searchField).
+SUCCESS: Plain old tab did not tab to the link (searchField).
+
diff --git a/LayoutTests/fast/events/option-tab.html b/LayoutTests/fast/events/option-tab.html
new file mode 100644 (file)
index 0000000..ee355f6
--- /dev/null
@@ -0,0 +1,38 @@
+<p>This tests that option-tab moves you from a text field to a link, but plain old tab does not.</p>
+<p>Note: Option is the Mac name for what other platforms call Alt.</p>
+<input id="textField" type=text> <a onfocus="window.linkFocused = true" href="http://www.apple.com">link</a>
+<input id="searchField" type=search> <a onfocus="window.linkFocused = true" href="http://www.apple.com">link</a>
+<pre id="console">
+</pre>
+<script>
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function test(fieldId)
+{
+    window.linkFocused = false;
+    document.getElementById(fieldId).focus();
+    var event = document.createEvent("KeyboardEvents");
+    event.initKeyboardEvent("keypress", true, true, document.defaultView, "U+000009", 0, false, true, false, false, false);
+    document.getElementById(fieldId).dispatchEvent(event);
+    if (window.linkFocused)
+        document.getElementById("console").innerHTML += "SUCCESS: Option-tab did tab to the link (" + fieldId + ").\n";
+    else
+        document.getElementById("console").innerHTML += "FAIL: Option-tab did not tab to the link (" + fieldId + ").\n";
+
+    window.linkFocused = false;
+    document.getElementById(fieldId).focus();
+    event = document.createEvent("KeyboardEvents");
+    event.initKeyboardEvent("keypress", true, true, document.defaultView, "U+000009", 0, false, false, false, false, false);
+    document.getElementById(fieldId).dispatchEvent(event);
+    if (window.linkFocused)
+        document.getElementById("console").innerHTML += "FAIL: Plain old tab did tab to the link (" + fieldId + ").\n";
+    else
+        document.getElementById("console").innerHTML += "SUCCESS: Plain old tab did not tab to the link (" + fieldId + ").\n";
+}
+
+test("textField");
+test("searchField");
+
+</script>
index 3efb242a886ee8906e3991ba83dd277ec2f00338..9b6f7d1c962214eec6ae8ccc00dfe81a0bd88c5e 100644 (file)
@@ -1,3 +1,103 @@
+2006-11-08  Darin Adler  <darin@apple.com>
+
+        Reviewed by Anders.
+
+        - added event parameters to focus-related functions so we can
+          implement the "option-tab to all links" behavior without relying
+          on a global "current event" -- also makes it work with DOM events
+
+        * page/Frame.h: Removed unneeded includes. Moved some functions
+        that were misplaced into the appropriate sections.
+        * page/Frame.cpp:
+        (WebCore::Frame::doTextFieldCommandFromEvent): Changed parameter from
+        PlatformKeyboardEvent to the DOM keyboard event class.
+        (WebCore::Frame::tabsToLinks): Added event parameter.
+        (WebCore::Frame::tabsToAllControls): Ditto.
+        (WebCore::scanForForm): Fixed code that incorrectly assumes
+        that an iframe is an HTMLFrameElement (no longer true since Geoff
+        changed the class hierarchy a bit).
+        (WebCore::Frame::hitTestResultAtPoint): Ditto.
+
+        * bridge/mac/FrameMac.h: Removed unneeded includes. Moved some functions
+        that were misplaced into the appropriate sections.
+        * bridge/mac/FrameMac.mm:
+        (WebCore::selectorForKeyEvent): Changed to use a DOM event instead of
+        a PlatformKeyboardEvent.
+        (WebCore::FrameMac::nextKeyViewInFrame): Changed to use currentKeyboardEvent()
+        and pass event into next/previousFocusNode.
+        (WebCore::FrameMac::currentKeyboardEvent): Added. Creates a DOM event from
+        the AppKit current event, if it's a keyboard event. Really just a hack that's
+        needed to preserve some code we can remove once we deal with the last NSView-
+        based form control.
+        (WebCore::isKeyboardOptionTab): Added.
+        (WebCore::FrameMac::tabsToLinks): Added event parameter, used to check if the
+        option (alt) key is down.
+        (WebCore::FrameMac::tabsToAllControls): Ditto.
+        (WebCore::FrameMac::keyEvent): Changed call to prepareForUserAction() to just
+        call resetMultipleFormSubmissionProtection() explicitly instead.
+        (WebCore::FrameMac::mouseDown): Ditto.
+
+        * bridge/mac/WebCoreAXObject.mm:
+        (-[WebCoreAXObject accessibilityDescription]): Fixed code that incorrectly
+        assumes that an iframe is an HTMLFrameElement (no longer true since Geoff
+        changed the class hierarchy a bit).
+        (-[WebCoreAXObject accessibilityPerformAction:]): Changed call to
+        prepareForUserAction() to call resetMultipleFormSubmissionProtection()
+        explicitly instead.
+
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::advanceFocus): Changed function to take an
+        event parameter, and decide the direction based on the shift key
+        modifier instead of a passed-in boolean.
+
+        * dom/Document.h:
+        * dom/Document.cpp:
+        (WebCore::Document::nextFocusNode): Added event parameter.
+        (WebCore::Document::previousFocusNode): Ditto.
+        * dom/Node.h:
+        * dom/Node.cpp:
+        (WebCore::Node::isKeyboardFocusable): Ditto.
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::isKeyboardFocusable): Ditto.
+        * html/HTMLGenericFormElement.h:
+        * html/HTMLGenericFormElement.cpp:
+        (WebCore::HTMLGenericFormElement::isKeyboardFocusable): Ditto.
+        * html/HTMLInputElement.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::isKeyboardFocusable): Ditto.
+        (WebCore::HTMLInputElement::defaultEventHandler): Ditto.
+        * html/HTMLSelectElement.h:
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::isKeyboardFocusable): Ditto.
+        * html/HTMLTextAreaElement.h:
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::isKeyboardFocusable): Ditto.
+
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::defaultEventHandler): Pass event to the
+        advanceFocus function.
+
+        * platform/TextField.h:
+        * platform/mac/TextFieldMac.mm: Removed the non-search field code.
+
+        * platform/mac/WebCoreTextField.h:
+        * platform/mac/WebCoreTextField.mm: Removed the non-search field code.
+        (-[WebCoreTextFieldController controlTextDidChange:]): Removed the
+        call to FrameMac::handleKeyboardOptionTabInView, which is no longer
+        needed since the default handler in HTMLInputElement takes care of
+        option-tab.
+
+        * platform/mac/SliderMac.mm:
+        (-[WebCoreSlider canBecomeKeyView]): Changed to use currentKeyboardEvent()
+        and pass event into tabsToAllControls.
+        (Slider::focusPolicy): Ditto.
+
+        * rendering/RenderLineEdit.cpp:
+        (WebCore::RenderLineEdit::RenderLineEdit): Removed the non-search field code.
+        (WebCore::RenderLineEdit::updateFromElement): Ditto.
+
 2006-11-08  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Dave Harrison, Oliver, and Darin 
index a32c70d69eab5f4c5c99522fa6686cee6d0862b3..e1195e2d65c344a3e32e6c0f91f5f5f0e2409107 100644 (file)
@@ -29,7 +29,6 @@
 #import "ClipboardAccessPolicy.h"
 #import "Frame.h"
 #import "PlatformMouseEvent.h"
-#import "StringHash.h"
 #import "WebCoreKeyboardAccess.h"
 
 class NPObject;
@@ -77,9 +76,8 @@ typedef int NSWritingDirection;
 namespace WebCore {
 
 class ClipboardMac;
-class EditorClient;
 class HTMLTableCellElement;
-class VisiblePosition;
+class RenderWidget;
 
 enum SelectionDirection {
     SelectingNext,
@@ -171,6 +169,9 @@ public:
     virtual void markMisspellingsInAdjacentWords(const VisiblePosition&);
     virtual void markMisspellings(const Selection&);
 
+    virtual bool canRedo() const;
+    virtual bool canUndo() const;
+
     bool canDHTMLCut();
     bool canDHTMLCopy();
     bool canDHTMLPaste();
@@ -200,8 +201,15 @@ public:
     void setMarkedTextRange(const Range* , NSArray* attributes, NSArray* ranges);
     virtual Range* markedTextRange() const { return m_markedTextRange.get(); }
 
+    virtual void textFieldDidBeginEditing(Element*);
+    virtual void textFieldDidEndEditing(Element*);
+    virtual void textDidChangeInTextField(Element*);
+    virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
+    virtual void textWillBeDeletedInTextField(Element*);
+    virtual void textDidChangeInTextArea(Element*);
+    
 private:
-    bool dispatchCPPEvent(const AtomicString &eventType, ClipboardAccessPolicy policy);
+    bool dispatchCPPEvent(const AtomicString& eventType, ClipboardAccessPolicy);
 
     void freeClipboard();
 
@@ -216,11 +224,11 @@ public:
     NSView* nextKeyView(Node* startingPoint, SelectionDirection);
     NSView* nextKeyViewInFrameHierarchy(Node* startingPoint, SelectionDirection);
     static NSView* nextKeyViewForWidget(Widget* startingPoint, SelectionDirection);
-    static bool currentEventIsKeyboardOptionTab();
-    static bool handleKeyboardOptionTabInView(NSView* view);
-    
-    virtual bool tabsToLinks() const;
-    virtual bool tabsToAllControls() const;
+
+    PassRefPtr<KeyboardEvent> currentKeyboardEvent() const;
+
+    virtual bool tabsToLinks(KeyboardEvent*) const;
+    virtual bool tabsToAllControls(KeyboardEvent*) const;
     
     static bool currentEventIsMouseDownInWidget(Widget* candidate);
 
@@ -256,20 +264,9 @@ public:
     
     WebCoreKeyboardUIMode keyboardUIMode() const;
 
-    virtual void textFieldDidBeginEditing(Element*);
-    virtual void textFieldDidEndEditing(Element*);
-    virtual void textDidChangeInTextField(Element*);
-    virtual bool doTextFieldCommandFromEvent(Element*, const PlatformKeyboardEvent*);
-    virtual void textWillBeDeletedInTextField(Element*);
-    virtual void textDidChangeInTextArea(Element*);
-    
     virtual bool inputManagerHasMarkedText() const;
     
-    // Implementation of CSS property -webkit-user-drag == auto
-    virtual bool shouldDragAutoNode(Node*, const IntPoint&) const;
-
-    virtual bool canRedo() const;
-    virtual bool canUndo() const;
+    virtual bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto
 
     virtual bool mouseDownMayStartSelect() const { return _mouseDownMayStartSelect; }
     
index 3a8434fd09cc910ed47509f06c291a1dad72cf0c..4869f95dd8cc20cf4df1e24057e6268767816fb0 100644 (file)
@@ -31,7 +31,6 @@
 #import "BeforeUnloadEvent.h"
 #import "BlockExceptions.h"
 #import "Chrome.h"
-#import "CSSComputedStyleDeclaration.h"
 #import "Cache.h"
 #import "ClipboardEvent.h"
 #import "ClipboardMac.h"
 #import "GraphicsContext.h"
 #import "HTMLDocument.h"
 #import "HTMLFormElement.h"
-#import "HTMLFrameElement.h"
 #import "HTMLGenericFormElement.h"
 #import "HTMLInputElement.h"
 #import "HTMLNames.h"
 #import "HTMLTableCellElement.h"
 #import "HitTestRequest.h"
 #import "HitTestResult.h"
+#import "KeyboardEvent.h"
 #import "Logging.h"
 #import "MouseEventWithHitTestResults.h"
 #import "Page.h"
@@ -131,35 +130,26 @@ struct FrameMacDragInfo {
 
 static FrameMacDragInfo* sharedDragInfo;
 
-static const unsigned int escChar = 27;
-static SEL selectorForKeyEvent(const PlatformKeyboardEvent* event)
+static SEL selectorForKeyEvent(KeyboardEvent* event)
 {
-    // FIXME: This helper function is for the autofill code so the bridge can pass a selector to the form delegate.  
-    // Eventually, we should move all of the autofill code down to WebKit and remove the need for this function by
+    // FIXME: This helper function is for the auto-fill code so the bridge can pass a selector to the form delegate.  
+    // Eventually, we should move all of the auto-fill code down to WebKit and remove the need for this function by
     // not relying on the selector in the new implementation.
-    String key = event->unmodifiedText();
-    if (key.length() != 1)
-        return 0;
-
-    SEL selector = NULL;
-    switch (key[0U]) {
-    case NSUpArrowFunctionKey:
-        selector = @selector(moveUp:); break;
-    case NSDownArrowFunctionKey:
-        selector = @selector(moveDown:); break;
-    case escChar:
-        selector = @selector(cancel:); break;
-    case NSTabCharacter:
-        selector = @selector(insertTab:); break;
-    case NSBackTabCharacter:
-        selector = @selector(insertBacktab:); break;
-    case NSNewlineCharacter:
-    case NSCarriageReturnCharacter:
-    case NSEnterCharacter:
-        selector = @selector(insertNewline:); break;
-        break;
-    }
-    return selector;
+    String key = event->keyIdentifier();
+    if (key == "Up")
+        return @selector(moveUp:);
+    if (key == "Down")
+        return @selector(moveDown:);
+    if (key == "U+00001B")
+        return @selector(cancel:);
+    if (key == "U+000009") {
+        if (event->shiftKey())
+            return @selector(insertBacktab:);
+        return @selector(insertTab:);
+    }
+    if (key == "Enter")
+        return @selector(insertNewline:);
+    return 0;
 }
 
 FrameMac::FrameMac(Page* page, Element* ownerElement, PassRefPtr<EditorClient> client)
@@ -636,20 +626,18 @@ void FrameMac::advanceToNextMisspelling(bool startBeforeSelection)
 
 bool FrameMac::wheelEvent(NSEvent *event)
 {
-    FrameView *v = d->m_view.get();
-
-    if (v) {
+    if (d->m_view) {
         NSEvent *oldCurrentEvent = _currentEvent;
         _currentEvent = HardRetain(event);
 
-        PlatformWheelEvent qEvent(event);
-        v->handleWheelEvent(qEvent);
+        PlatformWheelEvent wheelEvent(event);
+        d->m_view->handleWheelEvent(wheelEvent);
 
         ASSERT(_currentEvent == event);
         HardRelease(event);
         _currentEvent = oldCurrentEvent;
 
-        if (qEvent.isAccepted())
+        if (wheelEvent.isAccepted())
             return true;
     }
     
@@ -670,11 +658,14 @@ NSView* FrameMac::nextKeyViewInFrame(Node* n, SelectionDirection direction, bool
     Document* doc = document();
     if (!doc)
         return nil;
-    
+
+    RefPtr<KeyboardEvent> event = currentKeyboardEvent();
+
     RefPtr<Node> node = n;
     for (;;) {
         node = direction == SelectingNext
-            ? doc->nextFocusNode(node.get()) : doc->previousFocusNode(node.get());
+            ? doc->nextFocusNode(node.get(), event.get())
+            : doc->previousFocusNode(node.get(), event.get());
         if (!node)
             return nil;
         
@@ -770,7 +761,7 @@ NSView *FrameMac::nextKeyViewForWidget(Widget *startingWidget, SelectionDirectio
     return Mac(frameForNode(node))->nextKeyView(node, direction);
 }
 
-bool FrameMac::currentEventIsMouseDownInWidget(Widget *candidate)
+bool FrameMac::currentEventIsMouseDownInWidget(Widgetcandidate)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     switch ([[NSApp currentEvent] type]) {
@@ -788,73 +779,51 @@ bool FrameMac::currentEventIsMouseDownInWidget(Widget *candidate)
     return frameForNode(node)->d->m_view->nodeUnderMouse() == node;
 }
 
-bool FrameMac::currentEventIsKeyboardOptionTab()
+PassRefPtr<KeyboardEvent> FrameMac::currentKeyboardEvent() const
 {
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    NSEvent *evt = [NSApp currentEvent];
-    if ([evt type] != NSKeyDown) {
-        return NO;
-    }
-
-    if (([evt modifierFlags] & NSAlternateKeyMask) == 0) {
-        return NO;
+    NSEvent *event = [NSApp currentEvent];
+    if (!event)
+        return 0;
+    switch ([event type]) {
+        case NSKeyDown:
+        case NSKeyUp:
+            return new KeyboardEvent(event, document() ? document()->defaultView() : 0);
+        default:
+            return 0;
     }
-    
-    NSString *chars = [evt charactersIgnoringModifiers];
-    if ([chars length] != 1)
-        return NO;
-    
-    const unichar tabKey = 0x0009;
-    const unichar shiftTabKey = 0x0019;
-    unichar c = [chars characterAtIndex:0];
-    if (c != tabKey && c != shiftTabKey)
-        return NO;
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return YES;
 }
 
-bool FrameMac::handleKeyboardOptionTabInView(NSView *view)
+static bool isKeyboardOptionTab(KeyboardEvent* event)
 {
-    if (FrameMac::currentEventIsKeyboardOptionTab()) {
-        if (([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) != 0) {
-            [[view window] selectKeyViewPrecedingView:view];
-        } else {
-            [[view window] selectKeyViewFollowingView:view];
-        }
-        return YES;
-    }
-    
-    return NO;
+    return event
+        && (event->type() == keydownEvent || event->type() == keypressEvent)
+        && event->altKey()
+        && event->keyIdentifier() == "U+000009";
 }
 
-bool FrameMac::tabsToLinks() const
+bool FrameMac::tabsToLinks(KeyboardEvent* event) const
 {
     if ([_bridge keyboardUIMode] & WebCoreKeyboardAccessTabsToLinks)
-        return !FrameMac::currentEventIsKeyboardOptionTab();
-    else
-        return FrameMac::currentEventIsKeyboardOptionTab();
+        return !isKeyboardOptionTab(event);
+    return isKeyboardOptionTab(event);
 }
 
-bool FrameMac::tabsToAllControls() const
+bool FrameMac::tabsToAllControls(KeyboardEvent* event) const
 {
     WebCoreKeyboardUIMode keyboardUIMode = [_bridge keyboardUIMode];
-    BOOL handlingOptionTab = FrameMac::currentEventIsKeyboardOptionTab();
+    bool handlingOptionTab = isKeyboardOptionTab(event);
 
     // If tab-to-links is off, option-tab always highlights all controls
-    if ((keyboardUIMode & WebCoreKeyboardAccessTabsToLinks) == 0 && handlingOptionTab) {
-        return YES;
-    }
+    if ((keyboardUIMode & WebCoreKeyboardAccessTabsToLinks) == 0 && handlingOptionTab)
+        return true;
     
     // If system preferences say to include all controls, we always include all controls
-    if (keyboardUIMode & WebCoreKeyboardAccessFull) {
-        return YES;
-    }
+    if (keyboardUIMode & WebCoreKeyboardAccessFull)
+        return true;
     
     // Otherwise tab-to-links includes all controls, unless the sense is flipped via option-tab.
-    if (keyboardUIMode & WebCoreKeyboardAccessTabsToLinks) {
+    if (keyboardUIMode & WebCoreKeyboardAccessTabsToLinks)
         return !handlingOptionTab;
-    }
     
     return handlingOptionTab;
 }
@@ -1017,25 +986,21 @@ bool FrameMac::keyEvent(NSEvent *event)
             return false;
     }
     
-    if ([event type] == NSKeyDown) {
-        prepareForUserAction();
-    }
+    if ([event type] == NSKeyDown)
+        loader()->resetMultipleFormSubmissionProtection();
 
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = HardRetain(event);
 
-    PlatformKeyboardEvent qEvent(event);
-    result = !EventTargetNodeCast(node)->dispatchKeyEvent(qEvent);
+    result = !EventTargetNodeCast(node)->dispatchKeyEvent(event);
 
     // We want to send both a down and a press for the initial key event.
-    // To get KHTML to do this, we send a second KeyPress with "is repeat" set to true,
+    // To get the rest of WebCore to do this, we send a second KeyPress with "is repeat" set to true,
     // which causes it to send a press to the DOM.
-    // That's not a great hack; it would be good to do this in a better way.
-    if ([event type] == NSKeyDown && ![event isARepeat]) {
-        PlatformKeyboardEvent repeatEvent(event, true);
-        if (!EventTargetNodeCast(node)->dispatchKeyEvent(repeatEvent))
+    // We should do this a better way.
+    if ([event type] == NSKeyDown && ![event isARepeat])
+        if (!EventTargetNodeCast(node)->dispatchKeyEvent(PlatformKeyboardEvent(event, true)))
             result = true;
-    }
 
     ASSERT(_currentEvent == event);
     HardRelease(event);
@@ -1615,7 +1580,7 @@ void FrameMac::mouseDown(NSEvent *event)
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    prepareForUserAction();
+    loader()->resetMultipleFormSubmissionProtection();
 
     _mouseDownView = nil;
     sharedDragInfo->m_dragSrc = 0;
@@ -1757,10 +1722,9 @@ void FrameMac::sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent)
 
 void FrameMac::mouseMoved(NSEvent *event)
 {
-    FrameView *v = d->m_view.get();
     // Reject a mouse moved if the button is down - screws up tracking during autoscroll
     // These happen because WebKit sometimes has to fake up moved events.
-    if (!v || d->m_bMousePressed || _sendingEventToSubview)
+    if (!d->m_view || d->m_bMousePressed || _sendingEventToSubview)
         return;
     
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -1768,7 +1732,7 @@ void FrameMac::mouseMoved(NSEvent *event)
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = HardRetain(event);
     
-    v->handleMouseMoveEvent(event);
+    d->m_view->handleMouseMoveEvent(event);
     
     ASSERT(_currentEvent == event);
     HardRelease(event);
@@ -1784,11 +1748,9 @@ bool FrameMac::shouldDragAutoNode(Node* node, const IntPoint& point) const
     // This saves a bunch of expensive calls (creating WC and WK element dicts) as we walk farther up
     // the node hierarchy, and we also don't have to cook up a way to ask WK about non-leaf nodes
     // (since right now WK just hit-tests using a cached lastMouseDown).
-    if (!node->hasChildNodes() && d->m_view) {
-        NSPoint eventLoc = d->m_view->contentsToWindow(point);
-        return [_bridge mayStartDragAtEventLocation:eventLoc];
-    } else
-        return NO;
+    if (node->hasChildNodes() || !d->m_view)
+        return false;
+    return [_bridge mayStartDragAtEventLocation:d->m_view->contentsToWindow(point)];
 }
 
 bool FrameMac::sendContextMenuEvent(NSEvent *event)
@@ -2452,14 +2414,9 @@ void FrameMac::textDidChangeInTextArea(Element* textarea)
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-bool FrameMac::doTextFieldCommandFromEvent(Element* input, const PlatformKeyboardEvent* event)
+bool FrameMac::doTextFieldCommandFromEvent(Element* input, KeyboardEvent* event)
 {
-    // FIXME: We might eventually need to make sure key bindings for editing work even with
-    // events created with the DOM API. Those don't have a PlatformKeyboardEvent.
-    if (!event)
-        return false;
-
-    BOOL result = false;
+    bool result = false;
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     SEL selector = selectorForKeyEvent(event);
     if (selector)
index 07b8ef55cbb13219ee327637162e2d27eac05c68..26efc118563ed403c856f15d769db5aa0da59156 100644 (file)
 #import "Document.h"
 #import "EventNames.h"
 #import "FontData.h"
+#import "FrameLoader.h"
 #import "FrameMac.h"
 #import "FrameView.h"
 #import "HTMLAreaElement.h"
 #import "HTMLCollection.h"
-#import "HTMLFrameElement.h"
+#import "HTMLFrameElementBase.h"
 #import "HTMLInputElement.h"
 #import "HTMLLabelElement.h"
 #import "HTMLMapElement.h"
@@ -646,7 +647,7 @@ static HTMLLabelElement* labelForElement(Element* element)
     return nil;
 }
 
--(NSString*)accessibilityDescription
+- (NSString*)accessibilityDescription
 {
     if (!m_renderer || m_areaElement)
         return nil;
@@ -664,8 +665,8 @@ static HTMLLabelElement* labelForElement(Element* element)
     if ([self isWebArea]) {
         Node* owner = m_renderer->document()->ownerElement();
         if (owner && (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag))) {
-            HTMLFrameElement* frameElement = static_cast<HTMLFrameElement*>(owner);
-            return (NSString*)frameElement->name();
+            HTMLFrameElementBase* frameElement = static_cast<HTMLFrameElementBase*>(owner);
+            return frameElement->name();
         }
     }
     
@@ -881,7 +882,7 @@ static IntRect boundingBoxRect(RenderObject* obj)
             return;
 
         if (Frame* f = actionElement->document()->frame())
-            Mac(f)->prepareForUserAction();
+            f->loader()->resetMultipleFormSubmissionProtection();
 
         actionElement->accessKeyAction(true);
     }
index d2f0b7178ae42706318a93f9a5809fb62921b335..3e4c1bd6a78e927052e6f1690de18418f06bff25 100644 (file)
@@ -1414,7 +1414,7 @@ void Document::determineParseMode(const String&)
     hMode = XHtml;
 }
 
-Node* Document::nextFocusNode(Node* fromNode)
+Node* Document::nextFocusNode(Node* fromNode, KeyboardEvent* event)
 {
     unsigned short fromTabIndex;
 
@@ -1423,15 +1423,15 @@ Node* Document::nextFocusNode(Node* fromNode)
 
         int lowestTabIndex = 65535;
         for (Node* n = this; n; n = n->traverseNextNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() > 0 && n->tabIndex() < lowestTabIndex)
-                    lowestTabIndex = n->tabIndex();
+            if (n->isKeyboardFocusable(event) && n->tabIndex() > 0 && n->tabIndex() < lowestTabIndex)
+                lowestTabIndex = n->tabIndex();
 
         if (lowestTabIndex == 65535)
             lowestTabIndex = 0;
 
         // Go to the first node in the document that has the desired tab index
         for (Node* n = this; n; n = n->traverseNextNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == lowestTabIndex)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == lowestTabIndex)
                 return n;
 
         return 0;
@@ -1443,7 +1443,7 @@ Node* Document::nextFocusNode(Node* fromNode)
         // Just need to find the next selectable node after fromNode (in document order) that has a tab index of 0
         Node* n;
         for (n = fromNode->traverseNextNode(); n; n = n->traverseNextNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == 0)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == 0)
                 break;
         
         return n;
@@ -1459,7 +1459,7 @@ Node* Document::nextFocusNode(Node* fromNode)
     for (Node* n = this; n; n = n->traverseNextNode()) {
         if (n == fromNode)
             reachedFromNode = true;
-        else if (n->isKeyboardFocusable()
+        else if (n->isKeyboardFocusable(event)
                  && ((reachedFromNode && n->tabIndex() >= fromTabIndex)
                      || (!reachedFromNode && n->tabIndex() > fromTabIndex)))
             // We found a selectable node with a tab index at least as high as fromNode's. Keep searching though,
@@ -1471,7 +1471,7 @@ Node* Document::nextFocusNode(Node* fromNode)
         // No next node with a tab index -> just take first node with tab index of 0
         Node* n;
         for (n = this; n; n = n->traverseNextNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == 0)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == 0)
                 break;
         
         return n;
@@ -1479,19 +1479,19 @@ Node* Document::nextFocusNode(Node* fromNode)
 
     // Search forwards from fromNode
     for (Node* n = fromNode->traverseNextNode(); n; n = n->traverseNextNode())
-        if (n->isKeyboardFocusable() && n->tabIndex() == lowestSuitableTabIndex)
+        if (n->isKeyboardFocusable(event) && n->tabIndex() == lowestSuitableTabIndex)
             return n;
 
     // The next node isn't after fromNode, start from the beginning of the document
     for (Node* n = this; n != fromNode; n = n->traverseNextNode())
-        if (n->isKeyboardFocusable() && n->tabIndex() == lowestSuitableTabIndex)
+        if (n->isKeyboardFocusable(event) && n->tabIndex() == lowestSuitableTabIndex)
             return n;
 
     ASSERT_NOT_REACHED();
     return 0;
 }
 
-Node* Document::previousFocusNode(Node* fromNode)
+Node* Document::previousFocusNode(Node* fromNode, KeyboardEvent* event)
 {
     Node* lastNode;
     for (lastNode = this; lastNode->lastChild(); lastNode = lastNode->lastChild());
@@ -1501,7 +1501,7 @@ Node* Document::previousFocusNode(Node* fromNode)
 
         int highestTabIndex = 0;
         for (Node* n = lastNode; n; n = n->traversePreviousNode()) {
-            if (n->isKeyboardFocusable()) {
+            if (n->isKeyboardFocusable(event)) {
                 if (n->tabIndex() == 0)
                     return n;
                 else if (n->tabIndex() > highestTabIndex)
@@ -1511,7 +1511,7 @@ Node* Document::previousFocusNode(Node* fromNode)
 
         // No node with a tab index of 0; just go to the last node with the highest tab index
         for (Node* n = lastNode; n; n = n->traversePreviousNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == highestTabIndex)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == highestTabIndex)
                 return n;
 
         return 0;
@@ -1523,7 +1523,7 @@ Node* Document::previousFocusNode(Node* fromNode)
         // Find the previous selectable node before fromNode (in document order) that has a tab index of 0
         Node* n;
         for (n = fromNode->traversePreviousNode(); n; n = n->traversePreviousNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == 0)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == 0)
                 break;
         
         if (n)
@@ -1532,14 +1532,14 @@ Node* Document::previousFocusNode(Node* fromNode)
         // No previous nodes with a 0 tab index, go to the last node in the document that has the highest tab index
         int highestTabIndex = 0;
         for (n = this; n; n = n->traverseNextNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() > highestTabIndex)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() > highestTabIndex)
                 highestTabIndex = n->tabIndex();
 
         if (!highestTabIndex)
             return 0;
 
         for (n = lastNode; n; n = n->traversePreviousNode())
-            if (n->isKeyboardFocusable() && n->tabIndex() == highestTabIndex)
+            if (n->isKeyboardFocusable(event) && n->tabIndex() == highestTabIndex)
                 return n;
 
         ASSERT_NOT_REACHED();
@@ -1554,7 +1554,7 @@ Node* Document::previousFocusNode(Node* fromNode)
 
     bool reachedFromNode = false;
     for (Node* n = this; n; n = n->traverseNextNode()) {
-        if (n->isKeyboardFocusable() &&
+        if (n->isKeyboardFocusable(event) &&
             ((!reachedFromNode && (n->tabIndex() <= fromTabIndex)) ||
              (reachedFromNode && (n->tabIndex() < fromTabIndex)))  &&
             (n->tabIndex() > highestSuitableTabIndex) &&
@@ -1576,12 +1576,12 @@ Node* Document::previousFocusNode(Node* fromNode)
 
     // Search backwards from fromNode
     for (Node* n = fromNode->traversePreviousNode(); n; n = n->traversePreviousNode())
-        if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))
+        if (n->isKeyboardFocusable(event) && (n->tabIndex() == highestSuitableTabIndex))
             return n;
     
     // The previous node isn't before fromNode, start from the end of the document
     for (Node* n = lastNode; n != fromNode; n = n->traversePreviousNode())
-        if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))
+        if (n->isKeyboardFocusable(event) && (n->tabIndex() == highestSuitableTabIndex))
             return n;
 
     ASSERT_NOT_REACHED();
index 2092293c4c3d91227bc130239fc3ed5488b65bf1..82dee237782595924dda454fcbceaa751926470b 100644 (file)
@@ -458,7 +458,7 @@ public:
      *
      * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
      */
-    Node* nextFocusNode(Node* fromNode);
+    Node* nextFocusNode(Node* fromNode, KeyboardEvent*);
 
     /**
      * Searches through the document, starting from fromNode, for the previous selectable element (that comes _before_)
@@ -471,7 +471,7 @@ public:
      *
      * See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1
      */
-    Node* previousFocusNode(Node* fromNode);
+    Node* previousFocusNode(Node* fromNode, KeyboardEvent*);
 
     int nodeAbsIndex(Node*);
     Node* nodeWithAbsIndex(int absIndex);
index ced9e7b6cf762cf3decd2970706b3d2e4a16247a..e95984db158691c60cc0d04f9a1ce208e8f8e623 100644 (file)
@@ -529,7 +529,7 @@ void EventTargetNode::defaultEventHandler(Event* event)
         KeyboardEvent* keyEvent = static_cast<KeyboardEvent*>(event);
         if (keyEvent->keyIdentifier() == "U+000009") {
             Frame* frame = document()->frame();
-            if (frame && frame->view() && frame->view()->advanceFocus(!keyEvent->shiftKey()))
+            if (frame && frame->view() && frame->view()->advanceFocus(keyEvent))
                 event->setDefaultHandled();
         }
     }
index b682b6157ff814dc88c06444376cb06bd373553b..37929e8f408b937c362488e28b401e6eec20b09d 100644 (file)
@@ -363,7 +363,7 @@ bool Node::isFocusable() const
     return false;
 }
 
-bool Node::isKeyboardFocusable() const
+bool Node::isKeyboardFocusable(KeyboardEvent*) const
 {
     return isFocusable();
 }
index 8aad4c4085070da82f65c85ed55a1f7b754b787b..d29c55266366d406cefee4e000918475aff93a7b 100644 (file)
@@ -42,6 +42,7 @@ class Element;
 class Event;
 class EventListener;
 class IntRect;
+class KeyboardEvent;
 class NamedAttrMap;
 class NodeList;
 class PlatformKeyboardEvent;
@@ -237,7 +238,7 @@ public:
      */
     virtual bool supportsFocus() const { return isFocusable(); }
     virtual bool isFocusable() const;
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual bool isMouseFocusable() const;
 
     virtual bool isControl() const { return false; } // Eventually the notion of what is a control will be extensible.
index 3b1d66fc49ee9e0c33789572c4e335106a28cf0d..e14ceec04d54f071a3e3042f98888b15cfb9bbdd 100644 (file)
@@ -107,7 +107,7 @@ bool HTMLAnchorElement::isMouseFocusable() const
     return false;
 }
 
-bool HTMLAnchorElement::isKeyboardFocusable() const
+bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const
 {
     if (!isFocusable())
         return false;
@@ -115,7 +115,7 @@ bool HTMLAnchorElement::isKeyboardFocusable() const
     if (!document()->frame())
         return false;
 
-    return document()->frame()->tabsToLinks();
+    return document()->frame()->tabsToLinks(event);
 }
 
 void HTMLAnchorElement::defaultEventHandler(Event* evt)
index 08796f33cd5bcb09e08b0e79c9060e213dcb1619..dfbb565cfb8472ee9451acb1aa6896240b0c42a1 100644 (file)
@@ -42,7 +42,7 @@ public:
 
     virtual bool supportsFocus() const;
     virtual bool isMouseFocusable() const;
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual bool isFocusable() const;
     virtual void parseMappedAttribute(MappedAttribute*);
     virtual void defaultEventHandler(Event*);
index 8da2900b519979a7aa1f8d8a071dbb2abd22e13a..8a709bb9337f8a5d01be4475ecfb979a766e5542 100644 (file)
@@ -203,7 +203,7 @@ bool HTMLGenericFormElement::isFocusable() const
     return true;
 }
 
-bool HTMLGenericFormElement::isKeyboardFocusable() const
+bool HTMLGenericFormElement::isKeyboardFocusable(KeyboardEvent* event) const
 {
     if (isFocusable()) {
         if (renderer()->isWidget()) {
@@ -211,7 +211,7 @@ bool HTMLGenericFormElement::isKeyboardFocusable() const
                 (static_cast<RenderWidget*>(renderer())->widget()->focusPolicy() & Widget::TabFocus);
         }
         if (document()->frame())
-            return document()->frame()->tabsToAllControls();
+            return document()->frame()->tabsToAllControls(event);
     }
     return false;
 }
index b6244791e0c856c04908888bca0cf19894552461..318fea5dfe6ac22e219764076841f43f512abc5e 100644 (file)
@@ -73,7 +73,7 @@ public:
 
     virtual bool supportsFocus() const { return isFocusable() || (!disabled() && document() && !document()->haveStylesheetsLoaded()); }
     virtual bool isFocusable() const;
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual bool isMouseFocusable() const;
     virtual bool isEnumeratable() const { return false; }
 
index 333e8b2c369a778d7a2fa52bc33767b99b375b2c..65fca0252f13472da018736a60dd7b7197a2bf20 100644 (file)
@@ -134,14 +134,14 @@ const AtomicString& HTMLInputElement::name() const
     return m_name.isNull() ? emptyAtom : m_name;
 }
 
-bool HTMLInputElement::isKeyboardFocusable() const
+bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const
 {
     // If text fields can be focused, then they should always be keyboard focusable
     if (isNonWidgetTextField())
         return HTMLGenericFormElement::isFocusable();
         
     // If the base class says we can't be focused, then we can stop now.
-    if (!HTMLGenericFormElement::isKeyboardFocusable())
+    if (!HTMLGenericFormElement::isKeyboardFocusable(event))
         return false;
 
     if (inputType() == RADIO) {
@@ -1265,7 +1265,8 @@ void HTMLInputElement::defaultEventHandler(Event *evt)
         bool clickElement = false;
         bool clickDefaultFormButton = false;
     
-        if (isNonWidgetTextField() && document()->frame() && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt)->keyEvent())) {
+        if (isNonWidgetTextField() && document()->frame()
+                && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
             evt->setDefaultHandled();
             return;
         }
index 0b731c53aa114aeb282847025f01da493b6f69b0..bf2d28ff99281e2bb93629a9e49fa75af7f72c38 100644 (file)
@@ -62,7 +62,7 @@ public:
     virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     virtual int tagPriority() const { return 0; }
 
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual bool isMouseFocusable() const;
     virtual bool isEnumeratable() const { return inputType() != IMAGE; }
     virtual void focus();
index 34caff169e346212b28358eab0f37b972c0e51ce..64f61841be5076f08edd03d09558640064467814 100644 (file)
@@ -340,11 +340,11 @@ void HTMLSelectElement::parseMappedAttribute(MappedAttribute *attr)
         HTMLGenericFormElement::parseMappedAttribute(attr);
 }
 
-bool HTMLSelectElement::isKeyboardFocusable() const
+bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const
 {
     if (renderer())
         return isFocusable();
-    return HTMLGenericFormElement::isKeyboardFocusable();
+    return HTMLGenericFormElement::isKeyboardFocusable(event);
 }
 
 bool HTMLSelectElement::isMouseFocusable() const
index fa635330a502c4f471dc8f8d4355234c5618ee73..551955c85fdf029f85ff8d2141b83973b856ee98 100644 (file)
@@ -50,7 +50,7 @@ public:
 
     virtual const AtomicString& type() const;
     
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual bool isMouseFocusable() const;
 
     virtual void recalcStyle(StyleChange);
index 545ee11486993c38f106876b741faf1c4f54aaef..139097a8739fdd95b61def13c2013e3aa37ca28d 100644 (file)
@@ -182,7 +182,7 @@ void HTMLTextAreaElement::reset()
     setValue(defaultValue());
 }
 
-bool HTMLTextAreaElement::isKeyboardFocusable() const
+bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const
 {
     // If text areas can be focused, then they should always be keyboard focusable
     return HTMLGenericFormElement::isFocusable();
index 13d79a819a48a66775e25480d0098d6bc0dceecf..fd169db844a2a4a85ccd51f5d65987c384eb4144 100644 (file)
@@ -69,7 +69,7 @@ public:
     virtual void reset();
     virtual void defaultEventHandler(Event*);
     virtual bool isMouseFocusable() const;
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual void focus();
     virtual void updateFocusAppearance();
 
index 833a0860af8091ae5de2d813197c70429ba6acac..418f8f589f7fd7ef40b032d19574ea566e147cd9 100644 (file)
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "HTMLFormElement.h"
-#include "HTMLFrameElement.h"
+#include "HTMLFrameElementBase.h"
 #include "HTMLGenericFormElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
-#include "HTMLViewSourceDocument.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
 #include "IconDatabase.h"
@@ -66,9 +65,6 @@
 #include "NodeList.h"
 #include "Page.h"
 #include "PlatformScrollBar.h"
-#include "PlugInInfoStore.h"
-#include "Plugin.h"
-#include "PluginDocument.h"
 #include "RenderListBox.h"
 #include "RenderObject.h"
 #include "RenderPart.h"
@@ -76,7 +72,6 @@
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "SegmentedString.h"
-#include "TextDocument.h"
 #include "TextIterator.h"
 #include "TextResourceDecoder.h"
 #include "TypingCommand.h"
@@ -837,7 +832,7 @@ void Frame::textDidChangeInTextField(Element* input)
 {
 }
 
-bool Frame::doTextFieldCommandFromEvent(Element* input, const PlatformKeyboardEvent* evt)
+bool Frame::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
 {
     return false;
 }
@@ -936,12 +931,12 @@ void Frame::clearTypingStyle()
     d->m_typingStyle = 0;
 }
 
-bool Frame::tabsToLinks() const
+bool Frame::tabsToLinks(KeyboardEvent*) const
 {
     return true;
 }
 
-bool Frame::tabsToAllControls() const
+bool Frame::tabsToAllControls(KeyboardEvent*) const
 {
     return true;
 }
@@ -1306,7 +1301,7 @@ static HTMLFormElement *scanForForm(Node *start)
         else if (n->isHTMLElement() && static_cast<HTMLElement*>(n)->isGenericFormElement())
             return static_cast<HTMLGenericFormElement*>(n)->form();
         else if (n->hasTagName(frameTag) || n->hasTagName(iframeTag)) {
-            Node *childDoc = static_cast<HTMLFrameElement*>(n)->contentDocument();
+            Node *childDoc = static_cast<HTMLFrameElementBase*>(n)->contentDocument();
             if (HTMLFormElement *frameResult = scanForForm(childDoc))
                 return frameResult;
         }
@@ -1447,7 +1442,7 @@ HitTestResult Frame::hitTestResultAtPoint(const IntPoint& point, bool allowShado
         Widget* widget = static_cast<RenderWidget*>(n->renderer())->widget();
         if (!widget || !widget->isFrameView())
             break;
-        Frame* frame = static_cast<HTMLFrameElement*>(n)->contentFrame();
+        Frame* frame = static_cast<HTMLFrameElementBase*>(n)->contentFrame();
         if (!frame || !frame->renderer())
             break;
         int absX, absY;
@@ -1925,13 +1920,6 @@ void Frame::setMarkedTextMatchesAreHighlighted(bool flag)
     document()->repaintMarkers(DocumentMarker::TextMatch);
 }
 
-void Frame::prepareForUserAction()
-{
-    // Reset the multiple form submission protection code.
-    // We'll let you submit the same form twice if you do two separate user actions.
-    loader()->resetMultipleFormSubmissionProtection();
-}
-
 Node *Frame::mousePressNode()
 {
     return d->m_mousePressNode.get();
index 50f9063da542954f9a151f80ad71488fb55fd284..146c1506ab9fa8f1ccbbeb4c554e1bb84bc34425 100644 (file)
@@ -57,13 +57,11 @@ class CSSStyleDeclaration;
 class CommandByName;
 class DOMWindow;
 class Document;
-class DrawContentsEvent;
 class EditCommand;
 class Editor;
 class EditorClient;
 class Element;
 class FloatRect;
-class FormData;
 class FrameLoader;
 class FramePrivate;
 class FrameTree;
@@ -77,15 +75,10 @@ class KURL;
 class MouseEventWithHitTestResults;
 class Node;
 class Page;
-class PlatformKeyboardEvent;
-class Plugin;
 class Range;
-class RenderLayer;
 class RenderObject;
 class RenderPart;
 class RenderStyle;
-class RenderWidget;
-class ResourceRequest;
 class Selection;
 class SelectionController;
 class Settings;
@@ -295,6 +288,13 @@ public:
   
     CSSComputedStyleDeclaration* selectionComputedStyle(Node*& nodeToRemove) const;
 
+    virtual void textFieldDidBeginEditing(Element*);
+    virtual void textFieldDidEndEditing(Element*);
+    virtual void textDidChangeInTextField(Element*);
+    virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
+    virtual void textWillBeDeletedInTextField(Element* input);
+    virtual void textDidChangeInTextArea(Element*);
+
 // === to be moved into EventHandler
 
 public:
@@ -302,8 +302,8 @@ public:
 
     virtual bool lastEventIsMouseUp() const = 0;
 
-    virtual bool tabsToLinks() const;
-    virtual bool tabsToAllControls() const;
+    virtual bool tabsToLinks(KeyboardEvent*) const;
+    virtual bool tabsToAllControls(KeyboardEvent*) const;
     virtual void handleMousePressEvent(const MouseEventWithHitTestResults&);
     virtual void handleMouseMoveEvent(const MouseEventWithHitTestResults&);
     virtual void handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
@@ -323,9 +323,6 @@ public:
     static Node* nodeForWidget(const Widget*);
     static Frame* frameForNode(Node*);
 
-    // Call this method before handling a new user action, like on a mouse down or key down.
-    // Currently, all this does is clear the "don't submit form twice" data member.
-    void prepareForUserAction();
     Node* mousePressNode();
 
     void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
@@ -336,6 +333,8 @@ public:
     bool prohibitsScrolling() const;
     void setProhibitsScrolling(const bool);
   
+    virtual bool inputManagerHasMarkedText() const { return false; }
+
 private:
     void handleAutoscroll(RenderObject*);
     void startAutoscrollTimer();
@@ -371,15 +370,6 @@ public:
 
     virtual bool isContentEditable() const; // if true, everything in frame is editable
 
-    virtual void textFieldDidBeginEditing(Element*);
-    virtual void textFieldDidEndEditing(Element*);
-    virtual void textDidChangeInTextField(Element*);
-    virtual bool doTextFieldCommandFromEvent(Element*, const PlatformKeyboardEvent*);
-    virtual void textWillBeDeletedInTextField(Element* input);
-    virtual void textDidChangeInTextArea(Element*);
-
-    virtual bool inputManagerHasMarkedText() const { return false; }
-
     virtual void setSecureKeyboardEntry(bool) { }
     virtual bool isSecureKeyboardEntry() { return false; }
 
index d0c761e378085b9168dfb5c1bfaef98c0b5a872d..4a5ba2bb5162e8e351190e92660a6b0ccc84e04f 100644 (file)
@@ -43,6 +43,7 @@
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
 #include "Image.h"
+#include "KeyboardEvent.h"
 #include "MouseEvent.h"
 #include "MouseEventWithHitTestResults.h"
 #include "OverflowEvent.h"
@@ -57,7 +58,6 @@
 #include "Settings.h"
 #include "cssstyleselector.h"
 
-
 #ifdef SVG_SUPPORT
 #include "XLinkNames.h"
 #include "SVGNames.h"
@@ -1066,15 +1066,15 @@ bool FrameView::scrollTo(const IntRect& bounds)
     return scrollX != maxx && scrollY != maxy;
 }
 
-bool FrameView::advanceFocus(bool forward)
+bool FrameView::advanceFocus(KeyboardEvent* event)
 {
     Document* document = m_frame->document();
     if (!document)
         return false;
 
-    Node* node = forward
-        ? document->nextFocusNode(document->focusNode())
-        : document->previousFocusNode(document->focusNode());
+    Node* node = event->shiftKey()
+        ? document->previousFocusNode(document->focusNode(), event)
+        : document->nextFocusNode(document->focusNode(), event);
 
     if (!node)
         // FIXME: Need to support tabbing out of the document to the UI.
index 41cdc688aba06d4bddf27e774866a44070e7b98e..87215fb9f5f02eb2fcfa1b9b7fe720e7d18d3968 100644 (file)
@@ -42,6 +42,7 @@ class FrameViewPrivate;
 class HTMLFrameSetElement;
 class IntPoint;
 class IntRect;
+class KeyboardEvent;
 class PlatformMouseEvent;
 class MouseEventWithHitTestResults;
 class Node;
@@ -172,7 +173,7 @@ public:
 
     void doAutoScroll();
 
-    bool advanceFocus(bool forward);
+    bool advanceFocus(KeyboardEvent*);
 
     bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
     void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
index 08a9591c9f7763d65b7ddcd7162ae977fe377058..4d568e948af04fac5e7f1e7646ca455e21bf6802 100644 (file)
@@ -39,14 +39,13 @@ class WebCoreTextFieldController;
 
 namespace WebCore {
 
-    class Color;
+class Color;
 
+// Always search (obsolete other than for search).
 class TextField : public Widget {
 public:
-    enum Type { Normal, Password, Search };
-
-    TextField(Type);
-    ~TextField();
+    TextField();
+    virtual ~TextField();
 
     void setColors(const Color& background, const Color& foreground);
 
@@ -84,8 +83,6 @@ public:
     virtual FocusPolicy focusPolicy() const;
     virtual bool checksDescendantsForFocus() const;
 
-    Type type() const { return m_type; }
-    
     void setLiveSearch(bool liveSearch);
     void setAutoSaveName(const String& name);
     void setMaxResults(int maxResults);
@@ -93,7 +90,6 @@ public:
     void addSearchResult();
 
 private:
-    Type m_type;
     WebCoreTextFieldController *m_controller;
 };
 
index 7a90b73f9477acf03ba0ce65e149212d08efc86c..063227bbec993d1211bf859ebbbe90ecdc63ebc3 100644 (file)
@@ -29,6 +29,7 @@
 #import "BlockExceptions.h"
 #import "TextField.h"
 #import "FrameMac.h"
+#import "KeyboardEvent.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreWidgetHolder.h"
 #import "WidgetClient.h"
@@ -161,10 +162,12 @@ using namespace WebCore;
 {
     // Simplified method from NSView; overridden to replace NSView's way of checking
     // for full keyboard access with ours.
-    if (slider && !FrameMac::frameForWidget(slider)->tabsToAllControls()) {
-        return NO;
+    if (slider) {
+        FrameMac* frame = Mac(Frame::frameForWidget(slider));
+        if (!frame->tabsToAllControls(frame->currentKeyboardEvent().get()))
+            return NO;
     }
-    return ([self window] != nil) && ![self isHiddenOrHasHiddenAncestor] && [self acceptsFirstResponder];
+    return [self window] != nil && ![self isHiddenOrHasHiddenAncestor] && [self acceptsFirstResponder];
 }
 
 -(NSView *)nextValidKeyView
@@ -225,8 +228,8 @@ Widget::FocusPolicy Slider::focusPolicy() const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
-    WebCoreFrameBridge *bridge = FrameMac::bridgeForWidget(this);
-    if (!bridge || ![bridge _frame] || ![bridge _frame]->tabsToAllControls())
+    FrameMac* frame = Mac(Frame::frameForWidget(this));
+    if (!frame || !frame->tabsToAllControls(frame->currentKeyboardEvent().get()))
         return NoFocus;
     
     END_BLOCK_OBJC_EXCEPTIONS;
index 2565457ea9d325329d0fdf593e8b6ffef603e599..d75a0ca85cc6afe9376fdb172de482e388e54371 100644 (file)
@@ -55,11 +55,9 @@ NSControlSize ControlSizeForFont(const Font& f)
     return NSMiniControlSize;
 }
 
-TextField::TextField(Type type)
-    : m_type(type)
+TextField::TextField()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    ASSERT(type == Search);
     id view = [WebCoreSearchField alloc];
     [view initWithWidget:this];
     m_controller = [view controller];
@@ -95,18 +93,10 @@ int TextField::cursorPosition() const
 void TextField::setFont(const Font &font)
 {
     Widget::setFont(font);
-    if (m_type == Search) {
-        const NSControlSize size = ControlSizeForFont(font);    
-        NSControl * const searchField = static_cast<NSControl *>(getView());
-        [[searchField cell] setControlSize:size];
-        [searchField setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
-    }
-    else {
-        NSTextField *textField = (NSTextField *)getView();
-        BEGIN_BLOCK_OBJC_EXCEPTIONS;
-        [textField setFont:font.primaryFont()->getNSFont()];
-        END_BLOCK_OBJC_EXCEPTIONS;
-    }
+    const NSControlSize size = ControlSizeForFont(font);    
+    NSControl * const searchField = static_cast<NSControl *>(getView());
+    [[searchField cell] setControlSize:size];
+    [searchField setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
 }
 
 void TextField::setColors(const Color& background, const Color& foreground)
@@ -333,18 +323,12 @@ NSTextAlignment TextAlignment(HorizontalAlignment a)
 
 void TextField::setLiveSearch(bool liveSearch)
 {
-    if (m_type != Search)
-        return;
-    
     NSSearchField *searchField = (NSSearchField *)getView();
     [[searchField cell] setSendsWholeSearchString:!liveSearch];
 }
 
 void TextField::setAutoSaveName(const String& name)
 {
-    if (m_type != Search)
-        return;
-    
     String autosave;
     if (!name.isEmpty())
         autosave = "com.apple.WebKit.searchField:" + name;
@@ -355,9 +339,6 @@ void TextField::setAutoSaveName(const String& name)
 
 void TextField::setMaxResults(int maxResults)
 {
-    if (m_type != Search)
-        return;
-    
     NSSearchField *searchField = (NSSearchField *)getView();
     id searchCell = [searchField cell];
     if (maxResults == -1) {
@@ -386,9 +367,6 @@ void TextField::setPlaceholderString(const String& placeholder)
 
 void TextField::addSearchResult()
 {
-    if (m_type != Search)
-        return;
-    
     NSSearchField *searchField = (NSSearchField *)getView();
     [[searchField cell] _addStringToRecentSearches:[searchField stringValue]];
 }
index 3084b3f706ad4539cc46294be5f8ce16871d7a41..fac6ccf1685ef7de898cd8377dd0d3b58e35a21e 100644 (file)
@@ -65,18 +65,6 @@ namespace WebCore {
 
 @end
 
-@interface WebCoreTextField : NSTextField <WebCoreWidgetHolder>
-{
-@private
-    WebCoreTextFieldController* controller;
-    BOOL inNextValidKeyView;
-}
-
-- (id)initWithWidget:(WebCore::TextField *)widget;
-- (WebCoreTextFieldController *)controller;
-
-@end
-
 @interface WebCoreSearchField : NSSearchField <WebCoreWidgetHolder>
 {
 @private
index 49b4d2ba1db4c6b2dd58ffb8babdb4db184f00b4..2221b978bff41972b9db18da2838dcf31db2c1ba 100644 (file)
@@ -62,8 +62,6 @@ using namespace HTMLNames;
 
 // The three cell subclasses allow us to tell when we get focus without an editor subclass,
 // and override the base writing direction.
-@interface KWQTextFieldCell : NSTextFieldCell
-@end
 @interface WebCoreSearchFieldCell : NSSearchFieldCell
 @end
 
@@ -107,12 +105,10 @@ using namespace HTMLNames;
     [[field cell] setScrollable:YES];
     [field setFormatter:formatter];
     [field setDelegate:self];
-    
-    if (widget->type() == TextField::Search) {
-        [field setTarget:self];
-        [field setAction:@selector(action:)];
-    }
-    
+
+    [field setTarget:self];
+    [field setAction:@selector(action:)];
+
     return self;
 }
 
@@ -205,9 +201,6 @@ static DOMHTMLInputElement* inputElement(TextField* widget)
     if (!widget)
         return;
     
-    if (FrameMac::handleKeyboardOptionTabInView(field))
-        return;
-    
     if (![[field _webcore_currentEditor] hasMarkedText])
         if (DOMHTMLInputElement* input = inputElement(widget))
             [FrameMac::bridgeForWidget(widget) textDidChangeInTextField:input];
@@ -496,185 +489,6 @@ static DOMHTMLInputElement* inputElement(TextField* widget)
 
 @end
 
-@implementation WebCoreTextField
-
-+ (Class)cellClass
-{
-    return [KWQTextFieldCell class];
-}
-
-- (id)initWithWidget:(TextField *)w 
-{
-    self = [self init];
-    if (!self)
-        return nil;
-    controller = [[WebCoreTextFieldController alloc] initWithTextField:self TextField:w];
-    return self;
-}
-
-- (void)dealloc
-{
-    [controller release];
-    [super dealloc];
-}
-
-- (WebCoreTextFieldController *)controller
-{
-    return controller;
-}
-
-- (Widget *)widget
-{
-    return [controller widget];
-}
-
-- (void)selectText:(id)sender
-{
-    // Don't call the NSTextField's selectText if the field is already first responder.
-    // If we do, we'll end up deactivating and then reactivating, which will send
-    // unwanted onBlur events.
-    NSText *editor = [self currentEditor];
-    if (editor) {
-        [editor setSelectedRange:NSMakeRange(0, [[editor string] length])];
-        return;
-    }
-    
-    [super selectText:sender];
-}
-
-- (void)setStringValue:(NSString *)string
-{
-    [super setStringValue:[controller preprocessString:string]];
-    [controller textChanged];
-}
-
-- (NSView *)nextKeyView
-{
-    if (!inNextValidKeyView)
-        return [super nextKeyView];
-    Widget* widget = [controller widget];
-    if (!widget)
-        return [super nextKeyView];
-    return FrameMac::nextKeyViewForWidget(widget, SelectingNext);
-}
-
-- (NSView *)previousKeyView
-{
-    if (!inNextValidKeyView)
-        return [super previousKeyView];
-    Widget* widget = [controller widget];
-    if (!widget)
-        return [super previousKeyView];
-    return FrameMac::nextKeyViewForWidget(widget, SelectingPrevious);
-}
-
-- (NSView *)nextValidKeyView
-{
-    inNextValidKeyView = YES;
-    NSView *view = [super nextValidKeyView];
-    inNextValidKeyView = NO;
-    return view;
-}
-
-- (NSView *)previousValidKeyView
-{
-    inNextValidKeyView = YES;
-    NSView *view = [super previousValidKeyView];
-    inNextValidKeyView = NO;
-    return view;
-}
-
-- (BOOL)acceptsFirstResponder
-{
-    return [self isEnabled];
-}
-
-- (void)display
-{
-    // This is a workaround for Radar 2753974.
-    // Also, in the web page context, it's never OK to just display.
-    [self setNeedsDisplay:YES];
-}
-
-// This is the only one of the display family of calls that we use, and the way we do
-// displaying in WebCore means this is called on this NSView explicitly, so this catches
-// all cases where we are inside the normal display machinery. (Used only by the insertion
-// point method below.)
-- (void)displayRectIgnoringOpacity:(NSRect)rect
-{
-    [controller setInDrawingMachinery:YES];
-    [super displayRectIgnoringOpacity:rect];
-    [controller setInDrawingMachinery:NO];
-}
-
-- (BOOL)textView:(NSTextView *)view shouldDrawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)drawInsteadOfErase
-{
-    return [controller textView:view shouldDrawInsertionPointInRect:rect color:color turnedOn:drawInsteadOfErase];
-}
-
-- (BOOL)textView:(NSTextView *)view shouldHandleEvent:(NSEvent *)event
-{
-    return [controller textView:view shouldHandleEvent:event];
-}
-
-- (void)textView:(NSTextView *)view didHandleEvent:(NSEvent *)event
-{
-    [controller textView:view didHandleEvent:event];
-}
-
-- (BOOL)textView:(NSTextView *)view shouldChangeTextInRange:(NSRange)range replacementString:(NSString *)string
-{
-    return [controller textView:view shouldChangeTextInRange:range replacementString:string]
-        && [super textView:view shouldChangeTextInRange:range replacementString:string];
-}
-
-- (void)textViewDidChangeSelection:(NSNotification *)notification
-{
-    [super textViewDidChangeSelection:notification];
-    [controller textViewDidChangeSelection:notification];
-}
-
-- (void)textDidEndEditing:(NSNotification *)notification
-{
-    [controller setHasFocus:NO];
-    [super textDidEndEditing:notification];
-}
-
-@end
-
-@implementation KWQTextFieldCell
-
-- (void)editWithFrame:(NSRect)frame inView:(NSView *)view editor:(NSText *)editor delegate:(id)delegate event:(NSEvent *)event
-{
-    [super editWithFrame:frame inView:view editor:editor delegate:delegate event:event];
-    ASSERT([delegate isKindOfClass:[WebCoreTextField class]]);
-    [[(WebCoreTextField *)delegate controller] setHasFocus:YES];
-}
-
-- (void)selectWithFrame:(NSRect)frame inView:(NSView *)view editor:(NSText *)editor delegate:(id)delegate start:(int)start length:(int)length
-{
-    [super selectWithFrame:frame inView:view editor:editor delegate:delegate start:start length:length];
-    ASSERT([delegate isKindOfClass:[WebCoreTextField class]]);
-    [[(WebCoreTextField *)delegate controller] setHasFocus:YES];
-}
-
-- (NSMutableDictionary *)_textAttributes
-{
-    ASSERT([[self controlView] isKindOfClass:[WebCoreTextField class]]);
-    NSMutableDictionary* attributes = [super _textAttributes];
-    [[(WebCoreTextField*)[self controlView] controller] updateTextAttributes:attributes];
-    return attributes;
-}
-
-// Ignore the per-application typesetter setting and instead always use the latest behavior for
-// text fields in web pages. This fixes the "text fields too tall" problem.
-- (NSTypesetterBehavior)_typesetterBehavior
-{
-    return NSTypesetterLatestBehavior;
-}
-
-@end
-
 @implementation WebCoreSearchField
 
 + (Class)cellClass
@@ -815,6 +629,7 @@ static DOMHTMLInputElement* inputElement(TextField* widget)
 
 - (void)textDidEndEditing:(NSNotification *)notification
 {
+    Widget::setDeferFirstResponderChanges(false);
     [controller setHasFocus:NO];
     [super textDidEndEditing:notification];
 }
index 424653731572875ec8203790847db3240bbdff44..9d16385a33d03592f210c78820f7d21c272366bb 100644 (file)
@@ -42,21 +42,9 @@ RenderLineEdit::RenderLineEdit(HTMLInputElement* element)
     : RenderFormElement(element)
     , m_updating(false)
 {
-    TextField::Type type;
-    switch (element->inputType()) {
-        case HTMLInputElement::PASSWORD:
-            type = TextField::Password;
-            break;
-        case HTMLInputElement::SEARCH:
-            type = TextField::Search;
-            break;
-        default:
-            ASSERT(false);
-            type = TextField::Normal;
-    }
-    TextField* edit = new TextField(type);
-    if (type == TextField::Search)
-        edit->setLiveSearch(false);
+    ASSERT(element->inputType() == HTMLInputElement::SEARCH);
+    TextField* edit = new TextField();
+    edit->setLiveSearch(false);
     setWidget(edit);
 }
 
@@ -152,11 +140,9 @@ void RenderLineEdit::updateFromElement()
 
     // Handle updating the search attributes.
     w->setPlaceholderString(e->getAttribute(placeholderAttr).deprecatedString());
-    if (w->type() == TextField::Search) {
-        w->setLiveSearch(!e->getAttribute(incrementalAttr).isNull());
-        w->setAutoSaveName(e->getAttribute(autosaveAttr));
-        w->setMaxResults(e->maxResults());
-    }
+    w->setLiveSearch(!e->getAttribute(incrementalAttr).isNull());
+    w->setAutoSaveName(e->getAttribute(autosaveAttr));
+    w->setMaxResults(e->maxResults());
 
     w->setColors(style()->backgroundColor(), style()->color());