[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
xan at webkit.org
xan at webkit.org
Thu Oct 29 20:33:11 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 6de8a7f3e21016fa3b1c2392bfb01de351e4d27f
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 24 10:52:16 2009 +0000
Revert r48697, since it broke key handling notification to GTK+.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48714 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1aad15a..ed4c1b5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-24 Xan Lopez <xlopez at igalia.com>
+
+ Revert r48697, since it broke key handling notification to GTK+.
+
+ * platform/gtk/Skipped:
+
2009-09-24 Benjamin Poulain <benjamin.poulain at nokia.com>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 98aae96..9161e6b 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1606,6 +1606,11 @@ fast/events/dblclick-addEventListener.html
fast/events/drag-in-frames.html
fast/events/frame-tab-focus.html
fast/events/js-keyboard-event-creation.html
+fast/events/key-events-in-input-button.html
+fast/events/key-events-in-input-text.html
+fast/events/keydown-keypress-focus-change.html
+fast/events/keydown-keypress-preventDefault.html
+fast/events/keypress-focus-change.html
fast/events/keypress-insert-tab.html
fast/events/mouse-click-events.html
fast/events/mouseclick-target-and-positioning.html
@@ -1625,6 +1630,7 @@ fast/events/pointer-events-2.html
fast/events/popup-blocking-click-in-iframe.html
fast/events/right-click-focus.html
fast/events/scrollbar-double-click.html
+fast/events/special-key-events-in-input-text.html
fast/events/stop-load-in-unload-handler-using-document-write.html
fast/events/stop-load-in-unload-handler-using-window-stop.html
fast/events/tabindex-focus-blur-all.html
@@ -5577,6 +5583,7 @@ editing/pasteboard/files-during-page-drags.html
editing/selection/extend-selection-after-double-click.html
fast/events/drag-to-navigate.html
fast/events/prevent-drag-to-navigate.html
+fast/events/keydown-function-keys.html
fast/forms/slider-delete-while-dragging-thumb.html
fast/events/tab-focus-anchor.html
http/tests/local/drag-over-remote-content.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 668a717..f40ffa9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-24 Xan Lopez <xlopez at igalia.com>
+
+ Revert r48697, since it broke key handling notification to GTK+.
+
+ * platform/gtk/KeyEventGtk.cpp:
+ (WebCore::keyIdentifierForGdkKeyCode):
+ (WebCore::singleCharacterString):
+
2009-09-24 Philippe Normand <pnormand at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp
index 4186c2f..5875547 100644
--- a/WebCore/platform/gtk/KeyEventGtk.cpp
+++ b/WebCore/platform/gtk/KeyEventGtk.cpp
@@ -136,8 +136,6 @@ static String keyIdentifierForGdkKeyCode(guint keyCode)
// Standard says that DEL becomes U+007F.
case GDK_Delete:
return "U+007F";
- case GDK_BackSpace:
- return "U+0008";
case GDK_ISO_Left_Tab:
case GDK_3270_BackTab:
case GDK_Tab:
@@ -505,8 +503,6 @@ static String singleCharacterString(guint val)
case GDK_KP_Enter:
case GDK_Return:
return String("\r");
- case GDK_BackSpace:
- return String("\x8");
default:
gunichar c = gdk_keyval_to_unicode(val);
glong nwc;
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index f3ff195..8414c63 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-24 Xan Lopez <xlopez at igalia.com>
+
+ Revert r48697, since it broke key handling notification to GTK+.
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::imContextCommitted):
+ (WebKit::imContextPreeditChanged):
+ (WebKit::EditorClient::shouldBeginEditing):
+ (WebKit::EditorClient::shouldEndEditing):
+ (WebKit::interpretKeyEvent):
+ (WebKit::handleEditingKeyboardEvent):
+ (WebKit::EditorClient::handleKeyboardEvent):
+ (WebKit::EditorClient::handleInputMethodKeydown):
+
2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 3000d13..71a7c1a 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -49,32 +49,39 @@ using namespace WebCore;
namespace WebKit {
-static gchar* pendingComposition = 0;
-static gchar* pendingPreedit = 0;
-
-static void clearPendingIMData()
-{
- g_free(pendingComposition);
- pendingComposition = 0;
- g_free(pendingPreedit);
- pendingPreedit = 0;
-}
static void imContextCommitted(GtkIMContext* context, const gchar* str, EditorClient* client)
{
- ASSERT(!pendingComposition);
+ Frame* targetFrame = core(client->m_webView)->focusController()->focusedOrMainFrame();
- // This signal will fire during a keydown event. We want the contents of the
- // field to change right before the keyup event, so we wait until then to actually
- // commit this composition.
- pendingComposition = g_strdup(str);
+ if (!targetFrame || !targetFrame->editor()->canEdit())
+ return;
+
+ Editor* editor = targetFrame->editor();
+
+ String commitString = String::fromUTF8(str);
+ editor->confirmComposition(commitString);
}
static void imContextPreeditChanged(GtkIMContext* context, EditorClient* client)
{
- ASSERT(!pendingPreedit);
+ Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame();
+ Editor* editor = frame->editor();
+ gchar* preedit = NULL;
+ gint cursorPos = 0;
// We ignore the provided PangoAttrList for now.
- gtk_im_context_get_preedit_string(context, &pendingPreedit, NULL, NULL);
+ gtk_im_context_get_preedit_string(context, &preedit, NULL, &cursorPos);
+ String preeditString = String::fromUTF8(preedit);
+ g_free(preedit);
+
+ // setComposition() will replace the user selection if passed an empty
+ // preedit. We don't want this to happen.
+ if (preeditString.isEmpty() && !editor->hasComposition())
+ return;
+
+ Vector<CompositionUnderline> underlines;
+ underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
+ editor->setComposition(preeditString, underlines, cursorPos, 0);
}
void EditorClient::setInputMethodState(bool active)
@@ -129,16 +136,12 @@ int EditorClient::spellCheckerDocumentTag()
bool EditorClient::shouldBeginEditing(WebCore::Range*)
{
- clearPendingIMData();
-
notImplemented();
return true;
}
bool EditorClient::shouldEndEditing(WebCore::Range*)
{
- clearPendingIMData();
-
notImplemented();
return true;
}
@@ -418,7 +421,7 @@ static const KeyPressEntry keyPressEntries[] = {
{ '\r', AltKey | ShiftKey, "InsertNewline" },
};
-static const char* interpretEditorCommandKeyEvent(const KeyboardEvent* evt)
+static const char* interpretKeyEvent(const KeyboardEvent* evt)
{
ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent);
@@ -453,115 +456,74 @@ static const char* interpretEditorCommandKeyEvent(const KeyboardEvent* evt)
return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
}
-static bool handleCaretBrowsingKeyboardEvent(Frame* frame, const PlatformKeyboardEvent* keyEvent)
-{
- switch (keyEvent->windowsVirtualKeyCode()) {
- case VK_LEFT:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::LEFT,
- keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
- true);
- return true;
- case VK_RIGHT:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::RIGHT,
- keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
- true);
- return true;
- case VK_UP:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::BACKWARD,
- keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
- true);
- return true;
- case VK_DOWN:
- frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
- SelectionController::FORWARD,
- keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
- true);
- return true;
- default:
- return false; // Not a caret browswing keystroke, so continue processing.
- }
-}
-
-void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
+static bool handleEditingKeyboardEvent(KeyboardEvent* evt)
{
- Node* node = event->target()->toNode();
+ Node* node = evt->target()->toNode();
ASSERT(node);
Frame* frame = node->document()->frame();
ASSERT(frame);
- const PlatformKeyboardEvent* platformEvent = event->keyEvent();
- if (!platformEvent)
- return;
+ const PlatformKeyboardEvent* keyEvent = evt->keyEvent();
+ if (!keyEvent)
+ return false;
bool caretBrowsing = frame->settings()->caretBrowsingEnabled();
- if (caretBrowsing && handleCaretBrowsingKeyboardEvent(frame, platformEvent)) {
- // This was a caret browsing key event, so prevent it from bubbling up to the DOM.
- event->setDefaultHandled();
- return;
- }
-
- // Don't allow editor commands or text insertion for nodes that cannot edit.
- if (!frame->editor()->canEdit())
- return;
-
- const gchar* editorCommandString = interpretEditorCommandKeyEvent(event);
- if (editorCommandString) {
- Editor::Command command = frame->editor()->command(editorCommandString);
-
- // On editor commands from key down events, we only want to let the event bubble up to
- // the DOM if it inserts text. If it doesn't insert text (e.g. Tab that changes focus)
- // we just want WebKit to handle it immediately without a DOM event.
- if (platformEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
- if (!command.isTextInsertion() && command.execute(event))
- event->setDefaultHandled();
-
- return;
- } else if (command.execute(event)) {
- event->setDefaultHandled();
- return;
+ if (caretBrowsing) {
+ switch (keyEvent->windowsVirtualKeyCode()) {
+ case VK_LEFT:
+ frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
+ SelectionController::LEFT,
+ keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
+ true);
+ return true;
+ case VK_RIGHT:
+ frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
+ SelectionController::RIGHT,
+ keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity,
+ true);
+ return true;
+ case VK_UP:
+ frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
+ SelectionController::BACKWARD,
+ keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
+ true);
+ return true;
+ case VK_DOWN:
+ frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE,
+ SelectionController::FORWARD,
+ keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity,
+ true);
+ return true;
}
}
- // This is just a normal text insertion, so wait to execute the insertion
- // until a keyup event happens. This will ensure that the insertion will not
- // be reflected in the contents of the field until the keyup DOM event.
- if (event->type() != eventNames().keydownEvent) {
-
- if (pendingComposition) {
- String compositionString = String::fromUTF8(pendingComposition);
- frame->editor()->confirmComposition(compositionString);
+ Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
- clearPendingIMData();
+ if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
+ // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
+ // (e.g. Tab that inserts a Tab character, or Enter).
+ return !command.isTextInsertion() && command.execute(evt);
+ }
- } else if (pendingPreedit) {
- String preeditString = String::fromUTF8(pendingPreedit);
+ if (command.execute(evt))
+ return true;
- // Don't use an empty preedit as it will destroy the current
- // selection, even if the composition is cancelled or fails later on.
- if (!preeditString.isEmpty()) {
- Vector<CompositionUnderline> underlines;
- underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false));
- frame->editor()->setComposition(preeditString, underlines, 0, 0);
- }
+ // Don't insert null or control characters as they can result in unexpected behaviour
+ if (evt->charCode() < ' ')
+ return false;
- clearPendingIMData();
+ // Don't insert anything if a modifier is pressed
+ if (keyEvent->ctrlKey() || keyEvent->altKey())
+ return false;
- } else {
- // Don't insert null or control characters as they can result in unexpected behaviour
- if (event->charCode() < ' ')
- return;
-
- // Don't insert anything if a modifier is pressed
- if (platformEvent->ctrlKey() || platformEvent->altKey())
- return;
+ return frame->editor()->insertText(evt->keyEvent()->text(), evt);
+}
- if (frame->editor()->insertText(platformEvent->text(), event))
- event->setDefaultHandled();
- }
- }
+void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
+{
+ if (handleEditingKeyboardEvent(event))
+ event->setDefaultHandled();
}
void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
@@ -571,7 +533,9 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
return;
WebKitWebViewPrivate* priv = m_webView->priv;
- gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey());
+ // TODO: Dispatch IE-compatible text input events for IM events.
+ if (gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()))
+ event->setDefaultHandled();
}
EditorClient::EditorClient(WebKitWebView* webView)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list