Title: [187094] branches/safari-601.1-branch/Source/WebKit2
Revision
187094
Author
matthew_han...@apple.com
Date
2015-07-20 22:27:58 -0700 (Mon, 20 Jul 2015)

Log Message

Merge r187054. rdar://problem/21823349

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187093 => 187094)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-21 05:27:55 UTC (rev 187093)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-21 05:27:58 UTC (rev 187094)
@@ -1,5 +1,26 @@
 2015-07-20  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r187054. rdar://problem/21823349
+
+    2015-07-20  Simon Fraser  <simon.fra...@apple.com>
+
+            Facebook in tiled fullscreen is slow
+            https://bugs.webkit.org/show_bug.cgi?id=147134
+            rdar://problem/21823349
+
+            Reviewed by Tim Horton.
+
+            TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded() could cause a page to toggle
+            between two fixed layout sizes differing by a pixel, because of rounding. This would cause
+            lots of extra layouts and painting.
+
+            This happened because the the fixed layout size was computed using ceil(m_webPage.size().width() / viewScale)
+
+            * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+            (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
+
+2015-07-20  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r187044. rdar://problem/21661808
 
     2015-07-20  Jeremy Jones  <jere...@apple.com>

Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (187093 => 187094)


--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2015-07-21 05:27:55 UTC (rev 187093)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2015-07-21 05:27:58 UTC (rev 187094)
@@ -283,10 +283,12 @@
     m_webPage.layoutIfNeeded();
 
     int viewWidth = m_webPage.size().width();
-    bool documentWidthChangedOrInvalidated = m_webPage.mainFrame()->view()->needsLayout() || (m_lastDocumentSizeForScaleToFit.width() != m_webPage.mainFrameView()->renderView()->unscaledDocumentRect().width());
+    int documentWidth = m_webPage.mainFrameView()->renderView()->unscaledDocumentRect().width();
+
+    bool documentWidthChanged = m_lastDocumentSizeForScaleToFit.width() != documentWidth;
     bool viewWidthChanged = m_lastViewSizeForScaleToFit.width() != viewWidth;
 
-    if (!documentWidthChangedOrInvalidated && !viewWidthChanged)
+    if (!documentWidthChanged && !viewWidthChanged)
         return;
 
     // The view is now bigger than the document, so we'll re-evaluate whether we have to scale.
@@ -295,14 +297,16 @@
 
     // 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 && !documentWidthChangedOrInvalidated) {
+    if (m_isScalingViewToFitDocument && !documentWidthChanged) {
+        m_lastViewSizeForScaleToFit = m_webPage.size();
         float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
-        m_lastViewSizeForScaleToFit = m_webPage.size();
-        viewScale = std::max(viewScale, minimumViewScale);
+        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);
-
-        IntSize fixedLayoutSize(std::ceil(m_webPage.size().width() / viewScale), std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
-        m_webPage.setFixedLayoutSize(fixedLayoutSize);
         return;
     }
 
@@ -314,7 +318,7 @@
     m_lastViewSizeForScaleToFit = m_webPage.size();
     m_lastDocumentSizeForScaleToFit = documentSize;
 
-    int documentWidth = documentSize.width();
+    documentWidth = documentSize.width();
 
     float viewScale = 1;
 
@@ -325,8 +329,11 @@
         m_isScalingViewToFitDocument = true;
         m_webPage.setUseFixedLayout(true);
         viewScale = (float)viewWidth / (float)documentWidth;
-        viewScale = std::max(viewScale, minimumViewScale);
-        IntSize fixedLayoutSize(std::ceil(m_webPage.size().width() / viewScale), std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
+        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);
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to