本文整理汇总了C++中nsIFrame::GetStateBits方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIFrame::GetStateBits方法的具体用法?C++ nsIFrame::GetStateBits怎么用?C++ nsIFrame::GetStateBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIFrame
的用法示例。
在下文中一共展示了nsIFrame::GetStateBits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
nsSplitterFrameInner::EnsureOrient()
{
bool isHorizontal = !(mParentBox->GetStateBits() & NS_STATE_IS_HORIZONTAL);
if (isHorizontal)
mOuter->mState |= NS_STATE_IS_HORIZONTAL;
else
mOuter->mState &= ~NS_STATE_IS_HORIZONTAL;
}
示例2: savedMatrix
bool
PaintFrameCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)
return false;
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
nsRenderingContext context;
context.Init(mFrame->PresContext()->DeviceContext(), aContext);
aContext->Save();
// Clip to aFillRect so that we don't paint outside.
aContext->NewPath();
aContext->Rectangle(aFillRect);
aContext->Clip();
gfxMatrix savedMatrix(aContext->CurrentMatrix());
aContext->Multiply(gfxMatrix(aTransform).Invert());
// nsLayoutUtils::PaintFrame will anchor its painting at mFrame. But we want
// to have it anchored at the top left corner of the bounding box of all of
// mFrame's continuations. So we add a translation transform.
nsRect bbox = nsSVGIntegrationUtils::GetNonSVGUserSpace(mFrame);
PRInt32 appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
gfxPoint offset = gfxPoint(bbox.x, bbox.y) / appUnitsPerDevPixel;
aContext->Multiply(gfxMatrix().Translate(-offset));
gfxSize paintServerSize =
gfxSize(mPaintServerSize.width, mPaintServerSize.height) /
mFrame->PresContext()->AppUnitsPerDevPixel();
// nsLayoutUtils::PaintFrame wants to render with paintServerSize, but we
// want it to render with mRenderSize, so we need to set up a scale transform.
gfxFloat scaleX = mRenderSize.width / paintServerSize.width;
gfxFloat scaleY = mRenderSize.height / paintServerSize.height;
gfxMatrix scaleMatrix = gfxMatrix().Scale(scaleX, scaleY);
aContext->Multiply(scaleMatrix);
// Draw.
nsRect dirty(bbox.x, bbox.y, mPaintServerSize.width, mPaintServerSize.height);
nsLayoutUtils::PaintFrame(&context, mFrame,
dirty, NS_RGBA(0, 0, 0, 0),
nsLayoutUtils::PAINT_IN_TRANSFORM |
nsLayoutUtils::PAINT_ALL_CONTINUATIONS);
aContext->SetMatrix(savedMatrix);
aContext->Restore();
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
return true;
}
示例3: dirty
bool
PaintFrameCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const Filter& aFilter,
const gfxMatrix& aTransform)
{
if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)
return false;
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
aContext->Save();
// Clip to aFillRect so that we don't paint outside.
aContext->NewPath();
aContext->Rectangle(aFillRect);
aContext->Clip();
gfxMatrix invmatrix = aTransform;
if (!invmatrix.Invert()) {
return false;
}
aContext->Multiply(invmatrix);
// nsLayoutUtils::PaintFrame will anchor its painting at mFrame. But we want
// to have it anchored at the top left corner of the bounding box of all of
// mFrame's continuations. So we add a translation transform.
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
nsPoint offset = GetOffsetToBoundingBox(mFrame);
gfxPoint devPxOffset = gfxPoint(offset.x, offset.y) / appUnitsPerDevPixel;
aContext->Multiply(gfxMatrix::Translation(devPxOffset));
gfxSize paintServerSize =
gfxSize(mPaintServerSize.width, mPaintServerSize.height) /
mFrame->PresContext()->AppUnitsPerDevPixel();
// nsLayoutUtils::PaintFrame wants to render with paintServerSize, but we
// want it to render with mRenderSize, so we need to set up a scale transform.
gfxFloat scaleX = mRenderSize.width / paintServerSize.width;
gfxFloat scaleY = mRenderSize.height / paintServerSize.height;
aContext->Multiply(gfxMatrix::Scaling(scaleX, scaleY));
// Draw.
nsRect dirty(-offset.x, -offset.y,
mPaintServerSize.width, mPaintServerSize.height);
uint32_t flags = nsLayoutUtils::PAINT_IN_TRANSFORM;
if (mFlags & nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) {
flags |= nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES;
}
nsRenderingContext context(aContext);
nsLayoutUtils::PaintFrame(&context, mFrame,
dirty, NS_RGBA(0, 0, 0, 0),
flags);
nsIFrame* currentFrame = mFrame;
while ((currentFrame = currentFrame->GetNextContinuation()) != nullptr) {
offset = currentFrame->GetOffsetToCrossDoc(mFrame);
devPxOffset = gfxPoint(offset.x, offset.y) / appUnitsPerDevPixel;
aContext->Save();
aContext->Multiply(gfxMatrix::Scaling(1/scaleX, 1/scaleY));
aContext->Multiply(gfxMatrix::Translation(devPxOffset));
aContext->Multiply(gfxMatrix::Scaling(scaleX, scaleY));
nsLayoutUtils::PaintFrame(&context, currentFrame,
dirty - offset, NS_RGBA(0, 0, 0, 0),
flags);
aContext->Restore();
}
aContext->Restore();
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
return true;
}
示例4: autoSpaceManager
NS_IMETHODIMP
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame", aReflowState.reason);
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;
// Should we create a space manager?
nsAutoSpaceManager autoSpaceManager(NS_CONST_CAST(nsHTMLReflowState &, aReflowState));
// XXXldb If we start storing the space manager in the frame rather
// than keeping it around only during reflow then we should create it
// only when there are actually floats to manage. Otherwise things
// like tables will gain significant bloat.
if (NS_BLOCK_SPACE_MGR & mState)
autoSpaceManager.CreateSpaceManagerFor(aPresContext, this);
//------------ Handle Incremental Reflow -----------------
PRBool reflowContent = PR_TRUE;
PRBool reflowLegend = PR_TRUE;
nsReflowReason reason = aReflowState.reason;
if (reason == eReflowReason_Incremental) {
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
// See if it's targeted at us
if (command) {
nsReflowType reflowType;
command->GetType(reflowType);
switch (reflowType) {
case eReflowType_StyleChanged:
reason = eReflowReason_StyleChange;
break;
case eReflowType_ReflowDirty:
reason = eReflowReason_Dirty;
break;
default:
NS_ERROR("Unexpected Reflow Type");
}
} else {
reflowContent = PR_FALSE;
reflowLegend = PR_FALSE;
nsReflowPath::iterator iter = aReflowState.path->FirstChild();
nsReflowPath::iterator end = aReflowState.path->EndChildren();
for ( ; iter != end; ++iter) {
if (*iter == mLegendFrame)
reflowLegend = PR_TRUE;
else if (*iter == mContentFrame)
reflowContent = PR_TRUE;
}
}
}
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
reflowLegend = PR_TRUE;
reflowContent = PR_TRUE;
} else if (reason == eReflowReason_Dirty) {
// if dirty then check dirty flags
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
reflowLegend = PR_TRUE;
reflowContent = PR_TRUE;
} else {
if (reflowContent) {
reflowContent = mContentFrame ?
(mContentFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0 : PR_FALSE;
}
if (reflowLegend) {
reflowLegend = mLegendFrame ?
(mLegendFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0 : PR_FALSE;
}
}
}
// availSize could have unconstrained values, don't perform any addition on them
nsSize availSize(aReflowState.mComputedWidth, aReflowState.availableHeight);
// get our border and padding
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
const nsMargin &padding = aReflowState.mComputedPadding;
nsMargin border = borderPadding - padding;
if (aDesiredSize.mComputeMEW) {
aDesiredSize.mMaxElementWidth = borderPadding.left + borderPadding.right;
}
// Figure out how big the legend is if there is one.
//.........这里部分代码省略.........