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
--- /dev/null
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Reduced Test Case</title>
+
+<link href="bogus.css" rel="stylesheet" type="text/css" media="screen" />
+
+<script language="javascript" type="text/javascript">
+
+function measure2() {
+ document.getElementById('result').innerHTML = 'The resulting width is ' + document.getElementById('hello').offsetWidth;
+}
+
+// BEGIN PROXY FUNCTION
+// If we call the above function using this as a proxy, it works. Even with a "0" as our delay.
+
+function measure() {
+ setTimeout("measure2()",0);
+}
+
+// END PROXY FUNCTION
+
+
+</script>
+
+</head>
+<body onload="measure2()">
+
+<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="249" height="154"><param name="movie" value="bogus.swf"><param name="bgcolor" value="#000000"><param name="quality" value="high"><embed src="featuredcase.swf" bgcolor="#000000" quality="high" width="249" height="154" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>
+
+<br />
+<h1 id="hello" style="background-color: #FF0000">Measure Me</h1>
+
+
+<div id="result"></div>
+
+</body>
+</html>
+2005-05-05 David Hyatt <hyatt@apple.com>
+
+ 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 <darin@apple.com>
Reviewed by Dave Hyatt.
m_inDocument = true;
m_styleSelectorDirty = false;
m_inStyleRecalc = false;
+ m_closeAfterStyleRecalc = false;
m_usesDescendantRules = false;
m_usesSiblingRules = false;
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()
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();
bool m_docChanged;
bool m_styleSelectorDirty;
bool m_inStyleRecalc;
+ bool m_closeAfterStyleRecalc;
bool m_usesDescendantRules;
bool m_usesSiblingRules;