Changeset 170935 in webkit
- Timestamp:
- Jul 9, 2014 3:06:29 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r170933 r170935 1 2014-07-09 Anders Carlsson <andersca@apple.com> 2 3 Support transparent WKWebViews 4 https://bugs.webkit.org/show_bug.cgi?id=134779 5 <rdar://problem/17351058> 6 7 Reviewed by Tim Horton. 8 9 Schedule rebuilding the compositing layers if a FrameView's transparency changes. 10 11 * page/FrameView.cpp: 12 (WebCore::FrameView::setTransparent): 13 1 14 2014-07-09 Javier Fernandez <jfernandez@igalia.com> 2 15 CSS canvas color parsing accepts invalid color identifiers -
trunk/Source/WebCore/page/FrameView.cpp
r170830 r170935 2524 2524 void FrameView::setTransparent(bool isTransparent) 2525 2525 { 2526 if (m_isTransparent == isTransparent) 2527 return; 2528 2526 2529 m_isTransparent = isTransparent; 2530 2531 RenderView* renderView = this->renderView(); 2532 if (!renderView) 2533 return; 2534 2535 RenderLayerCompositor& compositor = renderView->compositor(); 2536 compositor.setCompositingLayersNeedRebuild(); 2537 compositor.scheduleCompositingLayerUpdate(); 2527 2538 } 2528 2539 -
trunk/Source/WebKit2/ChangeLog
r170934 r170935 1 2014-07-09 Anders Carlsson <andersca@apple.com> 2 3 Support transparent WKWebViews 4 https://bugs.webkit.org/show_bug.cgi?id=134779 5 <rdar://problem/17351058> 6 7 Reviewed by Tim Horton. 8 9 * UIProcess/API/Cocoa/WKWebView.mm: 10 (-[WKWebView initWithFrame:configuration:]): 11 Call _updateScrollViewBackground instead of setting the background color. 12 13 (contentZoomScale): 14 Use dot notation. 15 16 (scrollViewBackgroundColor): 17 Helper function that returns the scroll view background color. 18 If the web view isn't opaque, we want the scroll view to be transparent. 19 20 (-[WKWebView _updateScrollViewBackground]): 21 Call scrollViewBackgroundColor. 22 23 (-[WKWebView setOpaque:]): 24 Call WebPageProxy::setDrawsBackground and update the scroll view background. 25 26 (-[WKWebView setBackgroundColor:]): 27 Call setBackgroundColor on the content view. 28 1 29 2014-07-09 Andy Estes <aestes@apple.com> 2 30 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r170926 r170935 278 278 279 279 [self addSubview:_scrollView.get()]; 280 [_scrollView setBackgroundColor:[UIColor whiteColor]];281 280 282 281 _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:WTF::move(webPageConfiguration) webView:self]); … … 288 287 [_contentView layer].anchorPoint = CGPointZero; 289 288 [_contentView setFrame:bounds]; 290 [_scrollView addSubview:_contentView.get()];291 289 [_scrollView addSubview:[_contentView unscaledView]]; 290 [self _updateScrollViewBackground]; 291 292 292 _viewportMetaTagWidth = -1; 293 293 … … 655 655 } 656 656 657 static CGFloat contentZoomScale(WKWebView *webView)658 { 659 CGFloat scale = [[webView._currentContentView layer] affineTransform].a;657 static CGFloat contentZoomScale(WKWebView *webView) 658 { 659 CGFloat scale = webView._currentContentView.layer.affineTransform.a; 660 660 ASSERT(scale == [webView->_scrollView zoomScale]); 661 661 return scale; 662 662 } 663 663 664 - (void)_updateScrollViewBackground 665 { 664 static WebCore::Color scrollViewBackgroundColor(WKWebView *webView) 665 { 666 if (!webView.opaque) 667 return WebCore::Color::transparent; 668 666 669 WebCore::Color color; 667 if (_customContentView) 668 color = [_customContentView backgroundColor].CGColor; 670 671 if (webView->_customContentView) 672 color = [webView->_customContentView backgroundColor].CGColor; 669 673 else 670 color = _page->pageExtendedBackgroundColor();671 672 CGFloat zoomScale = contentZoomScale( self);673 CGFloat minimumZoomScale = [ _scrollView minimumZoomScale];674 color = webView->_page->pageExtendedBackgroundColor(); 675 676 CGFloat zoomScale = contentZoomScale(webView); 677 CGFloat minimumZoomScale = [webView->_scrollView minimumZoomScale]; 674 678 if (zoomScale < minimumZoomScale) { 675 679 CGFloat slope = 12; … … 677 681 color = WebCore::colorWithOverrideAlpha(color.rgb(), opacity); 678 682 } 683 684 return color; 685 } 686 687 - (void)_updateScrollViewBackground 688 { 689 WebCore::Color color = scrollViewBackgroundColor(self); 679 690 680 691 if (_scrollViewBackgroundColor == color) … … 1159 1170 { 1160 1171 _page->viewStateDidChange(WebCore::ViewState::IsInWindow); 1172 } 1173 1174 - (void)setOpaque:(BOOL)opaque 1175 { 1176 BOOL oldOpaque = self.opaque; 1177 1178 [super setOpaque:opaque]; 1179 [_contentView setOpaque:opaque]; 1180 1181 if (oldOpaque == opaque) 1182 return; 1183 1184 _page->setDrawsBackground(opaque); 1185 [self _updateScrollViewBackground]; 1186 } 1187 1188 - (void)setBackgroundColor:(UIColor *)backgroundColor 1189 { 1190 [super setBackgroundColor:backgroundColor]; 1191 [_contentView setBackgroundColor:backgroundColor]; 1161 1192 } 1162 1193
Note: See TracChangeset
for help on using the changeset viewer.