本文整理汇总了C++中nsIFrame::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIFrame::GetPosition方法的具体用法?C++ nsIFrame::GetPosition怎么用?C++ nsIFrame::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIFrame
的用法示例。
在下文中一共展示了nsIFrame::GetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autoSpaceManager
//.........这里部分代码省略.........
aDesiredSize.mMaxElementWidth = 0;
aDesiredSize.mMaxElementWidth += borderPadding.left + borderPadding.right;
}
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
aDesiredSize.mMaximumWidth = kidDesiredSize.mMaximumWidth +
borderPadding.left + borderPadding.right;
}
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
} else {
// if we don't need to reflow just get the old size
contentRect = mContentFrame->GetRect();
const nsStyleMargin* marginStyle = mContentFrame->GetStyleMargin();
nsMargin m(0,0,0,0);
marginStyle->GetMargin(m);
contentRect.Inflate(m);
}
}
// use the computed width if the inner content does not fill it
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE &&
aReflowState.mComputedWidth > contentRect.width) {
contentRect.width = aReflowState.mComputedWidth;
}
if (mLegendFrame) {
// if the content rect is larger then the legend we can align the legend
if (contentRect.width > mLegendRect.width) {
PRInt32 align = ((nsLegendFrame*)mLegendFrame)->GetAlign();
switch(align) {
case NS_STYLE_TEXT_ALIGN_RIGHT:
mLegendRect.x = contentRect.width - mLegendRect.width + borderPadding.left;
break;
case NS_STYLE_TEXT_ALIGN_CENTER:
float p2t;
p2t = aPresContext->PixelsToTwips();
mLegendRect.x = NSIntPixelsToTwips((nscoord) NSToIntRound((float)(contentRect.width/2 - mLegendRect.width/2 + borderPadding.left) / p2t),p2t);
break;
}
} else {
//otherwise make place for the legend
contentRect.width = mLegendRect.width;
}
// place the legend
nsRect actualLegendRect(mLegendRect);
actualLegendRect.Deflate(legendMargin);
nsPoint curOrigin = mLegendFrame->GetPosition();
// only if the origin changed
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
mLegendFrame->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
nsContainerFrame::PositionFrameView(mLegendFrame);
// We need to recursively process the legend frame's
// children since we're moving the frame after Reflow.
nsContainerFrame::PositionChildViews(mLegendFrame);
}
}
// Return our size and our result
if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
aDesiredSize.height = mLegendSpace +
borderPadding.top +
contentRect.height +
borderPadding.bottom;
} else {
nscoord min = borderPadding.top + borderPadding.bottom + mLegendRect.height;
aDesiredSize.height = aReflowState.mComputedHeight + borderPadding.top + borderPadding.bottom;
if (aDesiredSize.height < min)
aDesiredSize.height = min;
}
aDesiredSize.width = contentRect.width + borderPadding.left + borderPadding.right;
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;
if (aDesiredSize.mComputeMEW) {
// if the legend is wider use it
if (aDesiredSize.mMaxElementWidth < mLegendRect.width + borderPadding.left + borderPadding.right)
aDesiredSize.mMaxElementWidth = mLegendRect.width + borderPadding.left + borderPadding.right;
}
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
// make the mMaximumWidth large enough if the legendframe determines the size
if ((aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) && mLegendFrame) {
aDesiredSize.mMaximumWidth = PR_MAX(aDesiredSize.mMaximumWidth, mLegendRect.width +
borderPadding.left + borderPadding.right);
}
if (mLegendFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mLegendFrame);
if (mContentFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mContentFrame);
FinishAndStoreOverflow(&aDesiredSize);
Invalidate(aDesiredSize.mOverflowArea);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}