⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 237658 in webkit


Ignore:
Timestamp:
Oct 31, 2018, 3:44:27 PM (8 years ago)
Author:
Alan Bujtas
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.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r237648 r237658  
     12018-10-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iOS] Do not paint tap highlight unless it is above a certain threshold
     4        https://bugs.webkit.org/show_bug.cgi?id=191134
     5        <rdar://problem/43615142>
     6
     7        Flashing a large portion of the screen on every tap looks unpleasant.
     8        This patch impoves the existing heuristic by adding area check and a % threshold. 
     9
     10        Reviewed by Tim Horton.
     11
     12        * UIProcess/ios/WKContentViewInteraction.mm:
     13        (-[WKContentView _showTapHighlight]):
     14        (highlightedQuadsAreSmallerThanRect): Deleted.
     15
    1162018-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    217
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r237607 r237658  
    11521152#endif
    11531153
    1154 static inline bool highlightedQuadsAreSmallerThanRect(const Vector<FloatQuad>& quads, const FloatRect& rect)
    1155 {
    1156     for (size_t i = 0; i < quads.size(); ++i) {
    1157         FloatRect boundingBox = quads[i].boundingBox();
    1158         if (boundingBox.width() > rect.width() || boundingBox.height() > rect.height())
    1159             return false;
    1160     }
    1161     return true;
    1162 }
    1163 
    11641154static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius, CGFloat borderRadiusScale)
    11651155{
    … …  
    12241214- (void)_showTapHighlight
    12251215{
    1226     if (!highlightedQuadsAreSmallerThanRect(_tapHighlightInformation.quads, _page->unobscuredContentRect()) && !_showDebugTapHighlightsForFastClicking)
     1216    auto shouldPaintTapHighlight = [&](const FloatRect& rect) {
     1217        static const float highlightPaintThreshold = 0.3; // 30%
     1218        float highlightArea = 0;
     1219        for (auto highlightQuad : _tapHighlightInformation.quads) {
     1220            auto boundingBox = highlightQuad.boundingBox();
     1221            highlightArea += boundingBox.area();
     1222            if (boundingBox.width() > (rect.width() * highlightPaintThreshold) || boundingBox.height() > (rect.height() * highlightPaintThreshold))
     1223                return false;
     1224        }
     1225        return highlightArea < rect.area() * highlightPaintThreshold;
     1226    };
     1227
     1228    if (!shouldPaintTapHighlight(_page->unobscuredContentRect()) && !_showDebugTapHighlightsForFastClicking)
    12271229        return;
    12281230
Note: See TracChangeset for help on using the changeset viewer.