Changeset 184022 in webkit
- Timestamp:
- May 8, 2015, 4:04:29 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/mac/WKViewLayoutStrategy.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r184016 r184022 1 2015-05-08 Timothy Horton <timothy_horton@apple.com> 2 3 Periodically repaint during resize while using the DynamicSizeWithMinimumViewSize layout strategy 4 https://bugs.webkit.org/show_bug.cgi?id=144816 5 6 Reviewed by Simon Fraser. 7 8 * UIProcess/mac/WKViewLayoutStrategy.mm: 9 (-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy initWithPage:view:mode:]): 10 (-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy _updateTransientScale:]): 11 (-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy updateLayout]): 12 Factor out _updateTransientScale from updateLayout. 13 Keep track of the last viewScaleFactor that we know is being displayed 14 (_lastCommittedViewScale) and use that for computing the transient scale, 15 so that we can recompute the transient scale while the UI process's notion 16 of the actual view scale might have moved ahead of what the Web process has 17 painted. 18 1 19 2015-05-08 Timothy Horton <timothy_horton@apple.com> 2 20 -
trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm
r184011 r184022 46 46 @end 47 47 48 @interface WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy : WKViewLayoutStrategy 48 @interface WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy : WKViewLayoutStrategy { 49 BOOL _isWaitingForCommit; 50 BOOL _hasPendingLayout; 51 CGFloat _lastCommittedViewScale; 52 } 49 53 @end 50 54 … … 245 249 246 250 page.setUseFixedLayout(true); 247 248 return self; 249 } 250 251 - (void)updateLayout 252 { 251 _lastCommittedViewScale = _page->viewScaleFactor(); 252 253 return self; 254 } 255 256 - (void)_updateTransientScale:(CGFloat)scale 257 { 258 float topContentInset = _page->topContentInset(); 259 260 CGFloat relativeScale = scale / _lastCommittedViewScale; 261 262 CATransform3D transform = CATransform3DMakeTranslation(0, topContentInset - (topContentInset * relativeScale), 0); 263 transform = CATransform3DScale(transform, relativeScale, relativeScale, 1); 264 265 _wkView._rootLayer.transform = transform; 266 } 267 268 - (void)updateLayout 269 { 270 _hasPendingLayout = NO; 271 253 272 CGFloat scale = 1; 254 273 … … 272 291 } 273 292 274 // Send frame size updates if we're the only ones disabling them, 275 // if we're not scaling down. That way, everything will behave like a normal 276 // resize except in the critical section. 277 if ([_wkView inLiveResize] && scale == 1 && _frameSizeUpdatesDisabledCount == 1) { 293 _page->setFixedLayoutSize(IntSize(fixedLayoutWidth, fixedLayoutHeight)); 294 295 [self _updateTransientScale:scale]; 296 297 if (_isWaitingForCommit) { 298 _hasPendingLayout = YES; 299 return; 300 } 301 302 if ([_wkView inLiveResize] && _lastCommittedViewScale == 1 && scale == 1 && _frameSizeUpdatesDisabledCount == 1) { 303 // Send frame size updates if we're the only ones disabling them, 304 // if we're not scaling down. That way, everything will behave like a normal 305 // resize except in the critical section. 278 306 if (_wkView.shouldClipToVisibleRect) 279 307 [_wkView _updateViewExposedRect]; 280 308 [_wkView _setDrawingAreaSize:[_wkView frame].size]; 281 } 282 283 _page->setFixedLayoutSize(IntSize(fixedLayoutWidth, fixedLayoutHeight)); 284 285 if ([_wkView inLiveResize]) { 286 float topContentInset = _page->topContentInset(); 287 288 CGFloat relativeScale = scale / _page->viewScaleFactor(); 289 290 CATransform3D transform = CATransform3DMakeTranslation(0, topContentInset - (topContentInset * relativeScale), 0); 291 transform = CATransform3DScale(transform, relativeScale, relativeScale, 1); 292 293 _wkView._rootLayer.transform = transform; 294 } else if (scale != _page->viewScaleFactor()) { 309 return; 310 } 311 312 if (_lastCommittedViewScale == scale) 313 return; 314 315 _isWaitingForCommit = YES; 316 295 317 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 296 RetainPtr<CAContext> context = [_wkView.layer context]; 297 RetainPtr<WKView> retainedWKView = _wkView; 298 _page->scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), [retainedWKView, context] (const WebCore::MachSendRight& fencePort, CallbackBase::Error) { 299 [context setFencePort:fencePort.sendRight() commitHandler:^{ 300 [retainedWKView _rootLayer].transform = CATransform3DIdentity; 301 }]; 302 }); 318 RetainPtr<CAContext> context = [_wkView.layer context]; 319 RetainPtr<WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy> retainedSelf = self; 320 _page->scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), [retainedSelf, context, scale] (const WebCore::MachSendRight& fencePort, CallbackBase::Error error) { 321 if (error != CallbackBase::Error::None) 322 return; 323 324 [context setFencePort:fencePort.sendRight() commitHandler:[retainedSelf, scale] { 325 WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy *layoutStrategy = retainedSelf.get(); 326 layoutStrategy->_lastCommittedViewScale = scale; 327 [layoutStrategy _updateTransientScale:scale]; 328 layoutStrategy->_isWaitingForCommit = NO; 329 330 if (layoutStrategy->_hasPendingLayout) 331 [layoutStrategy updateLayout]; 332 }]; 333 }); 303 334 #else 304 _page->scaleView(scale);305 _wkView._rootLayer.transform = CATransform3DIdentity;335 _page->scaleView(scale); 336 _wkView._rootLayer.transform = CATransform3DIdentity; 306 337 #endif 307 }308 338 } 309 339
Note:
See TracChangeset
for help on using the changeset viewer.