From ad2ddb39c1e3a9021e19ef045077554c8ab83d76 Mon Sep 17 00:00:00 2001 From: hyatt Date: Thu, 5 May 2005 18:35:22 +0000 Subject: [PATCH] Fix for 4109667, sIFR flash replacement technique often malfunctions. This bug occurs when the plugin widget update causes the onload for the document to fire. Because you can be in the middle of a style recalc when doing an attach (in response to a stylesheet load), the onload fires in the middle of the attach process when the tree is in a bogus state. The fix is to add a bit to the document that tells style recalc that the implicitClose() method was invoked during the style recalc process and the code has been patched so that when this situation occurs, the close is deferred until after the style recalc has finished. Reviewed by John Sullivan * khtml/xml/dom_docimpl.cpp: (DocumentImpl::DocumentImpl): (DocumentImpl::recalcStyle): (DocumentImpl::implicitClose): * khtml/xml/dom_docimpl.h: * layout-tests/fast/dynamic/flash-replacement-test.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9126 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- .../fast/dynamic/flash-replacement-test.html | 39 +++++++++++++++++++ WebCore/ChangeLog-2005-08-23 | 20 ++++++++++ WebCore/khtml/xml/dom_docimpl.cpp | 13 +++++++ WebCore/khtml/xml/dom_docimpl.h | 1 + 4 files changed, 73 insertions(+) create mode 100644 LayoutTests/fast/dynamic/flash-replacement-test.html diff --git a/LayoutTests/fast/dynamic/flash-replacement-test.html b/LayoutTests/fast/dynamic/flash-replacement-test.html new file mode 100644 index 000000000000..c3f0aa9dbebe --- /dev/null +++ b/LayoutTests/fast/dynamic/flash-replacement-test.html @@ -0,0 +1,39 @@ + + + + +Reduced Test Case + + + + + + + + + + +
+

Measure Me

+ + +
+ + + diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index 5419a5be5ccf..139d2fa04ea6 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,23 @@ +2005-05-05 David Hyatt + + Fix for 4109667, sIFR flash replacement technique often malfunctions. This bug occurs when the plugin + widget update causes the onload for the document to fire. Because you can be in the middle of a style + recalc when doing an attach (in response to a stylesheet load), the onload fires in the middle of the attach + process when the tree is in a bogus state. + + The fix is to add a bit to the document that tells style recalc that the implicitClose() method was invoked + during the style recalc process and the code has been patched so that when this situation occurs, the close is + deferred until after the style recalc has finished. + + Reviewed by John Sullivan + + * khtml/xml/dom_docimpl.cpp: + (DocumentImpl::DocumentImpl): + (DocumentImpl::recalcStyle): + (DocumentImpl::implicitClose): + * khtml/xml/dom_docimpl.h: + * layout-tests/fast/dynamic/flash-replacement-test.html: Added. + 2005-05-05 Darin Adler Reviewed by Dave Hyatt. diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp index 4974fb4131f7..c9fa6eeae045 100644 --- a/WebCore/khtml/xml/dom_docimpl.cpp +++ b/WebCore/khtml/xml/dom_docimpl.cpp @@ -342,6 +342,7 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v) m_inDocument = true; m_styleSelectorDirty = false; m_inStyleRecalc = false; + m_closeAfterStyleRecalc = false; m_usesDescendantRules = false; m_usesSiblingRules = false; @@ -1104,6 +1105,12 @@ bail_out: setDocumentChanged( false ); m_inStyleRecalc = false; + + // If we wanted to emit the implicitClose() during recalcStyle, do so now that we're finished. + if (m_closeAfterStyleRecalc) { + m_closeAfterStyleRecalc = false; + implicitClose(); + } } void DocumentImpl::updateRendering() @@ -1417,6 +1424,12 @@ void DocumentImpl::close() void DocumentImpl::implicitClose() { + // If we're in the middle of recalcStyle, we need to defer the close until the style information is accurate and all elements are re-attached. + if (m_inStyleRecalc) { + m_closeAfterStyleRecalc = true; + return; + } + // First fire the onload. bool wasLocationChangePending = part() && part()->isScheduledLocationChangePending(); diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h index 8eee88c7a0b6..9a4e70ae1744 100644 --- a/WebCore/khtml/xml/dom_docimpl.h +++ b/WebCore/khtml/xml/dom_docimpl.h @@ -672,6 +672,7 @@ protected: bool m_docChanged; bool m_styleSelectorDirty; bool m_inStyleRecalc; + bool m_closeAfterStyleRecalc; bool m_usesDescendantRules; bool m_usesSiblingRules; -- 2.36.0