Title: [259148] trunk/Source/WebCore
- Revision
- 259148
- Author
- [email protected]
- Date
- 2020-03-27 17:45:05 -0700 (Fri, 27 Mar 2020)
Log Message
REGRESSION (r256577): Previous page continues to display after navigating to media document
https://bugs.webkit.org/show_bug.cgi?id=209630
<rdar://problem/60609318>
Reviewed by Simon Fraser.
Add a way for non-HTML documents to signal visually non-empty state (for example when media document constructs the controls for the media content.)
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
* html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):
* page/FrameView.cpp:
(WebCore::FrameView::resetLayoutMilestones):
(WebCore::FrameView::checkAndDispatchDidReachVisuallyNonEmptyState):
* page/FrameView.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (259147 => 259148)
--- trunk/Source/WebCore/ChangeLog 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/ChangeLog 2020-03-28 00:45:05 UTC (rev 259148)
@@ -1,3 +1,24 @@
+2020-03-27 Zalan Bujtas <[email protected]>
+
+ REGRESSION (r256577): Previous page continues to display after navigating to media document
+ https://bugs.webkit.org/show_bug.cgi?id=209630
+ <rdar://problem/60609318>
+
+ Reviewed by Simon Fraser.
+
+ Add a way for non-HTML documents to signal visually non-empty state (for example when media document constructs the controls for the media content.)
+
+ * html/FTPDirectoryDocument.cpp:
+ (WebCore::FTPDirectoryDocumentParser::appendEntry):
+ * html/MediaDocument.cpp:
+ (WebCore::MediaDocumentParser::createDocumentStructure):
+ * html/PluginDocument.cpp:
+ (WebCore::PluginDocumentParser::createDocumentStructure):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::resetLayoutMilestones):
+ (WebCore::FrameView::checkAndDispatchDidReachVisuallyNonEmptyState):
+ * page/FrameView.h:
+
2020-03-27 Simon Fraser <[email protected]>
Change SVGRenderingContext::renderSubtreeToImageBuffer() to SVGRenderingContext::renderSubtreeToContext()
Modified: trunk/Source/WebCore/dom/Document.h (259147 => 259148)
--- trunk/Source/WebCore/dom/Document.h 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/dom/Document.h 2020-03-28 00:45:05 UTC (rev 259148)
@@ -1567,6 +1567,9 @@
LazyLoadImageObserver& lazyLoadImageObserver();
+ void setHasVisuallyNonEmptyCustomContent() { m_hasVisuallyNonEmptyCustomContent = true; }
+ bool hasVisuallyNonEmptyCustomContent() const { return m_hasVisuallyNonEmptyCustomContent; }
+
protected:
enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
@@ -2089,6 +2092,7 @@
#if ENABLE(APPLE_PAY)
bool m_hasStartedApplePaySession { false };
#endif
+ bool m_hasVisuallyNonEmptyCustomContent { false };
Ref<UndoManager> m_undoManager;
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/html/FTPDirectoryDocument.cpp (259147 => 259148)
--- trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/html/FTPDirectoryDocument.cpp 2020-03-28 00:45:05 UTC (rev 259148)
@@ -135,6 +135,7 @@
sizeElement->appendChild(Text::create(document, size));
sizeElement->setAttributeWithoutSynchronization(HTMLNames::classAttr, AtomString("ftpDirectoryFileSize", AtomString::ConstructFromLiteral));
rowElement->appendChild(sizeElement);
+ document.setHasVisuallyNonEmptyCustomContent();
}
Ref<Element> FTPDirectoryDocumentParser::createTDForFilename(const String& filename)
Modified: trunk/Source/WebCore/html/MediaDocument.cpp (259147 => 259148)
--- trunk/Source/WebCore/html/MediaDocument.cpp 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/html/MediaDocument.cpp 2020-03-28 00:45:05 UTC (rev 259148)
@@ -126,6 +126,7 @@
}
body->appendChild(videoElement);
+ document.setHasVisuallyNonEmptyCustomContent();
RefPtr<Frame> frame = document.frame();
if (!frame)
Modified: trunk/Source/WebCore/html/PluginDocument.cpp (259147 => 259148)
--- trunk/Source/WebCore/html/PluginDocument.cpp 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/html/PluginDocument.cpp 2020-03-28 00:45:05 UTC (rev 259148)
@@ -108,6 +108,7 @@
document.setPluginElement(*m_embedElement);
body->appendChild(embedElement);
+ document.setHasVisuallyNonEmptyCustomContent();
}
void PluginDocumentParser::appendBytes(DocumentWriter&, const char*, size_t)
Modified: trunk/Source/WebCore/page/FrameView.cpp (259147 => 259148)
--- trunk/Source/WebCore/page/FrameView.cpp 2020-03-27 23:51:09 UTC (rev 259147)
+++ trunk/Source/WebCore/page/FrameView.cpp 2020-03-28 00:45:05 UTC (rev 259148)
@@ -4378,15 +4378,19 @@
{
auto qualifiesAsVisuallyNonEmpty = [&] {
// No content yet.
- Element* documentElement = frame().document()->documentElement();
+ auto& document = *frame().document();
+ auto* documentElement = document.documentElement();
if (!documentElement || !documentElement->renderer())
return false;
+ if (document.hasVisuallyNonEmptyCustomContent())
+ return true;
+
// FIXME: We should also ignore renderers with non-final style.
- if (frame().document()->styleScope().hasPendingSheetsBeforeBody())
+ if (document.styleScope().hasPendingSheetsBeforeBody())
return false;
- auto finishedParsingMainDocument = frame().loader().stateMachine().committedFirstRealDocumentLoad() && (frame().document()->readyState() == Document::Interactive || frame().document()->readyState() == Document::Complete);
+ auto finishedParsingMainDocument = frame().loader().stateMachine().committedFirstRealDocumentLoad() && (document.readyState() == Document::Interactive || document.readyState() == Document::Complete);
// Ensure that we always fire visually non-empty milestone eventually.
if (finishedParsingMainDocument && frame().loader().isComplete())
return true;
@@ -4402,7 +4406,7 @@
if (!isVisible(documentElement))
return false;
- if (!isVisible(frame().document()->body()))
+ if (!isVisible(document.body()))
return false;
// The first few hundred characters rarely contain the interesting content of the page.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes