Bug 336574, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@216997 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2006-12-15 00:23:39 +00:00
parent 8d457acb68
commit aec65575d1
3 changed files with 28 additions and 79 deletions

View File

@@ -844,11 +844,6 @@ public:
*/
NS_IMETHOD RecreateFramesFor(nsIContent* aContent);
/**
* Post a request to handle a DOM event after Reflow has finished.
*/
NS_IMETHOD PostDOMEvent(nsIContent* aContent, nsEvent* aEvent);
/**
* Post a request to set and attribute after reflow has finished.
*/
@@ -1156,10 +1151,7 @@ protected:
nsRevocableEventPtr<ReflowEvent> mReflowEvent;
// used for list of posted events and attribute changes. To be done
// after reflow.
nsDOMEventRequest* mFirstDOMEventRequest;
nsDOMEventRequest* mLastDOMEventRequest;
// used for list of posted attribute changes. To be done after reflow.
nsAttributeChangeRequest* mFirstAttributeRequest;
nsAttributeChangeRequest* mLastAttributeRequest;
nsCallbackEventRequest* mFirstCallbackEventRequest;
@@ -1426,9 +1418,7 @@ PresShell::~PresShell()
NS_ASSERTION(mCurrentEventContentStack.Count() == 0,
"Huh, event content left on the stack in pres shell dtor!");
NS_ASSERTION(mFirstDOMEventRequest == nsnull &&
mLastDOMEventRequest == nsnull &&
mFirstAttributeRequest == nsnull &&
NS_ASSERTION(mFirstAttributeRequest == nsnull &&
mLastAttributeRequest == nsnull &&
mFirstCallbackEventRequest == nsnull &&
mLastCallbackEventRequest == nsnull,
@@ -4671,39 +4661,6 @@ PresShell::CancelReflowCallback(nsIReflowCallback* aCallback)
return NS_OK;
}
/**
* Post a request to handle a DOM event after Reflow has finished.
* The event must have been created with the "new" operator.
*/
NS_IMETHODIMP
PresShell::PostDOMEvent(nsIContent* aContent, nsEvent* aEvent)
{
// ok we have a list of events to handle. Queue them up and handle them
// after we finish reflow.
void* result = AllocateFrame(sizeof(nsDOMEventRequest));
if (NS_UNLIKELY(!result)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsDOMEventRequest* request = (nsDOMEventRequest*)result;
request->content = aContent;
NS_ADDREF(aContent);
request->event = aEvent;
request->next = nsnull;
if (mLastDOMEventRequest) {
mLastDOMEventRequest = mLastDOMEventRequest->next = request;
} else {
mFirstDOMEventRequest = request;
mLastDOMEventRequest = request;
}
return NS_OK;
}
/**
* Post a request to set and attribute after reflow has finished.
*/
@@ -4767,30 +4724,6 @@ PresShell::HandlePostedReflowCallbacks()
FlushPendingNotifications(Flush_Layout);
}
void
PresShell::HandlePostedDOMEvents()
{
while(mFirstDOMEventRequest)
{
/* pull the node from the event request list. Be prepared for reentrant access to the list
from within Dispatch and its callees! */
nsDOMEventRequest* node = mFirstDOMEventRequest;
nsEventStatus status = nsEventStatus_eIgnore;
mFirstDOMEventRequest = node->next;
if (nsnull == mFirstDOMEventRequest) {
mLastDOMEventRequest = nsnull;
}
nsEventDispatcher::Dispatch(node->content, mPresContext, node->event,
nsnull, &status);
NS_RELEASE(node->content);
delete node->event;
node->nsDOMEventRequest::~nsDOMEventRequest(); // doesn't do anything, but just in case
FreeFrame(sizeof(nsDOMEventRequest), node);
}
}
void
PresShell::HandlePostedAttributeChanges()
{
@@ -6174,7 +6107,6 @@ PresShell::WillDoReflow()
void
PresShell::DidDoReflow()
{
HandlePostedDOMEvents();
HandlePostedAttributeChanges();
HandlePostedReflowCallbacks();
// Null-check mViewManager in case this happens during Destroy. See