Process XBL constructors after processing style reresolves. In particular,

this makes sure that we process the former even if there were none of the
latter.  Bug 394676 and bug 394014, r=smaug, sr=sicking, a=roc
This commit is contained in:
bzbarsky%mit.edu 2007-09-14 19:15:44 +00:00
Родитель f46523a0c6
Коммит 9404d2126d
6 изменённых файлов: 55 добавлений и 8 удалений

Просмотреть файл

@ -13020,11 +13020,6 @@ nsCSSFrameConstructor::ProcessPendingRestyles()
delete [] restylesToProcess;
// Run the XBL binding constructors for any new frames we've constructed.
// Note that the restyle event is holding a strong ref to us, so we're ok
// here.
mDocument->BindingManager()->ProcessAttachedQueue();
EndUpdate();
#ifdef DEBUG
@ -13071,7 +13066,7 @@ NS_IMETHODIMP nsCSSFrameConstructor::RestyleEvent::Run() {
if (!mConstructor)
return NS_OK; // event was revoked
nsIViewManager* viewManager =
nsCOMPtr<nsIViewManager> viewManager =
mConstructor->mPresShell->GetViewManager();
NS_ASSERTION(viewManager, "Must have view manager for update");
@ -13087,6 +13082,7 @@ NS_IMETHODIMP nsCSSFrameConstructor::RestyleEvent::Run() {
mConstructor->mRestyleEvent.Forget();
mConstructor->ProcessPendingRestyles();
mConstructor->mDocument->BindingManager()->ProcessAttachedQueue();
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
return NS_OK;

Просмотреть файл

@ -171,8 +171,9 @@ private:
public:
// Note: It's the caller's responsibility to make sure to wrap a
// ProcessPendingRestyles call in a view update batch.
// ProcessPendingRestyles will handle calling ProcessAttachedQueue() on the
// binding manager.
// This function does not call ProcessAttachedQueue() on the binding manager.
// If the caller wants that to happen synchronously, it needs to handle that
// itself.
void ProcessPendingRestyles();
void PostRestyleEvent(nsIContent* aContent, nsReStyleHint aRestyleHint,

Просмотреть файл

@ -4418,6 +4418,10 @@ PresShell::DoFlushPendingNotifications(mozFlushType aType,
mFrameConstructor->ProcessPendingRestyles();
}
if (!mIsDestroying) {
mDocument->BindingManager()->ProcessAttachedQueue();
}
if (aType >= Flush_Layout && !mIsDestroying) {
mFrameConstructor->RecalcQuotesAndCounters();
ProcessReflowCommands(aInterruptibleReflow);

Просмотреть файл

@ -0,0 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<span id="test">constructor onload </span>
</body>
</html>

Просмотреть файл

@ -0,0 +1,39 @@
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="xbltest">
<implementation>
<constructor>
<![CDATA[
str += "constructor "
testFinished();
]]>
</constructor>
</implementation>
</binding>
</bindings>
</head>
<body>
<span id="test" style="-moz-binding: url(#xbltest)"></span>
<script class="testbody" type="text/javascript">
<![CDATA[
var testsToFinish = 2;
var str = "";
function testFinished() {
--testsToFinish;
if (!testsToFinish) {
document.getElementById("test").textContent = str;
document.documentElement.className = '';
}
}
window.onload = function() {
str += "onload ";
testFinished();
}
]]>
</script>
</body>
</html>

Просмотреть файл

@ -378,3 +378,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug
== 393671-3.html 393671-3-ref.html
== 394111-1.html about:blank # Really an assertion test rather than a rendering test
== 394534-1.html 394534-1-ref.html
== 394676-1.xhtml 394676-1-ref.xhtml