Changeset 240942 in webkit


Ignore:
Timestamp:
Feb 4, 2019 2:19:41 PM (5 years ago)
Author:
Alan Bujtas
Message:

[First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
https://bugs.webkit.org/show_bug.cgi?id=194168

Reviewed by Simon Fraser.

Source/WebCore:

First paint should not be blocked by async or deferred scripts.

  • page/FrameView.cpp:

(WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):

Tools:

Test if the firstVisuallyNoneEmpty milestone fires before the deferred script's post-message.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit/FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm: Added.

(-[FirstPaintMessageHandler userContentController:didReceiveScriptMessage:]):
(-[RenderingProgressNavigationDelegate _webView:renderingProgressDidChange:]):
(TEST):

  • TestWebKitAPI/Tests/WebKit/deferred-script-load.html: Added.
  • TestWebKitAPI/Tests/WebKit/deferred-script.js: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240941 r240942  
     12019-02-04  Zalan Bujtas  <zalan@apple.com>
     2
     3        [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=194168
     5
     6        Reviewed by Simon Fraser.
     7
     8        First paint should not be blocked by async or deferred scripts.
     9
     10        * page/FrameView.cpp:
     11        (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
     12
    1132019-02-04  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebCore/page/FrameView.cpp

    r240940 r240942  
    44474447        return false;
    44484448
    4449     auto finishedParsingMainDocument = frame().loader().stateMachine().committedFirstRealDocumentLoad() && !frame().document()->parsing();
     4449    auto finishedParsingMainDocument = frame().loader().stateMachine().committedFirstRealDocumentLoad() && (frame().document()->readyState() == Document::Interactive || frame().document()->readyState() == Document::Complete);
    44504450    // Ensure that we always fire visually non-empty milestone eventually.
    44514451    if (finishedParsingMainDocument && frame().loader().isComplete())
     
    44784478
    44794479    auto isMoreContentExpected = [&]() {
    4480         // Pending css/javascript/font loading/processing means we should wait a little longer.
    4481         auto hasPendingScriptExecution = frame().document()->scriptRunner().hasPendingScripts();
    4482         if (hasPendingScriptExecution)
    4483             return true;
    4484 
     4480        ASSERT(finishedParsingMainDocument);
     4481        // Pending css/font loading means we should wait a little longer. Classic non-async, non-defer scripts are all processed by now.
    44854482        auto* documentLoader = frame().loader().documentLoader();
    44864483        if (!documentLoader)
     
    44954492            if (resource.value->isLoaded())
    44964493                continue;
    4497             if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::Script || resource.value->type() == CachedResource::Type::FontResource)
     4494            if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::FontResource)
    44984495                return true;
    44994496        }
  • trunk/Tools/ChangeLog

    r240936 r240942  
     12019-02-04  Zalan Bujtas  <zalan@apple.com>
     2
     3        [First paint] Adjust "finishedParsingMainDocument" flag by taking deferred and async scripts into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=194168
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test if the firstVisuallyNoneEmpty milestone fires before the deferred script's post-message.
     9
     10        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     11        * TestWebKitAPI/Tests/WebKit/FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm: Added.
     12        (-[FirstPaintMessageHandler userContentController:didReceiveScriptMessage:]):
     13        (-[RenderingProgressNavigationDelegate _webView:renderingProgressDidChange:]):
     14        (TEST):
     15        * TestWebKitAPI/Tests/WebKit/deferred-script-load.html: Added.
     16        * TestWebKitAPI/Tests/WebKit/deferred-script.js: Added.
     17
    1182019-02-04  Dean Johnson  <dean_johnson@apple.com>
    219
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r240667 r240942  
    5151                115EB3431EE0BA03003C2C0A /* ViewportSizeForViewportUnits.mm in Sources */ = {isa = PBXBuildFile; fileRef = 115EB3421EE0B720003C2C0A /* ViewportSizeForViewportUnits.mm */; };
    5252                1171B24F219F49CD00CB897D /* FirstMeaningfulPaintMilestone_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */; };
     53                118153442208B7AC00B2CCD2 /* deferred-script-load.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 118153432208B7AC00B2CCD2 /* deferred-script-load.html */; };
     54                118153462208B7E500B2CCD2 /* deferred-script.js in Copy Resources */ = {isa = PBXBuildFile; fileRef = 118153452208B7E500B2CCD2 /* deferred-script.js */; };
     55                118153482208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = 118153472208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm */; };
    5356                11B7FD28219F47110069B27F /* FirstMeaningfulPaintMilestone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */; };
    5457                11C2598D21FA6324004C9E23 /* async-script-load.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 11C2598C21FA618D004C9E23 /* async-script-load.html */; };
     
    10591062                                F457A9D6202D68AF00F7E9D5 /* DataTransfer.html in Copy Resources */,
    10601063                                F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */,
     1064                                118153442208B7AC00B2CCD2 /* deferred-script-load.html in Copy Resources */,
     1065                                118153462208B7E500B2CCD2 /* deferred-script.js in Copy Resources */,
    10611066                                C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
    10621067                                0799C34B1EBA3301003B7532 /* disableGetUserMedia.html in Copy Resources */,
     
    13301335                0FFC45A41B73EBE20085BD62 /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Lock.cpp; sourceTree = "<group>"; };
    13311336                115EB3421EE0B720003C2C0A /* ViewportSizeForViewportUnits.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewportSizeForViewportUnits.mm; sourceTree = "<group>"; };
     1337                118153432208B7AC00B2CCD2 /* deferred-script-load.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "deferred-script-load.html"; sourceTree = "<group>"; };
     1338                118153452208B7E500B2CCD2 /* deferred-script.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "deferred-script.js"; sourceTree = "<group>"; };
     1339                118153472208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm; sourceTree = "<group>"; };
    13321340                11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FirstMeaningfulPaintMilestone_Bundle.cpp; sourceTree = "<group>"; };
    13331341                11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FirstMeaningfulPaintMilestone.cpp; sourceTree = "<group>"; };
     
    25142522                                4612C2B8210A6ABF00B788A6 /* LoadFileThenReload.mm */,
    25152523                                57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */,
    2516                                 5774AA6721FBBF7800AF2A1B /* TestLoadOptimizer.mm */,
    25172524                                51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */,
    25182525                                CA38459520AE012E00990D3B /* LocalStorageDatabaseTracker.mm */,
     
    25752582                                1C734B5220788C4800F430EA /* SystemColors.mm */,
    25762583                                2D70059521EDA0C6003463CB /* TabOutOfWebView.mm */,
     2584                                5774AA6721FBBF7800AF2A1B /* TestLoadOptimizer.mm */,
    25772585                                F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */,
    25782586                                F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */,
     
    30883096                                11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */,
    30893097                                11B7FD21219F46DD0069B27F /* FirstMeaningfulPaintMilestone_Bundle.cpp */,
     3098                                118153472208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm */,
    30903099                                1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */,
    30913100                                376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */,
     
    32993308                                5C9E56861DF9148E00C9EE33 /* contentBlockerCheck.html */,
    33003309                                290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */,
     3310                                118153432208B7AC00B2CCD2 /* deferred-script-load.html */,
     3311                                118153452208B7E500B2CCD2 /* deferred-script.js */,
    33013312                                A14AAB641E78DC3F00C1ADC2 /* encrypted.pdf */,
    33023313                                07492B391DF8ADA400633DE1 /* enumerateMediaDevices.html */,
     
    40204031                                7C83E0401D0A63E300FEBCF3 /* FirstResponderScrollingPosition.mm in Sources */,
    40214032                                C9E6DD351EA97D0800DD78AA /* FirstResponderSuppression.mm in Sources */,
     4033                                118153482208BADF00B2CCD2 /* FirstVisuallyNonEmptyMilestoneWithDeferredScript.mm in Sources */,
    40224034                                7C83E0BC1D0A650700FEBCF3 /* FixedLayoutSize.mm in Sources */,
    40234035                                7A909A7E1D877480007E10F8 /* FloatPoint.cpp in Sources */,
     
    42424254                                F45E15762112CE6200307E82 /* TestInputDelegate.mm in Sources */,
    42434255                                F45D3891215A7B4B002A2979 /* TestInspectorBar.mm in Sources */,
     4256                                5774AA6821FBBF7800AF2A1B /* TestLoadOptimizer.mm in Sources */,
    42444257                                2D1C04A71D76298B000A6816 /* TestNavigationDelegate.mm in Sources */,
    42454258                                A14FC5901B8AE36F00D107EB /* TestProtocol.mm in Sources */,
     
    42604273                                7CCE7F2D1A411B1000447C4C /* UserContentTest.mm in Sources */,
    42614274                                7C882E0A1C80C764006BF731 /* UserContentWorld.mm in Sources */,
    4262                                 5774AA6821FBBF7800AF2A1B /* TestLoadOptimizer.mm in Sources */,
    42634275                                7CCB99211D3B41F6003922F6 /* UserInitiatedActionInNavigationAction.mm in Sources */,
    42644276                                7CCE7F171A411AE600447C4C /* UserMedia.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.