mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 01:10:22 +00:00
Rework the way that bullets are detected; this fixes up the http://client/nova page
This commit is contained in:
parent
ff0a8181d6
commit
522095421c
@ -1961,12 +1961,22 @@ nsCSSBlockFrame::ReflowInlineFrame(nsCSSBlockReflowState& aState,
|
||||
aState.mY,
|
||||
aState.mCurrentBand.availSpace.width,
|
||||
aState.mCurrentBand.availSpace.height);
|
||||
// If we we are a list-item container and we are positioning the
|
||||
// first child on the line (which is true when !mInlineLayoutPrepared)
|
||||
// and it's the first line, and we are not a continuation, then
|
||||
// set the mIsBullet flag for the line layout code.
|
||||
if (aState.mLineLayout.mListPositionOutside &&
|
||||
(0 == aState.mLineLayout.mLineNumber) &&
|
||||
(nsnull == mPrevInFlow)) {
|
||||
aState.mInlineLayout.mIsBullet = PR_TRUE;
|
||||
}
|
||||
aState.mInlineLayoutPrepared = PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIFrame* nextInFlow;
|
||||
aReflowResult = aState.mInlineLayout.ReflowAndPlaceFrame(aFrame);
|
||||
aState.mInlineLayout.mIsBullet = PR_FALSE;
|
||||
if (IS_REFLOW_ERROR(aReflowResult)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ nsCSSInlineLayout::nsCSSInlineLayout(nsCSSLineLayout& aLineLayout,
|
||||
mContainerDisplay = (const nsStyleDisplay*)
|
||||
aContainerStyle->GetStyleData(eStyleStruct_Display);
|
||||
mDirection = mContainerDisplay->mDirection;
|
||||
mIsBullet = PR_FALSE;
|
||||
}
|
||||
|
||||
nsCSSInlineLayout::~nsCSSInlineLayout()
|
||||
@ -84,6 +85,7 @@ nsCSSInlineLayout::Prepare(PRBool aUnconstrainedWidth,
|
||||
PRBool aNoWrap,
|
||||
PRBool aComputeMaxElementSize)
|
||||
{
|
||||
mIsBullet = PR_FALSE;
|
||||
mFrameNum = 0;
|
||||
mUnconstrainedWidth = aUnconstrainedWidth;
|
||||
mNoWrap = aNoWrap;
|
||||
@ -292,36 +294,26 @@ nsCSSInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
|
||||
// Special case to position outside list bullets.
|
||||
// XXX RTL bullets
|
||||
PRBool isBullet = PR_FALSE;
|
||||
if (mLineLayout.mListPositionOutside) {
|
||||
PRBool isFirstChild = IsFirstChild();
|
||||
if (isFirstChild && (0 == mLineLayout.mLineNumber)) {
|
||||
nsIFrame* containerPrevInFlow;
|
||||
mContainerFrame->GetPrevInFlow(containerPrevInFlow);
|
||||
if (nsnull == containerPrevInFlow) {
|
||||
isBullet = PR_TRUE;
|
||||
// We are placing the first child of the container and we have
|
||||
// list-style-position of "outside" therefore this is the
|
||||
// bullet that is being reflowed. The bullet is placed in the
|
||||
// padding area of this block. Don't worry about getting the Y
|
||||
// coordinate of the bullet right (vertical alignment will
|
||||
// take care of that).
|
||||
if (mIsBullet) {
|
||||
// We are placing the first child of the container and we have
|
||||
// list-style-position of "outside" therefore this is the
|
||||
// bullet that is being reflowed. The bullet is placed in the
|
||||
// padding area of this block. Don't worry about getting the Y
|
||||
// coordinate of the bullet right (vertical alignment will
|
||||
// take care of that).
|
||||
|
||||
// Compute gap between bullet and inner rect left edge
|
||||
nsIFontMetrics* fm =
|
||||
mLineLayout.mPresContext->GetMetricsFor(mContainerFont->mFont);
|
||||
nscoord kidAscent = fm->GetMaxAscent();
|
||||
nscoord dx = fm->GetHeight() / 2; // from old layout engine
|
||||
NS_RELEASE(fm);
|
||||
// Compute gap between bullet and inner rect left edge
|
||||
nsIFontMetrics* fm =
|
||||
mLineLayout.mPresContext->GetMetricsFor(mContainerFont->mFont);
|
||||
nscoord kidAscent = fm->GetMaxAscent();
|
||||
nscoord dx = fm->GetHeight() / 2; // from old layout engine
|
||||
NS_RELEASE(fm);
|
||||
|
||||
// XXX RTL bullets
|
||||
aFrameRect.x = mX - aFrameRect.width - dx;
|
||||
aFrame->SetRect(aFrameRect);
|
||||
}
|
||||
}
|
||||
// XXX RTL bullets
|
||||
aFrameRect.x = mX - aFrameRect.width - dx;
|
||||
aFrame->SetRect(aFrameRect);
|
||||
}
|
||||
nscoord totalWidth = 0;
|
||||
if (!isBullet) {
|
||||
else {
|
||||
// Place normal in-flow child
|
||||
aFrame->SetRect(aFrameRect);
|
||||
|
||||
@ -345,8 +337,7 @@ nsCSSInlineLayout::PlaceFrame(nsIFrame* aFrame,
|
||||
horizontalMargins = aFrameMargin.left + aFrameMargin.right;
|
||||
break;
|
||||
}
|
||||
totalWidth = aFrameMetrics.width + horizontalMargins;
|
||||
mX += totalWidth;
|
||||
mX += aFrameMetrics.width + horizontalMargins;
|
||||
}
|
||||
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CHILD_REFLOW,
|
||||
|
@ -89,6 +89,7 @@ struct nsCSSInlineLayout {
|
||||
PRPackedBool mUnconstrainedWidth;
|
||||
PRPackedBool mNoWrap;
|
||||
PRPackedBool mComputeMaxElementSize;
|
||||
PRPackedBool mIsBullet;
|
||||
nscoord mAvailWidth;
|
||||
nscoord mAvailHeight;
|
||||
nscoord mX, mY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user