Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (168559 => 168560)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-05-10 00:08:28 UTC (rev 168559)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-05-10 00:11:26 UTC (rev 168560)
@@ -447,7 +447,7 @@
CGFloat minimumZoomScale = [_scrollView minimumZoomScale];
if (zoomScale < minimumZoomScale) {
CGFloat slope = 12;
- CGFloat opacity = std::max(1 - slope * (minimumZoomScale - zoomScale), static_cast<CGFloat>(0));
+ CGFloat opacity = std::max<CGFloat>(1 - slope * (minimumZoomScale - zoomScale), 0);
cgColor = adoptCF(CGColorCreateCopyWithAlpha(cgColor.get(), opacity));
}
RetainPtr<UIColor*> uiBackgroundColor = adoptNS([[UIColor alloc] initWithCGColor:cgColor.get()]);
@@ -779,7 +779,11 @@
CGFloat scaleFactor = contentZoomScale(self);
BOOL isStableState = !(_isChangingObscuredInsetsInteractively || [_scrollView isDragging] || [_scrollView isDecelerating] || [_scrollView isZooming] || [_scrollView isZoomBouncing] || [_scrollView _isAnimatingZoom]);
- [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates unobscuredRectInScrollViewCoordinates:unobscuredRect scale:scaleFactor inStableState:isStableState isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively];
+ [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates
+ unobscuredRect:unobscuredRectInContentCoordinates
+ unobscuredRectInScrollViewCoordinates:unobscuredRect
+ scale:scaleFactor minimumScale:[_scrollView minimumZoomScale]
+ inStableState:isStableState isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively];
}
- (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (168559 => 168560)
--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm 2014-05-10 00:08:28 UTC (rev 168559)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm 2014-05-10 00:11:26 UTC (rev 168560)
@@ -261,9 +261,11 @@
CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, _obscuredInsets);
CGRect unobscuredRectInContentCoordinates = [self convertRect:unobscuredRect toView:_contentView.get()];
- CGFloat scaleFactor = [_scrollView zoomScale];
-
- [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates unobscuredRectInScrollViewCoordinates:unobscuredRect scale:scaleFactor inStableState:YES isChangingObscuredInsetsInteractively:NO];
+ [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates
+ unobscuredRect:unobscuredRectInContentCoordinates
+ unobscuredRectInScrollViewCoordinates:unobscuredRect
+ scale:[_scrollView zoomScale] minimumScale:[_scrollView minimumZoomScale]
+ inStableState:YES isChangingObscuredInsetsInteractively:NO];
}
- (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (168559 => 168560)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-05-10 00:08:28 UTC (rev 168559)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-05-10 00:11:26 UTC (rev 168560)
@@ -292,13 +292,43 @@
}
}
-static inline FloatRect fixedPositionRectFromExposedRect(CGRect unobscuredRect, CGSize documentSize, CGFloat scale)
+static inline float adjustedUnexposedEdge(float documentEdge, float exposedRectEdge, float factor)
{
- return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(unobscuredRect), roundedLayoutSize(FloatSize(documentSize)), scale, false, StickToViewportBounds);
+ if (exposedRectEdge < documentEdge)
+ return documentEdge - factor * (documentEdge - exposedRectEdge);
+
+ return exposedRectEdge;
}
-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates scale:(CGFloat)zoomScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
+static inline float adjustedUnexposedMaxEdge(float documentEdge, float exposedRectEdge, float factor)
{
+ if (exposedRectEdge > documentEdge)
+ return documentEdge + factor * (exposedRectEdge - documentEdge);
+
+ return exposedRectEdge;
+}
+
+static inline FloatRect fixedPositionRectFromExposedRect(CGRect unobscuredRect, CGSize documentSize, CGFloat scale, CGFloat minimumScale)
+{
+ FloatRect constrainedUnobscuredRect = unobscuredRect;
+ FloatRect documentRect = FloatRect(FloatPoint(), FloatSize(documentSize));
+
+ if (scale < minimumScale) {
+ const CGFloat slope = 12;
+ CGFloat factor = std::max<CGFloat>(1 - slope * (minimumScale - scale), 0);
+
+ constrainedUnobscuredRect.setX(adjustedUnexposedEdge(documentRect.x(), constrainedUnobscuredRect.x(), factor));
+ constrainedUnobscuredRect.setY(adjustedUnexposedEdge(documentRect.y(), constrainedUnobscuredRect.y(), factor));
+ constrainedUnobscuredRect.setWidth(adjustedUnexposedMaxEdge(documentRect.maxX(), constrainedUnobscuredRect.maxX(), factor) - constrainedUnobscuredRect.x());
+ constrainedUnobscuredRect.setHeight(adjustedUnexposedMaxEdge(documentRect.maxY(), constrainedUnobscuredRect.maxY(), factor) - constrainedUnobscuredRect.y());
+ }
+
+ return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), roundedLayoutSize(FloatSize(documentSize)), scale, false, StickToViewportBounds);
+}
+
+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
+ scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
+{
double timestamp = monotonicallyIncreasingTime();
HistoricalVelocityData::VelocityData velocityData;
if (!isStableState)
@@ -314,11 +344,11 @@
filteredScale = _page->displayedContentScale();
}
- FloatRect customFixedPositionRect = fixedPositionRectFromExposedRect(unobscuredRect, [self bounds].size, zoomScale);
+ FloatRect customFixedPositionRect = fixedPositionRectFromExposedRect(unobscuredRect, [self bounds].size, zoomScale, minimumScale);
_page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, unobscuredRectInScrollViewCoordinates, customFixedPositionRect, filteredScale, isStableState, isChangingObscuredInsetsInteractively, timestamp, velocityData.horizontalVelocity, velocityData.verticalVelocity, velocityData.scaleChangeRate));
RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
- scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), unobscuredRect, zoomScale);
+ scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), customFixedPositionRect, zoomScale);
if (auto drawingArea = _page->drawingArea())
drawingArea->updateDebugIndicator();