Changeset 167274 in webkit
- Timestamp:
- Apr 14, 2014 3:39:18 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r167273 r167274 1 2014-04-14 Benjamin Poulain <bpoulain@apple.com> 2 3 [iOS][WK2] Change the SPI used when starting the rotation animation 4 https://bugs.webkit.org/show_bug.cgi?id=131638 5 6 Reviewed by Tim Horton. 7 8 Having an update block where all the properties are changed is more convenient for Safari. 9 10 * UIProcess/API/Cocoa/WKWebView.mm: 11 (-[WKWebView _beginAnimatedResizeWithUpdates:]): 12 (-[WKWebView _beginAnimatedResizeToSize:obscuredInsets:minimumLayoutSizeOverride:]): Deleted. 13 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 14 1 15 2014-04-14 Simon Fraser <simon.fraser@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r167262 r167274 1243 1243 } 1244 1244 1245 - (void)_beginAnimatedResize ToSize:(CGSize)futureSize obscuredInsets:(UIEdgeInsets)futureObscuredInsets minimumLayoutSizeOverride:(CGSize)futureMinimumLayoutSize1245 - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock 1246 1246 { 1247 1247 _isAnimatingResize = YES; 1248 1248 _resizeAnimationTransformAdjustments = CATransform3DIdentity; 1249 1249 1250 CGRect oldBounds = self.bounds; 1251 CGSize oldMinimumLayoutSize = oldBounds.size; 1252 if (_hasStaticMinimumLayoutSize) 1253 oldMinimumLayoutSize = _minimumLayoutSizeOverride; 1254 WebCore::FloatRect oldUnobscuredContentRect = _page->unobscuredContentRect(); 1255 1256 updateBlock(); 1257 1250 1258 if (_customContentView) 1251 1259 return; 1252 1260 1261 CGRect newBounds = self.bounds; 1262 CGSize newMinimumLayoutSize = newBounds.size; 1263 if (_hasStaticMinimumLayoutSize) 1264 newMinimumLayoutSize = _minimumLayoutSizeOverride; 1265 1266 if (CGSizeEqualToSize(newMinimumLayoutSize, oldMinimumLayoutSize) && CGRectEqualToRect(newBounds, oldBounds)) 1267 return; 1268 1253 1269 CGSize contentSizeInContentViewCoordinates = [_contentView bounds].size; 1254 [_scrollView setMinimumZoomScale:std::min(futureSize.width / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])]; 1255 1256 _obscuredInsets = futureObscuredInsets; 1257 if (_hasStaticMinimumLayoutSize) 1258 _minimumLayoutSizeOverride = futureMinimumLayoutSize; 1259 1260 CGRect oldBounds = self.bounds; 1261 WebCore::FloatRect originalUnobscuredContentRect = _page->unobscuredContentRect(); 1262 1263 CGRect futureBounds = oldBounds; 1264 futureBounds.size = futureSize; 1265 [self setBounds:futureBounds]; 1270 [_scrollView setMinimumZoomScale:std::min(newBounds.size.width / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])]; 1266 1271 1267 1272 // Compute the new scale to keep the current content width in the scrollview. 1268 1273 CGFloat oldWebViewWidthInContentViewCoordinates = oldBounds.size.width / contentZoomScale(self); 1269 1274 CGFloat visibleContentViewWidthInContentCoordinates = std::min(contentSizeInContentViewCoordinates.width, oldWebViewWidthInContentViewCoordinates); 1270 CGFloat targetScale = futureBounds.size.width / visibleContentViewWidthInContentCoordinates;1275 CGFloat targetScale = newBounds.size.width / visibleContentViewWidthInContentCoordinates; 1271 1276 [_scrollView setZoomScale:targetScale]; 1272 1277 1273 1278 // Compute a new position to keep the content centered. 1274 CGPoint originalContentCenter = o riginalUnobscuredContentRect.center();1279 CGPoint originalContentCenter = oldUnobscuredContentRect.center(); 1275 1280 CGPoint originalContentCenterInSelfCoordinates = [self convertPoint:originalContentCenter fromView:_contentView.get()]; 1276 CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect( futureBounds, futureObscuredInsets);1281 CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets); 1277 1282 CGPoint futureUnobscuredRectCenterInSelfCoordinates = CGPointMake(futureUnobscuredRectInSelfCoordinates.origin.x + futureUnobscuredRectInSelfCoordinates.size.width / 2, futureUnobscuredRectInSelfCoordinates.origin.y + futureUnobscuredRectInSelfCoordinates.size.height / 2); 1278 1283 … … 1284 1289 // Limit the new offset within the scrollview, we do not want to rubber band programmatically. 1285 1290 CGSize futureContentSizeInSelfCoordinates = CGSizeMake(contentSizeInContentViewCoordinates.width * targetScale, contentSizeInContentViewCoordinates.height * targetScale); 1286 CGFloat maxHorizontalOffset = futureContentSizeInSelfCoordinates.width - futureBounds.size.width + _obscuredInsets.right;1291 CGFloat maxHorizontalOffset = futureContentSizeInSelfCoordinates.width - newBounds.size.width + _obscuredInsets.right; 1287 1292 contentOffset.x = std::min(contentOffset.x, maxHorizontalOffset); 1288 CGFloat maxVerticalOffset = futureContentSizeInSelfCoordinates.height - futureBounds.size.height + _obscuredInsets.bottom;1293 CGFloat maxVerticalOffset = futureContentSizeInSelfCoordinates.height - newBounds.size.height + _obscuredInsets.bottom; 1289 1294 contentOffset.y = std::min(contentOffset.y, maxVerticalOffset); 1290 1295 … … 1293 1298 1294 1299 // Make the top/bottom edges "sticky" within 1 pixel. 1295 if (o riginalUnobscuredContentRect.maxY() > contentSizeInContentViewCoordinates.height - 1)1300 if (oldUnobscuredContentRect.maxY() > contentSizeInContentViewCoordinates.height - 1) 1296 1301 contentOffset.y = maxVerticalOffset; 1297 if (o riginalUnobscuredContentRect.y() < 1)1302 if (oldUnobscuredContentRect.y() < 1) 1298 1303 contentOffset.y = -_obscuredInsets.top; 1299 1304 … … 1301 1306 [_scrollView setContentOffset:contentOffset]; 1302 1307 1303 CGRect visibleRectInContentCoordinates = [self convertRect: futureBounds toView:_contentView.get()];1304 1305 CGRect unobscuredRect = UIEdgeInsetsInsetRect( futureBounds, _obscuredInsets);1308 CGRect visibleRectInContentCoordinates = [self convertRect:newBounds toView:_contentView.get()]; 1309 1310 CGRect unobscuredRect = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets); 1306 1311 CGRect unobscuredRectInContentCoordinates = [self convertRect:unobscuredRect toView:_contentView.get()]; 1307 1312 1308 _page->dynamicViewportSizeUpdate(WebCore::IntSize(CGCeiling( futureMinimumLayoutSize.width), CGCeiling(futureMinimumLayoutSize.height)), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, targetScale);1313 _page->dynamicViewportSizeUpdate(WebCore::IntSize(CGCeiling(newMinimumLayoutSize.width), CGCeiling(newMinimumLayoutSize.height)), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, targetScale); 1309 1314 } 1310 1315 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r166933 r167274 109 109 - (void)_endInteractiveObscuredInsetsChange; 110 110 111 - (void)_beginAnimatedResize ToSize:(CGSize)futureSize obscuredInsets:(UIEdgeInsets)futureObscuredInsets minimumLayoutSizeOverride:(CGSize)futureMinimumLayoutSize;111 - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock; 112 112 - (void)_endAnimatedResize; 113 113
Note: See TracChangeset
for help on using the changeset viewer.