WebCore:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2007 19:37:35 +0000 (19:37 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2007 19:37:35 +0000 (19:37 +0000)
        Reviewed by Darin.

        WebCore part of fix for <rdar://problem/4946753>REGRESSION: Inserting tabs is broken in Mail

        In addition to this fix, I also reorganized some event handling code for keyPress events to
        prepare for another fix.  There's also just a little bit of unrelated cleanup.

        * dom/EventTargetNode.cpp: (WebCore::EventTargetNode::defaultEventHandler):
          Move tab focus behavior into new defaultKeyboardEventHandler method.

        * bridge/EditorClient.h: Added handleKeyPress.
        * editing/Editor.cpp:
        (WebCore::Editor::handleKeyPress): Added. Calls over to the client method.
        (WebCore::Editor::deleteRange): Removed unnecessary propogateDOMException.
        * editing/Editor.h: Added handleKeyPress.
        (WebCore::Editor::addToKillRing): Formatting cleanup.
        * editing/mac/EditorMac.mm: Removed unnecessary propogateDOMException.

        * page/EventHandler.cpp: (WebCore::EventHandler::defaultKeyboardEventHandler): Added. Checks
          the tabKeyCyclesThroughElements setting before advancing focus for tab key events.  Calls handleKeyPress.
        * page/EventHandler.h: Added defaultKeyboardEventHandler.

        * page/Page.cpp: (WebCore::Page::Page): Initialize m_tabKeyCyclesThroughElements to true.
        * page/Page.h: Added m_tabKeyCyclesThroughElements.
        (WebCore::Page::setTabKeyCyclesThroughElements): Added.
        (WebCore::Page::tabKeyCyclesThroughElements): Added.

        * platform/PlatformKeyboardEvent.h: Added ability to get NSEvent from PlatformKeyboardEvent.
        * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
          Initialize m_macEvent to the NSEvent.

        * platform/graphics/svg/SVGImageEmptyClients.h: (WebCore::SVGEmptyEditorClient::handleKeyPress): Added.

WebKit:

        Reviewed by Darin.

        WebKit part of fix for <rdar://problem/4946753>REGRESSION: Inserting tabs is broken in Mail

        In addition to this fix, I also reorganized some event handling code for keyPress events to
        prepare for another fix.

        * WebCoreSupport/WebEditorClient.h: Added handleKeyPress method.
        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::handleKeyPress): Added.  Code moved from WebHTMLView keyDown method.
         This is called from the defaultEventHandler so that in the future, we can make the right
         decision about which selection the keyPress should apply to.
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView keyDown:]): Moved _interceptEditingKeyEvent call to handleKeyPress.
        (-[WebHTMLView _interceptEditingKeyEvent:]): Prevents intercepting keys for cmd-modified events. Removed tabCycling checks
         since this is now handled in WebCore.
        * WebView/WebHTMLViewInternal.h: Made _interceptEditingKeyEvent SPI.
        * WebView/WebView.mm: Use new tabKeyCyclesThroughElements methods on the page.
        (-[WebViewPrivate init]): ditto.
        (-[WebView setTabKeyCyclesThroughElements:]): ditto.
        (-[WebView tabKeyCyclesThroughElements]): ditto.
        (-[WebView setEditable:]): ditto

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

21 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/EditorClient.h
WebCore/dom/EventTargetNode.cpp
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/mac/EditorMac.mm
WebCore/page/EventHandler.cpp
WebCore/page/EventHandler.h
WebCore/page/Page.cpp
WebCore/page/Page.h
WebCore/platform/PlatformKeyboardEvent.h
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebCore/platform/mac/KeyEventMac.mm
WebKit/ChangeLog
WebKit/WebCoreSupport/WebEditorClient.h
WebKit/WebCoreSupport/WebEditorClient.mm
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebHTMLView.mm
WebKit/WebView/WebHTMLViewInternal.h
WebKit/WebView/WebView.mm

index 718a64b..1f83c98 100644 (file)
@@ -1,3 +1,38 @@
+2007-01-23  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+        
+        WebCore part of fix for <rdar://problem/4946753>REGRESSION: Inserting tabs is broken in Mail
+
+        In addition to this fix, I also reorganized some event handling code for keyPress events to
+        prepare for another fix.  There's also just a little bit of unrelated cleanup.
+        
+        * dom/EventTargetNode.cpp: (WebCore::EventTargetNode::defaultEventHandler):
+          Move tab focus behavior into new defaultKeyboardEventHandler method.
+        
+        * bridge/EditorClient.h: Added handleKeyPress.
+        * editing/Editor.cpp:
+        (WebCore::Editor::handleKeyPress): Added. Calls over to the client method.
+        (WebCore::Editor::deleteRange): Removed unnecessary propogateDOMException.
+        * editing/Editor.h: Added handleKeyPress.
+        (WebCore::Editor::addToKillRing): Formatting cleanup.
+        * editing/mac/EditorMac.mm: Removed unnecessary propogateDOMException.
+        
+        * page/EventHandler.cpp: (WebCore::EventHandler::defaultKeyboardEventHandler): Added. Checks
+          the tabKeyCyclesThroughElements setting before advancing focus for tab key events.  Calls handleKeyPress.
+        * page/EventHandler.h: Added defaultKeyboardEventHandler.
+        
+        * page/Page.cpp: (WebCore::Page::Page): Initialize m_tabKeyCyclesThroughElements to true.
+        * page/Page.h: Added m_tabKeyCyclesThroughElements.
+        (WebCore::Page::setTabKeyCyclesThroughElements): Added.
+        (WebCore::Page::tabKeyCyclesThroughElements): Added.
+        
+        * platform/PlatformKeyboardEvent.h: Added ability to get NSEvent from PlatformKeyboardEvent.
+        * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+          Initialize m_macEvent to the NSEvent.
+        
+        * platform/graphics/svg/SVGImageEmptyClients.h: (WebCore::SVGEmptyEditorClient::handleKeyPress): Added.
+
 2007-01-23  George Staikos  <staikos@kde.org>
 
         Compile with a released Qt.
index 99b7c14..0a1f852 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index 4678f3a..a5911f7 100644 (file)
@@ -39,8 +39,10 @@ namespace WebCore {
 
 class CSSStyleDeclaration;
 class EditCommand;
+class EventTargetNode;
 class Frame;
 class HTMLElement;
+class KeyboardEvent;
 class Node;
 class Range;
 class String;
@@ -91,6 +93,8 @@ public:
     virtual void undo() = 0;
     virtual void redo() = 0;
 
+    virtual void handleKeyPress(EventTargetNode*, KeyboardEvent*) = 0;
+
 #if PLATFORM(MAC)
     // FIXME: This should become SelectionController::toWebArchive()
     virtual NSData* dataForArchivedSelection(Frame*) = 0; 
index 5158290..f9d1a5b 100644 (file)
@@ -560,13 +560,10 @@ bool EventTargetNode::disabled() const
 void EventTargetNode::defaultEventHandler(Event* event)
 {
     const AtomicString& eventType = event->type();
-    if (eventType == keypressEvent && event->isKeyboardEvent()) {
-        KeyboardEvent* keyEvent = static_cast<KeyboardEvent*>(event);
-        if (keyEvent->keyIdentifier() == "U+000009") {
-            if (Page* page = document()->page())
-                if (page->focusController()->advanceFocus(keyEvent))
-                    event->setDefaultHandled();
-        }
+    if (eventType == keypressEvent) {
+        if (event->isKeyboardEvent())
+            if (Frame* frame = document()->frame())
+                frame->eventHandler()->defaultKeyboardEventHandler(this, static_cast<KeyboardEvent*>(event));
     } else if (eventType == clickEvent) {
         int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail() : 0;
         dispatchUIEvent(DOMActivateEvent, detail, event);
index 2d65084..5b08b00 100644 (file)
@@ -72,6 +72,12 @@ EditorClient* Editor::client() const
     return 0;
 }
 
+void Editor::handleKeyPress(EventTargetNode* target, KeyboardEvent* event)
+{
+    if (EditorClient* c = client())
+        c->handleKeyPress(target, event);
+}
+
 bool Editor::canEdit() const
 {
     SelectionController* selectionController = m_frame->selectionController();
@@ -162,23 +168,26 @@ bool Editor::canSmartCopyOrDelete()
     return false;
 }
 
-void Editor::deleteRange(Range *range, bool killRing, bool prepend, bool smartDeleteOK, EditorDeleteAction deletionAction, TextGranularity granularity)
+void Editor::deleteRange(Rangerange, bool killRing, bool prepend, bool smartDeleteOK, EditorDeleteAction deletionAction, TextGranularity granularity)
 {
     if (killRing)
         addToKillRing(range, prepend);
 
-    SelectionController* selectionController = m_frame->selectionController();
-    bool smartDelete = smartDeleteOK ? canSmartCopyOrDelete() : false;
     ExceptionCode ec = 0;
+
+    SelectionController* selectionController = m_frame->selectionController();
+    bool smartDelete = smartDeleteOK && canSmartCopyOrDelete();
     switch (deletionAction) {
-        case deleteSelectionAction:             
+        case deleteSelectionAction:
             selectionController->setSelectedRange(range, DOWNSTREAM, true, ec);
-            propogateDOMException(ec);
+            if (ec)
+                return;
             deleteSelectionWithSmartDelete(smartDelete);
             break;
         case deleteKeyAction:
             selectionController->setSelectedRange(range, DOWNSTREAM, (granularity != CharacterGranularity), ec);
-            propogateDOMException(ec);
+            if (ec)
+                return;
             if (m_frame->document()) {
                 TypingCommand::deleteKeyPressed(m_frame->document(), smartDelete, granularity);
                 m_frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded);
@@ -186,7 +195,8 @@ void Editor::deleteRange(Range *range, bool killRing, bool prepend, bool smartDe
             break;
         case forwardDeleteKeyAction:
             selectionController->setSelectedRange(range, DOWNSTREAM, (granularity != CharacterGranularity), ec);
-            propogateDOMException(ec);
+            if (ec)
+                return;
             if (m_frame->document()) {
                 TypingCommand::forwardDeleteKeyPressed(m_frame->document(), smartDelete, granularity);
                 m_frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded);
index 0ecffc8..72cb420 100644 (file)
@@ -47,6 +47,7 @@ class DeleteButtonController;
 class DocumentFragment;
 class EditCommand;
 class EditorClient;
+class EventTargetNode;
 class FontData;
 class Frame;
 class HTMLElement;
@@ -64,7 +65,9 @@ public:
     Frame* frame() const { return m_frame; }
     DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
     EditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
-    
+
+    void handleKeyPress(EventTargetNode*, KeyboardEvent*);
+
     bool canEdit() const;
     bool canEditRichly() const;
 
@@ -114,7 +117,7 @@ public:
     void deleteRange(Range*, bool killRing, bool prepend, bool smartDeleteOK, EditorDeleteAction, TextGranularity);
     void deleteSelectionWithSmartDelete(bool smartDelete);
     void deleteSelectionWithSmartDelete();
-    bool dispatchCPPEvent(const AtomicString &, ClipboardAccessPolicy);
+    bool dispatchCPPEvent(const AtomicString&, ClipboardAccessPolicy);
     
     Node* removedAnchor() const { return m_removedAnchor.get(); }
     void setRemovedAnchor(PassRefPtr<Node> n) { m_removedAnchor = n; }
@@ -197,14 +200,10 @@ private:
     void writeSelectionToPasteboard(Pasteboard*);
 
 #if PLATFORM(MAC)
-    // propogate DOM exception as an ObjC exception
-    void propogateDOMException(ExceptionCode);
-
     void addToKillRing(Range*, bool prepend);
     bool m_startNewKillRingSequence;
 #else
-    void propogateDOMException(ExceptionCode){}
-    void addToKillRing(Range*, bool){}
+    void addToKillRing(Range*, bool) { }
 #endif
 
 };
index 00f3fc9..c3bb210 100644 (file)
@@ -70,11 +70,6 @@ NSString* Editor::userVisibleString(NSURL* nsURL)
     return nil;
 }
 
-void Editor::propogateDOMException(ExceptionCode ec)
-{
-    if (ec) raiseDOMException(ec);
-}
-
 void Editor::addToKillRing(Range* range, bool prepend)
 {
     if (m_startNewKillRingSequence)
@@ -649,5 +644,5 @@ void Editor::showColorPanel()
 {
     [[NSApplication sharedApplication] orderFrontColorPanel:nil];
 }
-    
+
 } // namespace WebCore
index b86b2f0..3a3901c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
 #include "Document.h"
 #include "Editor.h"
 #include "EventNames.h"
+#include "FocusController.h"
 #include "Frame.h"
 #include "FrameTree.h"
 #include "FrameView.h"
@@ -45,6 +46,7 @@
 #include "KeyboardEvent.h"
 #include "MouseEvent.h"
 #include "MouseEventWithHitTestResults.h"
+#include "Page.h"
 #include "PlatformScrollBar.h"
 #include "PlatformWheelEvent.h"
 #include "RenderWidget.h"
@@ -1173,4 +1175,17 @@ void EventHandler::hoverTimerFired(Timer<EventHandler>*)
     prepareMouseEvent(HitTestRequest(false, false, true), PlatformMouseEvent(PlatformMouseEvent::currentEvent));
 }
 
+void EventHandler::defaultKeyboardEventHandler(EventTargetNode* target, KeyboardEvent* event)
+{
+    if (target == event->target() && event->type() == keypressEvent) {
+        if (Page* page = target->document()->page())
+            if (page->tabKeyCyclesThroughElements() && event->keyIdentifier() == "U+000009")
+                if (page->focusController()->advanceFocus(event)) {
+                    event->setDefaultHandled();
+                    return;
+                }
+        m_frame->editor()->handleKeyPress(target, event);
+    }
+}
+
 }
index 920ca82..866e039 100644 (file)
@@ -125,6 +125,8 @@ public:
 
     void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; }
 
+    void defaultKeyboardEventHandler(EventTargetNode*, KeyboardEvent*);
+
 #if PLATFORM(MAC)
     PassRefPtr<KeyboardEvent> currentKeyboardEvent() const;
 
index 452af4e..08edad0 100644 (file)
@@ -61,6 +61,7 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
     , m_progress(new ProgressTracker)
     , m_editorClient(editorClient)
     , m_frameCount(0)
+    , m_tabKeyCyclesThroughElements(true)
     , m_defersLoading(false)
 {
     if (!allPages) {
index 07d6c26..5f88060 100644 (file)
@@ -90,6 +90,9 @@ namespace WebCore {
         Settings* settings() const { return m_settings.get(); }
         ProgressTracker* progress() const { return m_progress.get(); }
         
+        void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; }
+        bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; }
+        
         void setDefersLoading(bool);
         bool defersLoading() const { return m_defersLoading; }
 
@@ -115,6 +118,7 @@ namespace WebCore {
         int m_frameCount;
         String m_groupName;
 
+        bool m_tabKeyCyclesThroughElements;
         bool m_defersLoading;
 
 #if PLATFORM(WIN)
index 626619c..2610404 100644 (file)
@@ -30,6 +30,7 @@
 #include <wtf/Platform.h>
 
 #if PLATFORM(MAC)
+#include "RetainPtr.h"
 #ifdef __OBJC__
 @class NSEvent;
 #else
@@ -70,6 +71,7 @@ namespace WebCore {
 
 #if PLATFORM(MAC)
         PlatformKeyboardEvent(NSEvent*, bool forceAutoRepeat = false);
+        NSEvent* macEvent() const { return m_macEvent.get(); }
 #endif
 
 #if PLATFORM(WIN)
@@ -96,6 +98,10 @@ namespace WebCore {
         bool m_ctrlKey;
         bool m_altKey;
         bool m_metaKey;
+
+#if PLATFORM(MAC)
+        RetainPtr<NSEvent> m_macEvent;
+#endif
     };
 
 } // namespace WebCore
index b5ac050..a464581 100644 (file)
@@ -303,7 +303,9 @@ public:
     
     virtual void undo() { }
     virtual void redo() { }
-    
+
+    virtual void handleKeyPress(EventTargetNode*, KeyboardEvent*) { }
+
 #if PLATFORM(MAC)
     // FIXME: This should become SelectionController::toWebArchive()
     virtual NSData* dataForArchivedSelection(Frame*) { return 0; } 
index 4a84e47..9435c7d 100644 (file)
@@ -705,17 +705,18 @@ static int WindowsKeyCodeForKeyEvent(NSEvent* event)
 }
 
 PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event, bool forceAutoRepeat)
-    : m_text([event characters]),
-      m_unmodifiedText([event charactersIgnoringModifiers]),
-      m_keyIdentifier(keyIdentifierForKeyEvent(event)),
-      m_isKeyUp([event type] == NSKeyUp),
-      m_autoRepeat(forceAutoRepeat || [event isARepeat]),
-      m_WindowsKeyCode(WindowsKeyCodeForKeyEvent(event)),
-      m_isKeypad(isKeypadEvent(event)),
-      m_shiftKey([event modifierFlags] & NSShiftKeyMask),
-      m_ctrlKey([event modifierFlags] & NSControlKeyMask),
-      m_altKey([event modifierFlags] & NSAlternateKeyMask),
-      m_metaKey([event modifierFlags] & NSCommandKeyMask)
+    : m_text([event characters])
+    , m_unmodifiedText([event charactersIgnoringModifiers])
+    , m_keyIdentifier(keyIdentifierForKeyEvent(event))
+    , m_isKeyUp([event type] == NSKeyUp)
+    , m_autoRepeat(forceAutoRepeat || [event isARepeat])
+    , m_WindowsKeyCode(WindowsKeyCodeForKeyEvent(event))
+    , m_isKeypad(isKeypadEvent(event))
+    , m_shiftKey([event modifierFlags] & NSShiftKeyMask)
+    , m_ctrlKey([event modifierFlags] & NSControlKeyMask)
+    , m_altKey([event modifierFlags] & NSAlternateKeyMask)
+    , m_metaKey([event modifierFlags] & NSCommandKeyMask)
+    , m_macEvent(event)
 {
     // Turn 0x7F into 8, because backspace needs to always be 8.
     if (m_text == "\x7F")
index 1115683..7acbb4a 100644 (file)
@@ -1,3 +1,28 @@
+2007-01-23  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        WebKit part of fix for <rdar://problem/4946753>REGRESSION: Inserting tabs is broken in Mail
+        
+        In addition to this fix, I also reorganized some event handling code for keyPress events to
+        prepare for another fix.
+
+        * WebCoreSupport/WebEditorClient.h: Added handleKeyPress method.
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::handleKeyPress): Added.  Code moved from WebHTMLView keyDown method.
+         This is called from the defaultEventHandler so that in the future, we can make the right 
+         decision about which selection the keyPress should apply to.
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView keyDown:]): Moved _interceptEditingKeyEvent call to handleKeyPress.
+        (-[WebHTMLView _interceptEditingKeyEvent:]): Prevents intercepting keys for cmd-modified events. Removed tabCycling checks
+         since this is now handled in WebCore.
+        * WebView/WebHTMLViewInternal.h: Made _interceptEditingKeyEvent SPI.
+        * WebView/WebView.mm: Use new tabKeyCyclesThroughElements methods on the page.
+        (-[WebViewPrivate init]): ditto.
+        (-[WebView setTabKeyCyclesThroughElements:]): ditto.
+        (-[WebView tabKeyCyclesThroughElements]): ditto.
+        (-[WebView setEditable:]): ditto
+
 2007-01-23  Lars Knoll <lars@trolltech.com>
 
         Reviewed by Maciej
index 580ca07..92b69e1 100644 (file)
@@ -81,6 +81,9 @@ public:
     
     virtual void undo();
     virtual void redo();
+
+    virtual void handleKeyPress(WebCore::EventTargetNode*, WebCore::KeyboardEvent*);
+
 private:
     void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo);
     WebEditorClient();
index d46ecc7..45c9a51 100644 (file)
@@ -43,6 +43,8 @@
 #import <wtf/PassRefPtr.h>
 #import <WebCore/EditAction.h>
 #import <WebCore/EditCommand.h>
+#import <WebCore/KeyboardEvent.h>
+#import <WebCore/PlatformKeyboardEvent.h>
 
 using namespace WebCore;
 
@@ -385,6 +387,14 @@ void WebEditorClient::redo()
         [[m_webView undoManager] redo];    
 }
 
+void WebEditorClient::handleKeyPress(EventTargetNode* node, KeyboardEvent* event)
+{
+    WebHTMLView *webHTMLView = [[[m_webView mainFrame] frameView] documentView];
+    if (const PlatformKeyboardEvent* platformEvent = event->keyEvent())
+        if ([webHTMLView _canEdit] && [webHTMLView _interceptEditingKeyEvent:platformEvent->macEvent()])
+            event->setDefaultHandled();
+}
+
 /*
 bool WebEditorClient::shouldChangeSelectedRange(Range *currentRange, Range *toProposedRange, NSSelectionAffinity selectionAffinity, bool stillSelecting) { return false; }
 bool WebEditorClient::shouldChangeTypingStyle(CSSStyleDeclaration *currentStyle, CSSStyleDeclaration *toProposedStyle) { return false; }
index 9b941a2..88f970e 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );
index 1298640..0768423 100644 (file)
@@ -3319,27 +3319,6 @@ done:
     [self _endPrintMode];
 }
 
-- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event
-{   
-    // Use WebView's tabKeyCyclesThroughElements state to determine whether or not
-    // to process tab key events. The idea here is that tabKeyCyclesThroughElements
-    // will be YES when this WebView is being used in a browser, and we desire the
-    // behavior where tab moves to the next element in tab order. If tabKeyCyclesThroughElements
-    // is NO, it is likely that the WebView is being embedded as the whole view, as in Mail,
-    // and tabs should input tabs as expected in a text editor. Using Option-Tab always cycles
-    // through elements.
-
-    if ([[self _webView] tabKeyCyclesThroughElements] && [event _web_isTabKeyEvent]) 
-        return NO;
-
-    if (![[self _webView] tabKeyCyclesThroughElements] && [event _web_isOptionTabKeyEvent])
-        return NO;
-
-    // Now process the key normally
-    [self interpretKeyEvents:[NSArray arrayWithObject:event]];
-    return YES;
-}
-
 - (void)keyDown:(NSEvent *)event
 {
     BOOL eventWasSentToWebCore = (_private->keyDownEvent == event);
@@ -3357,11 +3336,8 @@ done:
     } else if (_private->compController && [_private->compController filterKeyDown:event]) {
         // Consumed by complete: popup window
     } else {
-        // We're going to process a key event, bail on any outstanding complete: UI
         [_private->compController endRevertingChange:YES moveLeft:NO];
-        BOOL handledKey = [self _canEdit] && [self _interceptEditingKeyEvent:event];
-        if (!handledKey)
-            callSuper = YES;
+        callSuper = YES;
     }
     if (callSuper)
         [super keyDown:event];
@@ -5260,6 +5236,18 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
     [self _updateMouseoverWithFakeEvent];
 }
 
+- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event
+{
+    // If the cmd-key is down, then we shouldn't intercept the key since this will
+    // be handled correctly in performKeyEquivalent
+    if ([event modifierFlags] & NSCommandKeyMask) 
+        return NO;
+
+    // Now process the key normally
+    [self interpretKeyEvents:[NSArray arrayWithObject:event]];
+    return YES;
+}
+
 @end
 
 @implementation WebHTMLView (WebNSTextInputSupport)
index 8257cee..5fb6f93 100644 (file)
 - (void)closeIfNotCurrentView;
 - (void)_lookUpInDictionaryFromMenu:(id)sender;
 - (void)_hoverFeedbackSuspendedChanged;
+- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event;
 - (DOMDocumentFragment*)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard;
 #if !BUILDING_ON_TIGER
 - (BOOL)isGrammarCheckingEnabled;
index a74da18..26187fa 100644 (file)
@@ -286,7 +286,6 @@ macro(yankAndSelect) \
     BOOL mainFrameDocumentReady;
     BOOL drawsBackground;
     BOOL editable;
-    BOOL tabKeyCyclesThroughElements;
     BOOL tabKeyCyclesThroughElementsChanged;
     BOOL becomingFirstResponder;
     BOOL hoverFeedbackSuspended;
@@ -396,7 +395,6 @@ static BOOL grammarCheckingEnabled;
     
     textSizeMultiplier = 1;
     dashboardBehaviorAllowWheelScrolling = YES;
-    tabKeyCyclesThroughElements = YES;
     shouldCloseWithWindow = objc_collecting_enabled();
     continuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled];
 #if !BUILDING_ON_TIGER
@@ -2677,12 +2675,12 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 - (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements
 {
     _private->tabKeyCyclesThroughElementsChanged = YES;
-    _private->tabKeyCyclesThroughElements = cyclesElements;
+    _private->page->setTabKeyCyclesThroughElements(cyclesElements);
 }
 
 - (BOOL)tabKeyCyclesThroughElements
 {
-    return _private->tabKeyCyclesThroughElements;
+    return _private->page->tabKeyCyclesThroughElements();
 }
 
 - (void)setScriptDebugDelegate:(id)delegate
@@ -2976,7 +2974,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
     if (_private->editable != flag) {
         _private->editable = flag;
         if (!_private->tabKeyCyclesThroughElementsChanged)
-            _private->tabKeyCyclesThroughElements = !flag;
+            _private->page->setTabKeyCyclesThroughElements(!flag);
         FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
         if (mainFrame) {
             if (flag) {