WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-217400-20201007143713.patch (text/plain), 10.45 KB, created by
Sihui Liu
on 2020-10-07 14:37:13 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2020-10-07 14:37:13 PDT
Size:
10.45 KB
patch
obsolete
>Subversion Revision: 268147 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d39184b96c80644a0ce9c005f6ece5b2b7f442d6..8a7bc19b8bd9d7af3cc3542942eb032c889ec5df 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2020-10-07 Sihui Liu <sihui_liu@apple.com> >+ >+ Adjust heuristic for checking whether view reaches visually non-empty state >+ https://bugs.webkit.org/show_bug.cgi?id=217400 >+ >+ Reviewed by Geoffrey Garen. >+ >+ We decide that view reaches visually non-empty state and fire corresponding events when main document is parsed >+ and no more content (font or css resources) is to be loaded. An edge case is when the page has an empty document >+ and depends on async scripts to fill content (like wpt.fyi), then we may fire the events too early. To mitigate >+ this issue, now we don't set the state if content is completely empty and there are scripts to be loaded. Also, >+ because lazily loading elements need rendering update to decide if they can be loaded, we should not wait for >+ scripts where there are such elements. >+ >+ API Test: WebKit.FirstVisuallyNonEmptyMilestoneWithDeferredScriptInEmptyDocument >+ >+ * page/FrameView.cpp: >+ (WebCore::FrameView::checkAndDispatchDidReachVisuallyNonEmptyState): >+ > 2020-10-07 Wenson Hsieh <wenson_hsieh@apple.com> > > [GPU Process] Support CanvasRenderingContext2D.drawImage() with HTMLVideoElement >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index aa0e21bfd9d476e3a4f5d2dba5342bfcbb897049..1898d4e1f7329cc2f9fa6c771c4cedd0776a49bd 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -4577,12 +4577,24 @@ void FrameView::checkAndDispatchDidReachVisuallyNonEmptyState() > return false; > > auto& resources = resourceLoader.allCachedResources(); >+ bool shouldWaitForScriptIfEmpty = false; >+#if ENABLE(INTERSECTION_OBSERVER) >+ shouldWaitForScriptIfEmpty = !document.numberOfIntersectionObservers(); >+#endif >+ bool isLoadingScript = false; > for (auto& resource : resources) { > if (resource.value->isLoaded()) > continue; >- if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::FontResource) >+ auto type = resource.value->type(); >+ if (type == CachedResource::Type::CSSStyleSheet || type == CachedResource::Type::FontResource) > return true; >+ if (type == CachedResource::Type::Script) >+ isLoadingScript = true; > } >+ >+ if (shouldWaitForScriptIfEmpty && !m_visuallyNonEmptyPixelCount && isLoadingScript) >+ return true; >+ > return false; > }; > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 085339557a540d07724951ab781f7c832dfe274d..aea2fcb6feea0d537f9dda518517f9e559096571 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,15 @@ >+2020-10-07 Sihui Liu <sihui_liu@apple.com> >+ >+ Adjust heuristic for checking whether view reaches visually non-empty state >+ https://bugs.webkit.org/show_bug.cgi?id=217400 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/FirstVisuallyNonEmptyMilestone.mm: >+ (-[RenderingProgressNavigationDelegate _webView:renderingProgressDidChange:]): >+ (TEST): >+ > 2020-10-07 Karl Rackler <rackler@apple.com> > > Unreviewed, reverting r268115. >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 5e00d4cf3d8cad5d50509a3dc1f4f774165c4676..a7c0cc70b77909b9179c4a53c14b06e7ed56ca60 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -795,6 +795,7 @@ > 9329AA291DE3F81E003ABD07 /* TextBreakIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9329AA281DE3F81E003ABD07 /* TextBreakIterator.cpp */; }; > 932AE53D1D371047005DFFAF /* focus-inputs.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93575C551D30366E000D604D /* focus-inputs.html */; }; > 933D631D1FCB76200032ECD6 /* Hasher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933D631B1FCB76180032ECD6 /* Hasher.cpp */; }; >+ 93494FFE252E66BA0099F171 /* deferred-script-load-in-empty-document.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93494FFD252E65440099F171 /* deferred-script-load-in-empty-document.html */; }; > 935786CC20F6A2700000CDFC /* IndexedDB.sqlite3-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 934FA5C520F69FED0040DC1B /* IndexedDB.sqlite3-wal */; }; > 935786CD20F6A2910000CDFC /* IndexedDB.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 934FA5C720F69FEE0040DC1B /* IndexedDB.sqlite3 */; }; > 935786CE20F6A2A10000CDFC /* IndexedDB.sqlite3-shm in Copy Resources */ = {isa = PBXBuildFile; fileRef = 934FA5C620F69FED0040DC1B /* IndexedDB.sqlite3-shm */; }; >@@ -1358,6 +1359,7 @@ > F486B1D01F67952300F34BDD /* DataTransfer-setDragImage.html in Copy Resources */, > F457A9D6202D68AF00F7E9D5 /* DataTransfer.html in Copy Resources */, > F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */, >+ 93494FFE252E66BA0099F171 /* deferred-script-load-in-empty-document.html in Copy Resources */, > 118153442208B7AC00B2CCD2 /* deferred-script-load.html in Copy Resources */, > 118153462208B7E500B2CCD2 /* deferred-script.js in Copy Resources */, > C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */, >@@ -2385,6 +2387,7 @@ > 9329AA281DE3F81E003ABD07 /* TextBreakIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIterator.cpp; sourceTree = "<group>"; }; > 9331407B17B4419000F083B1 /* DidNotHandleKeyDown.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DidNotHandleKeyDown.cpp; sourceTree = "<group>"; }; > 933D631B1FCB76180032ECD6 /* Hasher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Hasher.cpp; sourceTree = "<group>"; }; >+ 93494FFD252E65440099F171 /* deferred-script-load-in-empty-document.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "deferred-script-load-in-empty-document.html"; sourceTree = "<group>"; }; > 934FA5C520F69FED0040DC1B /* IndexedDB.sqlite3-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IndexedDB.sqlite3-wal"; sourceTree = "<group>"; }; > 934FA5C620F69FED0040DC1B /* IndexedDB.sqlite3-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IndexedDB.sqlite3-shm"; sourceTree = "<group>"; }; > 934FA5C720F69FEE0040DC1B /* IndexedDB.sqlite3 */ = {isa = PBXFileReference; lastKnownFileType = file; path = IndexedDB.sqlite3; sourceTree = "<group>"; }; >@@ -4276,6 +4279,7 @@ > 9B270FED1DDC25FD002D53F3 /* closed-shadow-tree-test.html */, > 5C9E56861DF9148E00C9EE33 /* contentBlockerCheck.html */, > 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */, >+ 93494FFD252E65440099F171 /* deferred-script-load-in-empty-document.html */, > 118153432208B7AC00B2CCD2 /* deferred-script-load.html */, > 118153452208B7E500B2CCD2 /* deferred-script.js */, > A14AAB641E78DC3F00C1ADC2 /* encrypted.pdf */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FirstVisuallyNonEmptyMilestone.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/FirstVisuallyNonEmptyMilestone.mm >index b420ab09bf2b88c4c93eefba3ecadc77c70f4ca4..d22738e65ef39f927b50d4bf88609334069b440d 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/FirstVisuallyNonEmptyMilestone.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/FirstVisuallyNonEmptyMilestone.mm >@@ -37,6 +37,7 @@ > > static bool didFirstVisuallyNonEmptyLayout; > static bool receivedMessage; >+static bool receivedMessageBeforeFirstVisuallyNonEmptyLayout; > > @interface FirstPaintMessageHandler : NSObject <WKScriptMessageHandler> > @end >@@ -54,8 +55,10 @@ static bool receivedMessage; > @implementation RenderingProgressNavigationDelegate > - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents > { >- if (progressEvents & _WKRenderingProgressEventFirstVisuallyNonEmptyLayout) >+ if (progressEvents & _WKRenderingProgressEventFirstVisuallyNonEmptyLayout) { >+ receivedMessageBeforeFirstVisuallyNonEmptyLayout = receivedMessage; > didFirstVisuallyNonEmptyLayout = true; >+ } > } > @end > >@@ -71,12 +74,36 @@ TEST(WebKit, FirstVisuallyNonEmptyMilestoneWithDeferredScript) > [webView setNavigationDelegate:delegate.get()]; > > receivedMessage = false; >+ receivedMessageBeforeFirstVisuallyNonEmptyLayout = false; > didFirstVisuallyNonEmptyLayout = false; > > [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"deferred-script-load" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; > > TestWebKitAPI::Util::run(&receivedMessage); > EXPECT_TRUE(didFirstVisuallyNonEmptyLayout); >+ EXPECT_FALSE(receivedMessageBeforeFirstVisuallyNonEmptyLayout); >+} >+ >+TEST(WebKit, FirstVisuallyNonEmptyMilestoneWithDeferredScriptInEmptyDocument) >+{ >+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto messageHandler = adoptNS([[FirstPaintMessageHandler alloc] init]); >+ [[webViewConfiguration userContentController] addScriptMessageHandler:messageHandler.get() name:@"firstpaint"]; >+ >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); >+ >+ RetainPtr<RenderingProgressNavigationDelegate> delegate = adoptNS([[RenderingProgressNavigationDelegate alloc] init]); >+ [webView setNavigationDelegate:delegate.get()]; >+ >+ receivedMessage = false; >+ receivedMessageBeforeFirstVisuallyNonEmptyLayout = false; >+ didFirstVisuallyNonEmptyLayout = false; >+ >+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"deferred-script-load-in-empty-document" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; >+ >+ TestWebKitAPI::Util::run(&didFirstVisuallyNonEmptyLayout); >+ EXPECT_TRUE(receivedMessage); >+ EXPECT_TRUE(receivedMessageBeforeFirstVisuallyNonEmptyLayout); > } > > @interface NeverFinishLoadingSchemeHandler : NSObject <WKURLSchemeHandler>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-feeder
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 217400
:
410677
|
410754
|
410781
|
410786
|
410849
|
412670