Source/WebCore: WebCore changes for: REGRESSION (WebKit2): Cursor, hover states not...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jan 2012 01:04:08 +0000 (01:04 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Jan 2012 01:04:08 +0000 (01:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75405

Reviewed by Anders Carlsson.

Test: fast/events/frame-scroll-fake-mouse-move.html

* page/FrameView.cpp:
(WebCore::FrameView::scrollPositionChanged): Added a call to
EventHandler::dispatchFakeMouseMoveEventSoon().

Source/WebKit/mac: WebKit/mac changes for: REGRESSION (WebKit2): Cursor, hover states not updated when page scrolls under stationary mouse pointer
https://bugs.webkit.org/show_bug.cgi?id=75405

Reviewed by Anders Carlsson.

Removed the WebKit/mac mechanism for dispatching fake mouse moved events
when an HTML frame scrolls, since FrameView now does this.

* WebView/WebHTMLView.mm:
(-[WebHTMLViewPrivate dealloc]): Removed an assertion about a removed ivar.
(-[WebHTMLView _updateMouseoverWithFakeEvent]): Removed call to
-_cancelUpdateMouseoverTimer.
(-[WebHTMLView _frameOrBoundsChanged]): Removed code to schedule a timer
for dispatching a mouse moved event on scroll.
(-[WebHTMLView close]): Removed call to _cancelUpdateMouseoverTimer.
(-[WebHTMLView viewWillMoveToWindow:]): Ditto.
(-[WebHTMLView mouseDown:]): Ditto.

LayoutTests: REGRESSION (WebKit2): Cursor, hover states not updated when page scrolls under stationary mouse pointer
https://bugs.webkit.org/show_bug.cgi?id=75405

Reviewed by Anders Carlsson.

* fast/events/frame-scroll-fake-mouse-move-expected.txt: Added.
* fast/events/frame-scroll-fake-mouse-move.html: Copied from
LayoutTests/fast/events/overflow-scroll-fake-mouse-move.html and adapted to page scrolling.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/frame-scroll-fake-mouse-move-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/frame-scroll-fake-mouse-move.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm

index 036db69f60f11224aeb2e98c1da95d14d3cefc93..9de58fdd20cbb630c61e1c5f83f365a8ab11b2c0 100644 (file)
@@ -1,3 +1,14 @@
+2011-12-31  Dan Bernstein  <mitz@apple.com>
+
+        REGRESSION (WebKit2): Cursor, hover states not updated when page scrolls under stationary mouse pointer
+        https://bugs.webkit.org/show_bug.cgi?id=75405
+
+        Reviewed by Anders Carlsson.
+
+        * fast/events/frame-scroll-fake-mouse-move-expected.txt: Added.
+        * fast/events/frame-scroll-fake-mouse-move.html: Copied from
+        LayoutTests/fast/events/overflow-scroll-fake-mouse-move.html and adapted to page scrolling.
+
 2011-12-30  Andreas Kling  <awesomekling@apple.com>
 
         Cache and reuse the HTMLTableElement.rows collection.
diff --git a/LayoutTests/fast/events/frame-scroll-fake-mouse-move-expected.txt b/LayoutTests/fast/events/frame-scroll-fake-mouse-move-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/events/frame-scroll-fake-mouse-move.html b/LayoutTests/fast/events/frame-scroll-fake-mouse-move.html
new file mode 100644 (file)
index 0000000..74af9d5
--- /dev/null
@@ -0,0 +1,32 @@
+<body style="height: 200%">
+<div onmouseover="mouseOver(event)" style="margin: 300px 0; width: 100px; height: 100px; background-color: blue;"></div>
+<div id="result">Test did not run</div>
+<script>
+    var passed = false;
+
+    function mouseOver(event)
+    {
+        passed = true;
+    }
+
+    function finish()
+    {
+        document.getElementById("result").innerText = passed ? "PASS" : "FAIL";
+        layoutTestController.notifyDone();
+    }
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+
+        // WebKit schedules a fake mouse move event as part of installing the WebView in
+        // a window. For the test to be valid, it must begin only after that event
+        // gets dispatched.
+        setTimeout(function()
+        {
+            eventSender.mouseMoveTo(50, 100);
+            document.body.scrollTop = 250;
+            setTimeout(finish, 200);
+        }, 200);
+    }
+</script>
index 0c16b61058b757a129fc72c6e2d9115b3f8c1876..984f6c645492af1271e7aba98343f5a674ff974d 100644 (file)
@@ -1,3 +1,16 @@
+2011-12-31  Dan Bernstein  <mitz@apple.com>
+
+        WebCore changes for: REGRESSION (WebKit2): Cursor, hover states not updated when page scrolls under stationary mouse pointer
+        https://bugs.webkit.org/show_bug.cgi?id=75405
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/events/frame-scroll-fake-mouse-move.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollPositionChanged): Added a call to
+        EventHandler::dispatchFakeMouseMoveEventSoon().
+
 2012-01-01  Andreas Kling  <awesomekling@apple.com>
 
         Cache named item collections on Document, not just their caches.
index 6392c320e9a5b4241771b83cbf632bc8d7ac5240..3a51f7eb1d13df436c855e837aa726e9c91bb995 100644 (file)
@@ -1735,6 +1735,7 @@ void FrameView::scrollPositionChangedViaPlatformWidget()
 void FrameView::scrollPositionChanged()
 {
     frame()->eventHandler()->sendScrollEvent();
+    frame()->eventHandler()->dispatchFakeMouseMoveEventSoon();
 
 #if USE(ACCELERATED_COMPOSITING)
     if (RenderView* root = rootRenderer(this)) {
index d691c525a77d1c80c325b11e30c3db7d8e25972b..1acdd15cc3c5853746995459dbfea02107cf16e9 100644 (file)
@@ -1,3 +1,23 @@
+2011-12-31  Dan Bernstein  <mitz@apple.com>
+
+        WebKit/mac changes for: REGRESSION (WebKit2): Cursor, hover states not updated when page scrolls under stationary mouse pointer
+        https://bugs.webkit.org/show_bug.cgi?id=75405
+
+        Reviewed by Anders Carlsson.
+
+        Removed the WebKit/mac mechanism for dispatching fake mouse moved events
+        when an HTML frame scrolls, since FrameView now does this.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLViewPrivate dealloc]): Removed an assertion about a removed ivar.
+        (-[WebHTMLView _updateMouseoverWithFakeEvent]): Removed call to
+        -_cancelUpdateMouseoverTimer.
+        (-[WebHTMLView _frameOrBoundsChanged]): Removed code to schedule a timer
+        for dispatching a mouse moved event on scroll.
+        (-[WebHTMLView close]): Removed call to _cancelUpdateMouseoverTimer.
+        (-[WebHTMLView viewWillMoveToWindow:]): Ditto.
+        (-[WebHTMLView mouseDown:]): Ditto.
+
 2011-12-23  Ryosuke Niwa  <rniwa@webkit.org>
 
         Chromium Mac build fix.
index c4bc2a2e02d5ba8842274f8b4c53f21943ab0544..7c7d6c97ffad0cc2663ae707305e9d61dcc10cc8 100644 (file)
@@ -518,8 +518,6 @@ struct WebHTMLViewInterpretKeyEventsParameters {
     
     WebDataSource *dataSource;
     WebCore::CachedImage* promisedDragTIFFDataSource;
-    
-    CFRunLoopTimerRef updateMouseoverTimer;
 
     SEL selectorForDoCommandBySelector;
 
@@ -578,7 +576,6 @@ static NSCellStateValue kit(TriState state)
 
     ASSERT(!autoscrollTimer);
     ASSERT(!autoscrollTriggerEvent);
-    ASSERT(!updateMouseoverTimer);
     
     [mouseDownEvent release];
     [keyDownEvent release];
@@ -1047,15 +1044,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     _private->mouseDownEvent = event;
 }
 
-- (void)_cancelUpdateMouseoverTimer
-{
-    if (_private->updateMouseoverTimer) {
-        CFRunLoopTimerInvalidate(_private->updateMouseoverTimer);
-        CFRelease(_private->updateMouseoverTimer);
-        _private->updateMouseoverTimer = NULL;
-    }
-}
-
 - (WebHTMLView *)_topHTMLView
 {
     // FIXME: this can fail if the dataSource is nil, which happens when the WebView is tearing down from the window closing.
@@ -1190,8 +1178,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 
 - (void)_updateMouseoverWithFakeEvent
 {
-    [self _cancelUpdateMouseoverTimer];
-    
     NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
         location:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
         modifierFlags:[[NSApp currentEvent] modifierFlags]
@@ -1203,13 +1189,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     [self _updateMouseoverWithEvent:fakeEvent];
 }
 
-static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
-{
-    WebHTMLView *view = (WebHTMLView *)info;
-    
-    [view _updateMouseoverWithFakeEvent];
-}
-
 - (void)_frameOrBoundsChanged
 {
     WebView *webView = [self _webView];
@@ -1231,16 +1210,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     }
     _private->lastScrollPosition = origin;
 
-    if ([self window] && !_private->closed && !_private->updateMouseoverTimer) {
-        CFRunLoopTimerContext context = { 0, self, NULL, NULL, NULL };
-        
-        // Use a 100ms delay so that the synthetic mouse over update doesn't cause cursor thrashing when pages are loading
-        // and scrolling rapidly back to back.
-        _private->updateMouseoverTimer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + 0.1, 0, 0, 0,
-                                                              _updateMouseoverTimerCallback, &context);
-        CFRunLoopAddTimer(CFRunLoopGetCurrent(), _private->updateMouseoverTimer, kCFRunLoopDefaultMode);
-    }
-    
 #if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD)
     [self _updateLayerHostingViewPosition];
 #endif
@@ -1902,7 +1871,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
 
     _private->closed = YES;
 
-    [self _cancelUpdateMouseoverTimer];
     [self _clearLastHitViewIfSelf];
     [self _removeMouseMovedObserverUnconditionally];
     [self _removeWindowObservers];
@@ -2910,7 +2878,6 @@ WEBCORE_COMMAND(yankAndSelect)
     [self _removeMouseMovedObserverUnconditionally];
     [self _removeWindowObservers];
     [self _removeSuperviewObservers];
-    [self _cancelUpdateMouseoverTimer];
 
     // FIXME: This accomplishes the same thing as the call to setCanStartMedia(false) in
     // WebView. It would be nice to have a single mechanism instead of two.
@@ -3534,9 +3501,6 @@ static void setMenuTargets(NSMenu* menu)
     if (!([event modifierFlags] & NSControlKeyMask)) {
         _private->ignoringMouseDraggedEvents = NO;
 
-        // Don't do any mouseover while the mouse is down.
-        [self _cancelUpdateMouseoverTimer];
-
         // Let WebCore get a chance to deal with the event. This will call back to us
         // to start the autoscroll timer if appropriate.
         if (Frame* coreframe = core([self _frame]))