{TelephoneNumber, Selection}ControllerMac implementations dosn't handle tiled drawing...
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 May 2014 20:57:57 +0000 (20:57 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 May 2014 20:57:57 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132746
<rdar://problem/16789588>

Reviewed by Tim Horton.

Don't try to draw the detector UI if no part of the selection bounds are inside
the current tile. Don't limit the detector UI to the bounds of this tile, or else
it will attempt to squeeze itself into the possibly small space available. Let it
draw as if it had the whole screen, and rely on the context clip region to
avoid overdrawing.

* WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm:
(WebKit::TelephoneNumberOverlayController::drawRect): Correct tiled drawing behavior.
* WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm:
(WebKit::SelectionOverlayController::drawRect): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm
Source/WebKit2/WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm

index 88ffcfd..beb8db1 100644 (file)
@@ -1,3 +1,22 @@
+2014-05-09  Brent Fulgham  <bfulgham@apple.com>
+
+        {TelephoneNumber, Selection}ControllerMac implementations dosn't handle tiled drawing properly.
+        https://bugs.webkit.org/show_bug.cgi?id=132746
+        <rdar://problem/16789588>
+
+        Reviewed by Tim Horton.
+
+        Don't try to draw the detector UI if no part of the selection bounds are inside
+        the current tile. Don't limit the detector UI to the bounds of this tile, or else
+        it will attempt to squeeze itself into the possibly small space available. Let it
+        draw as if it had the whole screen, and rely on the context clip region to
+        avoid overdrawing.
+
+        * WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm:
+        (WebKit::TelephoneNumberOverlayController::drawRect): Correct tiled drawing behavior.
+        * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm:
+        (WebKit::SelectionOverlayController::drawRect): Ditto.
+
 2014-05-09  Anders Carlsson  <andersca@apple.com>
 
         Production build fix.
index cc70d26..e156b78 100644 (file)
@@ -71,16 +71,25 @@ void SelectionOverlayController::drawRect(PageOverlay* overlay, WebCore::Graphic
         Vector<CGRect> cgRects;
         cgRects.reserveCapacity(m_currentSelectionRects.size());
 
-        for (auto& rect : m_currentSelectionRects)
+        for (auto& rect : m_currentSelectionRects) {
+            IntRect selectionRect(rect.pixelSnappedLocation(), rect.pixelSnappedSize());
+
+            if (!selectionRect.intersects(dirtyRect))
+                continue;
+
             cgRects.append((CGRect)pixelSnappedIntRect(rect));
+        }
 
-        m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects.begin(), cgRects.size(), (CGRect)dirtyRect, true));
-        m_currentHighlightIsDirty = false;
+        if (!cgRects.isEmpty()) {
+            CGRect bounds = m_webPage->corePage()->mainFrame().view()->boundsRect();
+            m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects.begin(), cgRects.size(), bounds, true));
+            m_currentHighlightIsDirty = false;
 
-        Boolean onButton;
-        m_mouseIsOverHighlight = DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &onButton);
+            Boolean onButton;
+            m_mouseIsOverHighlight = DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &onButton);
 
-        mouseHoverStateChanged();
+            mouseHoverStateChanged();
+        }
     }
 
     // If the UI is not visibile or if the mouse is not over the DDHighlight we have no drawing to do.
index 9529ddf..a533943 100644 (file)
@@ -91,9 +91,13 @@ void TelephoneNumberOverlayController::drawRect(PageOverlay* overlay, WebCore::G
         FrameView& mainFrameView = *m_webPage->corePage()->mainFrame().view();
         rect.setLocation(mainFrameView.windowToContents(viewForRange->contentsToWindow(rect.location())));
 
+        // If the selection rect is completely outside this drawing tile, don't process it further
+        if (!rect.intersects(dirtyRect))
+            continue;
+
         CGRect cgRects[] = { (CGRect)rect };
 
-        RetainPtr<DDHighlightRef> highlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects, 1, (CGRect)dirtyRect, true));
+        RetainPtr<DDHighlightRef> highlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects, 1, viewForRange->boundsRect(), true));
         RefPtr<TelephoneNumberData> telephoneNumberData = TelephoneNumberData::create(range.get(), highlight.get());
         m_telephoneNumberDatas.append(telephoneNumberData);