Skip to content
  • darin's avatar
    WebCore: · d1fbfdcc
    darin authored
            Reviewed by Oliver.
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12677
              <rdar://problem/4759563> REGRESSION: Return key is always sent when you confirm
              a clause in kotoeri (12677)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12596
              <rdar://problem/4794346> REGRESSION: Tab key shifts form field focus instead of
              navigating prediction window (12596)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=10010
              <rdar://problem/4822935> REGRESSION: Pressing Return with unconfirmed text in
              Hangul inserts carriage return (10010)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12531
              <rdar://problem/4975126> REGRESSION: Inline text input types repeated keys in
              latest nightly (r19336) (12531)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12539
              <rdar://problem/4975130> REGRESSION: Pressing Backspace while in inline input
              area moves to the previous page in history (12539)
    
            This area still needs work because keypress events are being sent for all the
            events before they go to the input methods, and it seems that this is not
            compatible with what other browsers do and with what sites assume. That's covered
            by this bug:
    
                http://bugs.webkit.org/show_bug.cgi?id=10871
                <rdar://problem/4823129> REGRESSION: IME key events different in nightly (10871)
    
            which is still open.
    
            * bindings/objc/ExceptionHandlers.h: Remove selectRange helper that doesn't really
            belong here, and also isn't needed since the callers don't want to raise ObjC
            exceptions.
            * bindings/objc/ExceptionHandlers.mm: Ditto. Also removed unneeded external globals
            that aren't exported anyway and unneeded includes.
    
            * bridge/EditorClient.h: Added Mac-specific function, markedTextAbandoned. Long term
            this might move into platform instead, but it's fine to have it on the client for now
            as long as it doesn't cause trouble for platforms other than Mac.
    
            * dom/EventTargetNode.cpp: (WebCore::EventTargetNode::defaultEventHandler): Since
            all the event handling code in this function is intended to run on the node itself,
            not parent nodes, check and do nothing if this event is bubbling up from another
            node. Added code to call a function on EventHandler for default handling of text
            input events.
    
            * dom/KeyboardEvent.h:
            * dom/KeyboardEvent.cpp: (WebCore::findKeyboardEvent): Added. Just like the
            findUIEventWithKeyState function, but specific to keyboard events.
    
            * dom/TextEvent.h: Added isLineBreak and isBackTab flags so that we can carry
            additional information about what a text input event is trying to do, but still
            go through the DOM event machinery.
            * dom/TextEvent.cpp: Ditto.
    
            * editing/Editor.h:
            * editing/Editor.cpp:
            (WebCore::Editor::handleKeyPress): Removed unneeded check of isCaretOrRange, since
            isContentEditable already checks that.
            (WebCore::Editor::canEdit): Ditto.
            (WebCore::Editor::canEditRichly): Ditto.
            (WebCore::Editor::canPaste): Changed to call canEdit for brevity.
            (WebCore::Editor::replaceSelectionWithText): Changed to take a const String&.
            (WebCore::Editor::shouldInsertText): Ditto.
            (WebCore::hasEditableSelection): Removed unneeded check of isCaretOrRange, since
            isContentEditable already checks that.
            (WebCore::Editor::Editor): Initialize the new m_ignoreMarkedTextSelectionChange
            flag. Moved here from WebHTMLView.
            (WebCore::Editor::insertText): Moved most of the code from -[WebHTMLView insertText:]
            here, since this needs to be done in response to a text input event and we don't want
            to go back over the WebKit side for that.
            (WebCore::Editor::insertLineBreak): Added. Moved here from -[WebHTMLView insertLineBreak:]
            for the same reason -- needs to be done in response to text input events.
            (WebCore::Editor::insertParagraphSeparator): Ditto.
            (WebCore::Editor::selectMarkedText): Added. Used by insertText.
            (WebCore::Editor::discardMarkedText): Added. Used by insertText.
            (WebCore::Editor::unmarkText): Added. Used by insertText.
            * editing/mac/EditorMac.mm:
            (WebCore::Editor::unmarkText): Added. Used by insertText.
    
            * html/HTMLInputElement.cpp:
            (WebCore::HTMLInputElement::canHaveSelection): Changed to use isTextField to avoid repeating
            the switch statement.
            (WebCore::HTMLInputElement::selectionStart): Ditto.
            (WebCore::HTMLInputElement::selectionEnd): Ditto.
            (WebCore::HTMLInputElement::setSelectionStart): Ditto.
            (WebCore::HTMLInputElement::setSelectionEnd): Ditto.
            (WebCore::HTMLInputElement::select): Ditto.
            (WebCore::HTMLInputElement::setSelectionRange): Ditto.
            (WebCore::HTMLInputElement::createRenderer): Resorted cases alphaebtically.
            (WebCore::HTMLInputElement::defaultEventHandler): Added code to make hitting return cause the
            form to be submitted when it comes through as a text input event. This is now the normal case
            on Macintosh, because enter key presses normally turn into this. In addition, change the other
            event handling to run only after trying the base defaultEventHandler. That makes the key
            handling done in EventTargetNode take precedence over the event handling here for editable text
            fields, which is what we want. This gets rid of the need for the hack where we check
            inputManagerHasMarkedText and suppress the handling of the enter key.
    
            * page/EventHandler.h: Removed unneeded includes. Moved EventHandlerDragState down into the
            private part of the class. Changed sendContextMenuEvent to take a const&. Added new
            handleTextInputEvent and defaultTextInputEventHandler functions. Made eventLoopHandleMouseUp
            and eventLoopHandleMouseDragged private. Added private defaultTabEventHandler function.
            * page/EventHandler.cpp:
            (WebCore::EventHandler::sendContextMenuEvent): Changed parameter to be a const&.
            (WebCore::EventHandler::defaultKeyboardEventHandler): Rearranged things so that the key bindings
            handling in handleKeyPress comes before special tab event handling. In cases where the tab turns
            into text to insert, we now handle it in the text input event handler.
            (WebCore::EventHandler::handleTextInputEvent): Added. Creates and dispatches a text input event.
            (WebCore::EventHandler::defaultTextInputEventHandler): Added. Inserts text, but has special cases
            for the tab and newline character cases.
            (WebCore::EventHandler::defaultTabEventHandler): Added. Shared by the tab-handling code in
            the keyboard event and text input event handlers.
            * page/mac/EventHandlerMac.mm: Tweak formatting, remove some unused functions.
    
            * page/FocusController.h: Removed unnneded includes and forwards, and added an overload of
            advanceFocus that takes a FocusDirection parameter.
            * page/FocusController.cpp: (WebCore::FocusController::advanceFocus): Changed to allow a 0 for
            the event pointer. Also added a version where the direction is passed explicitly, to be used
            for cases where we want to tab backward even if the event doesn't have a shift modifier key set.
    
            * platform/graphics/svg/SVGImageEmptyClients.h: Updated for change to EditorClient.
            This should really probably just use 0 for the EditorClient.
    
            * WebCore.exp: Update both for newly used and no-longer-used entry points.
    
            * page/mac/WebCoreFrameBridge.h:
            * page/mac/WebCoreFrameBridge.mm: Removed two unused methods.
    
    WebKit:
    
            Reviewed by Oliver.
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12677
              <rdar://problem/4759563> REGRESSION: Return key is always sent when you confirm
              a clause in kotoeri (12677)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12596
              <rdar://problem/4794346> REGRESSION: Tab key shifts form field focus instead of
              navigating prediction window (12596)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=10010
              <rdar://problem/4822935> REGRESSION: Pressing Return with unconfirmed text in
              Hangul inserts carriage return (10010)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12531
              <rdar://problem/4975126> REGRESSION: Inline text input types repeated keys in
              latest nightly (r19336) (12531)
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=12539
              <rdar://problem/4975130> REGRESSION: Pressing Backspace while in inline input
              area moves to the previous page in history (12539)
    
            * WebCoreSupport/WebEditorClient.h:
            * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::markedTextAbandoned):
            Added.
    
            * WebView/WebHTMLView.mm:
            (-[WebHTMLView menuForEvent:]): Added explicit constructor needed now that the
            function takes a const&.
            (-[WebHTMLView becomeFirstResponder]): Removed fake event code, no longer needed
            since advanceFocus now works fine with 0 for a DOM event.
            (-[WebHTMLView _expandSelectionToGranularity:]): Changed to use the normal
            selection controller function instead of selectRange.
            (-[WebHTMLView insertTab:]): Changed to call bottleneck that receives the DOM
            event.
            (-[WebHTMLView insertBacktab:]): Ditto.
            (-[WebHTMLView insertNewline:]): Ditto.
            (-[WebHTMLView insertLineBreak:]): Ditto.
            (-[WebHTMLView insertParagraphSeparator:]): Ditto.
            (-[WebHTMLView insertNewlineIgnoringFieldEditor:]): Ditto.
            (-[WebHTMLView insertTabIgnoringFieldEditor:]): Ditto.
            (-[WebHTMLView yank:]): Updated to call Editor directly since the insertText
            code now works via a text input event which is not what we want for paste-like
            things such as yank.
            (-[WebHTMLView yankAndSelect:]): Ditto.
            (-[WebHTMLView selectToMark:]): Changed to use the normal selection controller
            function instead of selectRange, which also allows us to remove the ObjC exception
            handling code.
            (-[WebHTMLView swapWithMark:]): Ditto.
            (-[WebHTMLView transpose:]): Ditto.
            (-[WebHTMLView unmarkText]): Since this is one of the calls back from the input
            manager, added code to set the "event was handled" flag. Moved the actual work
            into the Editor class in WebCore and just call that from here.
            (-[WebHTMLView _selectRangeInMarkedText:]): Changed to use the normal selection
            controller function instead of selectRange.
            (-[WebHTMLView setMarkedText:selectedRange:]): Since this is one of the calls
            back from the input manager, added code to set the "event was handled" flag.
            Also changed the ignoreMarkedTextSelectionChange to use the flag over on the
            WebCore side, since we moved it there and to call selectMarkedText over on
            the WebCore side too.
            (-[WebHTMLView doCommandBySelector:]): Added special cases for newline and tab
            selectors so that the event is passed along. These selectors are special because
            they are ones that turn into text input events.
            (-[WebHTMLView _discardMarkedText]): Moved the body of this function into the
            Editor class in WebCore and just call that from here.
            (-[WebHTMLView insertText:]): Added code to send a text input event instead of
            calling the editor to do text insertion. The insertion is then done in the
            default handler for the text input event.
            (-[WebHTMLView _insertNewlineWithEvent:isLineBreak:]): Added. Sends a text
            input event.
            (-[WebHTMLView _insertTabWithEvent:isBackTab:]): Ditto.
            (-[WebHTMLView _updateSelectionForInputManager]): Changed to use the
            ignoreMarkedTextSelectionChange flag in Editor now that the one here is gone.
    
            * WebView/WebHTMLViewInternal.h: Remove ignoreMarkedTextSelectionChange field.
    
            * WebView/WebView.mm: (-[WebView setSelectedDOMRange:affinity:]): Changed to
            use the normal selection controller function instead of selectRange.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d1fbfdcc