[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:42:11 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit e9477848fbb30d4fef16c3613b7cf12fd6bb4cc1
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed May 14 18:13:48 2003 +0000
WebCore:
Reviewed by Don.
- fixed 3257307 - REGRESSION: crash using onFocus="this.blur()"
* kwq/KWQTextField.mm:
(-[KWQTextField setHasFocus:]): Don't call
KWQKHTMLPart::setDocumentFocus(widget) to start with, it might
invoke a handler which could call blur(), and we don't want to do
the selection handling after that; futhermore, it will get called
anyway when we deliver the FocusIn event to the event
filter. Also, sometimes unfocusing in the middle of a focus can
leave us and AppKit in an inconsistent state; correct this. A
comment explains the details.
WebKit:
Reviewed by Don.
- fixed 3257307 - REGRESSION: crash using onFocus="this.blur()"
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge makeFirstResponder:]): Let the WebView know that
this is a programmatic focus.
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView becomeFirstResponder]): Check if this is a programmatic
focus from WebCore - if so, treat it like a direct focus, even if there
is a selection direction set.
* WebView.subproj/WebViewPrivate.h:
* WebView.subproj/WebViewPrivate.m:
(-[WebView _pushPerformingProgrammaticFocus]): New method to indicate
upcoming programmatic focus.
(-[WebView _popPerformingProgrammaticFocus]): New method to indicate
end of programmatic focus. Needs to nest with the previous.
(-[WebView _isPerformingProgrammaticFocus]): Check if we are handling
a programmatic focus from WebCore.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 98a3467..80e2f6f 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2003-05-14 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Don.
+
+ - fixed 3257307 - REGRESSION: crash using onFocus="this.blur()"
+
+ * kwq/KWQTextField.mm:
+
+ (-[KWQTextField setHasFocus:]): Don't call
+ KWQKHTMLPart::setDocumentFocus(widget) to start with, it might
+ invoke a handler which could call blur(), and we don't want to do
+ the selection handling after that; futhermore, it will get called
+ anyway when we deliver the FocusIn event to the event
+ filter. Also, sometimes unfocusing in the middle of a focus can
+ leave us and AppKit in an inconsistent state; correct this. A
+ comment explains the details.
+
2003-05-13 Maciej Stachowiak <mjs at apple.com>
Reviewed by John.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 98a3467..80e2f6f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2003-05-14 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Don.
+
+ - fixed 3257307 - REGRESSION: crash using onFocus="this.blur()"
+
+ * kwq/KWQTextField.mm:
+
+ (-[KWQTextField setHasFocus:]): Don't call
+ KWQKHTMLPart::setDocumentFocus(widget) to start with, it might
+ invoke a handler which could call blur(), and we don't want to do
+ the selection handling after that; futhermore, it will get called
+ anyway when we deliver the FocusIn event to the event
+ filter. Also, sometimes unfocusing in the middle of a focus can
+ leave us and AppKit in an inconsistent state; correct this. A
+ comment explains the details.
+
2003-05-13 Maciej Stachowiak <mjs at apple.com>
Reviewed by John.
diff --git a/WebCore/kwq/KWQTextField.mm b/WebCore/kwq/KWQTextField.mm
index fd6c6b5..c2e940d 100644
--- a/WebCore/kwq/KWQTextField.mm
+++ b/WebCore/kwq/KWQTextField.mm
@@ -410,8 +410,6 @@
_hasFocus = hasFocus;
if (hasFocus) {
- KWQKHTMLPart::setDocumentFocus(widget);
-
// Select all the text if we are tabbing in, but otherwise preserve/remember
// the selection from last time we had focus (to match WinIE).
if ([[self window] keyViewSelectionDirection] != NSDirectSelection) {
@@ -425,6 +423,19 @@
QFocusEvent event(QEvent::FocusIn);
const_cast<QObject *>(widget->eventFilterObject())->eventFilter(widget, &event);
+
+ // Sending the onFocus event above, may have resulted in a blur() - if this
+ // happens when tabbing from another text field, then endEditing: and
+ // controlTextDidEndEditing: will never be called. The bad side effects of this
+ // include the fact that our idea of the focus state will be wrong;
+ // and the text field will think it's still editing, so it will continue to draw
+ // the focus ring. So we call endEditing: manually if we detect this inconsistency,
+ // and the correct our internal impression of the focus state.
+
+ if ([self currentEditorForEitherField] == nil && [self currentEditor] != nil) {
+ [[self cell] endEditing:[self currentEditor]];
+ [self setHasFocus:NO];
+ }
} else {
lastSelectedRange = [self selectedRange];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 6d81312..b93623b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2003-05-14 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Don.
+
+ - fixed 3257307 - REGRESSION: crash using onFocus="this.blur()"
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge makeFirstResponder:]): Let the WebView know that
+ this is a programmatic focus.
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView becomeFirstResponder]): Check if this is a programmatic
+ focus from WebCore - if so, treat it like a direct focus, even if there
+ is a selection direction set.
+ * WebView.subproj/WebViewPrivate.h:
+ * WebView.subproj/WebViewPrivate.m:
+ (-[WebView _pushPerformingProgrammaticFocus]): New method to indicate
+ upcoming programmatic focus.
+ (-[WebView _popPerformingProgrammaticFocus]): New method to indicate
+ end of programmatic focus. Needs to nest with the previous.
+ (-[WebView _isPerformingProgrammaticFocus]): Check if we are handling
+ a programmatic focus from WebCore.
+
2003-05-14 Ken Kocienda <kocienda at apple.com>
Reviewed by John
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 33989a2..d4cd197 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -242,7 +242,9 @@
{
ASSERT(_frame != nil);
WebView *webView = [_frame webView];
+ [webView _pushPerformingProgrammaticFocus];
[[webView _UIDelegateForwarder] webView:webView makeFirstResponder:view];
+ [webView _popPerformingProgrammaticFocus];
}
- (void)closeWindowSoon
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 5e30df9..e8a3dae 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -783,15 +783,17 @@
- (BOOL)becomeFirstResponder
{
NSView *view = nil;
- switch ([[self window] keyViewSelectionDirection]) {
- case NSDirectSelection:
- break;
- case NSSelectingNext:
- view = [[self _bridge] nextKeyViewInsideWebFrameViews];
- break;
- case NSSelectingPrevious:
- view = [[self _bridge] previousKeyViewInsideWebFrameViews];
- break;
+ if (![[self _webView] _isPerformingProgrammaticFocus]) {
+ switch ([[self window] keyViewSelectionDirection]) {
+ case NSDirectSelection:
+ break;
+ case NSSelectingNext:
+ view = [[self _bridge] nextKeyViewInsideWebFrameViews];
+ break;
+ case NSSelectingPrevious:
+ view = [[self _bridge] previousKeyViewInsideWebFrameViews];
+ break;
+ }
}
if (view) {
[[self window] makeFirstResponder:view];
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 63b9314..f130c78 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -63,6 +63,8 @@ typedef struct _WebResourceDelegateImplementationCache {
BOOL lastElementWasNonNil;
NSWindow *hostWindow;
+
+ int programmaticFocusCount;
WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
}
@@ -195,6 +197,10 @@ Could be worth adding to the API.
+ (NSString *)_decodeData:(NSData *)data;
+- (void)_pushPerformingProgrammaticFocus;
+- (void)_popPerformingProgrammaticFocus;
+- (BOOL)_isPerformingProgrammaticFocus;
+
@end
@interface _WebSafeForwarder : NSObject
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index c32576a..5b12c9e 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -604,6 +604,21 @@ static NSMutableSet *schemesWithRepresentationsSet;
return [WebCoreEncodings decodeData:data];
}
+- (void)_pushPerformingProgrammaticFocus
+{
+ _private->programmaticFocusCount++;
+}
+
+- (void)_popPerformingProgrammaticFocus
+{
+ _private->programmaticFocusCount--;
+}
+
+- (BOOL)_isPerformingProgrammaticFocus
+{
+ return _private->programmaticFocusCount != 0;
+}
+
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list