Title: [187345] trunk/Source/WebKit2
Revision
187345
Author
[email protected]
Date
2015-07-24 10:51:05 -0700 (Fri, 24 Jul 2015)

Log Message

Recode.net gets into a continual resize loop in split fullscreen
https://bugs.webkit.org/show_bug.cgi?id=147266
rdar://problem/21409047

Reviewed by Tim Horton.

In split fullscreen, we use fixed layout and scale to shrink pages down to
fit a given width. This is re-evaluated every time the document width changes.
However some pages, like recode.net, end up continually resizing because
when laid out unconstrained they use a narrower width than when laid out with
a fixed layout size. In fixed layout, they actually use more width than the fixed
layout size.

Detect and break this cycle by just not re-scaling when we've done one fixed layout,
and the document is now taking more width than the fixed layout width.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (187344 => 187345)


--- trunk/Source/WebKit2/ChangeLog	2015-07-24 16:07:30 UTC (rev 187344)
+++ trunk/Source/WebKit2/ChangeLog	2015-07-24 17:51:05 UTC (rev 187345)
@@ -1,3 +1,24 @@
+2015-07-24  Simon Fraser  <[email protected]>
+
+        Recode.net gets into a continual resize loop in split fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=147266
+        rdar://problem/21409047
+
+        Reviewed by Tim Horton.
+        
+        In split fullscreen, we use fixed layout and scale to shrink pages down to
+        fit a given width. This is re-evaluated every time the document width changes.
+        However some pages, like recode.net, end up continually resizing because
+        when laid out unconstrained they use a narrower width than when laid out with
+        a fixed layout size. In fixed layout, they actually use more width than the fixed
+        layout size.
+        
+        Detect and break this cycle by just not re-scaling when we've done one fixed layout,
+        and the document is now taking more width than the fixed layout width.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
+
 2015-07-24  Carlos Garcia Campos  <[email protected]>
 
         [GStreamer] Crashes during plugin installation

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (187344 => 187345)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2015-07-24 16:07:30 UTC (rev 187344)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2015-07-24 17:51:05 UTC (rev 187345)
@@ -301,22 +301,29 @@
 
     // Our current understanding of the document width is still up to date, and we're in scaling mode.
     // Update the viewScale without doing an extra layout to re-determine the document width.
-    if (m_isScalingViewToFitDocument && !documentWidthChanged) {
-        m_lastViewSizeForScaleToFit = m_webPage.size();
-        float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
-        if (viewScale < minimumViewScale) {
-            viewScale = minimumViewScale;
-            documentWidth = std::ceil(viewWidth / viewScale);
+    if (m_isScalingViewToFitDocument) {
+        if (!documentWidthChanged) {
+            m_lastViewSizeForScaleToFit = m_webPage.size();
+            float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
+            if (viewScale < minimumViewScale) {
+                viewScale = minimumViewScale;
+                documentWidth = std::ceil(viewWidth / viewScale);
+            }
+            IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
+            m_webPage.setFixedLayoutSize(fixedLayoutSize);
+            m_webPage.scaleView(viewScale);
+
+            LOG(Resize, "  using fixed layout at %dx%d. document width %d unchanged, scaled to %.4f to fit view width %d", fixedLayoutSize.width(), fixedLayoutSize.height(), documentWidth, viewScale, viewWidth);
+            return;
         }
-        IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
-        m_webPage.setFixedLayoutSize(fixedLayoutSize);
-        m_webPage.scaleView(viewScale);
-
-        LOG(Resize, "  using fixed layout at %dx%d. document width %d unchanged, scaled to %.4f to fit view width %d", fixedLayoutSize.width(), fixedLayoutSize.height(), documentWidth, viewScale, viewWidth);
-        return;
+    
+        IntSize fixedLayoutSize = m_webPage.fixedLayoutSize();
+        if (documentWidth > fixedLayoutSize.width()) {
+            LOG(Resize, "  page laid out wider than fixed layout width. Not attempting to re-scale");
+            return;
+        }
     }
 
-
     LOG(Resize, "  doing unconstrained layout");
 
     // Lay out at the view size.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to