Title: [164892] trunk/Source
Revision
164892
Author
[email protected]
Date
2014-02-28 15:55:24 -0800 (Fri, 28 Feb 2014)

Log Message

Source/WebCore: [iOS][WK2] highlight rects should never big bigger than the view
https://bugs.webkit.org/show_bug.cgi?id=129472

Patch by Benjamin Poulain <[email protected]> on 2014-02-28
Reviewed by Enrica Casucci.

* WebCore.exp.in:

Source/WebKit2: [iOS][WK2] highlight rects should never big bigger than the view
https://bugs.webkit.org/show_bug.cgi?id=129472
<rdar://problem/15673655>

Patch by Benjamin Poulain <[email protected]> on 2014-02-28
Reviewed by Enrica Casucci.

The unobscuredRect on WebPageProxy is the "true" view rect as seen by the user.
Use that to constrain our highlight rects.

* UIProcess/ios/WKContentViewInteraction.mm:
(highlightedQuadsFitInRect):
(-[WKContentView _didGetTapHighlightForRequest:color:WebCore::quads:WebCore::topLeftRadius:WebCore::topRightRadius:WebCore::bottomLeftRadius:WebCore::bottomRightRadius:WebCore::]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164891 => 164892)


--- trunk/Source/WebCore/ChangeLog	2014-02-28 23:38:08 UTC (rev 164891)
+++ trunk/Source/WebCore/ChangeLog	2014-02-28 23:55:24 UTC (rev 164892)
@@ -1,3 +1,12 @@
+2014-02-28  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] highlight rects should never big bigger than the view
+        https://bugs.webkit.org/show_bug.cgi?id=129472
+
+        Reviewed by Enrica Casucci.
+
+        * WebCore.exp.in:
+
 2014-02-28  Beth Dakin  <[email protected]>
 
         Turn off margin tiles on iOS

Modified: trunk/Source/WebCore/WebCore.exp.in (164891 => 164892)


--- trunk/Source/WebCore/WebCore.exp.in	2014-02-28 23:38:08 UTC (rev 164891)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-02-28 23:55:24 UTC (rev 164892)
@@ -252,6 +252,7 @@
 __ZN7WebCore13KeyboardEventC1Ev
 __ZN7WebCore15FocusController20nextFocusableElementENS_20FocusNavigationScopeEPNS_4NodeEPNS_13KeyboardEventE
 __ZN7WebCore15FocusController24previousFocusableElementENS_20FocusNavigationScopeEPNS_4NodeEPNS_13KeyboardEventE
+__ZNK7WebCore9FloatRect8containsERKS0_
 __ZNK7WebCore11HTMLElement5titleEv
 __ZNK7WebCore17HTMLOptionElement4textEv
 __ZNK7WebCore17HTMLSelectElement13selectedIndexEv

Modified: trunk/Source/WebKit2/ChangeLog (164891 => 164892)


--- trunk/Source/WebKit2/ChangeLog	2014-02-28 23:38:08 UTC (rev 164891)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-28 23:55:24 UTC (rev 164892)
@@ -1,3 +1,18 @@
+2014-02-28  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] highlight rects should never big bigger than the view
+        https://bugs.webkit.org/show_bug.cgi?id=129472
+        <rdar://problem/15673655>
+
+        Reviewed by Enrica Casucci.
+
+        The unobscuredRect on WebPageProxy is the "true" view rect as seen by the user.
+        Use that to constrain our highlight rects.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (highlightedQuadsFitInRect):
+        (-[WKContentView _didGetTapHighlightForRequest:color:WebCore::quads:WebCore::topLeftRadius:WebCore::topRightRadius:WebCore::bottomLeftRadius:WebCore::bottomRightRadius:WebCore::]):
+
 2014-02-28  Simon Fraser  <[email protected]>
 
         Make UIViews for compositing layers in the UI process on iOS

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (164891 => 164892)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-02-28 23:38:08 UTC (rev 164891)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2014-02-28 23:55:24 UTC (rev 164892)
@@ -293,11 +293,24 @@
     }
 }
 
+static inline bool highlightedQuadsAreSmallerThanRect(const Vector<FloatQuad>& quads, const FloatRect& rect)
+{
+    for (size_t i = 0; i < quads.size(); ++i) {
+        FloatRect boundingBox = quads[i].boundingBox();
+        if (boundingBox.width() > rect.width() || boundingBox.height() > rect.height())
+            return false;
+    }
+    return true;
+}
+
 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&)color quads:(const Vector<WebCore::FloatQuad>&)highlightedQuads topLeftRadius:(const WebCore::IntSize&)topLeftRadius topRightRadius:(const WebCore::IntSize&)topRightRadius bottomLeftRadius:(const WebCore::IntSize&)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&)bottomRightRadius
 {
     if (!_isTapHighlightIDValid || _latestTapHighlightID != requestID)
         return;
 
+    if (!highlightedQuadsAreSmallerThanRect(highlightedQuads, _page->unobscuredContentRect()))
+        return;
+
     const CGFloat UIWebViewMinimumHighlightRadius = 2.0;
     if (!_highlightView) {
         _highlightView = adoptNS([[_UIHighlightView alloc] initWithFrame:CGRectZero]);
@@ -324,10 +337,8 @@
         }
     }
 
-    // FIXME: WebKit1 uses the visibleRect. Using the whole frame from the page seems overkill.
-    CGRect boundaryRect = [self frame];
     if (allHighlightRectsAreRectilinear)
-        [_highlightView setFrames:rects.get() boundaryRect:boundaryRect];
+        [_highlightView setFrames:rects.get() boundaryRect:_page->exposedContentRect()];
     else {
         RetainPtr<NSMutableArray> quads = adoptNS([[NSMutableArray alloc] initWithCapacity:static_cast<const NSUInteger>(quadCount)]);
         for (size_t i = 0; i < quadCount; ++i) {
@@ -338,7 +349,7 @@
             [quads addObject:[NSValue valueWithCGPoint:extendedQuad.p3()]];
             [quads addObject:[NSValue valueWithCGPoint:extendedQuad.p4()]];
         }
-        [_highlightView setQuads:quads.get() boundaryRect:boundaryRect];
+        [_highlightView setQuads:quads.get() boundaryRect:_page->exposedContentRect()];
     }
 
     RetainPtr<NSMutableArray> borderRadii = adoptNS([[NSMutableArray alloc] initWithCapacity:4]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to