Title: [172762] branches/safari-600.1-branch/Source/WebKit2
Revision
172762
Author
[email protected]
Date
2014-08-19 14:34:32 -0700 (Tue, 19 Aug 2014)

Log Message

Merged r172596.  <rdar://problem/17957690>

Modified Paths

Diff

Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172761 => 172762)


--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-19 21:31:59 UTC (rev 172761)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-19 21:34:32 UTC (rev 172762)
@@ -1,5 +1,24 @@
 2014-08-19  Dana Burkart  <[email protected]>
 
+        Merge r172596
+
+    2014-08-14  Enrica Casucci  <[email protected]>
+
+            [Services with UI] Selection services don't work inside <iframes>.
+            https://bugs.webkit.org/show_bug.cgi?id=135941
+            <rdar://problem/17957690>
+
+            Reviewed by Tim Horton.
+
+            Need to map the selection rectangles using the correct FrameView.
+            When handling the click, we must use the selection from the focused frame.
+
+            * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+            (WebKit::ServicesOverlayController::buildSelectionHighlight):
+            (WebKit::ServicesOverlayController::handleClick):
+
+2014-08-19  Dana Burkart  <[email protected]>
+
         Merge r172502
 
     2014-08-12  Pratik Solanki  <[email protected]>

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


--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-19 21:31:59 UTC (rev 172761)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-19 21:34:32 UTC (rev 172762)
@@ -518,14 +518,24 @@
     Vector<CGRect> cgRects;
     cgRects.reserveCapacity(m_currentSelectionRects.size());
 
-    for (auto& rect : m_currentSelectionRects)
-        cgRects.append((CGRect)pixelSnappedIntRect(rect));
+    RefPtr<Range> selectionRange = m_webPage.corePage()->selection().firstRange();
+    if (selectionRange) {
+        Frame* mainFrame = m_webPage.mainFrame();
+        FrameView& mainFrameView = *mainFrame->view();
+        FrameView* viewForRange = selectionRange->ownerDocument().view();
 
-    if (!cgRects.isEmpty()) {
-        CGRect visibleRect = m_webPage.corePage()->mainFrame().view()->visibleContentRect();
-        RetainPtr<DDHighlightRef> ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightNoOutlineWithArrow, YES, NSWritingDirectionNatural, NO, YES));
-        
-        m_potentialHighlights.add(Highlight::createForSelection(*this, ddHighlight));
+        for (auto& rect : m_currentSelectionRects) {
+            IntRect currentRect = pixelSnappedIntRect(rect);
+            currentRect.setLocation(mainFrameView.windowToContents(viewForRange->contentsToWindow(currentRect.location())));
+            cgRects.append((CGRect)currentRect);
+        }
+
+        if (!cgRects.isEmpty()) {
+            CGRect visibleRect = m_webPage.corePage()->mainFrame().view()->visibleContentRect();
+            RetainPtr<DDHighlightRef> ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightNoOutlineWithArrow, YES, NSWritingDirectionNatural, NO, YES));
+            
+            m_potentialHighlights.add(Highlight::createForSelection(*this, ddHighlight));
+        }
     }
 
     didRebuildPotentialHighlights();
@@ -745,7 +755,7 @@
         for (auto& range : telephoneNumberRanges)
             selectedTelephoneNumbers.append(range->text());
 
-        m_webPage.handleSelectionServiceClick(m_webPage.corePage()->mainFrame().selection(), selectedTelephoneNumbers, windowPoint);
+        m_webPage.handleSelectionServiceClick(m_webPage.corePage()->focusController().focusedOrMainFrame().selection(), selectedTelephoneNumbers, windowPoint);
     } else if (highlight.type() == Highlight::Type::TelephoneNumber)
         m_webPage.handleTelephoneNumberClick(highlight.range()->text(), windowPoint);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to