Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style>
#pass { display:inline; width:200px; height:200px; background-color: green; position: absolute; }
</style>
<body>
<div id=pass>PASS: Non-matching slow stylesheet didn't delay visually non-empty.</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<style>
#pass { display:none; width:200px; height:200px; background-color: green; position: absolute; }
#fail { display:inline; width:200px; height:200px; background-color: red; position: absolute; }
</style>
<body>
<link rel="stylesheet" href="http://127.0.0.1:8000/local/slow-css-pass.cgi" media="not all" onload="this.media='all'">
<div id=pass></div>
<div id=fail></div>
<script>
function test() {
document.body.offsetLeft;

if (window.internals)
pass.textContent = internals.isVisuallyNonEmpty ? "PASS: Non-matching slow stylesheet didn't delay visually non-empty." : "FAIL: Non-matching slow media delayed visually non-empty.";
}

setTimeout(test);
</script>
3 changes: 3 additions & 0 deletions Source/WebCore/page/FrameView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5069,6 +5069,9 @@ void FrameView::checkAndDispatchDidReachVisuallyNonEmptyState()
for (auto& resource : resources) {
if (resource.value->isLoaded())
continue;
// ResourceLoadPriority::VeryLow is used for resources that are not needed to render.
if (resource.value->loadPriority() == ResourceLoadPriority::VeryLow)
continue;
if (resource.value->type() == CachedResource::Type::CSSStyleSheet || resource.value->type() == CachedResource::Type::FontResource)
return true;
}
Expand Down
10 changes: 10 additions & 0 deletions Source/WebCore/testing/Internals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7014,4 +7014,14 @@ Internals::SelectorFilterHashCounts Internals::selectorFilterHashCounts(const St
return { hashes.ids.size(), hashes.classes.size(), hashes.tags.size(), hashes.attributes.size() };
}

bool Internals::isVisuallyNonEmpty() const
{
auto* document = contextDocument();
if (!document || !document->frame())
return false;

auto* frameView = document->frame()->view();
return frameView && frameView->isVisuallyNonEmpty();
}

} // namespace WebCore
2 changes: 2 additions & 0 deletions Source/WebCore/testing/Internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ class Internals final : public RefCounted<Internals>, private ContextDestruction
};
SelectorFilterHashCounts selectorFilterHashCounts(const String& selector);

bool isVisuallyNonEmpty() const;

private:
explicit Internals(Document&);
Document* contextDocument() const;
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/testing/Internals.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1194,4 +1194,6 @@ typedef (FetchRequest or FetchResponse) FetchObject;
boolean consumeTransientActivation();

SelectorFilterHashCounts selectorFilterHashCounts(DOMString selector);

readonly attribute boolean isVisuallyNonEmpty;
};