Title: [174286] trunk/Source/WebKit2
- Revision
- 174286
- Author
- [email protected]
- Date
- 2014-10-03 13:32:34 -0700 (Fri, 03 Oct 2014)
Log Message
[iOS] Highlight clicked links in WKPDFView
https://bugs.webkit.org/show_bug.cgi?id=137400
Reviewed by Tim Horton.
Show a _UIHighlightView on top of clicked links for 200 ms before starting the navigation. This matches the behavior of UIWebPDFView.
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _createHighlightViewWithFrame:]): Created a _UIHighlightView with a color and border radius matching the values used by UIWebPDFView.
(-[WKPDFView annotation:wasTouchedAtPoint:controller:]): Displayed the highlight, then removed it after the navigation began.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (174285 => 174286)
--- trunk/Source/WebKit2/ChangeLog 2014-10-03 20:29:29 UTC (rev 174285)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-03 20:32:34 UTC (rev 174286)
@@ -1,3 +1,16 @@
+2014-10-03 Andy Estes <[email protected]>
+
+ [iOS] Highlight clicked links in WKPDFView
+ https://bugs.webkit.org/show_bug.cgi?id=137400
+
+ Reviewed by Tim Horton.
+
+ Show a _UIHighlightView on top of clicked links for 200 ms before starting the navigation. This matches the behavior of UIWebPDFView.
+
+ * UIProcess/ios/WKPDFView.mm:
+ (-[WKPDFView _createHighlightViewWithFrame:]): Created a _UIHighlightView with a color and border radius matching the values used by UIWebPDFView.
+ (-[WKPDFView annotation:wasTouchedAtPoint:controller:]): Displayed the highlight, then removed it after the navigation began.
+
2014-10-03 Csaba Osztrogonác <[email protected]>
[GTK] URTBF after r174231.
Modified: trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm (174285 => 174286)
--- trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm 2014-10-03 20:29:29 UTC (rev 174285)
+++ trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm 2014-10-03 20:32:34 UTC (rev 174286)
@@ -38,6 +38,7 @@
#import <CorePDF/UIPDFPageView.h>
#import <UIKit/UIScrollView_Private.h>
#import <WebCore/FloatRect.h>
+#import <WebCore/_UIHighlightViewSPI.h>
#import <chrono>
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
@@ -318,6 +319,19 @@
_isStartingZoom = NO;
}
+- (RetainPtr<_UIHighlightView>)_createHighlightViewWithFrame:(CGRect)frame
+{
+ static const CGFloat highlightBorderRadius = 3;
+ static const CGFloat highlightColorComponent = 26.0 / 255;
+ static UIColor *highlightColor = [[UIColor alloc] initWithRed:highlightColorComponent green:highlightColorComponent blue:highlightColorComponent alpha:0.3];
+
+ RetainPtr<_UIHighlightView> highlightView = adoptNS([[_UIHighlightView alloc] initWithFrame:CGRectInset(frame, -highlightBorderRadius, -highlightBorderRadius)]);
+ [highlightView setOpaque:NO];
+ [highlightView setCornerRadius:highlightBorderRadius];
+ [highlightView setColor:highlightColor];
+ return highlightView;
+}
+
#pragma mark UIPDFPageViewDelegate
- (void)zoom:(UIPDFPageView *)pageView to:(CGRect)targetRect atPoint:(CGPoint)origin kind:(UIPDFObjectKind)kind
@@ -368,9 +382,12 @@
static const int64_t dispatchOffset = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::milliseconds(200)).count();
RetainPtr<WKWebView> retainedWebView = _webView;
- // Call navigateToURLWithSimulatedClick() on a delay so that a tap highlight can be shown.
+ CGRect highlightViewFrame = [self convertRect:[controller.pageView convertRectFromPDFPageSpace:annotation.Rect] fromView:controller.pageView];
+ RetainPtr<_UIHighlightView> highlightView = [self _createHighlightViewWithFrame:highlightViewFrame];
+ [self addSubview:highlightView.get()];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, dispatchOffset), dispatch_get_main_queue(), ^ {
retainedWebView->_page->navigateToURLWithSimulatedClick(urlString, roundedIntPoint(documentPoint), roundedIntPoint(screenPoint));
+ [highlightView removeFromSuperview];
});
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes