Title: [172568] branches/safari-600.1-branch/Source/WebKit2

Diff

Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172567 => 172568)


--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-14 04:10:01 UTC (rev 172567)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-14 04:11:52 UTC (rev 172568)
@@ -1,5 +1,25 @@
 2014-08-13  Lucas Forschler  <[email protected]>
 
+        Merge r172528
+
+    2014-08-13  Tim Horton  <[email protected]>
+
+            Avoid making new active service overlay highlights while the mouse is down
+            https://bugs.webkit.org/show_bug.cgi?id=135872
+            <rdar://problem/17982341>
+
+            Reviewed by Enrica Casucci.
+
+            * WebProcess/WebPage/ServicesOverlayController.h:
+            * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+            (WebKit::ServicesOverlayController::remainingTimeUntilHighlightShouldBeShown):
+            (WebKit::ServicesOverlayController::mouseEvent):
+            If the mouse is pressed or it's been less than 200ms since the mouse went up,
+            don't allow the highlight to change. We apply the mouse-is-pressed rule to telephone
+            number highlights as well, unlike the rest of the hysteresis logic.
+
+2014-08-13  Lucas Forschler  <[email protected]>
+
         Merge r172526
 
     2014-08-13  Timothy Hatcher  <[email protected]>

Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h (172567 => 172568)


--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h	2014-08-14 04:10:01 UTC (rev 172567)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h	2014-08-14 04:11:52 UTC (rev 172568)
@@ -151,6 +151,7 @@
 
     std::chrono::steady_clock::time_point m_lastSelectionChangeTime;
     std::chrono::steady_clock::time_point m_nextActiveHighlightChangeTime;
+    std::chrono::steady_clock::time_point m_lastMouseUpTime;
 
     RefPtr<Highlight> m_currentMouseDownOnButtonHighlight;
     WebCore::IntPoint m_mousePosition;

Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (172567 => 172568)


--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-14 04:10:01 UTC (rev 172567)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-14 04:11:52 UTC (rev 172568)
@@ -33,6 +33,7 @@
 #import "WebProcess.h"
 #import <QuartzCore/QuartzCore.h>
 #import <WebCore/Document.h>
+#import <WebCore/EventHandler.h>
 #import <WebCore/FloatQuad.h>
 #import <WebCore/FocusController.h>
 #import <WebCore/FrameView.h>
@@ -400,18 +401,25 @@
     if (!highlight)
         return std::chrono::milliseconds::zero();
 
+    auto minimumTimeUntilHighlightShouldBeShown = 200_ms;
+
+    bool mousePressed = false;
+    if (Frame* mainFrame = m_webPage.mainFrame())
+        mousePressed = mainFrame->eventHandler().mousePressed();
+
     // Highlight hysteresis is only for selection services, because telephone number highlights are already much more stable
-    // by virtue of being expanded to include the entire telephone number.
+    // by virtue of being expanded to include the entire telephone number. However, we will still avoid highlighting
+    // telephone numbers while the mouse is down.
     if (highlight->type() == Highlight::Type::TelephoneNumber)
-        return std::chrono::milliseconds::zero();
+        return mousePressed ? minimumTimeUntilHighlightShouldBeShown : 0_ms;
 
-    std::chrono::steady_clock::duration minimumTimeUntilHighlightShouldBeShown = 200_ms;
-
     auto now = std::chrono::steady_clock::now();
     auto timeSinceLastSelectionChange = now - m_lastSelectionChangeTime;
     auto timeSinceHighlightBecameActive = now - m_nextActiveHighlightChangeTime;
+    auto timeSinceLastMouseUp = mousePressed ? 0_ms : now - m_lastMouseUpTime;
 
-    return std::chrono::duration_cast<std::chrono::milliseconds>(std::max(minimumTimeUntilHighlightShouldBeShown - timeSinceLastSelectionChange, minimumTimeUntilHighlightShouldBeShown - timeSinceHighlightBecameActive));
+    auto remainingDelay = minimumTimeUntilHighlightShouldBeShown - std::min(std::min(timeSinceLastSelectionChange, timeSinceHighlightBecameActive), timeSinceLastMouseUp);
+    return std::chrono::duration_cast<std::chrono::milliseconds>(remainingDelay);
 }
 
 void ServicesOverlayController::determineActiveHighlightTimerFired(Timer<ServicesOverlayController>&)
@@ -688,6 +696,8 @@
         RefPtr<Highlight> mouseDownHighlight = m_currentMouseDownOnButtonHighlight;
         m_currentMouseDownOnButtonHighlight = nullptr;
 
+        m_lastMouseUpTime = std::chrono::steady_clock::now();
+
         if (mouseIsOverActiveHighlightButton && mouseDownHighlight) {
             handleClick(m_mousePosition, *mouseDownHighlight);
             return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to