@@ -1113,6 +1113,18 @@ IntRect CoordinatedGraphicsLayer::transformedVisibleRect()
1113
1113
return enclosingIntRect (rect);
1114
1114
}
1115
1115
1116
+ IntRect CoordinatedGraphicsLayer::transformedVisibleRectIncludingFuture ()
1117
+ {
1118
+ auto visibleRectIncludingFuture = transformedVisibleRect ();
1119
+ if (m_cachedInverseTransform != m_cachedFutureInverseTransform) {
1120
+ FloatRect rect = m_cachedFutureInverseTransform.clampedBoundsOfProjectedQuad (FloatQuad (m_coordinator->visibleContentsRect ()));
1121
+ clampToContentsRectIfRectIsInfinite (rect, size ());
1122
+ visibleRectIncludingFuture.unite (enclosingIntRect (rect));
1123
+ }
1124
+
1125
+ return visibleRectIncludingFuture;
1126
+ }
1127
+
1116
1128
void CoordinatedGraphicsLayer::requestBackingStoreUpdate ()
1117
1129
{
1118
1130
setNeedsVisibleRectAdjustment ();
@@ -1185,7 +1197,7 @@ void CoordinatedGraphicsLayer::updateContentBuffers()
1185
1197
1186
1198
if (m_pendingVisibleRectAdjustment) {
1187
1199
m_pendingVisibleRectAdjustment = false ;
1188
- layerState.mainBackingStore ->createTilesIfNeeded (transformedVisibleRect (), IntRect (0 , 0 , m_size.width (), m_size.height ()));
1200
+ layerState.mainBackingStore ->createTilesIfNeeded (transformedVisibleRectIncludingFuture (), IntRect (0 , 0 , m_size.width (), m_size.height ()));
1189
1201
}
1190
1202
1191
1203
if (is<CoordinatedAnimatedBackingStoreClient>(m_nicosia.animatedBackingStoreClient )) {
@@ -1375,8 +1387,13 @@ void CoordinatedGraphicsLayer::computeTransformedVisibleRect()
1375
1387
1376
1388
m_shouldUpdateVisibleRect = false ;
1377
1389
TransformationMatrix currentTransform = transform ();
1378
- if (m_movingVisibleRect)
1390
+ TransformationMatrix futureTransform = currentTransform;
1391
+ if (m_movingVisibleRect) {
1379
1392
client ().getCurrentTransform (this , currentTransform);
1393
+ Nicosia::Animation::ApplicationResult futureApplicationResults;
1394
+ m_animations.applyKeepingInternalState (futureApplicationResults, MonotonicTime::now () + 300_ms);
1395
+ futureTransform = futureApplicationResults.transform .value_or (currentTransform);
1396
+ }
1380
1397
m_layerTransform.setLocalTransform (currentTransform);
1381
1398
1382
1399
m_layerTransform.setAnchorPoint (m_adjustedAnchorPoint);
@@ -1389,6 +1406,17 @@ void CoordinatedGraphicsLayer::computeTransformedVisibleRect()
1389
1406
1390
1407
m_cachedInverseTransform = m_layerTransform.combined ().inverse ().value_or (TransformationMatrix ());
1391
1408
1409
+ m_layerFutureTransform = m_layerTransform;
1410
+ m_cachedFutureInverseTransform = m_cachedInverseTransform;
1411
+
1412
+ CoordinatedGraphicsLayer* parentLayer = downcast<CoordinatedGraphicsLayer>(parent ());
1413
+
1414
+ if (currentTransform != futureTransform || (parentLayer && parentLayer->m_layerTransform .combinedForChildren () != parentLayer->m_layerFutureTransform .combinedForChildren ())) {
1415
+ m_layerFutureTransform.setLocalTransform (futureTransform);
1416
+ m_layerFutureTransform.combineTransforms (parentLayer ? parentLayer->m_layerFutureTransform .combinedForChildren () : TransformationMatrix ());
1417
+ m_cachedFutureInverseTransform = m_layerFutureTransform.combined ().inverse ().value_or (TransformationMatrix ());
1418
+ }
1419
+
1392
1420
// The combined transform will be used in tiledBackingStoreVisibleRect.
1393
1421
setNeedsVisibleRectAdjustment ();
1394
1422
}
0 commit comments