Title: [237658] trunk/Source/WebKit
- Revision
- 237658
- Author
- za...@apple.com
- Date
- 2018-10-31 15:44:27 -0700 (Wed, 31 Oct 2018)
Log Message
[iOS] Do not paint tap highlight unless it is above a certain threshold
https://bugs.webkit.org/show_bug.cgi?id=191134
<rdar://problem/43615142>
Flashing a large portion of the screen on every tap looks unpleasant.
This patch impoves the existing heuristic by adding area check and a % threshold.
Reviewed by Tim Horton.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showTapHighlight]):
(highlightedQuadsAreSmallerThanRect): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (237657 => 237658)
--- trunk/Source/WebKit/ChangeLog 2018-10-31 22:05:51 UTC (rev 237657)
+++ trunk/Source/WebKit/ChangeLog 2018-10-31 22:44:27 UTC (rev 237658)
@@ -1,3 +1,18 @@
+2018-10-31 Zalan Bujtas <za...@apple.com>
+
+ [iOS] Do not paint tap highlight unless it is above a certain threshold
+ https://bugs.webkit.org/show_bug.cgi?id=191134
+ <rdar://problem/43615142>
+
+ Flashing a large portion of the screen on every tap looks unpleasant.
+ This patch impoves the existing heuristic by adding area check and a % threshold.
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _showTapHighlight]):
+ (highlightedQuadsAreSmallerThanRect): Deleted.
+
2018-10-31 Wenson Hsieh <wenson_hs...@apple.com>
API test WKAttachmentTests.CopyAndPasteBetweenWebViews fails on macOS 10.13
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (237657 => 237658)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-10-31 22:05:51 UTC (rev 237657)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2018-10-31 22:44:27 UTC (rev 237658)
@@ -1151,16 +1151,6 @@
}
#endif
-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;
-}
-
static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius, CGFloat borderRadiusScale)
{
return [NSValue valueWithCGSize:CGSizeMake((borderRadius.width() * borderRadiusScale) + minimumTapHighlightRadius, (borderRadius.height() * borderRadiusScale) + minimumTapHighlightRadius)];
@@ -1223,7 +1213,19 @@
- (void)_showTapHighlight
{
- if (!highlightedQuadsAreSmallerThanRect(_tapHighlightInformation.quads, _page->unobscuredContentRect()) && !_showDebugTapHighlightsForFastClicking)
+ auto shouldPaintTapHighlight = [&](const FloatRect& rect) {
+ static const float highlightPaintThreshold = 0.3; // 30%
+ float highlightArea = 0;
+ for (auto highlightQuad : _tapHighlightInformation.quads) {
+ auto boundingBox = highlightQuad.boundingBox();
+ highlightArea += boundingBox.area();
+ if (boundingBox.width() > (rect.width() * highlightPaintThreshold) || boundingBox.height() > (rect.height() * highlightPaintThreshold))
+ return false;
+ }
+ return highlightArea < rect.area() * highlightPaintThreshold;
+ };
+
+ if (!shouldPaintTapHighlight(_page->unobscuredContentRect()) && !_showDebugTapHighlightsForFastClicking)
return;
if (!_highlightView) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes