зеркало из https://github.com/mozilla/pjs.git
Added the same skip-over-non-body-content code that's in the root content frame code
This commit is contained in:
Родитель
51abae9138
Коммит
cc04a28262
|
@ -22,6 +22,7 @@
|
||||||
#include "nsIStyleContext.h"
|
#include "nsIStyleContext.h"
|
||||||
#include "nsIReflowCommand.h"
|
#include "nsIReflowCommand.h"
|
||||||
#include "nsIRenderingContext.h"
|
#include "nsIRenderingContext.h"
|
||||||
|
#include "nsHTMLAtoms.h"
|
||||||
|
|
||||||
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||||
: nsContainerFrame(aContent, aParent)
|
: nsContainerFrame(aContent, aParent)
|
||||||
|
@ -30,25 +31,38 @@ nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||||
|
|
||||||
void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
// Create a frame for our one and only content child
|
// XXX this is a copy of the root-content-frame's version
|
||||||
if (mContent->ChildCount() > 0) {
|
|
||||||
nsIContent* child = mContent->ChildAt(0);
|
|
||||||
|
|
||||||
|
// Create a frame for the body child
|
||||||
|
PRInt32 i, n;
|
||||||
|
n = mContent->ChildCount();
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
nsIContent* child = mContent->ChildAt(i);
|
||||||
if (nsnull != child) {
|
if (nsnull != child) {
|
||||||
// Create a frame
|
nsIAtom* tag;
|
||||||
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
tag = child->GetTag();
|
||||||
if (nsnull != cd) {
|
if (nsHTMLAtoms::body == tag) {
|
||||||
nsIStyleContext* kidStyleContext =
|
// Create a frame
|
||||||
aPresContext->ResolveStyleContextFor(child, this);
|
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
||||||
nsresult rv = cd->CreateFrame(aPresContext, child, this,
|
if (nsnull != cd) {
|
||||||
kidStyleContext, mFirstChild);
|
nsIStyleContext* kidStyleContext =
|
||||||
NS_RELEASE(kidStyleContext);
|
aPresContext->ResolveStyleContextFor(child, this);
|
||||||
if (NS_OK == mFirstChild) {
|
nsresult rv = cd->CreateFrame(aPresContext, child, this,
|
||||||
mChildCount = 1;
|
kidStyleContext, mFirstChild);
|
||||||
mLastContentOffset = mFirstContentOffset;
|
NS_RELEASE(kidStyleContext);
|
||||||
|
if (NS_OK == rv) {
|
||||||
|
mChildCount = 1;
|
||||||
|
mFirstContentOffset = i;
|
||||||
|
mLastContentOffset = i;
|
||||||
|
|
||||||
|
// We are always a pseudo-frame; make sure our content offset is
|
||||||
|
// properly pushed upwards
|
||||||
|
PropagateContentOffsets();
|
||||||
|
}
|
||||||
|
NS_RELEASE(cd);
|
||||||
}
|
}
|
||||||
NS_RELEASE(cd);
|
|
||||||
}
|
}
|
||||||
|
NS_IF_RELEASE(tag);
|
||||||
NS_RELEASE(child);
|
NS_RELEASE(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "nsIStyleContext.h"
|
#include "nsIStyleContext.h"
|
||||||
#include "nsIReflowCommand.h"
|
#include "nsIReflowCommand.h"
|
||||||
#include "nsIRenderingContext.h"
|
#include "nsIRenderingContext.h"
|
||||||
|
#include "nsHTMLAtoms.h"
|
||||||
|
|
||||||
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||||
: nsContainerFrame(aContent, aParent)
|
: nsContainerFrame(aContent, aParent)
|
||||||
|
@ -30,25 +31,38 @@ nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
|
||||||
|
|
||||||
void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
// Create a frame for our one and only content child
|
// XXX this is a copy of the root-content-frame's version
|
||||||
if (mContent->ChildCount() > 0) {
|
|
||||||
nsIContent* child = mContent->ChildAt(0);
|
|
||||||
|
|
||||||
|
// Create a frame for the body child
|
||||||
|
PRInt32 i, n;
|
||||||
|
n = mContent->ChildCount();
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
nsIContent* child = mContent->ChildAt(i);
|
||||||
if (nsnull != child) {
|
if (nsnull != child) {
|
||||||
// Create a frame
|
nsIAtom* tag;
|
||||||
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
tag = child->GetTag();
|
||||||
if (nsnull != cd) {
|
if (nsHTMLAtoms::body == tag) {
|
||||||
nsIStyleContext* kidStyleContext =
|
// Create a frame
|
||||||
aPresContext->ResolveStyleContextFor(child, this);
|
nsIContentDelegate* cd = child->GetDelegate(aPresContext);
|
||||||
nsresult rv = cd->CreateFrame(aPresContext, child, this,
|
if (nsnull != cd) {
|
||||||
kidStyleContext, mFirstChild);
|
nsIStyleContext* kidStyleContext =
|
||||||
NS_RELEASE(kidStyleContext);
|
aPresContext->ResolveStyleContextFor(child, this);
|
||||||
if (NS_OK == mFirstChild) {
|
nsresult rv = cd->CreateFrame(aPresContext, child, this,
|
||||||
mChildCount = 1;
|
kidStyleContext, mFirstChild);
|
||||||
mLastContentOffset = mFirstContentOffset;
|
NS_RELEASE(kidStyleContext);
|
||||||
|
if (NS_OK == rv) {
|
||||||
|
mChildCount = 1;
|
||||||
|
mFirstContentOffset = i;
|
||||||
|
mLastContentOffset = i;
|
||||||
|
|
||||||
|
// We are always a pseudo-frame; make sure our content offset is
|
||||||
|
// properly pushed upwards
|
||||||
|
PropagateContentOffsets();
|
||||||
|
}
|
||||||
|
NS_RELEASE(cd);
|
||||||
}
|
}
|
||||||
NS_RELEASE(cd);
|
|
||||||
}
|
}
|
||||||
|
NS_IF_RELEASE(tag);
|
||||||
NS_RELEASE(child);
|
NS_RELEASE(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче