Title: [175096] branches/safari-600.1.4.12-branch/Source/WebKit2
- Revision
- 175096
- Author
- [email protected]
- Date
- 2014-10-23 00:17:53 -0700 (Thu, 23 Oct 2014)
Log Message
Merged r175081. rdar://problem/17785162
Modified Paths
Diff
Modified: branches/safari-600.1.4.12-branch/Source/WebKit2/ChangeLog (175095 => 175096)
--- branches/safari-600.1.4.12-branch/Source/WebKit2/ChangeLog 2014-10-23 07:17:50 UTC (rev 175095)
+++ branches/safari-600.1.4.12-branch/Source/WebKit2/ChangeLog 2014-10-23 07:17:53 UTC (rev 175096)
@@ -1,5 +1,35 @@
2014-10-23 Babak Shafiei <[email protected]>
+ Merge r175081.
+
+ 2014-10-22 Benjamin Poulain <[email protected]>
+
+ [iOS WK2] Protect WKWebView dynamic viewport change against empty sizes
+ https://bugs.webkit.org/show_bug.cgi?id=137988
+ rdar://problem/17785162
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _beginAnimatedResizeWithUpdates:]):
+ The algorithm behind dynamic size update finds the best content area to put in the viewport
+ after a viewport change. If an initial size or a target size is empty, it is impossible to
+ compute a reasonable area to keep in the view. We end up handling NaN scales
+ and/or sizes and CoreAnimation raises an exception when applying that value.
+
+ This patch add early exits when that occurs and fallback to the common code.
+
+ On Input, things are easy. If any of the initial values is empty, we just execute the updateBlock
+ without attempting any of the dynamic behaviors.
+
+ For the target values, things are trickier. We do not know what the values are going to be before we execute
+ the block. But once we executed the block, we have already skipped all the setters that call the web process.
+
+ To handle that, every value is set manually on WebPageProxy. This is a bit unfortunate because the setters
+ get yet another entry point.
+
+2014-10-23 Babak Shafiei <[email protected]>
+
Merge r174788.
2014-10-16 Tim Horton <[email protected]>
Modified: branches/safari-600.1.4.12-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (175095 => 175096)
--- branches/safari-600.1.4.12-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-10-23 07:17:50 UTC (rev 175095)
+++ branches/safari-600.1.4.12-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-10-23 07:17:53 UTC (rev 175096)
@@ -2152,20 +2152,21 @@
- (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock
{
- if (_customContentView || !_hasCommittedLoadForMainFrame) {
+ CGRect oldBounds = self.bounds;
+ WebCore::FloatRect oldUnobscuredContentRect = _page->unobscuredContentRect();
+
+ if (_customContentView || !_hasCommittedLoadForMainFrame || CGRectIsEmpty(oldBounds) || oldUnobscuredContentRect.isEmpty()) {
updateBlock();
return;
}
_dynamicViewportUpdateMode = DynamicViewportUpdateMode::ResizingWithAnimation;
- CGRect oldBounds = self.bounds;
WebCore::FloatSize oldMinimumLayoutSize = activeMinimumLayoutSize(self, oldBounds);
WebCore::FloatSize oldMinimumLayoutSizeForMinimalUI = activeMinimumLayoutSizeForMinimalUI(self, oldMinimumLayoutSize);
WebCore::FloatSize oldMaximumUnobscuredSize = activeMaximumUnobscuredSize(self, oldBounds);
int32_t oldOrientation = activeOrientation(self);
UIEdgeInsets oldObscuredInsets = _obscuredInsets;
- WebCore::FloatRect oldUnobscuredContentRect = _page->unobscuredContentRect();
updateBlock();
@@ -2175,7 +2176,25 @@
WebCore::FloatSize newMaximumUnobscuredSize = activeMaximumUnobscuredSize(self, newBounds);
int32_t newOrientation = activeOrientation(self);
UIEdgeInsets newObscuredInsets = _obscuredInsets;
+ CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets);
+ ASSERT_WITH_MESSAGE(!(_overridesMinimumLayoutSize && newMinimumLayoutSize.isEmpty()), "Clients controlling the layout size should maintain a valid layout size to minimize layouts.");
+ ASSERT_WITH_MESSAGE(!(_overridesMinimumLayoutSizeForMinimalUI && newMinimumLayoutSizeForMinimalUI.isEmpty()), "Clients controlling the layout size should maintain a valid layout size for minimal UI to minimize layouts.");
+ if (CGRectIsEmpty(newBounds) || newMinimumLayoutSize.isEmpty() || newMinimumLayoutSizeForMinimalUI.isEmpty() || CGRectIsEmpty(futureUnobscuredRectInSelfCoordinates)) {
+ _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing;
+ [self _frameOrBoundsChanged];
+ if (_overridesMinimumLayoutSize)
+ _page->setViewportConfigurationMinimumLayoutSize(WebCore::FloatSize(newMinimumLayoutSize));
+ if (_overridesMinimumLayoutSizeForMinimalUI)
+ _page->setViewportConfigurationMinimumLayoutSizeForMinimalUI(WebCore::FloatSize(newMinimumLayoutSizeForMinimalUI));
+ if (_overridesMaximumUnobscuredSize)
+ _page->setMaximumUnobscuredSize(WebCore::FloatSize(newMaximumUnobscuredSize));
+ if (_overridesInterfaceOrientation)
+ _page->setDeviceOrientation(newOrientation);
+ [self _updateVisibleContentRects];
+ return;
+ }
+
if (CGRectEqualToRect(oldBounds, newBounds)
&& oldMinimumLayoutSize == newMinimumLayoutSize
&& oldMinimumLayoutSizeForMinimalUI == newMinimumLayoutSizeForMinimalUI
@@ -2209,7 +2228,6 @@
// Compute a new position to keep the content centered.
CGPoint originalContentCenter = oldUnobscuredContentRect.center();
CGPoint originalContentCenterInSelfCoordinates = [self convertPoint:originalContentCenter fromView:_contentView.get()];
- CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets);
CGPoint futureUnobscuredRectCenterInSelfCoordinates = CGPointMake(futureUnobscuredRectInSelfCoordinates.origin.x + futureUnobscuredRectInSelfCoordinates.size.width / 2, futureUnobscuredRectInSelfCoordinates.origin.y + futureUnobscuredRectInSelfCoordinates.size.height / 2);
CGPoint originalContentOffset = [_scrollView contentOffset];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes