mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Removed IsPseudoFrame() from nsContainerFrame
This commit is contained in:
parent
f1e955440e
commit
5dac3c72a9
@ -278,27 +278,6 @@ NS_METHOD nsContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Pseudo frame related
|
||||
|
||||
// Returns true if this frame is being used a pseudo frame
|
||||
PRBool nsContainerFrame::IsPseudoFrame() const
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if (nsnull != mGeometricParent) {
|
||||
nsIContent* parentContent;
|
||||
|
||||
mGeometricParent->GetContent(parentContent);
|
||||
if (parentContent == mContent) {
|
||||
result = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(parentContent);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Helper member functions
|
||||
|
||||
@ -598,7 +577,7 @@ NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
|
||||
mContent->GetTag(tag);
|
||||
if (tag != nsnull)
|
||||
tag->ToString(tagString);
|
||||
PRBool outputMe = (PRBool)((nsnull==aFilter) || ((PR_TRUE==aFilter->OutputTag(&tagString)) && (!IsPseudoFrame())));
|
||||
PRBool outputMe = (PRBool)((nsnull==aFilter) || (PR_TRUE==aFilter->OutputTag(&tagString)));
|
||||
if (PR_TRUE==outputMe)
|
||||
{
|
||||
// Indent
|
||||
@ -653,15 +632,6 @@ NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsContainerFrame::ListTag(FILE* out) const
|
||||
{
|
||||
if ((nsnull != mGeometricParent) && IsPseudoFrame()) {
|
||||
fputs("*", out);
|
||||
}
|
||||
nsFrame::ListTag(out);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define VERIFY_ASSERT(_expr, _msg) \
|
||||
if (!(_expr)) { \
|
||||
DumpTree(); \
|
||||
|
@ -21,86 +21,7 @@
|
||||
#include "nsSplittableFrame.h"
|
||||
|
||||
/**
|
||||
* Implementation of a container frame. Supports being used a pseudo-
|
||||
* frame (a frame that maps the same content as its parent).
|
||||
*
|
||||
* Container frame iterates its child content and for each content object creates
|
||||
* one or more child frames. There are three member variables (class invariants)
|
||||
* used to manage this mapping:
|
||||
* <dl>
|
||||
* <dt>mFirstContentOffset
|
||||
* <dd>the content offset of the first piece of content mapped by this container.
|
||||
* <dt>mLastContentOffset
|
||||
* <dd>the content offset of the last piece of content mapped by this container
|
||||
* <dt>mLastContentIsComplete
|
||||
* <dd>a boolean indicating whether the last piece of content mapped by this
|
||||
* container is complete, or whether its frame needs to be continued.
|
||||
* </dl>
|
||||
*
|
||||
* Here are the rules governing the state of the class invariants. The debug member
|
||||
* functions PreReflowCheck() and PostReflowCheck() validate these rules. For the
|
||||
* purposes of this discussion an <i>empty</i> frame is defined as a container
|
||||
* frame with a null child-list, i.e. its mFirstChild is nsnull.
|
||||
*
|
||||
* <h3>Non-Empty Frames</h3>
|
||||
* For a container frame that is not an empty frame the following must be true:
|
||||
* <ul>
|
||||
* <li>if the first child frame is a pseudo-frame then mFirstContentOffset must be
|
||||
* equal to the first child's mFirstContentOffset; otherwise, mFirstContentOffset
|
||||
* must be equal to the first child frame's index in parent
|
||||
* <li>if the last child frame is a pseudo-frame then mLastContentOffset must be
|
||||
* equal to the last child's mLastContentOffset; otherwise, mLastContentOffset
|
||||
* must be equal to the last child frame's index in parent
|
||||
* <li>if the last child is a pseudo-frame then mLastContentIsComplete should be
|
||||
* equal to that last child's mLastContentIsComplete; otherwise, if the last
|
||||
* child frame has a next-in-flow then mLastContentIsComplete must be PR_TRUE
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Empty Frames</h3>
|
||||
* For an empty container frame the following must be true:
|
||||
* <ul>
|
||||
* <li>mFirstContentOffset must be equal to the NextContentOffset() of the first
|
||||
* non-empty prev-in-flow
|
||||
* <li>mChildCount must be 0
|
||||
* </ul>
|
||||
*
|
||||
* The value of mLastContentOffset and mLastContentIsComplete are <i>undefined</i>
|
||||
* for an empty frame.
|
||||
*
|
||||
* <h3>Next-In-Flow List</h3>
|
||||
* The rule is that if a container frame is not complete then the mFirstContentOffset,
|
||||
* mLastContentOffset, and mLastContentIsComplete of its next-in-flow frames must
|
||||
* <b>always</b> correct. This means that whenever you push/pull child frames from a
|
||||
* next-in-flow you <b>must</b> update that next-in-flow's state so that it is
|
||||
* consistent with the aforementioned rules for empty and non-empty frames.
|
||||
*
|
||||
* <h3>Pulling-Up Frames</h3>
|
||||
* In the processing of pulling-up child frames from a next-in-flow it's possible
|
||||
* to pull-up all the child frames from a next-in-flow thereby leaving the next-in-flow
|
||||
* empty. There are two cases to consider:
|
||||
* <ol>
|
||||
* <li>All of the child frames from all of the next-in-flow have been pulled-up.
|
||||
* This means that all the next-in-flow frames are empty, the container being
|
||||
* reflowed is complete, and the next-in-flows will be deleted.
|
||||
*
|
||||
* In this case the next-in-flows' mFirstContentOffset is also undefined.
|
||||
* <li>Not all the child frames from all the next-in-flows have been pulled-up.
|
||||
* This means the next-in-flow consists of one or more empty frames followed
|
||||
* by one or more non-empty frames. Note that all the empty frames must be
|
||||
* consecutive. This means it is illegal to have an empty frame followed by
|
||||
* a non-empty frame, followed by an empty frame, followed by a non-empty frame.
|
||||
* </ol>
|
||||
*
|
||||
* <h3>Pseudo-Frames</h3>
|
||||
* As stated above, when pulling/pushing child frames from/to a next-in-flow the
|
||||
* state of the next-in-flow must be updated.
|
||||
*
|
||||
* If the next-in-flow is a pseudo-frame then not only does the next-in-flow's state
|
||||
* need to be updated, but the state of its geometric parent must be updated as well.
|
||||
* See member function PropagateContentOffsets() for details.
|
||||
*
|
||||
* This rule is applied recursively, so if the next-in-flow's geometric parent is
|
||||
* also a pseudo-frame then its geometric parent must be updated.
|
||||
* Implementation of a container frame.
|
||||
*/
|
||||
class nsContainerFrame : public nsSplittableFrame
|
||||
{
|
||||
@ -138,13 +59,8 @@ public:
|
||||
// IndexOf() returns -1 if the frame is not in the child list.
|
||||
NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
|
||||
|
||||
// Returns true if this frame is being used a pseudo frame
|
||||
// XXX deprecated
|
||||
PRBool IsPseudoFrame() const;
|
||||
|
||||
// Debugging
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
|
||||
NS_IMETHOD ListTag(FILE* out = stdout) const;
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
/**
|
||||
|
@ -147,8 +147,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent)
|
||||
{
|
||||
NS_ASSERTION(!IsPseudoFrame(), "pseudos not supported here");
|
||||
|
||||
// Find the frame that precedes the deletion point
|
||||
nsHTMLContainerFrame* flow;
|
||||
nsIFrame* deadFrame;
|
||||
|
@ -50,6 +50,25 @@ NS_NewBodyFrame(nsIContent* aContent, nsIFrame* aParent, nsIFrame*& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX FIX ME...
|
||||
// Returns true if this frame is being used a pseudo frame
|
||||
PRBool nsBodyFrame::IsPseudoFrame() const
|
||||
{
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
if (nsnull != mGeometricParent) {
|
||||
nsIContent* parentContent;
|
||||
|
||||
mGeometricParent->GetContent(parentContent);
|
||||
if (parentContent == mContent) {
|
||||
result = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(parentContent);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsBodyFrame::nsBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame)
|
||||
: nsHTMLContainerFrame(aContent, aParentFrame)
|
||||
{
|
||||
|
@ -79,14 +79,6 @@ public:
|
||||
|
||||
NS_IMETHOD VerifyTree() const;
|
||||
|
||||
#if 0
|
||||
// nsContainerFrame
|
||||
virtual void PropagateContentOffsets(nsIFrame* aChild,
|
||||
PRInt32 aFirstContentOffset,
|
||||
PRInt32 aLastContentOffset,
|
||||
PRBool aLastContentIsComplete);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
PRBool mIsPseudoFrame;
|
||||
|
||||
@ -125,6 +117,9 @@ private:
|
||||
nsSize GetColumnAvailSpace(nsIPresContext* aPresContext,
|
||||
const nsMargin& aBorderPadding,
|
||||
const nsSize& aMaxSize);
|
||||
|
||||
// XXX FIX ME...
|
||||
PRBool IsPseudoFrame() const;
|
||||
};
|
||||
|
||||
#endif /* nsBodyFrame_h___ */
|
||||
|
@ -147,8 +147,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInParent)
|
||||
{
|
||||
NS_ASSERTION(!IsPseudoFrame(), "pseudos not supported here");
|
||||
|
||||
// Find the frame that precedes the deletion point
|
||||
nsHTMLContainerFrame* flow;
|
||||
nsIFrame* deadFrame;
|
||||
|
@ -2915,6 +2915,29 @@ PRBool nsTableFrame::IsNested(const nsReflowState& aReflowState, nsStylePosition
|
||||
return result;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsPseudoFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsIContent* content;
|
||||
nsIFrame* parentFrame;
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
aFrame->GetContent(content);
|
||||
aFrame->GetGeometricParent(parentFrame);
|
||||
if (nsnull != parentFrame) {
|
||||
nsIContent* parentContent;
|
||||
|
||||
parentFrame->GetContent(parentContent);
|
||||
if (parentContent == content) {
|
||||
result = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(parentContent);
|
||||
}
|
||||
|
||||
NS_RELEASE(content);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* helper method for getting the width of the table's containing block */
|
||||
nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -2935,7 +2958,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
|
||||
if (NS_OK==rv)
|
||||
{ // we found a block, see if it's really a table cell (which means we're a nested table)
|
||||
PRBool skipThisBlock=PR_FALSE;
|
||||
if (PR_TRUE==((nsContainerFrame*)block)->IsPseudoFrame())
|
||||
// XXX FIX ME...
|
||||
if (IsPseudoFrame(block))
|
||||
{
|
||||
const nsReflowState* parentRS = rs->parentReflowState;
|
||||
if (nsnull!=parentRS)
|
||||
|
@ -2915,6 +2915,29 @@ PRBool nsTableFrame::IsNested(const nsReflowState& aReflowState, nsStylePosition
|
||||
return result;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsPseudoFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsIContent* content;
|
||||
nsIFrame* parentFrame;
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
aFrame->GetContent(content);
|
||||
aFrame->GetGeometricParent(parentFrame);
|
||||
if (nsnull != parentFrame) {
|
||||
nsIContent* parentContent;
|
||||
|
||||
parentFrame->GetContent(parentContent);
|
||||
if (parentContent == content) {
|
||||
result = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(parentContent);
|
||||
}
|
||||
|
||||
NS_RELEASE(content);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* helper method for getting the width of the table's containing block */
|
||||
nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
|
||||
{
|
||||
@ -2935,7 +2958,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsReflowState& aReflowState)
|
||||
if (NS_OK==rv)
|
||||
{ // we found a block, see if it's really a table cell (which means we're a nested table)
|
||||
PRBool skipThisBlock=PR_FALSE;
|
||||
if (PR_TRUE==((nsContainerFrame*)block)->IsPseudoFrame())
|
||||
// XXX FIX ME...
|
||||
if (IsPseudoFrame(block))
|
||||
{
|
||||
const nsReflowState* parentRS = rs->parentReflowState;
|
||||
if (nsnull!=parentRS)
|
||||
|
Loading…
Reference in New Issue
Block a user