Fix <rdar://5693854> REGRESSION (r29581): fast/events/frame-click-focus.html failing
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 18:44:31 +0000 (18:44 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 18:44:31 +0000 (18:44 +0000)
 WebKit/mac:

         Rename _updateActiveState to _updateFocusedAndActiveState

         Also renamed any related methods/members similarly.

         Reviewed by Adele.

         * WebView/WebHTMLView.mm:
         (-[WebHTMLViewPrivate dealloc]):
         (-[WebHTMLView _cancelUpdateFocusedAndActiveStateTimer]):
         (-[WebHTMLView close]):
         (_updateFocusedAndActiveStateTimerCallback):
         (-[WebHTMLView viewWillMoveToWindow:]):
         (-[WebHTMLView viewDidMoveToWindow]):
         (-[WebHTMLView windowDidBecomeKey:]):
         (-[WebHTMLView windowDidResignKey:]):
         (-[WebHTMLView becomeFirstResponder]):
         (-[WebHTMLView resignFirstResponder]):
         * WebView/WebHTMLViewInternal.h:
         * WebView/WebHTMLViewPrivate.h:

 WebKit/win:

         Fix <rdar://5693854> REGRESSION (r29581): fast/events/frame-click-focus.html failing

         Restored the previous behavior of IWebViewPrivate::updateActiveState,
         which DRT depends on, and renamed it to
         IWebViewPrivate::updateFocusedAndActiveState to be clearer about its
         side-effects.

         Reviewed by Adele.

         * Interfaces/IWebViewPrivate.idl:
         * WebView.cpp:
         (WebViewWndProc): Removed some FIXMEs that we no longer want to fix
         because the current design is better.
         (WebView::updateActiveState): This is now just a method of WebView,
         not any of its public interfaces.
         (WebView::updateFocusedAndActiveState): Performs the tasks that the
         old IWebViewPrivate::updateActiveState performed.
         * WebView.h:

 WebKitTools:

         Updated for method renames

         Reviewed by Adele.

         * DumpRenderTree/mac/FrameLoadDelegate.mm:
         (-[FrameLoadDelegate webView:didCommitLoadForFrame:]):
         * DumpRenderTree/mac/LayoutTestControllerMac.mm:
         (LayoutTestController::setMainFrameIsFirstResponder):
         (LayoutTestController::setWindowIsKey):
         * DumpRenderTree/mac/UIDelegate.mm:
         (-[UIDelegate webViewFocus:]):
         * DumpRenderTree/win/FrameLoadDelegate.cpp:
         (FrameLoadDelegate::didCommitLoadForFrame):

 LayoutTests:

         Reviewed by Adele.

         * platform/win/Skipped: Removed a fixed test, and a test that passes
         for me locally.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/win/Skipped
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebHTMLView.mm
WebKit/mac/WebView/WebHTMLViewInternal.h
WebKit/mac/WebView/WebHTMLViewPrivate.h
WebKit/win/ChangeLog
WebKit/win/Interfaces/IWebViewPrivate.idl
WebKit/win/WebView.cpp
WebKit/win/WebView.h
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm
WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
WebKitTools/DumpRenderTree/mac/UIDelegate.mm
WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp

index 790076c..c2b611c 100644 (file)
@@ -1,3 +1,10 @@
+2008-01-18  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Adele.
+
+        * platform/win/Skipped: Removed a fixed test, and a test that passes
+        for me locally.
+
 2008-01-17  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Adele.
index c9200e8..becda5a 100644 (file)
@@ -421,8 +421,3 @@ http/tests/xmlhttprequest/failed-auth.html
 http/tests/xmlhttprequest/connection-error-sync.html
 plugins/netscape-plugin-setwindow-size.html
 svg/custom/gradient-stop-style-change.svg
-
-# <rdar://problem/5693854> REGRESSION: fast/events/content-changed-during-drop.html and fast/events/frame-click-focus.html fail due to 29581
-fast/events/content-changed-during-drop.html
-fast/events/frame-click-focus.html
-
index f186533..69e23b4 100644 (file)
@@ -1,3 +1,25 @@
+2008-01-18  Adam Roben  <aroben@apple.com>
+
+        Rename _updateActiveState to _updateFocusedAndActiveState
+
+        Also renamed any related methods/members similarly.
+
+        Reviewed by Adele.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLViewPrivate dealloc]):
+        (-[WebHTMLView _cancelUpdateFocusedAndActiveStateTimer]):
+        (-[WebHTMLView close]):
+        (_updateFocusedAndActiveStateTimerCallback):
+        (-[WebHTMLView viewWillMoveToWindow:]):
+        (-[WebHTMLView viewDidMoveToWindow]):
+        (-[WebHTMLView windowDidBecomeKey:]):
+        (-[WebHTMLView windowDidResignKey:]):
+        (-[WebHTMLView becomeFirstResponder]):
+        (-[WebHTMLView resignFirstResponder]):
+        * WebView/WebHTMLViewInternal.h:
+        * WebView/WebHTMLViewPrivate.h:
+
 2008-01-17  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Darin
index ec7d2a9..e6f0d15 100644 (file)
@@ -410,7 +410,7 @@ static NSCellStateValue kit(TriState state)
 {
     ASSERT(!autoscrollTimer);
     ASSERT(!autoscrollTriggerEvent);
-    ASSERT(!updateActiveStateTimer);
+    ASSERT(!updateFocusedAndActiveStateTimer);
     ASSERT(!updateMouseoverTimer);
     
     [mouseDownEvent release];
@@ -801,12 +801,12 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     _private->mouseDownEvent = event;
 }
 
-- (void)_cancelUpdateActiveStateTimer
+- (void)_cancelUpdateFocusedAndActiveStateTimer
 {
-    if (_private->updateActiveStateTimer) {
-        CFRunLoopTimerInvalidate(_private->updateActiveStateTimer);
-        CFRelease(_private->updateActiveStateTimer);
-        _private->updateActiveStateTimer = NULL;
+    if (_private->updateFocusedAndActiveStateTimer) {
+        CFRunLoopTimerInvalidate(_private->updateFocusedAndActiveStateTimer);
+        CFRelease(_private->updateFocusedAndActiveStateTimer);
+        _private->updateFocusedAndActiveStateTimer = NULL;
     }
 }
 
@@ -1697,9 +1697,9 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     return [[self window] firstResponder] == self || [[self window] firstResponder] == [self _frameView];
 }
 
-- (void)_updateActiveState
+- (void)_updateFocusedAndActiveState
 {
-    [self _cancelUpdateActiveStateTimer];
+    [self _cancelUpdateFocusedAndActiveStateTimer];
 
     // This method does the job of updating the view based on the view's firstResponder-ness and
     // the window key-ness of the window containing this view. This involves four kinds of 
@@ -1759,7 +1759,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     if (!_private || _private->closed)
         return;
     [self _cancelUpdateMouseoverTimer];
-    [self _cancelUpdateActiveStateTimer];
+    [self _cancelUpdateFocusedAndActiveStateTimer];
     [self _clearLastHitViewIfSelf];
     // FIXME: This is slow; should remove individual observers instead.
     [[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -2524,10 +2524,10 @@ WEBCORE_COMMAND(yankAndSelect)
     }
 }
 
-static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
+static void _updateFocusedAndActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
 {
     WebHTMLView *view = (WebHTMLView *)info;
-    [view _updateActiveState];
+    [view _updateFocusedAndActiveState];
 }
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
@@ -2544,7 +2544,7 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
     [self removeWindowObservers];
     [self removeSuperviewObservers];
     [self _cancelUpdateMouseoverTimer];
-    [self _cancelUpdateActiveStateTimer];
+    [self _cancelUpdateFocusedAndActiveStateTimer];
     
     [[self _pluginController] stopAllPlugins];
 }
@@ -2571,11 +2571,11 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
         // at the time this code is running. However, it will be there on the next
         // crank of the run loop. Doing this helps to make a blinking caret appear 
         // in a new, empty window "automatic".
-        if (!_private->updateActiveStateTimer) {
+        if (!_private->updateFocusedAndActiveStateTimer) {
             CFRunLoopTimerContext context = { 0, self, NULL, NULL, NULL };
-            _private->updateActiveStateTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 0, 0, 0,
-                                                                    _updateActiveStateTimerCallback, &context);
-            CFRunLoopAddTimer(CFRunLoopGetCurrent(), _private->updateActiveStateTimer, kCFRunLoopDefaultMode);
+            _private->updateFocusedAndActiveStateTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 0, 0, 0,
+                                                                    _updateFocusedAndActiveStateTimerCallback, &context);
+            CFRunLoopAddTimer(CFRunLoopGetCurrent(), _private->updateFocusedAndActiveStateTimer, kCFRunLoopDefaultMode);
         }
         
         [[self _pluginController] startAllPlugins];
@@ -2871,7 +2871,7 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
         [self addMouseMovedObserver];
 
     if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet])
-        [self _updateActiveState];
+        [self _updateFocusedAndActiveState];
 }
 
 - (void)windowDidResignKey:(NSNotification *)notification
@@ -2882,7 +2882,7 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
         [self removeMouseMovedObserver];
 
     if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) {
-        [self _updateActiveState];
+        [self _updateFocusedAndActiveState];
         [_private->compController endRevertingChange:NO moveLeft:NO];
     }
 }
@@ -3159,7 +3159,7 @@ noPromisedData:
     if (![[self _webView] _isPerformingProgrammaticFocus])
         direction = [[self window] keyViewSelectionDirection];
 
-    [self _updateActiveState];
+    [self _updateFocusedAndActiveState];
     [self _updateFontPanel];
     
     Frame* frame = core([self _frame]);
@@ -3194,7 +3194,7 @@ noPromisedData:
             if (![[self _webView] _isPerformingProgrammaticFocus])
                 [self clearFocus];
         }
-        [self _updateActiveState];
+        [self _updateFocusedAndActiveState];
         _private->resigningFirstResponder = NO;
     }
     return resign;
index 845da90..e54ab2d 100644 (file)
@@ -89,7 +89,7 @@ struct WebHTMLViewInterpretKeyEventsParameters;
     WebDataSource *dataSource;
     WebCore::CachedImage *promisedDragTIFFDataSource;
     
-    CFRunLoopTimerRef updateActiveStateTimer;
+    CFRunLoopTimerRef updateFocusedAndActiveStateTimer;
     CFRunLoopTimerRef updateMouseoverTimer;
 
     SEL selectorForDoCommandBySelector;
index a73711d..0360915 100644 (file)
 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard forType:(NSString *)pboardType inContext:(DOMRange *)context subresources:(NSArray **)subresources;
 
 // SPI for DumpRenderTree
-- (void)_updateActiveState;
+- (void)_updateFocusedAndActiveState;
 
 // SPI for printing (should be converted to API someday). When the WebHTMLView isn't being printed
 // directly, this method must be called before paginating, or the computed height might be incorrect.
index 331b7b5..b953404 100644 (file)
@@ -1,3 +1,24 @@
+2008-01-18  Adam Roben  <aroben@apple.com>
+
+        Fix <rdar://5693854> REGRESSION (r29581): fast/events/frame-click-focus.html failing
+
+        Restored the previous behavior of IWebViewPrivate::updateActiveState,
+        which DRT depends on, and renamed it to
+        IWebViewPrivate::updateFocusedAndActiveState to be clearer about its
+        side-effects.
+
+        Reviewed by Adele.
+
+        * Interfaces/IWebViewPrivate.idl:
+        * WebView.cpp:
+        (WebViewWndProc): Removed some FIXMEs that we no longer want to fix
+        because the current design is better.
+        (WebView::updateActiveState): This is now just a method of WebView,
+        not any of its public interfaces.
+        (WebView::updateFocusedAndActiveState): Performs the tasks that the
+        old IWebViewPrivate::updateActiveState performed.
+        * WebView.h:
+
 2008-01-18  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Adam Roben.
index e091440..8328608 100644 (file)
@@ -93,7 +93,7 @@ interface IWebViewPrivate : IUnknown
     HRESULT visibleContentRect([out, retval] LPRECT rect);
     
     // SPI for DumpRenderTree
-    HRESULT updateActiveState();
+    HRESULT updateFocusedAndActiveState();
 
     // Support for displaying multiple text matches.
     HRESULT markAllMatchesForText([in] BSTR search, [in] BOOL caseSensitive, [in] BOOL highlight, [in] UINT limit, [out] UINT* matches);
index 2abbd58..5994088 100644 (file)
@@ -1678,7 +1678,6 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
             if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
                 SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
                 uiDelegatePrivate->webViewReceivedFocus(webView);
-            // FIXME: Merge this logic with updateActiveState, and switch this over to use updateActiveState
 
             FocusController* focusController = webView->page()->focusController();
             if (Frame* frame = focusController->focusedFrame()) {
@@ -1697,7 +1696,6 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
             if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
                 SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
                 uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd);
-            // FIXME: Merge this logic with updateActiveState, and switch this over to use updateActiveState
 
             // However here we have to be careful.  If we are losing focus because of a deactivate,
             // then we need to remember our focused target for restoration later.  
@@ -2704,11 +2702,20 @@ HRESULT STDMETHODCALLTYPE WebView::searchFor(
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE WebView::updateActiveState()
+void WebView::updateActiveState()
 {
     HWND activeWindow = GetActiveWindow();
-
     m_page->focusController()->setActive(activeWindow && m_topLevelParent == findTopLevelParent(activeWindow));
+}
+
+HRESULT STDMETHODCALLTYPE WebView::updateFocusedAndActiveState()
+{
+    updateActiveState();
+
+    bool active = m_page->focusController()->isActive();
+    Frame* mainFrame = m_page->mainFrame();
+    Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
+    mainFrame->selectionController()->setFocused(active && mainFrame == focusedFrame);
 
     return S_OK;
 }
index 4772bc6..112e1df 100644 (file)
@@ -569,7 +569,7 @@ public:
     virtual HRESULT STDMETHODCALLTYPE visibleContentRect( 
         /* [retval][out] */ LPRECT rect);
 
-    virtual HRESULT STDMETHODCALLTYPE updateActiveState(void);
+    virtual HRESULT STDMETHODCALLTYPE updateFocusedAndActiveState();
 
     virtual HRESULT STDMETHODCALLTYPE executeCoreCommandByName(BSTR name, BSTR value);
 
@@ -711,6 +711,8 @@ public:
 
     HWND topLevelParent() const { return m_topLevelParent; }
 
+    void updateActiveState();
+
 protected:
     HIMC getIMMContext();
     void releaseIMMContext(HIMC);
index de17a58..75c3c38 100644 (file)
@@ -1,3 +1,19 @@
+2008-01-18  Adam Roben  <aroben@apple.com>
+
+        Updated for method renames
+
+        Reviewed by Adele.
+
+        * DumpRenderTree/mac/FrameLoadDelegate.mm:
+        (-[FrameLoadDelegate webView:didCommitLoadForFrame:]):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setMainFrameIsFirstResponder):
+        (LayoutTestController::setWindowIsKey):
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webViewFocus:]):
+        * DumpRenderTree/win/FrameLoadDelegate.cpp:
+        (FrameLoadDelegate::didCommitLoadForFrame):
+
 2008-01-18  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Adam Roben.
index c6dcc15..760c5e6 100644 (file)
     NSView *documentView = [[mainFrame frameView] documentView];
     [[[mainFrame webView] window] makeFirstResponder:documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
+        [(WebHTMLView *)documentView _updateFocusedAndActiveState];
 }
 
 - (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame
index 63e551f..6cd15e0 100644 (file)
@@ -178,7 +178,7 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
     [[[mainFrame webView] window] makeFirstResponder:firstResponder];
         
     if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
+        [(WebHTMLView *)documentView _updateFocusedAndActiveState];
 }
 
 void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
@@ -218,7 +218,7 @@ void LayoutTestController::setWindowIsKey(bool windowIsKey)
     m_windowIsKey = windowIsKey;
     NSView *documentView = [[mainFrame frameView] documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
+        [(WebHTMLView *)documentView _updateFocusedAndActiveState];
 }
 
 static const CFTimeInterval waitToDumpWatchdogInterval = 10.0;
index 9d9b4ae..8d41258 100644 (file)
@@ -100,7 +100,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
     layoutTestController->setWindowIsKey(true);
     NSView *documentView = [[mainFrame frameView] documentView];
     if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _updateActiveState];
+        [(WebHTMLView *)documentView _updateFocusedAndActiveState];
 }
 
 - (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request
index e6b530c..0269514 100644 (file)
@@ -160,7 +160,7 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame(
     HRESULT hr = webView->QueryInterface(&webViewPrivate);
     if (FAILED(hr))
         return hr;
-    webViewPrivate->updateActiveState();
+    webViewPrivate->updateFocusedAndActiveState();
 
     if (!done && layoutTestController->dumpFrameLoadCallbacks())
         printf("%s - didCommitLoadForFrame\n",