Title: [240565] branches/safari-607-branch
Revision
240565
Author
[email protected]
Date
2019-01-28 01:40:51 -0800 (Mon, 28 Jan 2019)

Log Message

Cherry-pick r240450. rdar://problem/47586830

    DidFirstVisuallyNonEmptyLayout milestone should always fire at some point.
    https://bugs.webkit.org/show_bug.cgi?id=193741
    <rdar://problem/47135030>

    Reviewed by Antti Koivisto and Simon Fraser.

    Source/WebCore:

    fireLayoutRelatedMilestonesIfNeeded() is part of the post-layout tasks. In certain cases when
        1. the received data is not "contentful" yet
        2. and we are expecting some more (loading is not complete yet)
        3. but no layout is initiated anymore
    nothing triggers the milestone firing.

    This patch ensures that we fire the DidFirstVisuallyNonEmptyLayout when the frame load is complete unless we already did.

    * page/FrameView.cpp:
    (WebCore::FrameView::FrameView):
    (WebCore::FrameView::loadProgressingStatusChanged):

    Tools:

    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp:
    (TestWebKitAPI::TEST):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240450 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (240564 => 240565)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-28 09:40:47 UTC (rev 240564)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-28 09:40:51 UTC (rev 240565)
@@ -1,3 +1,56 @@
+2019-01-28  Babak Shafiei  <[email protected]>
+
+        Cherry-pick r240450. rdar://problem/47586830
+
+    DidFirstVisuallyNonEmptyLayout milestone should always fire at some point.
+    https://bugs.webkit.org/show_bug.cgi?id=193741
+    <rdar://problem/47135030>
+    
+    Reviewed by Antti Koivisto and Simon Fraser.
+    
+    Source/WebCore:
+    
+    fireLayoutRelatedMilestonesIfNeeded() is part of the post-layout tasks. In certain cases when
+        1. the received data is not "contentful" yet
+        2. and we are expecting some more (loading is not complete yet)
+        3. but no layout is initiated anymore
+    nothing triggers the milestone firing.
+    
+    This patch ensures that we fire the DidFirstVisuallyNonEmptyLayout when the frame load is complete unless we already did.
+    
+    * page/FrameView.cpp:
+    (WebCore::FrameView::FrameView):
+    (WebCore::FrameView::loadProgressingStatusChanged):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-24  Zalan Bujtas  <[email protected]>
+
+            DidFirstVisuallyNonEmptyLayout milestone should always fire at some point.
+            https://bugs.webkit.org/show_bug.cgi?id=193741
+            <rdar://problem/47135030>
+
+            Reviewed by Antti Koivisto and Simon Fraser.
+
+            fireLayoutRelatedMilestonesIfNeeded() is part of the post-layout tasks. In certain cases when
+                1. the received data is not "contentful" yet
+                2. and we are expecting some more (loading is not complete yet)
+                3. but no layout is initiated anymore
+            nothing triggers the milestone firing.
+
+            This patch ensures that we fire the DidFirstVisuallyNonEmptyLayout when the frame load is complete unless we already did.
+
+            * page/FrameView.cpp:
+            (WebCore::FrameView::FrameView):
+            (WebCore::FrameView::loadProgressingStatusChanged):
+
 2019-01-19  Youenn Fablet  <[email protected]>
 
             Cherry-pick r240206. rdar://problem/47357218

Modified: branches/safari-607-branch/Source/WebCore/page/FrameView.cpp (240564 => 240565)


--- branches/safari-607-branch/Source/WebCore/page/FrameView.cpp	2019-01-28 09:40:47 UTC (rev 240564)
+++ branches/safari-607-branch/Source/WebCore/page/FrameView.cpp	2019-01-28 09:40:51 UTC (rev 240565)
@@ -2841,6 +2841,9 @@
 
 void FrameView::loadProgressingStatusChanged()
 {
+    auto hasPendingVisuallyNonEmptyCallback = m_firstVisuallyNonEmptyLayoutCallbackPending && !m_isVisuallyNonEmpty;
+    if (hasPendingVisuallyNonEmptyCallback && frame().loader().isComplete())
+        fireLayoutRelatedMilestonesIfNeeded();
     updateLayerFlushThrottling();
     adjustTiledBackingCoverage();
 }
@@ -5187,8 +5190,11 @@
             milestonesAchieved.add(DidRenderSignificantAmountOfText);
     }
 
-    if (milestonesAchieved && frame().isMainFrame())
+    if (milestonesAchieved && frame().isMainFrame()) {
+        if (milestonesAchieved.contains(DidFirstVisuallyNonEmptyLayout))
+            RELEASE_LOG_IF_ALLOWED("fireLayoutRelatedMilestonesIfNeeded() - firing first visually non-empty layout milestone on the main frame");
         frame().loader().didReachLayoutMilestone(milestonesAchieved);
+    }
 }
 
 void FrameView::firePaintRelatedMilestonesIfNeeded()

Modified: branches/safari-607-branch/Tools/ChangeLog (240564 => 240565)


--- branches/safari-607-branch/Tools/ChangeLog	2019-01-28 09:40:47 UTC (rev 240564)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-01-28 09:40:51 UTC (rev 240565)
@@ -1,5 +1,50 @@
 2019-01-28  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r240450. rdar://problem/47586830
+
+    DidFirstVisuallyNonEmptyLayout milestone should always fire at some point.
+    https://bugs.webkit.org/show_bug.cgi?id=193741
+    <rdar://problem/47135030>
+    
+    Reviewed by Antti Koivisto and Simon Fraser.
+    
+    Source/WebCore:
+    
+    fireLayoutRelatedMilestonesIfNeeded() is part of the post-layout tasks. In certain cases when
+        1. the received data is not "contentful" yet
+        2. and we are expecting some more (loading is not complete yet)
+        3. but no layout is initiated anymore
+    nothing triggers the milestone firing.
+    
+    This patch ensures that we fire the DidFirstVisuallyNonEmptyLayout when the frame load is complete unless we already did.
+    
+    * page/FrameView.cpp:
+    (WebCore::FrameView::FrameView):
+    (WebCore::FrameView::loadProgressingStatusChanged):
+    
+    Tools:
+    
+    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+    * TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp:
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-24  Zalan Bujtas  <[email protected]>
+
+            DidFirstVisuallyNonEmptyLayout milestone should always fire at some point.
+            https://bugs.webkit.org/show_bug.cgi?id=193741
+            <rdar://problem/47135030>
+
+            Reviewed by Antti Koivisto and Simon Fraser.
+
+            * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+            * TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp:
+            (TestWebKitAPI::TEST):
+
+2019-01-28  Babak Shafiei  <[email protected]>
+
         Cherry-pick r240443. rdar://problem/47586900
 
     [PSON] Flash on back navigation on Mac

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (240564 => 240565)


--- branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-01-28 09:40:47 UTC (rev 240564)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2019-01-28 09:40:51 UTC (rev 240565)
@@ -51,6 +51,7 @@
 		115EB3431EE0BA03003C2C0A /* ViewportSizeForViewportUnits.mm in Sources */ = {isa = PBXBuildFile; fileRef = 115EB3421EE0B720003C2C0A /* ViewportSizeForViewportUnits.mm */; };
 		1171B24F219F49CD00CB897D /* FirstMeaningfulPaintMilestone_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */; };
 		11B7FD28219F47110069B27F /* FirstMeaningfulPaintMilestone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */; };
+		11C2598D21FA6324004C9E23 /* async-script-load.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 11C2598C21FA618D004C9E23 /* async-script-load.html */; };
 		143DDE9820C9018B007F76FA /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 574F55D0204D471C002948C6 /* Security.framework */; };
 		1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
 		1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3524AC1D63A4FB0031729B /* Scope.cpp */; };
@@ -1000,6 +1001,7 @@
 				5C9E59421D3EB5AC00E3C62E /* ApplicationCache.db-shm in Copy Resources */,
 				5C9E59431D3EB5AC00E3C62E /* ApplicationCache.db-wal in Copy Resources */,
 				F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */,
+				11C2598D21FA6324004C9E23 /* async-script-load.html in Copy Resources */,
 				F4856CA31E649EA8009D7EE7 /* attachment-element.html in Copy Resources */,
 				B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */,
 				7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */,
@@ -1323,6 +1325,7 @@
 		115EB3421EE0B720003C2C0A /* ViewportSizeForViewportUnits.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewportSizeForViewportUnits.mm; sourceTree = "<group>"; };
 		11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FirstMeaningfulPaintMilestone_Bundle.cpp; sourceTree = "<group>"; };
 		11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FirstMeaningfulPaintMilestone.cpp; sourceTree = "<group>"; };
+		11C2598C21FA618D004C9E23 /* async-script-load.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "async-script-load.html"; sourceTree = "<group>"; };
 		14464012167A8305000BD218 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; };
 		14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SaturatedArithmeticOperations.cpp; sourceTree = "<group>"; };
 		1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
@@ -3264,6 +3267,7 @@
 				1C2B81851C89252300A5529F /* Ahem.ttf */,
 				93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */,
 				F6B7BE9617469B7E008A3445 /* associate-form-controls.html */,
+				11C2598C21FA618D004C9E23 /* async-script-load.html */,
 				C9C9A91A21DED24D00FDE96E /* audio-with-play-button.html */,
 				76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
 				C9C60E631E53A9BA006DA181 /* autoplay-check-frame.html */,

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp (240564 => 240565)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp	2019-01-28 09:40:47 UTC (rev 240564)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/LayoutMilestonesWithAllContentInFrame.cpp	2019-01-28 09:40:51 UTC (rev 240565)
@@ -117,6 +117,28 @@
     didNavigate = false;
 }
 
+TEST(WebKit, FirstVisuallyNonEmptyMilestoneWithLoadComplete)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreateWithConfiguration(nullptr));
+    PlatformWebView webView(context.get());
+
+    WKPageNavigationClientV3 loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+
+    loaderClient.base.version = 3;
+    loaderClient.base.clientInfo = &webView;
+    loaderClient.renderingProgressDidChange = renderingProgressDidChange;
+
+    WKPageSetPageNavigationClient(webView.page(), &loaderClient.base);
+    didFirstVisuallyNonEmptyLayout = false;
+
+    WKPageListenForLayoutMilestones(webView.page(), WKPageRenderingProgressEventFirstVisuallyNonEmptyLayout);
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("async-script-load", "html")).get());
+
+    Util::run(&didFirstVisuallyNonEmptyLayout);
+    EXPECT_TRUE(didFirstVisuallyNonEmptyLayout);
+}
+
 } // namespace TestWebKitAPI
 
 #endif

Added: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/async-script-load.html (0 => 240565)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/async-script-load.html	                        (rev 0)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKit/async-script-load.html	2019-01-28 09:40:51 UTC (rev 240565)
@@ -0,0 +1,16 @@
+<head>
+<style>
+@font-face {
+    font-family: 'FontAwesome';
+    src: url("font1.woff2") format("woff2");
+    font-weight: normal;
+    font-style: normal
+}
+
+.foobar {
+    font: normal normal normal 14px / 1 FontAwesome;
+}
+</style>
+</head>
+<body>foobar<script>document.body.offsetHeight</script>
+<script async="true" src=""
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to