Add DidFirstMeaningfulPaint milestone.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2018 22:54:21 +0000 (22:54 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2018 22:54:21 +0000 (22:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191754

Reviewed by Simon Fraser.

Source/WebCore:

This milestone fires sone after the paint triggered by the first visually non-empty layout.

* page/FrameView.cpp:
(WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
(WebCore::FrameView::firePaintRelatedMilestonesIfNeeded):
* page/LayoutMilestone.h:

Source/WebKit:

* Shared/API/c/WKPageLoadTypes.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestones):
(WebKit::toLayoutMilestones):
* UIProcess/API/C/WKPageRenderingProgressEvents.h:
* UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
(pageRenderingProgressEvents):

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp: Added.
(TestWebKitAPI::didReachMilestone):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp: Copied from Source/WebKit/UIProcess/API/C/WKPageRenderingProgressEvents.h.
(TestWebKitAPI::FirstMeaningfulPaintMilestoneTest::FirstMeaningfulPaintMilestoneTest):
(TestWebKitAPI::FirstMeaningfulPaintMilestoneTest::didCreatePage):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/LayoutMilestone.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/API/Cocoa/_WKRenderingProgressEvents.h
Source/WebKit/Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h
Source/WebKit/Shared/API/c/WKPageLoadTypes.h
Source/WebKit/Shared/API/c/WKSharedAPICast.h
Source/WebKit/UIProcess/API/C/WKPageRenderingProgressEvents.h
Source/WebKit/UIProcess/API/C/WKPageRenderingProgressEventsInternal.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp [new file with mode: 0644]

index f4b47d2..04955a7 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-16  Zalan Bujtas  <zalan@apple.com>
+
+        Add DidFirstMeaningfulPaint milestone.
+        https://bugs.webkit.org/show_bug.cgi?id=191754
+
+        Reviewed by Simon Fraser.
+
+        This milestone fires sone after the paint triggered by the first visually non-empty layout.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
+        (WebCore::FrameView::firePaintRelatedMilestonesIfNeeded):
+        * page/LayoutMilestone.h:
+
 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
 
         Provide default implementations of Image and Icon
index ec09e00..39110a6 100644 (file)
@@ -5173,6 +5173,8 @@ void FrameView::fireLayoutRelatedMilestonesIfNeeded()
     // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
     if (m_isVisuallyNonEmpty && m_firstVisuallyNonEmptyLayoutCallbackPending) {
         m_firstVisuallyNonEmptyLayoutCallbackPending = false;
+        addPaintPendingMilestones(DidFirstMeaningfulPaint);
+
         if (requestedMilestones & DidFirstVisuallyNonEmptyLayout)
             milestonesAchieved.add(DidFirstVisuallyNonEmptyLayout);
     }
@@ -5206,6 +5208,11 @@ void FrameView::firePaintRelatedMilestonesIfNeeded()
             milestonesAchieved.add(DidFirstPaintAfterSuppressedIncrementalRendering);
     }
 
+    if (m_milestonesPendingPaint & DidFirstMeaningfulPaint) {
+        if (page->requestedLayoutMilestones() & DidFirstMeaningfulPaint)
+            milestonesAchieved.add(DidFirstMeaningfulPaint);
+    }
+
     m_milestonesPendingPaint = { };
 
     if (milestonesAchieved)
index fa0eeca..8a7c67e 100644 (file)
@@ -41,6 +41,7 @@ enum LayoutMilestone {
     DidFirstPaintAfterSuppressedIncrementalRendering    = 1 << 5,
     ReachedSessionRestorationRenderTreeSizeThreshold    = 1 << 6, // FIXME: only implemented by WK2 currently.
     DidRenderSignificantAmountOfText                    = 1 << 7,
+    DidFirstMeaningfulPaint                             = 1 << 8,
 };
 
 } // namespace WebCore
index 71838bd..db81413 100644 (file)
@@ -1,3 +1,18 @@
+2018-11-16  Zalan Bujtas  <zalan@apple.com>
+
+        Add DidFirstMeaningfulPaint milestone.
+        https://bugs.webkit.org/show_bug.cgi?id=191754
+
+        Reviewed by Simon Fraser.
+
+        * Shared/API/c/WKPageLoadTypes.h:
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toWKLayoutMilestones):
+        (WebKit::toLayoutMilestones):
+        * UIProcess/API/C/WKPageRenderingProgressEvents.h:
+        * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
+        (pageRenderingProgressEvents):
+
 2018-11-16  Chris Dumez  <cdumez@apple.com>
 
         Automatic process prewarming should be turned on if PSON is enabled via experimental features
index 4aa5aca..7935974 100644 (file)
@@ -36,6 +36,7 @@ typedef NS_OPTIONS(NSUInteger, _WKRenderingProgressEvents) {
     _WKRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering WK_API_AVAILABLE(macosx(10.11), ios(9.0)) = 1 << 5,
     _WKRenderingProgressEventFirstPaint WK_API_AVAILABLE(macosx(10.11), ios(9.0)) = 1 << 6,
     _WKRenderingProgressEventDidRenderSignificantAmountOfText WK_API_AVAILABLE(macosx(10.14), ios(12.0)) = 1 << 7,
+    _WKRenderingProgressEventFirstMeaningfulPaint WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)) = 1 << 8,
 } WK_API_AVAILABLE(macosx(10.10), ios(8.0));
 
 #endif
index 582245c..2169df8 100644 (file)
@@ -54,6 +54,9 @@ static inline _WKRenderingProgressEvents renderingProgressEvents(OptionSet<WebCo
     if (milestones & WebCore::DidRenderSignificantAmountOfText)
         events |= _WKRenderingProgressEventDidRenderSignificantAmountOfText;
 
+    if (milestones & WebCore::DidFirstMeaningfulPaint)
+        events |= _WKRenderingProgressEventFirstMeaningfulPaint;
+
     return events;
 }
 
index 860a646..cef6e68 100644 (file)
@@ -57,7 +57,8 @@ enum {
     kWKReserved = 1 << 3, // Note that the fourth member of this enum is actually private and defined in WKPageLoadTypesPrivate.h
     kWKDidFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
     kWKDidFirstPaintAfterSuppressedIncrementalRendering = 1 << 5,
-    kWKDidRenderSignificantAmountOfText = 1 << 7
+    kWKDidRenderSignificantAmountOfText = 1 << 7,
+    kWKDidFirstMeaningfulPaint = 1 << 8
 };
 typedef uint32_t WKLayoutMilestones;
 
index 677791d..06f9744 100644 (file)
@@ -877,7 +877,9 @@ inline WKLayoutMilestones toWKLayoutMilestones(OptionSet<WebCore::LayoutMileston
         wkMilestones |= kWKDidFirstPaintAfterSuppressedIncrementalRendering;
     if (milestones & WebCore::DidRenderSignificantAmountOfText)
         wkMilestones |= kWKDidRenderSignificantAmountOfText;
-    
+    if (milestones & WebCore::DidFirstMeaningfulPaint)
+        wkMilestones |= kWKDidFirstMeaningfulPaint;
+
     return wkMilestones;
 }
 
@@ -899,6 +901,8 @@ inline OptionSet<WebCore::LayoutMilestone> toLayoutMilestones(WKLayoutMilestones
         milestones.add(WebCore::DidFirstPaintAfterSuppressedIncrementalRendering);
     if (wkMilestones & kWKDidRenderSignificantAmountOfText)
         milestones.add(WebCore::DidRenderSignificantAmountOfText);
+    if (wkMilestones & kWKDidFirstMeaningfulPaint)
+        milestones.add(WebCore::DidFirstMeaningfulPaint);
     
     return milestones;
 }
index 3de2de5..ba9b33b 100644 (file)
@@ -39,6 +39,7 @@ enum {
     WKPageRenderingProgressEventReachedSessionRestorationRenderTreeSizeThreshold = 1 << 3,
     WKPageRenderingProgressEventFirstLayoutAfterSuppressedIncrementalRendering = 1 << 4,
     WKPageRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering = 1 << 5,
+    WKPageRenderingProgressEventFirstMeaningfulPaint = 1 << 8
 };
 typedef uint32_t WKPageRenderingProgressEvents;
 
index 264ddcd..cf77115 100644 (file)
@@ -49,5 +49,8 @@ static inline WKPageRenderingProgressEvents pageRenderingProgressEvents(OptionSe
     if (milestones & WebCore::DidFirstPaintAfterSuppressedIncrementalRendering)
         events |= WKPageRenderingProgressEventFirstPaintAfterSuppressedIncrementalRendering;
 
+    if (milestones & WebCore::DidFirstMeaningfulPaint)
+        events |= WKPageRenderingProgressEventFirstMeaningfulPaint;
+
     return events;
 }
index ba6f8ce..3c56b6e 100644 (file)
@@ -4842,6 +4842,9 @@ static inline OptionSet<WebCore::LayoutMilestone> layoutMilestones(_WKRenderingP
     if (events & _WKRenderingProgressEventDidRenderSignificantAmountOfText)
         milestones.add(WebCore::DidRenderSignificantAmountOfText);
 
+    if (events & _WKRenderingProgressEventFirstMeaningfulPaint)
+        milestones.add(WebCore::DidFirstMeaningfulPaint);
+
     return milestones;
 }
 
index 7af572c..ca8649a 100644 (file)
@@ -1,3 +1,20 @@
+2018-11-16  Zalan Bujtas  <zalan@apple.com>
+
+        Add DidFirstMeaningfulPaint milestone.
+        https://bugs.webkit.org/show_bug.cgi?id=191754
+
+        Reviewed by Simon Fraser.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp: Added.
+        (TestWebKitAPI::didReachMilestone):
+        (TestWebKitAPI::setPageLoaderClient):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp: Copied from Source/WebKit/UIProcess/API/C/WKPageRenderingProgressEvents.h.
+        (TestWebKitAPI::FirstMeaningfulPaintMilestoneTest::FirstMeaningfulPaintMilestoneTest):
+        (TestWebKitAPI::FirstMeaningfulPaintMilestoneTest::didCreatePage):
+
 2018-11-16  Takashi Komori  <Takashi.Komori@sony.com>
 
         [WinCairo][WebKitTestRunner] Test contents window is displayed while testing.
index 49f0a8c..0f32558 100644 (file)
@@ -45,6 +45,7 @@ if (ENABLE_WEBKIT)
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/EvaluateJavaScript.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FailedLoad.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/Find.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ForceRepaint.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FrameMIMETypeHTML.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FrameMIMETypePNG.cpp
@@ -230,6 +231,7 @@ if (ENABLE_WEBKIT)
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ParentFrame_Bundle.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ProvisionalURLAfterWillSendRequestCallback_Bundle.cpp
         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
index 1690dca..de3d855 100644 (file)
@@ -48,6 +48,8 @@
                0F5651F71FCE4DDC00310FBC /* NoHistoryItemScrollToFragment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F5651F61FCE4DDB00310FBC /* NoHistoryItemScrollToFragment.mm */; };
                0F5651F91FCE513500310FBC /* scroll-to-anchor.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 0F5651F81FCE50E800310FBC /* scroll-to-anchor.html */; };
                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 */; };
                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 */; };
                7CCE7EDB1A411A9200447C4C /* CSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5451E919E41F9D0016936F /* CSSParser.cpp */; };
                7CCE7EDC1A411A9200447C4C /* CalculationValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93A720E518F1A0E800A848E1 /* CalculationValue.cpp */; };
                7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDC2C7141797089D00E627FB /* TimeRanges.cpp */; };
-               CD51C2A93E78B5C1FF337C08 /* AbortableTaskQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF510632A19B8AC7EC40E17 /* AbortableTaskQueue.cpp */; };
                7CCE7EDE1A411A9200447C4C /* URL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 440A1D3814A0103A008A66F2 /* URL.cpp */; };
                7CCE7EDF1A411A9200447C4C /* LayoutUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14464012167A8305000BD218 /* LayoutUnit.cpp */; };
                7CCE7EE01A411A9A00447C4C /* EditorCommands.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCAA485714A044D40088FAC4 /* EditorCommands.mm */; };
                0FEAE3671B7D19CB00CE17F2 /* Condition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Condition.cpp; sourceTree = "<group>"; };
                0FFC45A41B73EBE20085BD62 /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lock.cpp; sourceTree = "<group>"; };
                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>"; };
                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>"; };
                A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WindowlessWebViewWithMedia.html; sourceTree = "<group>"; };
                A5E2027215B2181900C13E14 /* WindowlessWebViewWithMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowlessWebViewWithMedia.mm; sourceTree = "<group>"; };
                A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
+               ABF510632A19B8AC7EC40E17 /* AbortableTaskQueue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AbortableTaskQueue.cpp; sourceTree = "<group>"; };
                AD57AC1D1DA7463800FF1BDE /* many-iframes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "many-iframes.html"; sourceTree = "<group>"; };
                AD57AC1E1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp; sourceTree = "<group>"; };
                AD57AC1F1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DidRemoveFrameFromHiearchyInPageCache.cpp; sourceTree = "<group>"; };
                CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenZoomInitialFrame.html; sourceTree = "<group>"; };
                CDBFCC431A9FF44800A7B691 /* FullscreenZoomInitialFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenZoomInitialFrame.mm; sourceTree = "<group>"; };
                CDC2C7141797089D00E627FB /* TimeRanges.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TimeRanges.cpp; sourceTree = "<group>"; };
-               ABF510632A19B8AC7EC40E17 /* AbortableTaskQueue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AbortableTaskQueue.cpp; sourceTree = "<group>"; };
                CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AudioSessionCategoryIOS.mm; sourceTree = "<group>"; };
                CDC8E4891BC5C96200594FEC /* video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "video-with-audio.html"; sourceTree = "<group>"; };
                CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "video-with-audio.mp4"; sourceTree = "<group>"; };
                                BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
                                1A02C84E125D4A8400E3F4BD /* Find.cpp */,
                                C51AFB98169F49FF009CCF66 /* FindMatches.mm */,
+                               11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */,
+                               11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */,
                                1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */,
                                376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */,
                                BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
                                7CCE7EF31A411AE600447C4C /* Find.cpp in Sources */,
                                7C83E0BB1D0A650000FEBCF3 /* FindInPage.mm in Sources */,
                                7CCE7EF41A411AE600447C4C /* FindMatches.mm in Sources */,
+                               11B7FD28219F47110069B27F /* FirstMeaningfulPaintMilestone.cpp in Sources */,
                                7C83E0401D0A63E300FEBCF3 /* FirstResponderScrollingPosition.mm in Sources */,
                                C9E6DD351EA97D0800DD78AA /* FirstResponderSuppression.mm in Sources */,
                                7C83E0BC1D0A650700FEBCF3 /* FixedLayoutSize.mm in Sources */,
                                5CAE463820193B6A0051610F /* NetworkProcessCrashNonPersistentDataStore.mm in Sources */,
                                9B19CDA01F06DFE3000548DD /* NetworkProcessCrashWithPendingConnection.mm in Sources */,
                                7CCE7F021A411AE600447C4C /* NewFirstVisuallyNonEmptyLayout.cpp in Sources */,
-                               3781746D2198AE4600062C26 /* WKProcessPoolConfiguration.mm in Sources */,
                                7CCE7F031A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFails.cpp in Sources */,
                                7CCE7F041A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */,
                                7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
                                2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
                                2D21FE591F04642900B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm in Sources */,
                                7CCE7F211A411AE600447C4C /* WKPreferences.cpp in Sources */,
+                               3781746D2198AE4600062C26 /* WKProcessPoolConfiguration.mm in Sources */,
                                44817A2F1F0486BF00003810 /* WKRequestActivatedElementInfo.mm in Sources */,
                                7C83E0B51D0A649300FEBCF3 /* WKRetainPtr.cpp in Sources */,
                                5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate.mm in Sources */,
                                BCB68042126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp in Sources */,
                                51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */,
                                F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */,
+                               1171B24F219F49CD00CB897D /* FirstMeaningfulPaintMilestone_Bundle.cpp in Sources */,
                                C0C5D3C61459912900A802A6 /* GetBackingScaleFactor_Bundle.mm in Sources */,
                                F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */,
                                4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp b/Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone.cpp
new file mode 100644 (file)
index 0000000..83207ea
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit/WKContextPrivate.h>
+
+namespace TestWebKitAPI {
+
+static bool didUnlockFistMeaningfulPaintMilestone = false;
+
+static void didReachMilestone(WKPageRef, WKPageRenderingProgressEvents type, WKTypeRef, const void *)
+{
+    if (type & kWKDidFirstMeaningfulPaint)
+        didUnlockFistMeaningfulPaintMilestone = true;
+}
+
+static void setPageLoaderClient(WKPageRef page)
+{
+    WKPageNavigationClientV3 loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+
+    loaderClient.base.version = 3;
+    loaderClient.renderingProgressDidChange = didReachMilestone;
+
+    WKPageSetPageNavigationClient(page, &loaderClient.base);
+}
+
+TEST(WebKit, FirstMeaningfulPaint)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("FirstMeaningfulPaintMilestoneTest"));
+
+    PlatformWebView webView(context.get());
+    setPageLoaderClient(webView.page());
+
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-text", "html")).get());
+
+    Util::run(&didUnlockFistMeaningfulPaintMilestone);
+    EXPECT_TRUE(didUnlockFistMeaningfulPaintMilestone);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
diff --git a/Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp b/Tools/TestWebKitAPI/Tests/WebKit/FirstMeaningfulPaintMilestone_Bundle.cpp
new file mode 100644 (file)
index 0000000..ffbf7ea
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "InjectedBundleTest.h"
+
+#include "PlatformUtilities.h"
+#include <WebKit/WKBundlePage.h>
+#include <WebKit/WKBundlePagePrivate.h>
+
+namespace TestWebKitAPI {
+
+class FirstMeaningfulPaintMilestoneTest : public InjectedBundleTest {
+public:
+    FirstMeaningfulPaintMilestoneTest(const std::string& identifier)
+        : InjectedBundleTest(identifier)
+    {
+    }
+
+    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+    {
+        WKBundlePageListenForLayoutMilestones(page, kWKDidFirstMeaningfulPaint);
+    }
+    
+};
+
+static InjectedBundleTest::Register<FirstMeaningfulPaintMilestoneTest> registrar("FirstMeaningfulPaintMilestoneTest");
+
+} // namespace TestWebKitAPI
+
+#endif