Changeset 180848 in webkit


Ignore:
Timestamp:
Feb 28, 2015 8:36:39 PM (9 years ago)
Author:
Simon Fraser
Message:

Viewport units should not dirty style just before we do layout
https://bugs.webkit.org/show_bug.cgi?id=141682

Reviewed by Zalan Bujtas.
Source/WebCore:

In documents using viewport units, we dirtied style every time layout changed
the size of the document. This is nonsensical, because viewport units depend on the
viewport size, not the document size.

Move the style dirtying from layout() into availableContentSizeChanged(). Hook
this up for WebKit1 by calling from -[WebFrameView _frameSizeChanged], and,
since that causes availableContentSizeChanged() to be called for WK1 for the first
time, protect the call to updateScrollbars() with a !platformWidget check.

Covered by existing viewport unit tests.

  • page/FrameView.cpp:

(WebCore::FrameView::layout):
(WebCore::FrameView::availableContentSizeChanged):
(WebCore::FrameView::viewportSizeForCSSViewportUnits): Add a FIXME comment. Whether
scrollbars are ignored depends on the value of the overflow property on the root element.

  • page/FrameView.h:
  • platform/ScrollView.cpp:

(WebCore::ScrollView::availableContentSizeChanged):

Source/WebKit/mac:

  • WebView/WebFrameView.mm:

(-[WebFrameView _frameSizeChanged]):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r180847 r180848  
     12015-02-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Viewport units should not dirty style just before we do layout
     4        https://bugs.webkit.org/show_bug.cgi?id=141682
     5
     6        Reviewed by Zalan Bujtas.
     7       
     8        In documents using viewport units, we dirtied style every time layout changed
     9        the size of the document. This is nonsensical, because viewport units depend on the
     10        viewport size, not the document size.
     11       
     12        Move the style dirtying from layout() into availableContentSizeChanged(). Hook
     13        this up for WebKit1 by calling from -[WebFrameView _frameSizeChanged], and,
     14        since that causes availableContentSizeChanged() to be called for WK1 for the first
     15        time, protect the call to updateScrollbars() with a !platformWidget check.
     16
     17        Covered by existing viewport unit tests.
     18
     19        * page/FrameView.cpp:
     20        (WebCore::FrameView::layout):
     21        (WebCore::FrameView::availableContentSizeChanged):
     22        (WebCore::FrameView::viewportSizeForCSSViewportUnits): Add a FIXME comment. Whether
     23        scrollbars are ignored depends on the value of the overflow property on the root element.
     24        * page/FrameView.h:
     25        * platform/ScrollView.cpp:
     26        (WebCore::ScrollView::availableContentSizeChanged):
     27
    1282015-02-28  Andreas Kling  <akling@apple.com>
    229
  • trunk/Source/WebCore/page/FrameView.cpp

    r180846 r180848  
    12891289                    else if (rootRenderer && rootRenderer->stretchesToViewport())
    12901290                        rootRenderer->setChildNeedsLayout();
    1291 
    1292                     document.updateViewportUnitsOnResize();
    12931291                }
    12941292            }
     
    22922290void FrameView::availableContentSizeChanged(AvailableSizeChangeReason reason)
    22932291{
     2292    if (Document* document = frame().document())
     2293        document->updateViewportUnitsOnResize();
     2294
    22942295    setNeedsLayout();
    22952296    ScrollView::availableContentSizeChanged(reason);
     
    47274728    m_hasOverrideViewportSize = true;
    47284729   
    4729     if (Document* document = m_frame->document())
     4730    if (Document* document = m_frame->document()) {
     4731        // FIXME: this should probably be updateViewportUnitsOnResize(), but synchronously
     4732        // dirtying style here causes assertions on iOS (rdar://problem/19998166).
    47304733        document->styleResolverChanged(DeferRecalcStyle);
     4734    }
    47314735}
    47324736   
     
    47364740        return m_overrideViewportSize;
    47374741   
     4742    // FIXME: the value returned should take into account the value of the overflow
     4743    // property on the root element.
    47384744    return visibleContentRectIncludingScrollbars().size();
    47394745}
  • trunk/Source/WebCore/page/FrameView.h

    r180615 r180848  
    489489    WEBCORE_EXPORT virtual void willEndLiveResize() override;
    490490
     491    WEBCORE_EXPORT virtual void availableContentSizeChanged(AvailableSizeChangeReason) override;
     492
    491493    void addPaintPendingMilestones(LayoutMilestones);
    492494    void firePaintRelatedMilestonesIfNeeded();
     
    582584    virtual void repaintContentRectangle(const IntRect&) override;
    583585    virtual void updateContentsSize() override;
    584     virtual void availableContentSizeChanged(AvailableSizeChangeReason) override;
    585586    virtual void addedOrRemovedScrollbar() override;
    586587
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r180615 r180848  
    367367{
    368368    ScrollableArea::availableContentSizeChanged(reason);
     369
     370    if (platformWidget())
     371        return;
     372
    369373    if (reason != AvailableSizeChangeReason::ScrollbarsChanged)
    370374        updateScrollbars(scrollOffset());
  • trunk/Source/WebKit/mac/ChangeLog

    r180704 r180848  
     12015-02-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Viewport units should not dirty style just before we do layout
     4        https://bugs.webkit.org/show_bug.cgi?id=141682
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * WebView/WebFrameView.mm:
     9        (-[WebFrameView _frameSizeChanged]):
     10
    1112015-02-26  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebKit/mac/WebView/WebFrameView.mm

    r179376 r180848  
    352352    if (Frame* coreFrame = [self _web_frame]) {
    353353        if (FrameView* coreFrameView = coreFrame->view())
    354             coreFrameView->setNeedsLayout();
     354            coreFrameView->availableContentSizeChanged(ScrollableArea::AvailableSizeChangeReason::AreaSizeChanged);
    355355    }
    356356}
Note: See TracChangeset for help on using the changeset viewer.