mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-13 07:24:47 +00:00
Added support methods to make bullet alignment better
This commit is contained in:
parent
c972607d82
commit
eb1ba95e39
@ -28,6 +28,7 @@
|
|||||||
#include "nsHTMLContainerFrame.h"
|
#include "nsHTMLContainerFrame.h"
|
||||||
#include "nsHTMLIIDs.h"
|
#include "nsHTMLIIDs.h"
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
|
#include "nsCRT.h"
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
#undef NOISY_VERTICAL_ALIGN
|
#undef NOISY_VERTICAL_ALIGN
|
||||||
@ -663,6 +664,53 @@ nsInlineReflow::PlaceFrame(nsHTMLReflowMetrics& aMetrics)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsInlineReflow::AddFrame(nsIFrame* aFrame, const nsHTMLReflowMetrics& aMetrics)
|
||||||
|
{
|
||||||
|
SetFrame(aFrame);
|
||||||
|
PerFrameData* pfd = mFrameDataBase + mFrameNum;
|
||||||
|
mFrameNum++;
|
||||||
|
pfd->mAscent = aMetrics.ascent;
|
||||||
|
pfd->mDescent = aMetrics.descent;
|
||||||
|
pfd->mMargin.SizeTo(0, 0, 0, 0);
|
||||||
|
aFrame->GetRect(pfd->mBounds);/* XXX not right, but its ok for now */
|
||||||
|
pfd->mCombinedArea = aMetrics.mCombinedArea;
|
||||||
|
pfd->mMaxElementSize.width = pfd->mBounds.width;
|
||||||
|
pfd->mMaxElementSize.height = pfd->mBounds.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsInlineReflow::RemoveFrame(nsIFrame* aFrame)
|
||||||
|
{
|
||||||
|
PerFrameData* pfd = mFrameDataBase;
|
||||||
|
PerFrameData* last = pfd + mFrameNum - 1;
|
||||||
|
while (pfd <= last) {
|
||||||
|
if (pfd->mFrame == aFrame) {
|
||||||
|
mFrameNum--;
|
||||||
|
if (pfd != last) {
|
||||||
|
// Slide down the other structs over the vacancy
|
||||||
|
nsCRT::memmove(pfd, pfd + 1, (last - pfd) * sizeof(PerFrameData));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pfd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
nsInlineReflow::IsZeroHeight() const
|
||||||
|
{
|
||||||
|
PerFrameData* pfd = mFrameDataBase;
|
||||||
|
PerFrameData* last = pfd + mFrameNum - 1;
|
||||||
|
while (pfd <= last) {
|
||||||
|
if (0 != pfd->mBounds.height) {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
pfd++;
|
||||||
|
}
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// XXX what about ebina's center vs. ncsa-center?
|
// XXX what about ebina's center vs. ncsa-center?
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -54,6 +54,14 @@ public:
|
|||||||
PRBool aIsAdjacentWithTop,
|
PRBool aIsAdjacentWithTop,
|
||||||
nsReflowStatus& aReflowStatus);
|
nsReflowStatus& aReflowStatus);
|
||||||
|
|
||||||
|
// Add frame into the reflow state as if this code reflowed it so
|
||||||
|
// that it can be manipulated by the vertical/horizontal,
|
||||||
|
// etc. alignment routines.
|
||||||
|
void AddFrame(nsIFrame* aFrame, const nsHTMLReflowMetrics& aMetrics);
|
||||||
|
|
||||||
|
// Take aFrame out of the list of frames to align
|
||||||
|
void RemoveFrame(nsIFrame* aFrame);
|
||||||
|
|
||||||
void VerticalAlignFrames(nsRect& aLineBox,
|
void VerticalAlignFrames(nsRect& aLineBox,
|
||||||
nscoord& aMaxAscent,
|
nscoord& aMaxAscent,
|
||||||
nscoord& aMaxDescent);
|
nscoord& aMaxDescent);
|
||||||
@ -89,6 +97,8 @@ public:
|
|||||||
return mRightEdge - mX;
|
return mRightEdge - mX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool IsZeroHeight() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult SetFrame(nsIFrame* aFrame);
|
nsresult SetFrame(nsIFrame* aFrame);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user