Changeset 244633 in webkit


Ignore:
Timestamp:
Apr 24, 2019 7:17:50 PM (5 years ago)
Author:
Alan Bujtas
Message:

Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
https://bugs.webkit.org/show_bug.cgi?id=196948
<rdar://problem/49927131>

Reviewed by Tim Horton.

Source/WebCore:

Covered by existing tests.

  • loader/EmptyClients.h:
  • page/ChromeClient.h:
  • page/FrameView.cpp:

(WebCore::FrameView::autoSizeIfEnabled):
(WebCore::FrameView::enableAutoSizeMode):

  • page/FrameView.h:

Source/WebKit:

Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
after r244291 there's no reason to have it in DrawingArea.

  • UIProcess/DrawingAreaProxy.h:

(WebKit::DrawingAreaProxy::didUpdateGeometry):
(WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.

  • UIProcess/DrawingAreaProxy.messages.in:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didChangeIntrinsicContentSize):
(WebKit::WebPageProxy::setViewLayoutSize):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
  • UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:

(WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::intrinsicContentsSizeChanged const):

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
(WebKit::WebPage::dispatchDidReachLayoutMilestone):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebChromeClient.h:

Source/WebKitLegacy/win:

  • WebCoreSupport/WebChromeClient.cpp:

(WebChromeClient::intrinsicContentsSizeChanged const):

  • WebCoreSupport/WebChromeClient.h:

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:

(TEST):
The expected order of incoming events is

  1. didInvalidateIntrinsicContentSize
  2. didFirstLayout

At setRenderingProgressDidChange, we already check if didInvalidateIntrinsicContentSize comes in first.
However it's not guaranteed that the milestone event is delayed until after TestWebKitAPI::Util::run() is finished
(and remember, all we care about is ordering).

Location:
trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244632 r244633  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
     4        https://bugs.webkit.org/show_bug.cgi?id=196948
     5        <rdar://problem/49927131>
     6
     7        Reviewed by Tim Horton.
     8
     9        Covered by existing tests.
     10
     11        * loader/EmptyClients.h:
     12        * page/ChromeClient.h:
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::autoSizeIfEnabled):
     15        (WebCore::FrameView::enableAutoSizeMode):
     16        * page/FrameView.h:
     17
    1182019-04-24  Youenn Fablet  <youenn@apple.com>
    219
  • trunk/Source/WebCore/loader/EmptyClients.h

    r242108 r244633  
    114114    PlatformPageClient platformPageClient() const final { return 0; }
    115115    void contentsSizeChanged(Frame&, const IntSize&) const final { }
     116    void intrinsicContentsSizeChanged(const IntSize&) const final { }
    116117
    117118    void mouseDidMoveOverElement(const HitTestResult&, unsigned) final { }
  • trunk/Source/WebCore/page/ChromeClient.h

    r244382 r244633  
    196196
    197197    virtual void contentsSizeChanged(Frame&, const IntSize&) const = 0;
     198    virtual void intrinsicContentsSizeChanged(const IntSize&) const = 0;
    198199    virtual void scrollRectIntoView(const IntRect&) const { }; // Currently only Mac has a non empty implementation.
    199200
  • trunk/Source/WebCore/page/FrameView.cpp

    r244446 r244633  
    34643464    document->updateStyleIfNeeded();
    34653465    document->updateLayoutIgnorePendingStylesheets();
    3466     m_autoSizeContentSize = contentsSize();
    3467 
    3468     auto finalWidth = std::max(m_autoSizeConstraint.width(), m_autoSizeContentSize.width());
    3469     auto finalHeight = m_autoSizeFixedMinimumHeight ? std::max(m_autoSizeFixedMinimumHeight, m_autoSizeContentSize.height()) : m_autoSizeContentSize.height();
     3466
     3467    auto currentContentsSize = this->contentsSize();
     3468    auto finalWidth = std::max(m_autoSizeConstraint.width(), currentContentsSize.width());
     3469    auto finalHeight = m_autoSizeFixedMinimumHeight ? std::max(m_autoSizeFixedMinimumHeight, currentContentsSize.height()) : currentContentsSize.height();
    34703470    resize(finalWidth, finalHeight);
    34713471    document->updateLayoutIgnorePendingStylesheets();
     3472    m_autoSizeContentSize = contentsSize();
     3473    if (auto* page = frame().page())
     3474        page->chrome().client().intrinsicContentsSizeChanged(m_autoSizeContentSize);
    34723475    m_didRunAutosize = true;
    34733476}
     
    44714474    m_shouldAutoSize = enable;
    44724475    m_autoSizeConstraint = viewSize;
     4476    m_autoSizeContentSize = contentsSize();
    44734477    m_didRunAutosize = false;
    44744478
  • trunk/Source/WebCore/page/FrameView.h

    r244446 r244633  
    402402    WEBCORE_EXPORT void enableAutoSizeMode(bool enable, const IntSize& minSize);
    403403    WEBCORE_EXPORT void setAutoSizeFixedMinimumHeight(int);
     404    bool isAutoSizeEnabled() const { return m_shouldAutoSize; }
    404405    IntSize autoSizingIntrinsicContentSize() const { return m_autoSizeContentSize; }
    405406
  • trunk/Source/WebKit/ChangeLog

    r244628 r244633  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
     4        https://bugs.webkit.org/show_bug.cgi?id=196948
     5        <rdar://problem/49927131>
     6
     7        Reviewed by Tim Horton.
     8
     9        Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
     10        after r244291 there's no reason to have it in DrawingArea.
     11
     12        * UIProcess/DrawingAreaProxy.h:
     13        (WebKit::DrawingAreaProxy::didUpdateGeometry):
     14        (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
     15        * UIProcess/DrawingAreaProxy.messages.in:
     16        * UIProcess/WebPageProxy.cpp:
     17        (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
     18        (WebKit::WebPageProxy::setViewLayoutSize):
     19        * UIProcess/WebPageProxy.h:
     20        * UIProcess/WebPageProxy.messages.in:
     21        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
     22        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
     23        (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
     24        * UIProcess/mac/WebPageProxyMac.mm:
     25        (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
     26        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     27        (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
     28        * WebProcess/WebCoreSupport/WebChromeClient.h:
     29        * WebProcess/WebPage/WebPage.cpp:
     30        (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
     31        (WebKit::WebPage::dispatchDidReachLayoutMilestone):
     32        * WebProcess/WebPage/WebPage.h:
     33        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     34        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     35        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
     36        (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
     37
    1382019-04-24  Commit Queue  <commit-queue@webkit.org>
    239
  • trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h

    r244446 r244633  
    144144#if PLATFORM(COCOA)
    145145    virtual void didUpdateGeometry() { }
    146     virtual void intrinsicContentSizeDidChange(const WebCore::IntSize&) { }
    147146
    148147#if PLATFORM(MAC)
  • trunk/Source/WebKit/UIProcess/DrawingAreaProxy.messages.in

    r244446 r244633  
    3232    // Used by TiledCoreAnimationDrawingAreaProxy.
    3333    DidUpdateGeometry()
    34     IntrinsicContentSizeDidChange(WebCore::IntSize newIntrinsicContentSize)
    3534#endif
    3635}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r244614 r244633  
    54735473}
    54745474
     5475void WebPageProxy::didChangeIntrinsicContentSize(const IntSize& intrinsicContentSize)
     5476{
     5477#if USE(APPKIT)
     5478    pageClient().intrinsicContentSizeDidChange(intrinsicContentSize);
     5479#endif
     5480}
     5481
    54755482#if ENABLE(INPUT_TYPE_COLOR)
    54765483void WebPageProxy::showColorPicker(const WebCore::Color& initialColor, const IntRect& elementRect, Vector<WebCore::Color>&& suggestions)
     
    76057612#if USE(APPKIT)
    76067613    if (m_viewLayoutSize.width() <= 0)
    7607         intrinsicContentSizeDidChange(IntSize(-1, -1));
     7614        didChangeIntrinsicContentSize(IntSize(-1, -1));
    76087615#endif
    76097616}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r244614 r244633  
    791791    _WKRemoteObjectRegistry *remoteObjectRegistry();
    792792
    793     void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
    794793    CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const;
    795794#endif // PLATFORM(MAC)
     
    17151714
    17161715    void didChangeContentSize(const WebCore::IntSize&);
     1716    void didChangeIntrinsicContentSize(const WebCore::IntSize&);
    17171717
    17181718#if ENABLE(INPUT_TYPE_COLOR)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r244559 r244633  
    8989
    9090    DidChangeContentSize(WebCore::IntSize newSize)
     91    DidChangeIntrinsicContentSize(WebCore::IntSize newIntrinsicContentSize)
    9192
    9293#if ENABLE(INPUT_TYPE_COLOR)
  • trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h

    r244446 r244633  
    6161    // Message handlers.
    6262    void didUpdateGeometry() override;
    63     void intrinsicContentSizeDidChange(const WebCore::IntSize&) override;
    6463
    6564    void sendUpdateGeometry();
  • trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm

    r244446 r244633  
    126126}
    127127
    128 void TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange(const IntSize& newIntrinsicContentSize)
    129 {
    130     if (m_webPageProxy.viewLayoutSize().width() > 0)
    131         m_webPageProxy.intrinsicContentSizeDidChange(newIntrinsicContentSize);
    132 }
    133 
    134128void TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry()
    135129{
  • trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r244446 r244633  
    434434}
    435435
    436 void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize)
    437 {
    438     pageClient().intrinsicContentSizeDidChange(intrinsicContentSize);
    439 }
    440 
    441436void WebPageProxy::setRemoteLayerTreeRootNode(RemoteLayerTreeNode* rootNode)
    442437{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r244440 r244633  
    590590}
    591591
     592void WebChromeClient::intrinsicContentsSizeChanged(const IntSize& size) const
     593{
     594    m_page.updateIntrinsicContentSizeIfNeeded(size);
     595}
     596
    592597void WebChromeClient::contentsSizeChanged(Frame& frame, const IntSize& size) const
    593598{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h

    r244382 r244633  
    118118    PlatformPageClient platformPageClient() const final;
    119119    void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
     120    void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final;
    120121    void scrollRectIntoView(const WebCore::IntRect&) const final; // Currently only Mac has a non empty implementation.
    121122
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r244599 r244633  
    62316231}
    62326232
     6233void WebPage::updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize& size)
     6234{
     6235    if (!viewLayoutSize().width())
     6236        return;
     6237    ASSERT(mainFrameView());
     6238    ASSERT(mainFrameView()->isAutoSizeEnabled());
     6239    ASSERT(!mainFrameView()->needsLayout());
     6240    if (m_lastSentIntrinsicContentSize == size)
     6241        return;
     6242    m_lastSentIntrinsicContentSize = size;
     6243    send(Messages::WebPageProxy::DidChangeIntrinsicContentSize(size));
     6244}
     6245
    62336246void WebPage::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> milestones)
    62346247{
     
    62456258        if (drawingAreaRelatedMilestones && m_drawingArea->addMilestonesToDispatch(drawingAreaRelatedMilestones))
    62466259            milestones.remove(drawingAreaRelatedMilestones);
     6260    }
     6261    if (milestones.contains(DidFirstLayout) && mainFrameView()) {
     6262        // Ensure we never send DidFirstLayout milestone without updating the intrinsic size.
     6263        updateIntrinsicContentSizeIfNeeded(mainFrameView()->autoSizingIntrinsicContentSize());
    62476264    }
    62486265
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r244599 r244633  
    11791179    void setRemoteObjectRegistry(RemoteObjectRegistry&);
    11801180
     1181    void updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize&);
     1182
    11811183private:
    11821184    WebPage(uint64_t pageID, WebPageCreationParameters&&);
     
    18911893    WeakPtr<RemoteObjectRegistry> m_remoteObjectRegistry;
    18921894#endif
     1895    WebCore::IntSize m_lastSentIntrinsicContentSize;
    18931896};
    18941897
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r244446 r244633  
    122122    void updateDebugInfoLayer(bool showLayer);
    123123
    124     void updateIntrinsicContentSizeIfNeeded();
    125124    void updateScrolledExposedRect();
    126125    void scaleViewToFitDocumentIfNeeded();
     
    150149    WebCore::IntSize m_lastViewSizeForScaleToFit;
    151150    WebCore::IntSize m_lastDocumentSizeForScaleToFit;
    152 
    153     WebCore::IntSize m_lastSentIntrinsicContentSize;
    154151
    155152    double m_transientZoomScale { 1 };
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r244446 r244633  
    279279}
    280280
    281 void TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded()
    282 {
    283     if (!m_webPage.viewLayoutSize().width())
    284         return;
    285 
    286     FrameView* frameView = m_webPage.mainFrameView();
    287     if (!frameView)
    288         return;
    289 
    290     if (frameView->needsLayout())
    291         return;
    292 
    293     IntSize contentSize = frameView->autoSizingIntrinsicContentSize();
    294     if (m_lastSentIntrinsicContentSize == contentSize)
    295         return;
    296 
    297     m_lastSentIntrinsicContentSize = contentSize;
    298     send(Messages::DrawingAreaProxy::IntrinsicContentSizeDidChange(contentSize));
    299 }
    300 
    301281void TiledCoreAnimationDrawingArea::setShouldScaleViewToFitDocument(bool shouldScaleView)
    302282{
     
    463443        m_webPage.flushPendingEditorStateUpdate();
    464444
    465         updateIntrinsicContentSizeIfNeeded();
    466 
    467445        if (m_pendingRootLayer) {
    468446            setRootCompositingLayer(m_pendingRootLayer.get());
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r244627 r244633  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
     4        https://bugs.webkit.org/show_bug.cgi?id=196948
     5        <rdar://problem/49927131>
     6
     7        Reviewed by Tim Horton.
     8
     9        * WebCoreSupport/WebChromeClient.h:
     10
    1112019-04-24  Eric Carlson  <eric.carlson@apple.com>
    212
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h

    r241321 r244633  
    105105    PlatformPageClient platformPageClient() const final;
    106106    void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
     107    void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final { }
    107108    void scrollRectIntoView(const WebCore::IntRect&) const final;
    108109
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r244599 r244633  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
     4        https://bugs.webkit.org/show_bug.cgi?id=196948
     5        <rdar://problem/49927131>
     6
     7        Reviewed by Tim Horton.
     8
     9        * WebCoreSupport/WebChromeClient.cpp:
     10        (WebChromeClient::intrinsicContentsSizeChanged const):
     11        * WebCoreSupport/WebChromeClient.h:
     12
    1132019-04-24  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.cpp

    r244440 r244633  
    525525}
    526526
     527void WebChromeClient::intrinsicContentsSizeChanged(const IntSize&) const
     528{
     529    notImplemented();
     530}
     531
    527532void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
    528533{
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebChromeClient.h

    r241321 r244633  
    103103    PlatformPageClient platformPageClient() const final;
    104104    void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
     105    void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final;
    105106
    106107    void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) final;
  • trunk/Tools/ChangeLog

    r244627 r244633  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
     4        https://bugs.webkit.org/show_bug.cgi?id=196948
     5        <rdar://problem/49927131>
     6
     7        Reviewed by Tim Horton.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:
     10        (TEST):
     11        The expected order of incoming events is
     12        1. didInvalidateIntrinsicContentSize
     13        2. didFirstLayout
     14        At setRenderingProgressDidChange, we already check if didInvalidateIntrinsicContentSize comes in first.
     15        However it's not guaranteed that the milestone event is delayed until after TestWebKitAPI::Util::run() is finished
     16        (and remember, all we care about is ordering).
     17
    1182019-04-24  Eric Carlson  <eric.carlson@apple.com>
    219
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm

    r244446 r244633  
    164164    // the intrinsic size change callback.
    165165    [webView _setShouldExpandContentToViewHeightForAutoLayout:YES];
    166     [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 100) resettingWidth:NO];
     166    [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 1000) resettingWidth:NO];
    167167    [webView evaluateJavaScript:@"window.innerHeight" completionHandler:^(id value, NSError *error) {
    168168        EXPECT_TRUE([value isKindOfClass:[NSNumber class]]);
     
    175175}
    176176
    177 TEST(WebKit, DISABLED_AutoLayoutRenderingProgressRelativeOrdering)
     177TEST(WebKit, AutoLayoutRenderingProgressRelativeOrdering)
    178178{
    179179    RetainPtr<AutoLayoutWKWebView> webView = adoptNS([[AutoLayoutWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 1000, 1000)]);
     
    200200    [webView loadHTMLString:@"<body style='margin: 0; height: 400px;'></body>" baseURL:nil];
    201201    TestWebKitAPI::Util::run(&didInvalidateIntrinsicContentSize);
    202     EXPECT_FALSE(didFirstLayout);
    203202    TestWebKitAPI::Util::run(&didFirstLayout);
    204203    TestWebKitAPI::Util::run(&didFinishNavigation);
Note: See TracChangeset for help on using the changeset viewer.