https://bugs.webkit.org/show_bug.cgi?id=134210
<rdar://problem/
17369463>
Reviewed by Benjamin Poulain.
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
Only use the view snapshot if the snapshot is the same (in device space) size
as the layer it's going to be put into, and only if the device scale factor is
the same as it was when the snapshot was taken.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170326
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-06-23 Timothy Horton <timothy_horton@apple.com>
+
+ [iOS][wk2] Don't use view snapshots if the destination layer is a different size
+ https://bugs.webkit.org/show_bug.cgi?id=134210
+ <rdar://problem/17369463>
+
+ Reviewed by Benjamin Poulain.
+
+ * UIProcess/ios/ViewGestureControllerIOS.mm:
+ (WebKit::ViewGestureController::beginSwipeGesture):
+ Only use the view snapshot if the snapshot is the same (in device space) size
+ as the layer it's going to be put into, and only if the device scale factor is
+ the same as it was when the snapshot was taken.
+
2014-06-23 Benjamin Poulain <bpoulain@apple.com>
[iOS][WK2] Make the state restore from HistoryItem more precise and reliable
m_snapshotView = adoptNS([[UIView alloc] initWithFrame:liveSwipeViewFrame]);
ViewSnapshot snapshot;
- if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot) && snapshot.hasImage())
- [m_snapshotView layer].contents = snapshot.asLayerContents();
+ if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot) && snapshot.hasImage()) {
+ float deviceScaleFactor = m_webPageProxy.deviceScaleFactor();
+ FloatSize swipeLayerSizeInDeviceCoordinates(liveSwipeViewFrame.size);
+ swipeLayerSizeInDeviceCoordinates.scale(deviceScaleFactor);
+ if (snapshot.size == swipeLayerSizeInDeviceCoordinates && deviceScaleFactor == snapshot.deviceScaleFactor)
+ [m_snapshotView layer].contents = snapshot.asLayerContents();
+ }
[m_snapshotView setBackgroundColor:[UIColor whiteColor]];
[m_snapshotView layer].contentsGravity = kCAGravityTopLeft;