Title: [169068] trunk/Source/WebKit2
- Revision
- 169068
- Author
- [email protected]
- Date
- 2014-05-19 14:42:38 -0700 (Mon, 19 May 2014)
Log Message
[iOS][WK2] When a page relayout on dynamic resize, keep the same relative width in view
https://bugs.webkit.org/show_bug.cgi?id=133026
<rdar://problem/16833971>
Patch by Benjamin Poulain <[email protected]> on 2014-05-19
Reviewed by Simon Fraser.
When a page does not relayout, we keep the same width in view.
When a page relayout, we should keep the same relative width in view.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isResponsiveDesignWithContentLargerThanLayout):
(WebKit::WebPage::dynamicViewportSizeUpdate):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (169067 => 169068)
--- trunk/Source/WebKit2/ChangeLog 2014-05-19 21:19:49 UTC (rev 169067)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-19 21:42:38 UTC (rev 169068)
@@ -1,3 +1,18 @@
+2014-05-19 Benjamin Poulain <[email protected]>
+
+ [iOS][WK2] When a page relayout on dynamic resize, keep the same relative width in view
+ https://bugs.webkit.org/show_bug.cgi?id=133026
+ <rdar://problem/16833971>
+
+ Reviewed by Simon Fraser.
+
+ When a page does not relayout, we keep the same width in view.
+ When a page relayout, we should keep the same relative width in view.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::isResponsiveDesignWithContentLargerThanLayout):
+ (WebKit::WebPage::dynamicViewportSizeUpdate):
+
2014-05-19 Benjamin Poulain <[email protected]>
[WK2] Add some missing state reset on crash
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (169067 => 169068)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-05-19 21:19:49 UTC (rev 169067)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-05-19 21:42:38 UTC (rev 169068)
@@ -1941,10 +1941,12 @@
m_dynamicSizeUpdateHistory.add(std::make_pair(oldContentSize, oldPageScaleFactor), IntPoint(frameView.scrollOffset()));
RefPtr<Node> oldNodeAtCenter;
+ double visibleHorizontalFraction = 1;
float relativeHorizontalPositionInNodeAtCenter = 0;
float relativeVerticalPositionInNodeAtCenter = 0;
{
IntRect unobscuredContentRect = frameView.unobscuredContentRect();
+ visibleHorizontalFraction = static_cast<float>(unobscuredContentRect.width()) / oldContentSize.width();
IntPoint unobscuredContentRectCenter = unobscuredContentRect.center();
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
@@ -1978,6 +1980,14 @@
else
scale = std::max(std::min(targetScale, m_viewportConfiguration.maximumScale()), m_viewportConfiguration.minimumScale());
+ if (m_userHasChangedPageScaleFactor && newContentSize.width() != oldContentSize.width()) {
+ // When the content size change, we keep the same relative horizontal content width in view, otherwise we would
+ // end up zoom to far in landscape->portrait, and too close in portrait->landscape.
+ float widthToKeepInView = visibleHorizontalFraction * newContentSize.width();
+ double newScale = targetUnobscuredRectInScrollViewCoordinates.width() / widthToKeepInView;
+ scale = std::max(std::min(newScale, m_viewportConfiguration.maximumScale()), m_viewportConfiguration.minimumScale());
+ }
+
FloatRect newUnobscuredContentRect = targetUnobscuredRect;
FloatRect newExposedContentRect = targetExposedContentRect;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes