Title: [168572] trunk/Source/WebKit2
- Revision
- 168572
- Author
- [email protected]
- Date
- 2014-05-09 22:14:24 -0700 (Fri, 09 May 2014)
Log Message
[iOS][WK2] Fix bugs exposed by r168556
https://bugs.webkit.org/show_bug.cgi?id=132768
Patch by Benjamin Poulain <[email protected]> on 2014-05-09
Reviewed by Ryosuke Niwa.
Fix two bugs exposed by r168556.
1) We were only changing the page scale factor when the scale was not adjusted by live
resize. The idea was that the scale would either be the same (responsive content)
or that it would be defined by the next viewContentRectUpdate.
Now that we also send resize and scroll events, we must always update the scale since
it affects some APIs observable from _javascript_ (like scrolling bounds).
2) Internally, Page's scaleFactor is stored as a float and not double. The rounding error
were causing us to send DynamicViewportUpdateChangedTarget() in cases were there is no change
of target.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::withinEpsilon):
(WebKit::WebPage::dynamicViewportSizeUpdate):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (168571 => 168572)
--- trunk/Source/WebKit2/ChangeLog 2014-05-10 04:51:49 UTC (rev 168571)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-10 05:14:24 UTC (rev 168572)
@@ -1,3 +1,26 @@
+2014-05-09 Benjamin Poulain <[email protected]>
+
+ [iOS][WK2] Fix bugs exposed by r168556
+ https://bugs.webkit.org/show_bug.cgi?id=132768
+
+ Reviewed by Ryosuke Niwa.
+
+ Fix two bugs exposed by r168556.
+ 1) We were only changing the page scale factor when the scale was not adjusted by live
+ resize. The idea was that the scale would either be the same (responsive content)
+ or that it would be defined by the next viewContentRectUpdate.
+
+ Now that we also send resize and scroll events, we must always update the scale since
+ it affects some APIs observable from _javascript_ (like scrolling bounds).
+
+ 2) Internally, Page's scaleFactor is stored as a float and not double. The rounding error
+ were causing us to send DynamicViewportUpdateChangedTarget() in cases were there is no change
+ of target.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::withinEpsilon):
+ (WebKit::WebPage::dynamicViewportSizeUpdate):
+
2014-05-09 Ryuan Choi <[email protected]>
[EFL][WK2] Close icondatabase when EwkFaviconDatabase is destroyed
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (168571 => 168572)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-05-10 04:51:49 UTC (rev 168571)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-05-10 05:14:24 UTC (rev 168572)
@@ -1891,6 +1891,11 @@
viewportConfigurationChanged();
}
+static inline bool withinEpsilon(float a, float b)
+{
+ return fabs(a - b) < std::numeric_limits<float>::epsilon();
+}
+
void WebPage::dynamicViewportSizeUpdate(const FloatSize& minimumLayoutSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale)
{
TemporaryChange<bool> dynamicSizeUpdateGuard(m_inDynamicSizeUpdate, true);
@@ -2031,15 +2036,14 @@
frameView.setUnobscuredContentRect(roundedUnobscuredContentRect);
m_drawingArea->setExposedContentRect(newExposedContentRect);
- if (scale == targetScale)
- scalePage(scale, roundedUnobscuredContentRect.location());
+ scalePage(scale, roundedUnobscuredContentRect.location());
FloatSize unobscuredContentRectSizeInContentCoordinates = newUnobscuredContentRect.size();
unobscuredContentRectSizeInContentCoordinates.scale(scale);
frameView.setCustomSizeForResizeEvent(expandedIntSize(unobscuredContentRectSizeInContentCoordinates));
frameView.setScrollOffset(roundedUnobscuredContentRect.location());
- if (pageScaleFactor() != targetScale || roundedIntPoint(targetUnobscuredRect.location()) != frameView.scrollPosition())
+ if (!withinEpsilon(pageScaleFactor(), targetScale) || roundedIntPoint(targetUnobscuredRect.location()) != frameView.scrollPosition())
send(Messages::WebPageProxy::DynamicViewportUpdateChangedTarget(pageScaleFactor(), frameView.scrollPosition()));
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes