iBooks: text can disappear/flash during finger drag highlight
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 21:42:52 +0000 (21:42 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 21:42:52 +0000 (21:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185993
<rdar://problem/34026943>

Reviewed by Simon Fraser.

Reuse existing tiles when override rect is fully covered by the active grid.
Also, recover dropped tiles if override rect forces us to create new ones.

Unable to create a reproducible test case.

* platform/ios/LegacyTileCache.h:
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::setOverrideVisibleRect):
* platform/ios/LegacyTileLayer.mm:
(-[LegacyTileHostLayer renderInContext:]):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/LegacyTileCache.h
Source/WebCore/platform/ios/LegacyTileCache.mm
Source/WebCore/platform/ios/LegacyTileLayer.mm

index 1862b34..7351f26 100644 (file)
@@ -1,3 +1,22 @@
+2018-05-25  Zalan Bujtas  <zalan@apple.com>
+
+        iBooks: text can disappear/flash during finger drag highlight
+        https://bugs.webkit.org/show_bug.cgi?id=185993
+        <rdar://problem/34026943>
+
+        Reviewed by Simon Fraser.
+
+        Reuse existing tiles when override rect is fully covered by the active grid.
+        Also, recover dropped tiles if override rect forces us to create new ones. 
+
+        Unable to create a reproducible test case.
+
+        * platform/ios/LegacyTileCache.h:
+        * platform/ios/LegacyTileCache.mm:
+        (WebCore::LegacyTileCache::setOverrideVisibleRect):
+        * platform/ios/LegacyTileLayer.mm:
+        (-[LegacyTileHostLayer renderInContext:]):
+
 2018-05-25  Eric Carlson  <eric.carlson@apple.com>
 
         Encode ISOWebVTTCue "strings" when logging
index 40343b5..ee55b74 100644 (file)
@@ -142,7 +142,8 @@ public:
     CALayer* hostLayer() const;
     unsigned tileCapacityForGrid(LegacyTileGrid*);
     Color colorForGridTileBorder(LegacyTileGrid*) const;
-    void setOverrideVisibleRect(std::optional<FloatRect>);
+    bool setOverrideVisibleRect(const FloatRect&);
+    void clearOverrideVisibleRect() { m_overrideVisibleRect = std::nullopt; }
 
     void doPendingRepaints();
 
index 3a02c15..42b4ad6 100644 (file)
@@ -99,9 +99,13 @@ FloatRect LegacyTileCache::visibleRectInLayer(CALayer *layer) const
     return [layer convertRect:[m_window extendedVisibleRect] fromLayer:hostLayer()];
 }
 
-void LegacyTileCache::setOverrideVisibleRect(std::optional<FloatRect> rect)
+bool LegacyTileCache::setOverrideVisibleRect(const FloatRect& rect)
 {
     m_overrideVisibleRect = rect;
+    auto coveredByExistingTiles = false;
+    if (activeTileGrid())
+        coveredByExistingTiles = activeTileGrid()->tilesCover(enclosingIntRect(m_overrideVisibleRect.value()));
+    return coveredByExistingTiles;
 }
 
 bool LegacyTileCache::tilesOpaque() const
index ad14675..8aad67c 100644 (file)
@@ -59,12 +59,15 @@ using WebCore::LegacyTileCache;
         WebThreadLock();
 
     CGRect dirtyRect = CGContextGetClipBoundingBox(context);
-    _tileGrid->tileCache().setOverrideVisibleRect(WebCore::FloatRect(dirtyRect));
-    _tileGrid->tileCache().doLayoutTiles();
+    auto useExistingTiles = _tileGrid->tileCache().setOverrideVisibleRect(WebCore::FloatRect(dirtyRect));
+    if (!useExistingTiles)
+        _tileGrid->tileCache().doLayoutTiles();
 
     [super renderInContext:context];
 
-    _tileGrid->tileCache().setOverrideVisibleRect(std::nullopt);
+    _tileGrid->tileCache().clearOverrideVisibleRect();
+    if (!useExistingTiles)
+        _tileGrid->tileCache().doLayoutTiles();
 }
 @end