Changeset 246920 in webkit


Ignore:
Timestamp:
Jun 27, 2019 8:22:29 PM (5 years ago)
Author:
Alan Bujtas
Message:

REGRESSION(r244633): e-mail with "height: 100%" causes unstable layout.
https://bugs.webkit.org/show_bug.cgi?id=199303
<rdar://problem/51340927>

Reviewed by Tim Horton.

Source/WebCore:

This patch restores the previous behavior (pre r244633) where we intentionally reported stale content size value to
avoid unstable layout for content like height: 100px.

  • page/FrameView.cpp:

(WebCore::FrameView::autoSizeIfEnabled):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:

(TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246919 r246920  
     12019-06-27  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION(r244633): e-mail with "height: 100%" causes unstable layout.
     4        https://bugs.webkit.org/show_bug.cgi?id=199303
     5        <rdar://problem/51340927>
     6
     7        Reviewed by Tim Horton.
     8
     9        This patch restores the previous behavior (pre r244633) where we intentionally reported stale content size value to
     10        avoid unstable layout for content like height: 100px.
     11
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::autoSizeIfEnabled):
     14
    1152019-06-27  Fujii Hironori  <Hironori.Fujii@sony.com>
    216
  • trunk/Source/WebCore/page/FrameView.cpp

    r246285 r246920  
    34693469    document->updateStyleIfNeeded();
    34703470    document->updateLayoutIgnorePendingStylesheets();
    3471 
    3472     auto currentContentsSize = this->contentsSize();
    3473     auto finalWidth = std::max(m_autoSizeConstraint.width(), currentContentsSize.width());
    3474     auto finalHeight = m_autoSizeFixedMinimumHeight ? std::max(m_autoSizeFixedMinimumHeight, currentContentsSize.height()) : currentContentsSize.height();
     3471    // While the final content size could slightly be different after the next resize/layout (see below), we intentionally save and report
     3472    // the current value to avoid unstable layout (e.g. content "height: 100%").
     3473    // See also webkit.org/b/173561
     3474    m_autoSizeContentSize = contentsSize();
     3475
     3476    auto finalWidth = std::max(m_autoSizeConstraint.width(), m_autoSizeContentSize.width());
     3477    auto finalHeight = m_autoSizeFixedMinimumHeight ? std::max(m_autoSizeFixedMinimumHeight, m_autoSizeContentSize.height()) : m_autoSizeContentSize.height();
    34753478    resize(finalWidth, finalHeight);
    34763479    document->updateLayoutIgnorePendingStylesheets();
    3477     m_autoSizeContentSize = contentsSize();
    34783480    if (auto* page = frame().page())
    34793481        page->chrome().client().intrinsicContentsSizeChanged(m_autoSizeContentSize);
  • trunk/Tools/ChangeLog

    r246892 r246920  
     12019-06-27  Zalan Bujtas  <zalan@apple.com>
     2
     3        REGRESSION(r244633): e-mail with "height: 100%" causes unstable layout.
     4        https://bugs.webkit.org/show_bug.cgi?id=199303
     5        <rdar://problem/51340927>
     6
     7        Reviewed by Tim Horton.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:
     10        (TEST):
     11
    1122019-06-27  Beth Dakin  <bdakin@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm

    r244633 r246920  
    164164    // the intrinsic size change callback.
    165165    [webView _setShouldExpandContentToViewHeightForAutoLayout:YES];
    166     [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 1000) resettingWidth:NO];
     166    // 100px _is_the_expected_ height because we intentionally report stale value to avoid unstable layout.
     167    // See FrameView::autoSizeIfEnabled().
     168    [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 100) resettingWidth:NO];
    167169    [webView evaluateJavaScript:@"window.innerHeight" completionHandler:^(id value, NSError *error) {
    168170        EXPECT_TRUE([value isKindOfClass:[NSNumber class]]);
Note: See TracChangeset for help on using the changeset viewer.