[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:32:48 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 43250c6f47eefbcae552e65c56108d04d0b56f92
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 24 02:44:03 2009 +0000
2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
Reviewed by Xan Lopez.
[GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
https://bugs.webkit.org/show_bug.cgi?id=29654
Enable tests which are now passing because of key event fixes.
* platform/gtk/Skipped:
2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
Reviewed by Xan Lopez.
[GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
https://bugs.webkit.org/show_bug.cgi?id=29654
Give GDK_Backspace key events the proper text properties.
Instead of adding new tests, this change removes existing tests
from Gtk's skipped list.
* platform/gtk/KeyEventGtk.cpp:
(WebCore::keyIdentifierForGdkKeyCode):
(WebCore::singleCharacterString):
2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
Reviewed by Xan Lopez.
[GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
https://bugs.webkit.org/show_bug.cgi?id=29654
Ensure that even when GTKSimpleIMContext filters non-IME keystrokes,
keyboard events are fired properly.
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::clearPendingIMData):
(WebKit::imContextCommitted):
(WebKit::imContextPreeditChanged):
(WebKit::EditorClient::shouldBeginEditing):
(WebKit::EditorClient::shouldEndEditing):
(WebKit::interpretEditorCommandKeyEvent):
(WebKit::handleCaretBrowsingKeyboardEvent):
(WebKit::EditorClient::handleKeyboardEvent):
(WebKit::EditorClient::handleInputMethodKeydown):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48697 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6fc52dd..cc66725 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
+ https://bugs.webkit.org/show_bug.cgi?id=29654
+
+ Enable tests which are now passing because of key event fixes.
+
+ * platform/gtk/Skipped:
+
2009-09-23 Eric Seidel <eric at webkit.org>
No review, just adding missing pixel test results from recent test additions.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 9161e6b..98aae96 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1606,11 +1606,6 @@ 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
@@ -1630,7 +1625,6 @@ 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
@@ -5583,7 +5577,6 @@ 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 0c0f6a2..479db41 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
+ https://bugs.webkit.org/show_bug.cgi?id=29654
+
+ Give GDK_Backspace key events the proper text properties.
+
+ Instead of adding new tests, this change removes existing tests
+ from Gtk's skipped list.
+
+ * platform/gtk/KeyEventGtk.cpp:
+ (WebCore::keyIdentifierForGdkKeyCode):
+ (WebCore::singleCharacterString):
+
2009-09-23 Sam Weinig <sam at webkit.org>
Reviewed by Adam Barth.
diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp
index 5875547..4186c2f 100644
--- a/WebCore/platform/gtk/KeyEventGtk.cpp
+++ b/WebCore/platform/gtk/KeyEventGtk.cpp
@@ -136,6 +136,8 @@ 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:
@@ -503,6 +505,8 @@ 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 91c7f82..f3ff195 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,24 @@
+2009-09-23 Martin Robinson <martin.james.robinson at gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images
+ https://bugs.webkit.org/show_bug.cgi?id=29654
+
+ Ensure that even when GTKSimpleIMContext filters non-IME keystrokes,
+ keyboard events are fired properly.
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::clearPendingIMData):
+ (WebKit::imContextCommitted):
+ (WebKit::imContextPreeditChanged):
+ (WebKit::EditorClient::shouldBeginEditing):
+ (WebKit::EditorClient::shouldEndEditing):
+ (WebKit::interpretEditorCommandKeyEvent):
+ (WebKit::handleCaretBrowsingKeyboardEvent):
+ (WebKit::EditorClient::handleKeyboardEvent):
+ (WebKit::EditorClient::handleInputMethodKeydown):
+
2009-09-23 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 71a7c1a..3000d13 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -49,39 +49,32 @@ 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)
{
- Frame* targetFrame = core(client->m_webView)->focusController()->focusedOrMainFrame();
+ ASSERT(!pendingComposition);
- if (!targetFrame || !targetFrame->editor()->canEdit())
- return;
-
- Editor* editor = targetFrame->editor();
-
- String commitString = String::fromUTF8(str);
- editor->confirmComposition(commitString);
+ // 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);
}
static void imContextPreeditChanged(GtkIMContext* context, EditorClient* client)
{
- Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame();
- Editor* editor = frame->editor();
+ ASSERT(!pendingPreedit);
- gchar* preedit = NULL;
- gint cursorPos = 0;
// We ignore the provided PangoAttrList for now.
- 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);
+ gtk_im_context_get_preedit_string(context, &pendingPreedit, NULL, NULL);
}
void EditorClient::setInputMethodState(bool active)
@@ -136,12 +129,16 @@ int EditorClient::spellCheckerDocumentTag()
bool EditorClient::shouldBeginEditing(WebCore::Range*)
{
+ clearPendingIMData();
+
notImplemented();
return true;
}
bool EditorClient::shouldEndEditing(WebCore::Range*)
{
+ clearPendingIMData();
+
notImplemented();
return true;
}
@@ -421,7 +418,7 @@ static const KeyPressEntry keyPressEntries[] = {
{ '\r', AltKey | ShiftKey, "InsertNewline" },
};
-static const char* interpretKeyEvent(const KeyboardEvent* evt)
+static const char* interpretEditorCommandKeyEvent(const KeyboardEvent* evt)
{
ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent);
@@ -456,74 +453,115 @@ static const char* interpretKeyEvent(const KeyboardEvent* evt)
return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
}
-static bool handleEditingKeyboardEvent(KeyboardEvent* evt)
+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)
{
- Node* node = evt->target()->toNode();
+ Node* node = event->target()->toNode();
ASSERT(node);
Frame* frame = node->document()->frame();
ASSERT(frame);
- const PlatformKeyboardEvent* keyEvent = evt->keyEvent();
- if (!keyEvent)
- return false;
+ const PlatformKeyboardEvent* platformEvent = event->keyEvent();
+ if (!platformEvent)
+ return;
bool caretBrowsing = frame->settings()->caretBrowsingEnabled();
- 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;
- }
+ if (caretBrowsing && handleCaretBrowsingKeyboardEvent(frame, platformEvent)) {
+ // This was a caret browsing key event, so prevent it from bubbling up to the DOM.
+ event->setDefaultHandled();
+ return;
}
- Editor::Command command = frame->editor()->command(interpretKeyEvent(evt));
+ // Don't allow editor commands or text insertion for nodes that cannot edit.
+ if (!frame->editor()->canEdit())
+ return;
- 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);
+ 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 (command.execute(evt))
- 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) {
- // Don't insert null or control characters as they can result in unexpected behaviour
- if (evt->charCode() < ' ')
- return false;
+ if (pendingComposition) {
+ String compositionString = String::fromUTF8(pendingComposition);
+ frame->editor()->confirmComposition(compositionString);
- // Don't insert anything if a modifier is pressed
- if (keyEvent->ctrlKey() || keyEvent->altKey())
- return false;
+ clearPendingIMData();
- return frame->editor()->insertText(evt->keyEvent()->text(), evt);
-}
+ } else if (pendingPreedit) {
+ String preeditString = String::fromUTF8(pendingPreedit);
-void EditorClient::handleKeyboardEvent(KeyboardEvent* event)
-{
- if (handleEditingKeyboardEvent(event))
- event->setDefaultHandled();
+ // 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);
+ }
+
+ clearPendingIMData();
+
+ } 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;
+
+ if (frame->editor()->insertText(platformEvent->text(), event))
+ event->setDefaultHandled();
+ }
+ }
}
void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
@@ -533,9 +571,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
return;
WebKitWebViewPrivate* priv = m_webView->priv;
- // TODO: Dispatch IE-compatible text input events for IM events.
- if (gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()))
- event->setDefaultHandled();
+ gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey());
}
EditorClient::EditorClient(WebKitWebView* webView)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list