зеркало из https://github.com/mozilla/gecko-dev.git
Bug 536718. Clean up NotifyDestroyingFrame. r=roc
This commit is contained in:
Родитель
577da369d1
Коммит
285f81171c
|
@ -288,15 +288,6 @@ nsFrameManager::GetCanvasFrame()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsFrameManager::RemoveAsPrimaryFrame(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame)
|
||||
{
|
||||
if (aContent->GetPrimaryFrame() == aPrimaryFrame) {
|
||||
aContent->SetPrimaryFrame(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
// Placeholder frame functions
|
||||
nsPlaceholderFrame*
|
||||
nsFrameManager::GetPlaceholderFrameFor(nsIFrame* aFrame)
|
||||
|
@ -564,14 +555,9 @@ nsFrameManager::RemoveFrame(nsIAtom* aListName,
|
|||
void
|
||||
nsFrameManager::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||
{
|
||||
//XXXfr Because we destroy most continuation chains starting from the FIF
|
||||
// this does excess work by triggering on every continuation in the chain
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (!aFrame->GetPrevContinuation() && content) {
|
||||
RemoveAsPrimaryFrame(content, aFrame);
|
||||
if (content != aFrame->GetParent()->GetContent()) { // first-letter
|
||||
ClearAllUndisplayedContentIn(content);
|
||||
}
|
||||
if (content && content->GetPrimaryFrame() == aFrame) {
|
||||
ClearAllUndisplayedContentIn(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,12 +109,6 @@ public:
|
|||
*/
|
||||
NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
|
||||
|
||||
// Primary frame functions
|
||||
// If aPrimaryFrame is the current primary frame for aContent, set its
|
||||
// primary frame to null. aPrimaryFrame must not be null.
|
||||
NS_HIDDEN_(void) RemoveAsPrimaryFrame(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame);
|
||||
|
||||
// Placeholder frame functions
|
||||
NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
|
||||
NS_HIDDEN_(nsresult)
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIImageMap.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
@ -85,7 +84,6 @@ public:
|
|||
void HasFocus(PRBool aHasFocus);
|
||||
|
||||
void GetHREF(nsAString& aHref) const;
|
||||
void GetArea(nsIContent** aArea) const;
|
||||
|
||||
nsCOMPtr<nsIContent> mArea;
|
||||
nscoord* mCoords;
|
||||
|
@ -97,6 +95,7 @@ Area::Area(nsIContent* aArea)
|
|||
: mArea(aArea)
|
||||
{
|
||||
MOZ_COUNT_CTOR(Area);
|
||||
NS_PRECONDITION(mArea, "How did that happen?");
|
||||
mCoords = nsnull;
|
||||
mNumCoords = 0;
|
||||
mHasFocus = PR_FALSE;
|
||||
|
@ -117,13 +116,6 @@ Area::GetHREF(nsAString& aHref) const
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Area::GetArea(nsIContent** aArea) const
|
||||
{
|
||||
*aArea = mArea;
|
||||
NS_IF_ADDREF(*aArea);
|
||||
}
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
inline PRBool
|
||||
|
@ -757,18 +749,14 @@ nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
|
|||
void
|
||||
nsImageMap::FreeAreas()
|
||||
{
|
||||
nsFrameManager *frameManager = mPresShell->FrameManager();
|
||||
|
||||
PRUint32 i, n = mAreas.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = mAreas.ElementAt(i);
|
||||
frameManager->RemoveAsPrimaryFrame(area->mArea, mImageFrame);
|
||||
NS_ASSERTION(area->mArea->GetPrimaryFrame() == mImageFrame,
|
||||
"Unexpected primary frame");
|
||||
area->mArea->SetPrimaryFrame(nsnull);
|
||||
|
||||
nsCOMPtr<nsIContent> areaContent;
|
||||
area->GetArea(getter_AddRefs(areaContent));
|
||||
if (areaContent) {
|
||||
areaContent->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
|
||||
}
|
||||
area->mArea->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
|
||||
delete area;
|
||||
}
|
||||
mAreas.Clear();
|
||||
|
@ -912,7 +900,7 @@ nsImageMap::IsInside(nscoord aX, nscoord aY,
|
|||
for (i = 0; i < n; i++) {
|
||||
Area* area = mAreas.ElementAt(i);
|
||||
if (area->IsInside(aX, aY)) {
|
||||
area->GetArea(aContent);
|
||||
NS_ADDREF(*aContent = area->mArea);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1009,9 +997,7 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus)
|
|||
PRUint32 i, n = mAreas.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
Area* area = mAreas.ElementAt(i);
|
||||
nsCOMPtr<nsIContent> areaContent;
|
||||
area->GetArea(getter_AddRefs(areaContent));
|
||||
if (areaContent == targetContent) {
|
||||
if (area->mArea == targetContent) {
|
||||
//Set or Remove internal focus
|
||||
area->HasFocus(aFocus);
|
||||
//Now invalidate the rect
|
||||
|
|
Загрузка…
Ссылка в новой задаче