Changeset 220112 in webkit


Ignore:
Timestamp:
Aug 1, 2017 2:42:28 PM (7 years ago)
Author:
Alan Bujtas
Message:

REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
https://bugs.webkit.org/show_bug.cgi?id=175009
<rdar://problem/33505791>

Reviewed by Simon Fraser.

Source/WebCore:

This patch ensures that we report the desktop, non-frame-flattened frame size for media queries in subframes.
Some websites don't expect the iframes to be expanded to the size of the content and when the media query
callback mutates the content (triggering frame resize), they might end up getting into a never ending layout.

Test: fast/frames/flattening/media-query-growing-content.html

  • css/MediaQueryEvaluator.cpp:

(WebCore::orientationEvaluate):
(WebCore::aspectRatioEvaluate):
(WebCore::heightEvaluate):
(WebCore::widthEvaluate):

  • page/FrameView.cpp:

(WebCore::FrameView::layout):
(WebCore::FrameView::layoutSizeForMediaQuery const):
(WebCore::FrameView::evaluateMediaQueryList):

  • page/FrameView.h:

LayoutTests:

  • fast/frames/flattening/media-query-growing-content-expected.txt: Added.
  • fast/frames/flattening/media-query-growing-content.html: Added.
  • fast/frames/flattening/resources/media-query-min-height-with-flattening.html: Added.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220111 r220112  
     12017-08-01  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
     4        https://bugs.webkit.org/show_bug.cgi?id=175009
     5        <rdar://problem/33505791>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/frames/flattening/media-query-growing-content-expected.txt: Added.
     10        * fast/frames/flattening/media-query-growing-content.html: Added.
     11        * fast/frames/flattening/resources/media-query-min-height-with-flattening.html: Added.
     12
    1132017-08-01  Youenn Fablet  <youenn@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r220109 r220112  
     12017-08-01  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
     4        https://bugs.webkit.org/show_bug.cgi?id=175009
     5        <rdar://problem/33505791>
     6
     7        Reviewed by Simon Fraser.
     8
     9        This patch ensures that we report the desktop, non-frame-flattened frame size for media queries in subframes.
     10        Some websites don't expect the iframes to be expanded to the size of the content and when the media query
     11        callback mutates the content (triggering frame resize), they might end up getting into a never ending layout.
     12
     13        Test: fast/frames/flattening/media-query-growing-content.html
     14
     15        * css/MediaQueryEvaluator.cpp:
     16        (WebCore::orientationEvaluate):
     17        (WebCore::aspectRatioEvaluate):
     18        (WebCore::heightEvaluate):
     19        (WebCore::widthEvaluate):
     20        * page/FrameView.cpp:
     21        (WebCore::FrameView::layout):
     22        (WebCore::FrameView::layoutSizeForMediaQuery const):
     23        (WebCore::FrameView::evaluateMediaQueryList):
     24        * page/FrameView.h:
     25
    1262017-07-26  Jiewen Tan  <jiewen_tan@apple.com>
    227
  • trunk/Source/WebCore/css/MediaQueryEvaluator.cpp

    r220090 r220112  
    305305        return false;
    306306
    307     auto width = view->layoutWidth();
    308     auto height = view->layoutHeight();
    309 
     307    auto viewSize = view->layoutSizeForMediaQuery();
    310308    if (!is<CSSPrimitiveValue>(value)) {
    311309        // Expression (orientation) evaluates to true if width and height >= 0.
    312         return height >= 0 && width >= 0;
     310        return viewSize.height() >= 0 && viewSize.width() >= 0;
    313311    }
    314312
    315313    auto keyword = downcast<CSSPrimitiveValue>(*value).valueID();
    316     if (width > height) // Square viewport is portrait.
     314    if (viewSize.width() > viewSize.height()) // Square viewport is portrait.
    317315        return keyword == CSSValueLandscape;
    318316    return keyword == CSSValuePortrait;
     
    325323    if (!value)
    326324        return true;
    327 
    328325    FrameView* view = frame.view();
    329326    if (!view)
    330327        return true;
    331 
    332     return compareAspectRatioValue(value, view->layoutWidth(), view->layoutHeight(), op);
     328    auto viewSize = view->layoutSizeForMediaQuery();
     329    return compareAspectRatioValue(value, viewSize.width(), viewSize.height(), op);
    333330}
    334331
     
    446443    if (!view)
    447444        return false;
    448     int height = view->layoutHeight();
     445    int height = view->layoutSizeForMediaQuery().height();
    449446    if (!value)
    450447        return height;
     
    460457    if (!view)
    461458        return false;
    462     int width = view->layoutWidth();
     459    int width = view->layoutSizeForMediaQuery().width();
    463460    if (!value)
    464461        return width;
  • trunk/Source/WebCore/page/FrameView.cpp

    r219876 r220112  
    13171317
    13181318    if (inChildFrameLayoutWithFrameFlattening) {
     1319        if (!m_frameFlatteningViewSizeForMediaQuery)
     1320            m_frameFlatteningViewSizeForMediaQuery = ScrollView::layoutSize();
    13191321        startLayoutAtMainFrameViewIfNeeded(allowSubtree);
    13201322        RenderElement* root = m_layoutRoot ? m_layoutRoot : frame().document()->renderView();
     
    13711373            InspectorInstrumentation::mediaQueryResultChanged(document);
    13721374        }
    1373        
    13741375        document.evaluateMediaQueryList();
    1375 
    13761376        // If there is any pagination to apply, it will affect the RenderView's style, so we should
    13771377        // take care of that now.
    13781378        applyPaginationToViewport();
    1379 
    13801379        // Always ensure our style info is up-to-date. This can happen in situations where
    13811380        // the layout beats any sort of style recalc update that needs to occur.
     
    54085407    return renderView() && renderView()->shouldPlaceBlockDirectionScrollbarOnLeft();
    54095408}
    5410    
     5409
     5410IntSize FrameView::layoutSizeForMediaQuery() const
     5411{
     5412    return m_frameFlatteningViewSizeForMediaQuery.value_or(ScrollView::layoutSize());
     5413}
     5414
    54115415} // namespace WebCore
  • trunk/Source/WebCore/page/FrameView.h

    r219668 r220112  
    217217
    218218    WEBCORE_EXPORT void adjustViewSize();
    219    
     219    IntSize layoutSizeForMediaQuery() const;
     220
    220221    WEBCORE_EXPORT void setViewportSizeForCSSViewportUnits(IntSize);
    221222    IntSize viewportSizeForCSSViewportUnits() const;
     
    891892    // The intrinsic content size decided by autosizing.
    892893    IntSize m_autoSizeContentSize;
     894    // Report the first computed frame view size to media queries.
     895    std::optional<IntSize> m_frameFlatteningViewSizeForMediaQuery;
    893896
    894897    std::unique_ptr<ScrollableAreaSet> m_scrollableAreas;
Note: See TracChangeset for help on using the changeset viewer.