@@ -1113,6 +1113,18 @@ IntRect CoordinatedGraphicsLayer::transformedVisibleRect()
11131113 return enclosingIntRect (rect);
11141114}
11151115
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+
11161128void CoordinatedGraphicsLayer::requestBackingStoreUpdate ()
11171129{
11181130 setNeedsVisibleRectAdjustment ();
@@ -1185,7 +1197,7 @@ void CoordinatedGraphicsLayer::updateContentBuffers()
11851197
11861198 if (m_pendingVisibleRectAdjustment) {
11871199 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 ()));
11891201 }
11901202
11911203 if (is<CoordinatedAnimatedBackingStoreClient>(m_nicosia.animatedBackingStoreClient )) {
@@ -1375,8 +1387,13 @@ void CoordinatedGraphicsLayer::computeTransformedVisibleRect()
13751387
13761388 m_shouldUpdateVisibleRect = false ;
13771389 TransformationMatrix currentTransform = transform ();
1378- if (m_movingVisibleRect)
1390+ TransformationMatrix futureTransform = currentTransform;
1391+ if (m_movingVisibleRect) {
13791392 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+ }
13801397 m_layerTransform.setLocalTransform (currentTransform);
13811398
13821399 m_layerTransform.setAnchorPoint (m_adjustedAnchorPoint);
@@ -1389,6 +1406,17 @@ void CoordinatedGraphicsLayer::computeTransformedVisibleRect()
13891406
13901407 m_cachedInverseTransform = m_layerTransform.combined ().inverse ().value_or (TransformationMatrix ());
13911408
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+
13921420 // The combined transform will be used in tiledBackingStoreVisibleRect.
13931421 setNeedsVisibleRectAdjustment ();
13941422}
0 commit comments