Changeset 170783 in webkit
- Timestamp:
- Jul 3, 2014 5:48:14 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r170782 r170783 1 2014-07-03 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK2] Compositing layers draw outside page bounds 4 https://bugs.webkit.org/show_bug.cgi?id=134619 5 <rdar://problem/16953222> 6 7 Reviewed by Benjamin Poulain. 8 9 With the new rubber-banding behavior, we no longer have the root content layer clipping all 10 the web layers, but this resulted in web layers which were moved outside the viewport by CSS 11 transforms not being clipped. 12 13 Fix by adding a clipping layer inside the scroll view, above _rootContentView. This layer 14 normally has the same bounds as the content, but when rubber-banding or pinching, 15 it takes the union of the content bounds and the rect used for fixed positioning. 16 To make scrolling work as expected in this scenario, when it has non-zero offset, it 17 has to compensate by setting its bounds origin. 18 19 The bounds of the clipping layer are updated on scrolling/zooming, and when the 20 layer commit tells us that the content size changed. 21 22 * UIProcess/API/Cocoa/WKWebView.mm: 23 (-[WKWebView _updateScrollViewBackground]): 24 * UIProcess/ios/WKContentView.mm: 25 (-[WKContentView initWithFrame:context:configuration:webView:]): 26 (-[WKContentView updateFixedClippingView:]): 27 (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]): 28 (-[WKContentView _didCommitLayerTree:]): 29 1 30 2014-07-03 Brady Eidson <beidson@apple.com> 2 31 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r170776 r170783 665 665 else 666 666 color = _page->pageExtendedBackgroundColor(); 667 667 668 CGFloat zoomScale = contentZoomScale(self); 668 669 CGFloat minimumZoomScale = [_scrollView minimumZoomScale]; -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r170774 r170783 418 418 419 419 RetainPtr<UIView> _rootContentView; 420 RetainPtr<UIView> _fixedClippingView; 420 421 RetainPtr<WKInspectorIndicationView> _inspectorIndicationView; 421 422 RetainPtr<WKInspectorHighlightView> _inspectorHighlightView; … … 445 446 _rootContentView = adoptNS([[UIView alloc] init]); 446 447 [_rootContentView layer].masksToBounds = NO; 447 448 [self addSubview:_rootContentView.get()]; 448 449 _fixedClippingView = adoptNS([[UIView alloc] init]); 450 [_fixedClippingView layer].masksToBounds = YES; 451 [_fixedClippingView layer].anchorPoint = CGPointZero; 452 #ifndef NDEBUG 453 [[_fixedClippingView layer] setName:@"Fixed clipping"]; 454 #endif 455 456 [self addSubview:_fixedClippingView.get()]; 457 [_fixedClippingView addSubview:_rootContentView.get()]; 449 458 450 459 [self setupInteraction]; … … 554 563 } 555 564 565 - (void)updateFixedClippingView:(FloatRect)fixedPositionRectForUI 566 { 567 FloatRect clippingBounds = [self bounds]; 568 clippingBounds.unite(fixedPositionRectForUI); 569 570 [_fixedClippingView setCenter:clippingBounds.location()]; // Not really the center since we set an anchor point. 571 [_fixedClippingView setBounds:clippingBounds]; 572 } 573 556 574 - (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates 557 575 scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively … … 571 589 572 590 RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy(); 573 scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), zoomScale), zoomScale); 591 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), zoomScale); 592 scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), fixedPositionRect, zoomScale); 574 593 575 594 if (auto drawingArea = _page->drawingArea()) … … 578 597 if (!withinEpsilon(oldDisplayedContentScale, zoomScale)) 579 598 [self _updateUnscaledView]; 599 600 [self updateFixedClippingView:fixedPositionRect]; 580 601 } 581 602 … … 668 689 { 669 690 CGSize contentsSize = layerTreeTransaction.contentsSize(); 670 671 [self setBounds:{CGPointZero, contentsSize}]; 672 [_rootContentView setFrame:CGRectMake(0, 0, contentsSize.width, contentsSize.height)]; 673 [_inspectorIndicationView setFrame:[self bounds]]; 691 CGRect contentBounds = { CGPointZero, contentsSize }; 692 CGRect oldBounds = [self bounds]; 693 694 BOOL boundsChanged = !CGRectEqualToRect(oldBounds, contentBounds); 695 if (boundsChanged) { 696 [self setBounds:contentBounds]; 697 [_rootContentView setFrame:contentBounds]; 698 [_inspectorIndicationView setFrame:contentBounds]; 699 } 674 700 675 701 [_webView _didCommitLayerTree:layerTreeTransaction]; 702 703 if (boundsChanged) { 704 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), [[_webView scrollView] zoomScale]); 705 [self updateFixedClippingView:fixedPositionRect]; 706 } 707 676 708 [self _updateChangedSelection]; 677 709 }
Note: See TracChangeset
for help on using the changeset viewer.