Title: [203145] trunk/Source/WebKit2
Revision
203145
Author
[email protected]
Date
2016-07-12 17:55:47 -0700 (Tue, 12 Jul 2016)

Log Message

[iOS WK2] After zooming and when under memory pressure, page tiles sometimes don't redraw while panning
https://bugs.webkit.org/show_bug.cgi?id=159697
rdar://problem/26314075

Reviewed by Benjamin Poulain.

When under memory pressure, and after pinching back to minimum scale, WebPage::updateVisibleContentRects()
would sometimes always bail under the "boundedScale != currentScale..." condition.

This happened because the visibleContentRectUpdateInfo.scale() is a double, but m_page->pageScaleFactor()
is a float, and the constraining between min and max scale (which are doubles) caused boundedScale
to be always different from currentScale.

Fix by using floats throughout.

No test because there's no way to simulate memory pressure for testing.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203144 => 203145)


--- trunk/Source/WebKit2/ChangeLog	2016-07-13 00:45:11 UTC (rev 203144)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-13 00:55:47 UTC (rev 203145)
@@ -1,3 +1,25 @@
+2016-07-12  Simon Fraser  <[email protected]>
+
+        [iOS WK2] After zooming and when under memory pressure, page tiles sometimes don't redraw while panning
+        https://bugs.webkit.org/show_bug.cgi?id=159697
+        rdar://problem/26314075
+
+        Reviewed by Benjamin Poulain.
+
+        When under memory pressure, and after pinching back to minimum scale, WebPage::updateVisibleContentRects()
+        would sometimes always bail under the "boundedScale != currentScale..." condition.
+
+        This happened because the visibleContentRectUpdateInfo.scale() is a double, but m_page->pageScaleFactor()
+        is a float, and the constraining between min and max scale (which are doubles) caused boundedScale
+        to be always different from currentScale.
+
+        Fix by using floats throughout.
+
+        No test because there's no way to simulate memory pressure for testing.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2016-07-12  Chris Dumez  <[email protected]>
 
         [WK2][NetworkSession] Fix unsafe RunLoop::dispatch() in NetworkLoad constructor

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (203144 => 203145)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-07-13 00:45:11 UTC (rev 203144)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-07-13 00:55:47 UTC (rev 203145)
@@ -3020,15 +3020,16 @@
     m_isInStableState = visibleContentRectUpdateInfo.inStableState();
 
     double scaleNoiseThreshold = 0.005;
-    double filteredScale = visibleContentRectUpdateInfo.scale();
-    double currentScale = m_page->pageScaleFactor();
-    if (!m_isInStableState && fabs(filteredScale - m_page->pageScaleFactor()) < scaleNoiseThreshold) {
+    float filteredScale = visibleContentRectUpdateInfo.scale();
+    float currentScale = m_page->pageScaleFactor();
+
+    if (!m_isInStableState && fabs(filteredScale - currentScale) < scaleNoiseThreshold) {
         // Tiny changes of scale during interactive zoom cause content to jump by one pixel, creating
         // visual noise. We filter those useless updates.
         filteredScale = currentScale;
     }
 
-    double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), filteredScale));
+    float boundedScale = std::min<float>(m_viewportConfiguration.maximumScale(), std::max<float>(m_viewportConfiguration.minimumScale(), filteredScale));
 
     // Skip progressively redrawing tiles if pinch-zooming while the system is under memory pressure.
     if (boundedScale != currentScale && !m_isInStableState && MemoryPressureHandler::singleton().isUnderMemoryPressure())
@@ -3047,21 +3048,20 @@
 
     IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredContentRect().location());
 
-    float floatBoundedScale = boundedScale;
     bool hasSetPageScale = false;
-    if (floatBoundedScale != currentScale) {
+    if (boundedScale != currentScale) {
         m_scaleWasSetByUIProcess = true;
         m_hasStablePageScaleFactor = m_isInStableState;
 
         m_dynamicSizeUpdateHistory.clear();
 
-        m_page->setPageScaleFactor(floatBoundedScale, scrollPosition, m_isInStableState);
+        m_page->setPageScaleFactor(boundedScale, scrollPosition, m_isInStableState);
         hasSetPageScale = true;
-        send(Messages::WebPageProxy::PageScaleFactorDidChange(floatBoundedScale));
+        send(Messages::WebPageProxy::PageScaleFactorDidChange(boundedScale));
     }
 
     if (!hasSetPageScale && m_isInStableState) {
-        m_page->setPageScaleFactor(floatBoundedScale, scrollPosition, true);
+        m_page->setPageScaleFactor(boundedScale, scrollPosition, true);
         hasSetPageScale = true;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to