Diff
Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/ChangeLog 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog 2011-12-08 20:47:11 UTC (rev 102367)
@@ -1,3 +1,47 @@
+2011-12-08 Lucas Forschler <[email protected]>
+
+ Merge 100483
+
+ 2011-11-16 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=72400
+ Scrollbar uiStateTransitionProgress requires tracking the mouse all the time
+ -and corresponding-
+ <rdar://problem/10409328>
+
+ Reviewed by Darin Adler.
+
+ This patch makes it so we track the mouse all the time when we have legacy
+ scrollbars (rather than only tracking the mouse when the window is key). When
+ we're in that mode, we want to do as little work as possible when handling the
+ mouseMoved event so that this extra tracking has little to no performance impact.
+ Also, we don't want to change basic behaviors by having normal web content hover
+ effects start happening when a window is in the background. So this patch also
+ introduces a way to handle a mouseMoved event that will only affect scrollbars.
+
+ EventHandler::mouseMoved() and EventHandler::handleMouseEvent() both now take a
+ boolean parameter that indicates if we are only updating scrollbars. If that is
+ the case, then we make our HitTestRequest ReadOnly, and we return early once
+ updateLastScrollbarUnderMouse() is called.
+ * WebCore.exp.in:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::mouseMoved):
+ (WebCore::EventHandler::handleMouseMoveEvent):
+
+ In addition to calling Scrollbar::mouseExited() when appropriate, this function
+ now calls a new function, Scrollbar::mouseEntered() when appropriate.
+ (WebCore::EventHandler::updateLastScrollbarUnderMouse):
+ * page/EventHandler.h:
+
+ Scrollbar::mouseMoved() used to be responsible for calling
+ ScrollAnimator::mouseEnteredScrollbar(), but now Scrollbar::mouseEntered() takes
+ care of that instead, much like how Scrollbar::mouseExited() takes care of calling
+ the animator's exit function.
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::mouseMoved):
+ (WebCore::Scrollbar::mouseEntered):
+ * platform/Scrollbar.h:
+
2011-12-07 Lucas Forschler <[email protected]>
Fix a compiler error about implicit conversion from 64 to 32bit int.
Modified: branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/WebCore.exp.in 2011-12-08 20:47:11 UTC (rev 102367)
@@ -227,7 +227,7 @@
__ZN7WebCore12ChromeClient23paintCustomScrollCornerEPNS_15GraphicsContextERKNS_9FloatRectE
__ZN7WebCore12EditingStyleD1Ev
__ZN7WebCore12EventHandler10mouseMovedEP7NSEvent
-__ZN7WebCore12EventHandler10mouseMovedERKNS_18PlatformMouseEventE
+__ZN7WebCore12EventHandler10mouseMovedERKNS_18PlatformMouseEventEb
__ZN7WebCore12EventHandler10wheelEventEP7NSEvent
__ZN7WebCore12EventHandler12mouseDraggedEP7NSEvent
__ZN7WebCore12EventHandler14currentNSEventEv
Modified: branches/safari-534.53-branch/Source/WebCore/page/EventHandler.cpp (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/page/EventHandler.cpp 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/page/EventHandler.cpp 2011-12-08 20:47:11 UTC (rev 102367)
@@ -1526,11 +1526,14 @@
return layer;
}
-bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
+bool EventHandler::mouseMoved(const PlatformMouseEvent& event, bool onlyUpdateScrollbars)
{
HitTestResult hoveredNode = HitTestResult(IntPoint());
- bool result = handleMouseMoveEvent(event, &hoveredNode);
+ bool result = handleMouseMoveEvent(event, &hoveredNode, onlyUpdateScrollbars);
+ if (onlyUpdateScrollbars)
+ return result;
+
Page* page = m_frame->page();
if (!page)
return result;
@@ -1549,7 +1552,7 @@
return result;
}
-bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, HitTestResult* hoveredNode)
+bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, HitTestResult* hoveredNode, bool onlyUpdateScrollbars)
{
// in Radar 3703768 we saw frequent crashes apparently due to the
// part being null here, which seems impossible, so check for nil
@@ -1581,12 +1584,13 @@
if (m_lastScrollbarUnderMouse && m_mousePressed)
return m_lastScrollbarUnderMouse->mouseMoved(mouseEvent);
- // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent
- // if we are allowed to select.
- // This means that :hover and :active freeze in the state they were in when the mouse
- // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down.
+ // Mouse events should be treated as "read-only" in prepareMouseEvent if the mouse is
+ // pressed and we are allowed to select OR if we're updating only scrollbars. This
+ // means that :hover and :active freeze in the state they were in, rather than updating
+ // for nodes the mouse moves over while you hold the mouse down (in the mouse pressed case)
+ // or while the window is not key (as in the onlyUpdateScrollbars case).
HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove;
- if (m_mousePressed && m_mouseDownMayStartSelect)
+ if ((m_mousePressed && m_mouseDownMayStartSelect) || onlyUpdateScrollbars)
hitType |= HitTestRequest::ReadOnly;
if (m_mousePressed)
hitType |= HitTestRequest::Active;
@@ -1613,6 +1617,8 @@
scrollbar = mev.scrollbar();
updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
+ if (onlyUpdateScrollbars)
+ return true;
}
bool swallowEvent = false;
@@ -3066,6 +3072,11 @@
// Send mouse exited to the old scrollbar.
if (m_lastScrollbarUnderMouse)
m_lastScrollbarUnderMouse->mouseExited();
+
+ // Send mouse entered if we're setting a new scrollbar.
+ if (scrollbar && setLast)
+ scrollbar->mouseEntered();
+
m_lastScrollbarUnderMouse = setLast ? scrollbar : 0;
}
}
Modified: branches/safari-534.53-branch/Source/WebCore/page/EventHandler.h (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/page/EventHandler.h 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/page/EventHandler.h 2011-12-08 20:47:11 UTC (rev 102367)
@@ -150,12 +150,12 @@
bool tabsToLinks(KeyboardEvent*) const;
bool tabsToAllFormControls(KeyboardEvent*) const;
- bool mouseMoved(const PlatformMouseEvent&);
+ bool mouseMoved(const PlatformMouseEvent&, bool _onlyUpdateScrollbars_ = false);
void lostMouseCapture();
bool handleMousePressEvent(const PlatformMouseEvent&);
- bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0);
+ bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool _onlyUpdateScrollbars_ = false);
bool handleMouseReleaseEvent(const PlatformMouseEvent&);
bool handleWheelEvent(PlatformWheelEvent&);
void defaultWheelEventHandler(Node*, WheelEvent*);
Modified: branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.cpp (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.cpp 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.cpp 2011-12-08 20:47:11 UTC (rev 102367)
@@ -343,11 +343,6 @@
if (m_pressedPart != NoPart)
m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
- if (m_hoveredPart == NoPart) {
- if (m_scrollableArea)
- m_scrollableArea->scrollAnimator()->mouseEnteredScrollbar(this);
- }
-
ScrollbarPart part = theme()->hitTest(this, evt);
if (part != m_hoveredPart) {
if (m_pressedPart != NoPart) {
@@ -370,6 +365,12 @@
return true;
}
+void Scrollbar::mouseEntered()
+{
+ if (m_scrollableArea)
+ m_scrollableArea->scrollAnimator()->mouseEnteredScrollbar(this);
+}
+
bool Scrollbar::mouseExited()
{
if (m_scrollableArea)
Modified: branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.h (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.h 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebCore/platform/Scrollbar.h 2011-12-08 20:47:11 UTC (rev 102367)
@@ -94,6 +94,7 @@
// when the mouse went down in a scrollbar, since it is assumed the scrollbar will start
// grabbing all events in that case anyway.
bool mouseMoved(const PlatformMouseEvent&);
+ void mouseEntered();
bool mouseExited();
// Used by some platform scrollbars to know when they've been released from capture.
Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog 2011-12-08 20:47:11 UTC (rev 102367)
@@ -1,5 +1,31 @@
2011-12-08 Lucas Forschler <[email protected]>
+ Merge 100483
+
+ 2011-11-16 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=72400
+ Scrollbar uiStateTransitionProgress requires tracking the mouse all the time
+ -and corresponding-
+ <rdar://problem/10409328>
+
+ Reviewed by Darin Adler.
+
+ Set up our initial tracking area based on the currently recommended scrollbar
+ style. Track the mouse all the time if the style is legacy.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView initWithFrame:contextRef:pageGroupRef:]):
+
+ Now that we might be getting mouseMoved events all the time even when the window
+ is not key, make sure we opt into the new 'onlyUpdateScrollbars' mode for
+ EventHandler::mouseMoved() when the window is not focused.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::handleMouseEvent):
+ (WebKit::WebPage::mouseEvent):
+ (WebKit::WebPage::mouseEventSyncForTesting):
+
+2011-12-08 Lucas Forschler <[email protected]>
+
Merge 99912
2011-11-10 Beth Dakin <[email protected]>
Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2011-12-08 20:47:11 UTC (rev 102367)
@@ -227,8 +227,19 @@
InitWebCoreSystemInterface();
RunLoop::initializeMainRunLoop();
+ // Legacy style scrollbars have design details that rely on tracking the mouse all the time.
+ NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy)
+ options |= NSTrackingActiveAlways;
+ else
+ options |= NSTrackingActiveInKeyWindow;
+#else
+ options |= NSTrackingActiveInKeyWindow;
+#endif
+
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:frame
- options:(NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect)
+ options:options
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102366 => 102367)
--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-12-08 20:41:30 UTC (rev 102366)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-12-08 20:47:11 UTC (rev 102367)
@@ -1035,7 +1035,7 @@
return handled;
}
-static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page)
+static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page, bool onlyUpdateScrollbars)
{
Frame* frame = page->mainFrame();
if (!frame->view())
@@ -1058,7 +1058,7 @@
case WebCore::MouseEventReleased:
return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
case WebCore::MouseEventMoved:
- return frame->eventHandler()->mouseMoved(platformMouseEvent);
+ return frame->eventHandler()->mouseMoved(platformMouseEvent, onlyUpdateScrollbars);
default:
ASSERT_NOT_REACHED();
@@ -1084,7 +1084,7 @@
if (!handled) {
CurrentEvent currentEvent(mouseEvent);
- handled = handleMouseEvent(mouseEvent, m_page.get());
+ handled = handleMouseEvent(mouseEvent, m_page.get(), !windowIsFocused());
}
send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), handled));