Reviewed by Darin Adler.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Apr 2011 00:27:29 +0000 (00:27 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Apr 2011 00:27:29 +0000 (00:27 +0000)
        REGRESSION: Assertion failure when executing a complex custom key binding
        https://bugs.webkit.org/show_bug.cgi?id=57681

        Also completes the fix for
        <rdar://problem/9063782> WebKit2: Text fields in Safari don't honor custom key bindings

        * UIProcess/API/mac/WKView.mm: (-[WKView hasMarkedText]): There is no need to execute saved
        commands when they can't possibly change the result.

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

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 70693f2..7e4fd4c 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-01  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: Assertion failure when executing a complex custom key binding
+        https://bugs.webkit.org/show_bug.cgi?id=57681
+
+        * WebView/WebHTMLView.mm: (-[WebHTMLView hasMarkedText]): There is no need to execute saved
+        commands when they can't possibly change the result.
+
 2011-04-01  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Sam Weinig.
index f810191..afeedb7 100644 (file)
@@ -5876,10 +5876,15 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
 
 - (BOOL)hasMarkedText
 {
-    [self _executeSavedKeypressCommands];
-
     Frame* coreFrame = core([self _frame]);
     BOOL result = coreFrame && coreFrame->editor()->hasComposition();
+
+    if (result) {
+        // A saved command can confirm a composition, but it cannot start a new one.
+        [self _executeSavedKeypressCommands];
+        result = coreFrame->editor()->hasComposition();
+    }
+
     LOG(TextInput, "hasMarkedText -> %u", result);
     return result;
 }
index 07e2b64..a42afaf 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-01  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: Assertion failure when executing a complex custom key binding
+        https://bugs.webkit.org/show_bug.cgi?id=57681
+
+        Also completes a fix for
+        <rdar://problem/9063782> WebKit2: Text fields in Safari don't honor custom key bindings
+
+        * UIProcess/API/mac/WKView.mm: (-[WKView hasMarkedText]): There is no need to execute saved
+        commands when they can't possibly change the result.
+
 2011-04-01  Brian Weinstein  <bweinstein@apple.com>
 
         Reviewed by Anders Carlsson.
index 4fa8009..7b70f93 100644 (file)
@@ -1205,14 +1205,17 @@ static const short kIOHIDEventTypeScroll = 6;
 
 - (BOOL)hasMarkedText
 {
-    [self _executeSavedKeypressCommands];
-
     WKViewInterpretKeyEventsParameters* parameters = _data->_interpretKeyEventsParameters;
 
     BOOL result;
-    if (parameters)
+    if (parameters) {
         result = parameters->cachedTextInputState.hasMarkedText;
-    else {
+        if (result) {
+            // A saved command can confirm a composition, but it cannot start a new one.
+            [self _executeSavedKeypressCommands];
+            result = parameters->cachedTextInputState.hasMarkedText;
+        }
+    } else {
         uint64_t location;
         uint64_t length;
         _data->_page->getMarkedRange(location, length);