Title: [172501] trunk/Source
Revision
172501
Author
[email protected]
Date
2014-08-12 15:48:36 -0700 (Tue, 12 Aug 2014)

Log Message

Small region (~1px tall) where you get the selection button instead of the phone number overlay
https://bugs.webkit.org/show_bug.cgi?id=135852
<rdar://problem/17992795>

Reviewed by Enrica Casucci.

* WebProcess/WebPage/ServicesOverlayController.h:
* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
(WebKit::ServicesOverlayController::determineActiveHighlight):
If our new active highlight is a selection highlight that is completely contained
by one of the phone number highlights, we'll make the phone number highlight active
even if it's not hovered. This fixes the case where the selection highlight
(a subset of a telephone number) is slightly taller than the telephone number
highlight, and can be hovered without hovering the phone number highlight

* WebCore.exp.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172500 => 172501)


--- trunk/Source/WebCore/ChangeLog	2014-08-12 22:43:27 UTC (rev 172500)
+++ trunk/Source/WebCore/ChangeLog	2014-08-12 22:48:36 UTC (rev 172501)
@@ -1,3 +1,13 @@
+2014-08-12  Tim Horton  <[email protected]>
+
+        Small region (~1px tall) where you get the selection button instead of the phone number overlay
+        https://bugs.webkit.org/show_bug.cgi?id=135852
+        <rdar://problem/17992795>
+
+        Reviewed by Enrica Casucci.
+
+        * WebCore.exp.in:
+
 2014-08-12  Alex Christensen  <[email protected]>
 
         Generate header detection headers for CMake on Windows.

Modified: trunk/Source/WebCore/WebCore.exp.in (172500 => 172501)


--- trunk/Source/WebCore/WebCore.exp.in	2014-08-12 22:43:27 UTC (rev 172500)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-08-12 22:48:36 UTC (rev 172501)
@@ -1896,6 +1896,7 @@
 __ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
 __ZNK7WebCore4Page9groupNameEv
 __ZNK7WebCore4Page9pageCountEv
+__ZNK7WebCore4Page9selectionEv
 __ZNK7WebCore4Page9sessionIDEv
 __ZNK7WebCore5Color10serializedEv
 __ZNK7WebCore5Color7getRGBAERdS1_S1_S1_

Modified: trunk/Source/WebKit2/ChangeLog (172500 => 172501)


--- trunk/Source/WebKit2/ChangeLog	2014-08-12 22:43:27 UTC (rev 172500)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-12 22:48:36 UTC (rev 172501)
@@ -43,6 +43,24 @@
 
 2014-08-12  Tim Horton  <[email protected]>
 
+        Small region (~1px tall) where you get the selection button instead of the phone number overlay
+        https://bugs.webkit.org/show_bug.cgi?id=135852
+        <rdar://problem/17992795>
+
+        Reviewed by Enrica Casucci.
+
+        * WebProcess/WebPage/ServicesOverlayController.h:
+        * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+        (WebKit::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
+        (WebKit::ServicesOverlayController::determineActiveHighlight):
+        If our new active highlight is a selection highlight that is completely contained
+        by one of the phone number highlights, we'll make the phone number highlight active
+        even if it's not hovered. This fixes the case where the selection highlight
+        (a subset of a telephone number) is slightly taller than the telephone number
+        highlight, and can be hovered without hovering the phone number highlight.
+
+2014-08-12  Tim Horton  <[email protected]>
+
         REGRESSION (r172424): Extra menu header in combined telephone number menu when no phone paired
         https://bugs.webkit.org/show_bug.cgi?id=135854
         <rdar://problem/17996339>

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h (172500 => 172501)


--- trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h	2014-08-12 22:43:27 UTC (rev 172500)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h	2014-08-12 22:48:36 UTC (rev 172501)
@@ -117,6 +117,8 @@
     void clearActiveHighlight();
     Highlight* activeHighlight() const { return m_activeHighlight.get(); }
 
+    Highlight* findTelephoneNumberHighlightContainingSelectionHighlight(Highlight&);
+
     bool hasRelevantSelectionServices();
 
     bool mouseIsOverHighlight(Highlight&, bool& mouseIsOverButton) const;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (172500 => 172501)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-12 22:43:27 UTC (rev 172500)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-12 22:48:36 UTC (rev 172501)
@@ -576,6 +576,30 @@
     return false;
 }
 
+ServicesOverlayController::Highlight* ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight(Highlight& selectionHighlight)
+{
+    if (selectionHighlight.type() != Highlight::Type::Selection)
+        return nullptr;
+
+    const VisibleSelection& selection = m_webPage.corePage()->selection();
+    if (!selection.isRange())
+        return nullptr;
+
+    RefPtr<Range> activeSelectionRange = selection.toNormalizedRange();
+    if (!activeSelectionRange)
+        return nullptr;
+
+    for (auto& highlight : m_potentialHighlights) {
+        if (highlight->type() != Highlight::Type::TelephoneNumber)
+            continue;
+
+        if (highlight->range()->contains(*activeSelectionRange))
+            return highlight.get();
+    }
+
+    return nullptr;
+}
+
 void ServicesOverlayController::determineActiveHighlight(bool& mouseIsOverActiveHighlightButton)
 {
     mouseIsOverActiveHighlightButton = false;
@@ -603,6 +627,18 @@
         mouseIsOverActiveHighlightButton = mouseIsOverButton;
     }
 
+    // If our new active highlight is a selection highlight that is completely contained
+    // by one of the phone number highlights, we'll make the phone number highlight active even if it's not hovered.
+    if (newActiveHighlight && newActiveHighlight->type() == Highlight::Type::Selection) {
+        if (Highlight* containedTelephoneNumberHighlight = findTelephoneNumberHighlightContainingSelectionHighlight(*newActiveHighlight)) {
+            newActiveHighlight = containedTelephoneNumberHighlight;
+
+            // We will always initially choose the telephone number highlight over the selection highlight if the
+            // mouse is over the telephone number highlight's button, so we know that it's not hovered if we got here.
+            mouseIsOverActiveHighlightButton = false;
+        }
+    }
+
     if (!this->highlightsAreEquivalent(m_activeHighlight.get(), newActiveHighlight.get())) {
         // When transitioning to a new highlight, we might end up in determineActiveHighlight multiple times
         // before the new highlight actually becomes active. Keep track of the last next-but-not-yet-active
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to