- Revision
- 104773
- Author
- bda...@apple.com
- Date
- 2012-01-11 17:17:47 -0800 (Wed, 11 Jan 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=75904
WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all
the time
-and corresponding-
<rdar://problem/10498816>
Reviewed by Darin Adler.
Source/WebCore:
This patch gets rid of the optional parameter called onlyUpdateScrollbars for
mouseMoved() and instead moves that functionality into its own function
called passMouseMovedEventToScrollbars().
* WebCore.exp.in:
* page/EventHandler.cpp:
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::passMouseMovedEventToScrollbars):
* page/EventHandler.h:
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::passMouseMovedEventToScrollbars):
Source/WebKit/mac:
New ivar trackingAreaForNonKeyWindow stores our NSTrackingArea whenever we
have one.
* WebView/WebHTMLView.mm:
(-[WebHTMLViewPrivate dealloc]):
(-[WebHTMLViewPrivate clear]):
When we know that mouse movements won't affect anything other than
scrollbars, call our new function passMouseMovedEventToScrollbars(),
otherwise we'll call the old mouseMoved().
(mouseEventIsPartOfClickOrDrag):
(-[WebHTMLView _updateMouseoverWithEvent:]):
Make sure not to remove the mouse observer when there are legacy scrollbars.
(-[WebHTMLView removeMouseMovedObserver]):
Set up a tracking area when the window is not key to ensure that the WebView
gets the relevant events. Remove it when the window is key again so that we
rely on the existing mechanism.
(-[WebHTMLView windowDidBecomeKey:]):
(-[WebHTMLView windowDidResignKey:]):
Source/WebKit2:
This patch gets rid of the optional parameter called onlyUpdateScrollbars for
WebCore::EventHandler::mouseMoved() and instead moves that functionality into
its own function called passMouseMovedEventToScrollbars().
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleMouseEvent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104772 => 104773)
--- trunk/Source/WebCore/ChangeLog 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebCore/ChangeLog 2012-01-12 01:17:47 UTC (rev 104773)
@@ -1,3 +1,24 @@
+2012-01-11 Beth Dakin <bda...@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75904
+ WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all
+ the time
+ -and corresponding-
+ <rdar://problem/10498816>
+
+ Reviewed by Darin Adler.
+
+ This patch gets rid of the optional parameter called onlyUpdateScrollbars for
+ mouseMoved() and instead moves that functionality into its own function
+ called passMouseMovedEventToScrollbars().
+ * WebCore.exp.in:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::mouseMoved):
+ (WebCore::EventHandler::passMouseMovedEventToScrollbars):
+ * page/EventHandler.h:
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::passMouseMovedEventToScrollbars):
+
2012-01-11 Joshua Bell <jsb...@chromium.org>
IndexedDB: Methods should throw TRANSACTION_INACTIVE_ERR when transaction is completed/aborted
Modified: trunk/Source/WebCore/WebCore.exp.in (104772 => 104773)
--- trunk/Source/WebCore/WebCore.exp.in 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-01-12 01:17:47 UTC (rev 104773)
@@ -225,7 +225,7 @@
__ZN7WebCore12ChromeClient23paintCustomOverhangAreaEPNS_15GraphicsContextERKNS_7IntRectES5_S5_
__ZN7WebCore12EditingStyleD1Ev
__ZN7WebCore12EventHandler10mouseMovedEP7NSEvent
-__ZN7WebCore12EventHandler10mouseMovedERKNS_18PlatformMouseEventEb
+__ZN7WebCore12EventHandler10mouseMovedERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler10wheelEventEP7NSEvent
__ZN7WebCore12EventHandler12mouseDraggedEP7NSEvent
__ZN7WebCore12EventHandler14currentNSEventEv
@@ -237,6 +237,8 @@
__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE
+__ZN7WebCore12EventHandler31passMouseMovedEventToScrollbarsEP7NSEvent
+__ZN7WebCore12EventHandler31passMouseMovedEventToScrollbarsERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler7mouseUpEP7NSEvent
__ZN7WebCore12EventHandler8keyEventEP7NSEvent
__ZN7WebCore12EventHandler8keyEventERKNS_21PlatformKeyboardEventE
Modified: trunk/Source/WebCore/page/EventHandler.cpp (104772 => 104773)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-01-12 01:17:47 UTC (rev 104773)
@@ -1557,14 +1557,11 @@
return layer;
}
-bool EventHandler::mouseMoved(const PlatformMouseEvent& event, bool onlyUpdateScrollbars)
+bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
{
HitTestResult hoveredNode = HitTestResult(LayoutPoint());
- bool result = handleMouseMoveEvent(event, &hoveredNode, onlyUpdateScrollbars);
+ bool result = handleMouseMoveEvent(event, &hoveredNode);
- if (onlyUpdateScrollbars)
- return result;
-
Page* page = m_frame->page();
if (!page)
return result;
@@ -1583,6 +1580,12 @@
return result;
}
+bool EventHandler::passMouseMovedEventToScrollbars(const PlatformMouseEvent& event)
+{
+ HitTestResult hoveredNode;
+ return handleMouseMoveEvent(event, &hoveredNode, true);
+}
+
bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars)
{
// in Radar 3703768 we saw frequent crashes apparently due to the
Modified: trunk/Source/WebCore/page/EventHandler.h (104772 => 104773)
--- trunk/Source/WebCore/page/EventHandler.h 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebCore/page/EventHandler.h 2012-01-12 01:17:47 UTC (rev 104773)
@@ -148,7 +148,8 @@
bool tabsToLinks(KeyboardEvent*) const;
bool tabsToAllFormControls(KeyboardEvent*) const;
- bool mouseMoved(const PlatformMouseEvent&, bool _onlyUpdateScrollbars_ = false);
+ bool mouseMoved(const PlatformMouseEvent&);
+ bool passMouseMovedEventToScrollbars(const PlatformMouseEvent&);
void lostMouseCapture();
@@ -200,6 +201,8 @@
bool keyEvent(NSEvent *);
bool wheelEvent(NSEvent *);
+ void passMouseMovedEventToScrollbars(NSEvent *);
+
void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
void setActivationEventNumber(int num) { m_activationEventNumber = num; }
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (104772 => 104773)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2012-01-12 01:17:47 UTC (rev 104773)
@@ -593,6 +593,19 @@
END_BLOCK_OBJC_EXCEPTIONS;
}
+void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event)
+{
+ // Reject a mouse moved if the button is down - screws up tracking during autoscroll
+ // These happen because WebKit sometimes has to fake up moved events.
+ if (!m_frame->view() || m_mousePressed || m_sendingEventToSubview)
+ return;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ CurrentEventScope scope(event);
+ passMouseMovedEventToScrollbars(currentPlatformMouseEvent());
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
static bool frameHasPlatformWidget(Frame* frame)
{
if (FrameView* frameView = frame->view()) {
Modified: trunk/Source/WebKit/mac/ChangeLog (104772 => 104773)
--- trunk/Source/WebKit/mac/ChangeLog 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebKit/mac/ChangeLog 2012-01-12 01:17:47 UTC (rev 104773)
@@ -1,3 +1,34 @@
+2012-01-11 Beth Dakin <bda...@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75904
+ WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all
+ the time
+ -and corresponding-
+ <rdar://problem/10498816>
+
+ Reviewed by Darin Adler.
+
+ New ivar trackingAreaForNonKeyWindow stores our NSTrackingArea whenever we
+ have one.
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLViewPrivate dealloc]):
+ (-[WebHTMLViewPrivate clear]):
+
+ When we know that mouse movements won't affect anything other than
+ scrollbars, call our new function passMouseMovedEventToScrollbars(),
+ otherwise we'll call the old mouseMoved().
+ (mouseEventIsPartOfClickOrDrag):
+ (-[WebHTMLView _updateMouseoverWithEvent:]):
+
+ Make sure not to remove the mouse observer when there are legacy scrollbars.
+ (-[WebHTMLView removeMouseMovedObserver]):
+
+ Set up a tracking area when the window is not key to ensure that the WebView
+ gets the relevant events. Remove it when the window is key again so that we
+ rely on the existing mechanism.
+ (-[WebHTMLView windowDidBecomeKey:]):
+ (-[WebHTMLView windowDidResignKey:]):
+
2012-01-10 Dan Bernstein <m...@apple.com>
Made -[WebHistoryItem copyWithZone:] allocate an object of the same class as the receiver.
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (104772 => 104773)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2012-01-12 01:17:47 UTC (rev 104773)
@@ -521,6 +521,8 @@
SEL selectorForDoCommandBySelector;
+ NSTrackingArea *trackingAreaForNonKeyWindow;
+
#ifndef NDEBUG
BOOL enumeratingSubviews;
#endif
@@ -584,6 +586,7 @@
[completionController release];
[dataSource release];
[highlighters release];
+ [trackingAreaForNonKeyWindow release];
if (promisedDragTIFFDataSource)
promisedDragTIFFDataSource->removeClient(promisedDataClient());
@@ -609,6 +612,7 @@
[completionController release];
[dataSource release];
[highlighters release];
+ [trackingAreaForNonKeyWindow release];
if (promisedDragTIFFDataSource)
promisedDragTIFFDataSource->removeClient(promisedDataClient());
@@ -619,6 +623,7 @@
completionController = nil;
dataSource = nil;
highlighters = nil;
+ trackingAreaForNonKeyWindow = nil;
promisedDragTIFFDataSource = 0;
#if USE(ACCELERATED_COMPOSITING)
@@ -1545,6 +1550,24 @@
return [[_private->toolTip copy] autorelease];
}
+static bool mouseEventIsPartOfClickOrDrag(NSEvent *event)
+{
+ switch ([event type]) {
+ case NSLeftMouseDown:
+ case NSLeftMouseUp:
+ case NSLeftMouseDragged:
+ case NSRightMouseDown:
+ case NSRightMouseUp:
+ case NSRightMouseDragged:
+ case NSOtherMouseDown:
+ case NSOtherMouseUp:
+ case NSOtherMouseDragged:
+ return true;
+ default:
+ return false;
+ }
+}
+
- (void)_updateMouseoverWithEvent:(NSEvent *)event
{
if (_private->closed)
@@ -1586,8 +1609,17 @@
lastHitView = view;
if (view) {
- if (Frame* coreFrame = core([view _frame]))
- coreFrame->eventHandler()->mouseMoved(event);
+ if (Frame* coreFrame = core([view _frame])) {
+ // We need to do a full, normal hit test during this mouse event if the page is active or if a mouse
+ // button is currently pressed. It is possible that neither of those things will be true on Lion and
+ // newer when legacy scrollbars are enabled, because then WebKit receives mouse events all the time.
+ // If it is one of those cases where the page is not active and the mouse is not pressed, then we can
+ // fire a much more restricted and efficient scrollbars-only version of the event.
+ if ([[self window] isKeyWindow] || mouseEventIsPartOfClickOrDrag(event))
+ coreFrame->eventHandler()->mouseMoved(event);
+ else
+ coreFrame->eventHandler()->passMouseMovedEventToScrollbars(event);
+ }
[view release];
}
@@ -2800,6 +2832,12 @@
return;
#endif
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ // Legacy scrollbars require tracking the mouse at all times.
+ if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy)
+ return;
+#endif
+
[[self _webView] _mouseDidMoveOverElement:nil modifierFlags:0];
[self _removeMouseMovedObserverUnconditionally];
}
@@ -3333,6 +3371,14 @@
return;
}
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (_private->trackingAreaForNonKeyWindow) {
+ [self removeTrackingArea:_private->trackingAreaForNonKeyWindow];
+ [_private->trackingAreaForNonKeyWindow release];
+ _private->trackingAreaForNonKeyWindow = nil;
+ }
+#endif
+
NSWindow *keyWindow = [notification object];
if (keyWindow == [self window]) {
@@ -3357,6 +3403,19 @@
[self _updateSecureInputState];
[_private->completionController endRevertingChange:NO moveLeft:NO];
}
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) {
+ // Legacy style scrollbars have design details that rely on tracking the mouse all the time.
+ // It's easiest to do this with a tracking area, which we will remove when the window is key
+ // again.
+ _private->trackingAreaForNonKeyWindow = [[NSTrackingArea alloc] initWithRect:[self bounds]
+ options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:_private->trackingAreaForNonKeyWindow];
+ }
+#endif
}
- (void)windowWillOrderOnScreen:(NSNotification *)notification
Modified: trunk/Source/WebKit2/ChangeLog (104772 => 104773)
--- trunk/Source/WebKit2/ChangeLog 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-12 01:17:47 UTC (rev 104773)
@@ -1,3 +1,19 @@
+2012-01-11 Beth Dakin <bda...@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75904
+ WebKit 1: Scrollbar uiStateTransitionProgress requires tracking the mouse all
+ the time
+ -and corresponding-
+ <rdar://problem/10498816>
+
+ Reviewed by Darin Adler.
+
+ This patch gets rid of the optional parameter called onlyUpdateScrollbars for
+ WebCore::EventHandler::mouseMoved() and instead moves that functionality into
+ its own function called passMouseMovedEventToScrollbars().
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::handleMouseEvent):
+
2012-01-11 Brent Fulgham <bfulg...@webkit.org>
WinCairo build correction.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (104772 => 104773)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-12 01:15:38 UTC (rev 104772)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-12 01:17:47 UTC (rev 104773)
@@ -1208,7 +1208,9 @@
case PlatformEvent::MouseReleased:
return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
case PlatformEvent::MouseMoved:
- return frame->eventHandler()->mouseMoved(platformMouseEvent, onlyUpdateScrollbars);
+ if (onlyUpdateScrollbars)
+ return frame->eventHandler()->passMouseMovedEventToScrollbars(platformMouseEvent);
+ return frame->eventHandler()->mouseMoved(platformMouseEvent);
default:
ASSERT_NOT_REACHED();
return false;