Changeset 187345 in webkit


Ignore:
Timestamp:
Jul 24, 2015 10:51:05 AM (9 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r187338 r187345  
     12015-07-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Recode.net gets into a continual resize loop in split fullscreen
     4        https://bugs.webkit.org/show_bug.cgi?id=147266
     5        rdar://problem/21409047
     6
     7        Reviewed by Tim Horton.
     8       
     9        In split fullscreen, we use fixed layout and scale to shrink pages down to
     10        fit a given width. This is re-evaluated every time the document width changes.
     11        However some pages, like recode.net, end up continually resizing because
     12        when laid out unconstrained they use a narrower width than when laid out with
     13        a fixed layout size. In fixed layout, they actually use more width than the fixed
     14        layout size.
     15       
     16        Detect and break this cycle by just not re-scaling when we've done one fixed layout,
     17        and the document is now taking more width than the fixed layout width.
     18
     19        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     20        (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
     21
    1222015-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
    223
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r187178 r187345  
    302302    // Our current understanding of the document width is still up to date, and we're in scaling mode.
    303303    // Update the viewScale without doing an extra layout to re-determine the document width.
    304     if (m_isScalingViewToFitDocument && !documentWidthChanged) {
    305         m_lastViewSizeForScaleToFit = m_webPage.size();
    306         float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
    307         if (viewScale < minimumViewScale) {
    308             viewScale = minimumViewScale;
    309             documentWidth = std::ceil(viewWidth / viewScale);
     304    if (m_isScalingViewToFitDocument) {
     305        if (!documentWidthChanged) {
     306            m_lastViewSizeForScaleToFit = m_webPage.size();
     307            float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
     308            if (viewScale < minimumViewScale) {
     309                viewScale = minimumViewScale;
     310                documentWidth = std::ceil(viewWidth / viewScale);
     311            }
     312            IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
     313            m_webPage.setFixedLayoutSize(fixedLayoutSize);
     314            m_webPage.scaleView(viewScale);
     315
     316            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);
     317            return;
    310318        }
    311         IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
    312         m_webPage.setFixedLayoutSize(fixedLayoutSize);
    313         m_webPage.scaleView(viewScale);
    314 
    315         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);
    316         return;
    317     }
    318 
     319   
     320        IntSize fixedLayoutSize = m_webPage.fixedLayoutSize();
     321        if (documentWidth > fixedLayoutSize.width()) {
     322            LOG(Resize, "  page laid out wider than fixed layout width. Not attempting to re-scale");
     323            return;
     324        }
     325    }
    319326
    320327    LOG(Resize, "  doing unconstrained layout");
Note: See TracChangeset for help on using the changeset viewer.