зеркало из https://github.com/mozilla/pjs.git
When doing ContentRemoved, IndexOf() will always return -1. So don't use it.
Bug 360524, r+sr=roc
This commit is contained in:
Родитель
f6cc859e62
Коммит
8fc18b2ae7
|
@ -8004,7 +8004,7 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchyInternal()
|
|||
|
||||
// Get the frame that corresponds to the document element
|
||||
nsIFrame* docElementFrame =
|
||||
state.mFrameManager->GetPrimaryFrameFor(rootContent);
|
||||
state.mFrameManager->GetPrimaryFrameFor(rootContent, -1);
|
||||
|
||||
// Remove any existing fixed items: they are always on the
|
||||
// FixedContainingBlock. Note that this has to be done before we call
|
||||
|
@ -9746,7 +9746,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the child frame that maps the content
|
||||
nsIFrame* childFrame = mPresShell->GetPrimaryFrameFor(aChild);
|
||||
nsIFrame* childFrame =
|
||||
mPresShell->FrameManager()->GetPrimaryFrameFor(aChild, aIndexInContainer);
|
||||
|
||||
if (! childFrame) {
|
||||
frameManager->ClearUndisplayedContentIn(aChild, aContainer);
|
||||
|
@ -11212,7 +11213,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsFrameManager* aFrameManager,
|
|||
// call us back if there is no mapping in the hash table
|
||||
nsCOMPtr<nsIContent> parentContent = aContent->GetParent(); // Get this once
|
||||
if (parentContent) {
|
||||
parentFrame = aFrameManager->GetPrimaryFrameFor(parentContent);
|
||||
parentFrame = aFrameManager->GetPrimaryFrameFor(parentContent, -1);
|
||||
while (parentFrame) {
|
||||
// Search the child frames for a match
|
||||
*aFrame = FindFrameWithContent(aFrameManager, parentFrame,
|
||||
|
|
|
@ -339,7 +339,8 @@ nsFrameManager::GetCanvasFrame()
|
|||
|
||||
// Primary frame functions
|
||||
nsIFrame*
|
||||
nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent)
|
||||
nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent,
|
||||
PRInt32 aIndexHint)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, nsnull);
|
||||
|
||||
|
@ -383,7 +384,7 @@ nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent)
|
|||
nsIContent* parent = aContent->GetParent();
|
||||
if (parent)
|
||||
{
|
||||
PRInt32 index = parent->IndexOf(aContent);
|
||||
PRInt32 index = aIndexHint >= 0 ? aIndexHint : parent->IndexOf(aContent);
|
||||
if (index > 0) // no use looking if it's the first child
|
||||
{
|
||||
nsIContent *prevSibling;
|
||||
|
|
|
@ -110,7 +110,10 @@ public:
|
|||
NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
|
||||
|
||||
// Primary frame functions
|
||||
NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent);
|
||||
// If aIndexHint it not -1, it will be used as when determining a frame hint
|
||||
// instead of calling IndexOf(aContent).
|
||||
NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent,
|
||||
PRInt32 aIndexHint);
|
||||
NS_HIDDEN_(nsresult) SetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame);
|
||||
NS_HIDDEN_(void) ClearPrimaryFrameMap();
|
||||
|
|
|
@ -5479,7 +5479,7 @@ PresShell::StyleRuleRemoved(nsIDocument *aDocument,
|
|||
nsIFrame*
|
||||
PresShell::GetPrimaryFrameFor(nsIContent* aContent) const
|
||||
{
|
||||
return FrameManager()->GetPrimaryFrameFor(aContent);
|
||||
return FrameManager()->GetPrimaryFrameFor(aContent, -1);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -6299,7 +6299,7 @@ PresShell::RemoveOverrideStyleSheet(nsIStyleSheet *aSheet)
|
|||
static void
|
||||
StopPluginInstance(PresShell *aShell, nsIContent *aContent)
|
||||
{
|
||||
nsIFrame *frame = aShell->FrameManager()->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *frame = aShell->FrameManager()->GetPrimaryFrameFor(aContent, -1);
|
||||
|
||||
nsIObjectFrame *objectFrame = nsnull;
|
||||
if (frame)
|
||||
|
|
|
@ -2192,7 +2192,8 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale)
|
|||
|
||||
// Check to see if the subdocument's element has been hidden by the parent document
|
||||
if (aPO->mParent && aPO->mParent->mPresShell) {
|
||||
nsIFrame * frame = aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent);
|
||||
nsIFrame * frame =
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
|
@ -2244,7 +2245,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
|||
if (aPO->mParent && aPO->mParent->IsPrintable()) {
|
||||
if (aPO->mParent->mPresShell) {
|
||||
frame = aPO->mParent->mPresShell->FrameManager()->
|
||||
GetPrimaryFrameFor(aPO->mContent);
|
||||
GetPrimaryFrameFor(aPO->mContent, -1);
|
||||
}
|
||||
// Without a frame, this document can't be displayed; therefore, there is no
|
||||
// point to reflowing it
|
||||
|
|
Загрузка…
Ссылка в новой задаче