зеркало из https://github.com/mozilla/pjs.git
Fix leaks of mCurrentEventContent. A few other little pieces of cleanup. b=230270 r+sr=bryner
This commit is contained in:
Родитель
3182c46acf
Коммит
86711e63ce
|
@ -3863,6 +3863,7 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
if (aFrame == mCurrentEventFrame) {
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
mCurrentEventContent = aFrame->GetContent();
|
||||
NS_IF_ADDREF(mCurrentEventContent);
|
||||
mCurrentEventFrame = nsnull;
|
||||
|
@ -5370,10 +5371,7 @@ PresShell::ReconstructStyleData()
|
|||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
GetFrameManager(getter_AddRefs(frameManager));
|
||||
|
||||
// Now handle some of our more problematic widgets (and also deal with
|
||||
// skin XBL changing).
|
||||
nsStyleChangeList changeList;
|
||||
|
||||
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
|
||||
frameManager->ComputeStyleChangeFor(rootFrame, kNameSpaceID_Unknown, nsnull,
|
||||
changeList, NS_STYLE_HINT_NONE,
|
||||
|
@ -5381,9 +5379,8 @@ PresShell::ReconstructStyleData()
|
|||
|
||||
if (frameChange & nsChangeHint_ReconstructDoc)
|
||||
set->ReconstructDocElementHierarchy(mPresContext);
|
||||
else {
|
||||
else
|
||||
cssFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
|
||||
}
|
||||
|
||||
VERIFY_STYLE_TREE;
|
||||
|
||||
|
@ -5766,9 +5763,7 @@ PRBool PresShell::InZombieDocument(nsIContent *aContent)
|
|||
// Such documents cannot handle DOM events.
|
||||
// It might actually be in a node not attached to any document,
|
||||
// in which case there is not parent presshell to retarget it to.
|
||||
// XXXbz shouldn't this use aContent->GetDocument? Good thing we
|
||||
// only call it on mCurrentEventContent....
|
||||
return !mCurrentEventContent->GetDocument();
|
||||
return !aContent->GetDocument();
|
||||
}
|
||||
|
||||
nsresult PresShell::RetargetEventToParent(nsIView *aView,
|
||||
|
@ -5898,6 +5893,11 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
aEvent->message == NS_CONTEXTMENU_KEY) &&
|
||||
NS_SUCCEEDED(mPresContext->GetEventStateManager(getter_AddRefs(manager)))) {
|
||||
|
||||
// XXXldb Perhaps there should be an
|
||||
// NS_IF_RELEASE(mCurrentEventContent) here. This might prevent
|
||||
// the need for it before |CallQueryInterface| into
|
||||
// |mCurrentEventContent| below and also prevent the need for the
|
||||
// |IsZombieDocument| test a little below that.
|
||||
manager->GetFocusedFrame(&mCurrentEventFrame);
|
||||
if (!mCurrentEventFrame) {
|
||||
#if defined(MOZ_X11)
|
||||
|
@ -5922,6 +5922,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (focusedElement) {
|
||||
// get mCurrentEventContent from focusedElement
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
CallQueryInterface(focusedElement, &mCurrentEventContent);
|
||||
}
|
||||
}
|
||||
|
@ -5932,8 +5933,10 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
if (!mCurrentEventContent) {
|
||||
NS_IF_ADDREF(mCurrentEventContent = mDocument->GetRootContent());
|
||||
}
|
||||
mCurrentEventFrame = nsnull;
|
||||
mCurrentEventFrame = nsnull; // XXXldb Isn't it already?
|
||||
}
|
||||
// XXXldb Is the need for this just a side-effect of forgetting to
|
||||
// release above? See comment above.
|
||||
if (mCurrentEventContent && InZombieDocument(mCurrentEventContent)) {
|
||||
return RetargetEventToParent(aView, aEvent, aEventStatus, aForceHandle,
|
||||
aHandled, mCurrentEventContent);
|
||||
|
@ -5966,10 +5969,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
nsIView *view = nsnull;
|
||||
frame->GetOriginToViewOffset(mPresContext, originOffset, &view);
|
||||
|
||||
#ifdef DEBUG_kin
|
||||
NS_ASSERTION(view == aView, "view != aView");
|
||||
#endif // DEBUG_kin
|
||||
|
||||
if (view == aView)
|
||||
eventPoint -= originOffset;
|
||||
|
||||
|
|
|
@ -3863,6 +3863,7 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
if (aFrame == mCurrentEventFrame) {
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
mCurrentEventContent = aFrame->GetContent();
|
||||
NS_IF_ADDREF(mCurrentEventContent);
|
||||
mCurrentEventFrame = nsnull;
|
||||
|
@ -5370,10 +5371,7 @@ PresShell::ReconstructStyleData()
|
|||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
GetFrameManager(getter_AddRefs(frameManager));
|
||||
|
||||
// Now handle some of our more problematic widgets (and also deal with
|
||||
// skin XBL changing).
|
||||
nsStyleChangeList changeList;
|
||||
|
||||
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
|
||||
frameManager->ComputeStyleChangeFor(rootFrame, kNameSpaceID_Unknown, nsnull,
|
||||
changeList, NS_STYLE_HINT_NONE,
|
||||
|
@ -5381,9 +5379,8 @@ PresShell::ReconstructStyleData()
|
|||
|
||||
if (frameChange & nsChangeHint_ReconstructDoc)
|
||||
set->ReconstructDocElementHierarchy(mPresContext);
|
||||
else {
|
||||
else
|
||||
cssFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
|
||||
}
|
||||
|
||||
VERIFY_STYLE_TREE;
|
||||
|
||||
|
@ -5766,9 +5763,7 @@ PRBool PresShell::InZombieDocument(nsIContent *aContent)
|
|||
// Such documents cannot handle DOM events.
|
||||
// It might actually be in a node not attached to any document,
|
||||
// in which case there is not parent presshell to retarget it to.
|
||||
// XXXbz shouldn't this use aContent->GetDocument? Good thing we
|
||||
// only call it on mCurrentEventContent....
|
||||
return !mCurrentEventContent->GetDocument();
|
||||
return !aContent->GetDocument();
|
||||
}
|
||||
|
||||
nsresult PresShell::RetargetEventToParent(nsIView *aView,
|
||||
|
@ -5898,6 +5893,11 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
aEvent->message == NS_CONTEXTMENU_KEY) &&
|
||||
NS_SUCCEEDED(mPresContext->GetEventStateManager(getter_AddRefs(manager)))) {
|
||||
|
||||
// XXXldb Perhaps there should be an
|
||||
// NS_IF_RELEASE(mCurrentEventContent) here. This might prevent
|
||||
// the need for it before |CallQueryInterface| into
|
||||
// |mCurrentEventContent| below and also prevent the need for the
|
||||
// |IsZombieDocument| test a little below that.
|
||||
manager->GetFocusedFrame(&mCurrentEventFrame);
|
||||
if (!mCurrentEventFrame) {
|
||||
#if defined(MOZ_X11)
|
||||
|
@ -5922,6 +5922,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (focusedElement) {
|
||||
// get mCurrentEventContent from focusedElement
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
CallQueryInterface(focusedElement, &mCurrentEventContent);
|
||||
}
|
||||
}
|
||||
|
@ -5932,8 +5933,10 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
if (!mCurrentEventContent) {
|
||||
NS_IF_ADDREF(mCurrentEventContent = mDocument->GetRootContent());
|
||||
}
|
||||
mCurrentEventFrame = nsnull;
|
||||
mCurrentEventFrame = nsnull; // XXXldb Isn't it already?
|
||||
}
|
||||
// XXXldb Is the need for this just a side-effect of forgetting to
|
||||
// release above? See comment above.
|
||||
if (mCurrentEventContent && InZombieDocument(mCurrentEventContent)) {
|
||||
return RetargetEventToParent(aView, aEvent, aEventStatus, aForceHandle,
|
||||
aHandled, mCurrentEventContent);
|
||||
|
@ -5966,10 +5969,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
nsIView *view = nsnull;
|
||||
frame->GetOriginToViewOffset(mPresContext, originOffset, &view);
|
||||
|
||||
#ifdef DEBUG_kin
|
||||
NS_ASSERTION(view == aView, "view != aView");
|
||||
#endif // DEBUG_kin
|
||||
|
||||
if (view == aView)
|
||||
eventPoint -= originOffset;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче