Changeset 213643 in webkit
- Timestamp:
- Mar 9, 2017 8:26:41 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r213638 r213643 1 2017-03-09 Tim Horton <timothy_horton@apple.com> 2 3 WKWebView should automatically respect insets from the view controller hierarchy 4 https://bugs.webkit.org/show_bug.cgi?id=169398 5 <rdar://problem/30617593> 6 7 Reviewed by Dean Jackson. 8 9 * Platform/spi/ios/UIKitSPI.h: 10 * UIProcess/API/Cocoa/WKWebView.mm: 11 (-[WKWebView _initializeWithConfiguration:]): 12 (-[WKWebView _computedContentInset]): 13 (activeMinimumLayoutSize): 14 (-[WKWebView _frameOrBoundsChanged]): 15 Factor insets from above us in the view controller hierarchy into our 16 content insets (and layout size) automatically. 17 1 18 2017-03-09 Tomas Popela <tpopela@redhat.com> 2 19 -
trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h
r213584 r213643 874 874 @end 875 875 876 @interface UIView () 877 - (void)safeAreaInsetsDidChange; 878 @end 879 880 @interface UIScrollView () 881 @property (nonatomic, setter=_setEdgesScrollingContentIntoSafeArea:) UIRectEdge _edgesScrollingContentIntoSafeArea; 882 @property (nonatomic, readonly) UIEdgeInsets _systemContentInset; 883 @end 884 876 885 WTF_EXTERN_C_BEGIN 877 886 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r213590 r213643 507 507 [_scrollView setBouncesZoom:YES]; 508 508 509 if ([_scrollView respondsToSelector:@selector(_setEdgesScrollingContentIntoSafeArea:)]) 510 [_scrollView _setEdgesScrollingContentIntoSafeArea:UIRectEdgeAll]; 511 509 512 [self addSubview:_scrollView.get()]; 510 513 … … 1342 1345 return _obscuredInsets; 1343 1346 1344 return [_scrollView contentInset]; 1347 UIEdgeInsets insets = [_scrollView contentInset]; 1348 1349 if ([_scrollView respondsToSelector:@selector(_systemContentInset)]) { 1350 UIEdgeInsets systemInsets = [_scrollView _systemContentInset]; 1351 insets.top += systemInsets.top; 1352 insets.bottom += systemInsets.bottom; 1353 insets.left += systemInsets.left; 1354 insets.right += systemInsets.right; 1355 } 1356 1357 return insets; 1345 1358 } 1346 1359 … … 2192 2205 } 2193 2206 2207 static WebCore::FloatSize activeMinimumLayoutSize(WKWebView *webView, const CGRect& bounds) 2208 { 2209 if (webView->_overridesMinimumLayoutSize) 2210 return WebCore::FloatSize(webView->_minimumLayoutSizeOverride); 2211 2212 if ([webView->_scrollView respondsToSelector:@selector(_systemContentInset)]) { 2213 UIEdgeInsets systemContentInset = [webView->_scrollView _systemContentInset]; 2214 return WebCore::FloatSize(UIEdgeInsetsInsetRect(CGRectMake(0, 0, bounds.size.width, bounds.size.height), systemContentInset).size); 2215 } 2216 2217 return WebCore::FloatSize(bounds.size); 2218 } 2219 2194 2220 - (void)_frameOrBoundsChanged 2195 2221 { … … 2199 2225 if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing) { 2200 2226 if (!_overridesMinimumLayoutSize) 2201 _page->setViewportConfigurationMinimumLayoutSize( WebCore::FloatSize(bounds.size));2227 _page->setViewportConfigurationMinimumLayoutSize(activeMinimumLayoutSize(self, self.bounds)); 2202 2228 if (!_overridesMaximumUnobscuredSize) 2203 2229 _page->setMaximumUnobscuredSize(WebCore::FloatSize(bounds.size)); … … 2233 2259 CGPoint boundedOffset = contentOffsetBoundedInValidRange(_scrollView.get(), contentOffset); 2234 2260 return !pointsEqualInDevicePixels(contentOffset, boundedOffset, deviceScaleFactor); 2261 } 2262 2263 - (void)safeAreaInsetsDidChange 2264 { 2265 if ([super respondsToSelector:@selector(safeAreaInsetsDidChange)]) 2266 [super safeAreaInsetsDidChange]; 2267 2268 [self _scheduleVisibleContentRectUpdate]; 2235 2269 } 2236 2270 … … 3655 3689 3656 3690 #if PLATFORM(IOS) 3657 static WebCore::FloatSize activeMinimumLayoutSize(WKWebView *webView, const CGRect& bounds)3658 {3659 return WebCore::FloatSize(webView->_overridesMinimumLayoutSize ? webView->_minimumLayoutSizeOverride : bounds.size);3660 }3661 3662 3691 static WebCore::FloatSize activeMaximumUnobscuredSize(WKWebView *webView, const CGRect& bounds) 3663 3692 {
Note: See TracChangeset
for help on using the changeset viewer.