本文整理汇总了C++中nsDisplayListSet::Content方法的典型用法代码示例。如果您正苦于以下问题:C++ nsDisplayListSet::Content方法的具体用法?C++ nsDisplayListSet::Content怎么用?C++ nsDisplayListSet::Content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsDisplayListSet
的用法示例。
在下文中一共展示了nsDisplayListSet::Content方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nsDisplayGeneric
//------------------------------------------------------------
NS_IMETHODIMP
nsGfxCheckboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
NS_ENSURE_SUCCESS(rv, rv);
// Get current checked state through content model.
if (!GetCheckboxState() || !IsVisibleForPainting(aBuilder))
return NS_OK; // we're not checked or not visible, nothing to paint.
if (IsThemed())
return NS_OK; // No need to paint the checkmark. The theme will do it.
// Paint the checkmark
if (mCheckButtonFaceStyle) {
// This code actually works now; not sure how useful it'll be
// (The putpose is to allow the UA stylesheet can substitute its own
// checkmark for the default one)
const nsStyleBackground* myBackground = mCheckButtonFaceStyle->GetStyleBackground();
if (!myBackground->IsTransparent())
return aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayGeneric(this, PaintCheckMarkFromStyle, "CheckMarkFromStyle"));
}
return aLists.Content()->AppendNewToTop(new (aBuilder) nsDisplayCheckMark(this));
}
示例2: set
void
nsRangeFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (IsThemed()) {
DisplayBorderBackgroundOutline(aBuilder, aLists);
// Only create items for the thumb. Specifically, we do not want
// the track to paint, since *our* background is used to paint
// the track, and we don't want the unthemed track painting over
// the top of the themed track.
// This logic is copied from
// nsContainerFrame::BuildDisplayListForNonBlockChildren as
// called by BuildDisplayListForInline.
nsIFrame* thumb = mThumbDiv->GetPrimaryFrame();
if (thumb) {
nsDisplayListSet set(aLists, aLists.Content());
BuildDisplayListForChild(aBuilder, thumb, aDirtyRect, set, DISPLAY_CHILD_INLINE);
}
} else {
BuildDisplayListForInline(aBuilder, aDirtyRect, aLists);
}
// Draw a focus outline if appropriate:
if (!aBuilder->IsForPainting() ||
!IsVisibleForPainting(aBuilder)) {
// we don't want the focus ring item for hit-testing or if the item isn't
// in the area being [re]painted
return;
}
EventStates eventStates = mContent->AsElement()->State();
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) ||
!eventStates.HasState(NS_EVENT_STATE_FOCUSRING)) {
return; // can't have focus or doesn't match :-moz-focusring
}
if (!mOuterFocusStyle ||
!mOuterFocusStyle->StyleBorder()->HasBorder()) {
// no ::-moz-focus-outer specified border (how style specifies a focus ring
// for range)
return;
}
const nsStyleDisplay *disp = StyleDisplay();
if (IsThemed(disp) &&
PresContext()->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
return; // the native theme displays its own visual indication of focus
}
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayRangeFocusRing(aBuilder, this));
}
示例3: GetRootLayer
NS_IMETHODIMP
RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsSubDocumentFrame* aFrame,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
// We're the subdoc for <browser remote="true"> and it has
// painted content. Display its shadow layer tree.
nsDisplayList shadowTree;
ContainerLayer* container = GetRootLayer();
if (aBuilder->IsForEventDelivery() && container) {
nsRect bounds = aFrame->EnsureInnerView()->GetBounds();
ViewTransform offset =
ViewTransform(GetRootFrameOffset(aFrame, aBuilder), 1, 1);
BuildListForLayer(container, mFrameLoader, offset,
aBuilder, shadowTree, aFrame);
} else {
shadowTree.AppendToTop(
new (aBuilder) nsDisplayRemote(aBuilder, aFrame, this));
}
// Clip the shadow layers to subdoc bounds
nsPoint offset = aFrame->GetOffsetToCrossDoc(aBuilder->ReferenceFrame());
nsRect bounds = aFrame->EnsureInnerView()->GetBounds() + offset;
return aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayClip(aBuilder, aFrame, &shadowTree,
bounds));
}
示例4: childLists
void
nsGridContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
DisplayBorderBackgroundOutline(aBuilder, aLists);
// Our children are all grid-level boxes, which behave the same as
// inline-blocks in painting, so their borders/backgrounds all go on
// the BlockBorderBackgrounds list.
// Also, we capture positioned descendants so we can sort them by
// CSS 'order'.
nsDisplayList positionedDescendants;
nsDisplayListSet childLists(aLists.BlockBorderBackgrounds(),
aLists.BlockBorderBackgrounds(),
aLists.Floats(),
aLists.Content(),
&positionedDescendants,
aLists.Outlines());
typedef GridItemCSSOrderIterator::OrderState OrderState;
OrderState order = mIsNormalFlowInCSSOrder ? OrderState::eKnownOrdered
: OrderState::eKnownUnordered;
GridItemCSSOrderIterator iter(this, kPrincipalList, order);
for (; !iter.AtEnd(); iter.Next()) {
nsIFrame* child = *iter;
BuildDisplayListForChild(aBuilder, child, aDirtyRect, childLists,
::GetDisplayFlagsForGridItem(child));
}
positionedDescendants.SortByCSSOrder(aBuilder);
aLists.PositionedDescendants()->AppendToTop(&positionedDescendants);
}
示例5: WrapLists
nsresult nsDisplayWrapper::WrapLists(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, const nsDisplayListSet& aIn, const nsDisplayListSet& aOut)
{
nsresult rv = WrapListsInPlace(aBuilder, aFrame, aIn);
NS_ENSURE_SUCCESS(rv, rv);
if (&aOut == &aIn)
return NS_OK;
aOut.BorderBackground()->AppendToTop(aIn.BorderBackground());
aOut.BlockBorderBackgrounds()->AppendToTop(aIn.BlockBorderBackgrounds());
aOut.Floats()->AppendToTop(aIn.Floats());
aOut.Content()->AppendToTop(aIn.Content());
aOut.PositionedDescendants()->AppendToTop(aIn.PositionedDescendants());
aOut.Outlines()->AppendToTop(aIn.Outlines());
return NS_OK;
}
示例6: clipState
void
nsSimplePageSequenceFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
DisplayBorderBackgroundOutline(aBuilder, aLists);
nsDisplayList content;
{
// Clear clip state while we construct the children of the
// nsDisplayTransform, since they'll be in a different coordinate system.
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
clipState.Clear();
nsIFrame* child = GetFirstPrincipalChild();
nsRect dirty = aDirtyRect;
dirty.ScaleInverseRoundOut(PresContext()->GetPrintPreviewScale());
while (child) {
if (child->GetVisualOverflowRectRelativeToParent().Intersects(dirty)) {
child->BuildDisplayListForStackingContext(aBuilder,
dirty - child->GetPosition(), &content);
aBuilder->ResetMarkedFramesForDisplayList();
}
child = child->GetNextSibling();
}
}
content.AppendNewToTop(new (aBuilder)
nsDisplayTransform(aBuilder, this, &content, content.GetVisibleRect(),
::ComputePageSequenceTransform));
aLists.Content()->AppendToTop(&content);
}
示例7: new
NS_IMETHODIMP
nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsresult rv = nsLeafBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
NS_ENSURE_SUCCESS(rv, rv);
if ((0 == mRect.width) || (0 == mRect.height)) {
// Do not render when given a zero area. This avoids some useless
// scaling work while we wait for our image dimensions to arrive
// asynchronously.
return NS_OK;
}
if (!IsVisibleForPainting(aBuilder))
return NS_OK;
nsDisplayList list;
rv = list.AppendNewToTop(
new (aBuilder) nsDisplayXULImage(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);
CreateOwnLayerIfNeeded(aBuilder, &list);
aLists.Content()->AppendToTop(&list);
return NS_OK;
}
示例8: clip
void
nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsLeafBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
if ((0 == mRect.width) || (0 == mRect.height)) {
// Do not render when given a zero area. This avoids some useless
// scaling work while we wait for our image dimensions to arrive
// asynchronously.
return;
}
if (!IsVisibleForPainting(aBuilder))
return;
uint32_t clipFlags =
nsStyleUtil::ObjectPropsMightCauseOverflow(StylePosition()) ?
0 : DisplayListClipState::ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT;
DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox
clip(aBuilder, this, clipFlags);
nsDisplayList list;
list.AppendNewToTop(
new (aBuilder) nsDisplayXULImage(aBuilder, this));
CreateOwnLayerIfNeeded(aBuilder, &list);
aLists.Content()->AppendToTop(&list);
}
示例9: GetCurrentCheckState
NS_IMETHODIMP
nsGfxRadioControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect,
aLists);
NS_ENSURE_SUCCESS(rv, rv);
if (!IsVisibleForPainting(aBuilder))
return NS_OK;
if (IsThemed())
return NS_OK; // The theme will paint the check, if any.
bool checked = true;
GetCurrentCheckState(&checked); // Get check state from the content model
if (!checked)
return NS_OK;
return aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayGeneric(aBuilder, this, PaintCheckedRadioButton,
"CheckedRadioButton",
nsDisplayItem::TYPE_CHECKED_RADIOBUTTON));
}
示例10: DisplaySelectionOverlay
NS_IMETHODIMP
nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
#ifdef NOISY
printf("%p paint at (%d, %d, %d, %d)\n", this,
aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
#endif
if (aBuilder->IsForEventDelivery()) {
// Don't allow children to receive events.
// REVIEW: following old GetFrameForPoint
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
NS_ENSURE_SUCCESS(rv, rv);
} else {
// REVIEW: Our in-flow child frames are inline-level so they will paint in our
// content list, so we don't need to mess with layers.
nsresult rv = nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
NS_ENSURE_SUCCESS(rv, rv);
}
nsPresContext *presContext = PresContext();
const nsStyleDisplay *disp = GetStyleDisplay();
if ((!IsThemed(disp) ||
!presContext->GetTheme()->ThemeDrawsFocusForWidget(presContext, this, disp->mAppearance)) &&
mDisplayFrame && IsVisibleForPainting(aBuilder)) {
nsresult rv = aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayComboboxFocus(this));
NS_ENSURE_SUCCESS(rv, rv);
}
return DisplaySelectionOverlay(aBuilder, aLists);
}
示例11: set
// Only paint the selected child...
void
nsMathMLSelectedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
// Report an error if something wrong was found in this frame.
// We can't call nsDisplayMathMLError from here,
// so ask nsMathMLContainerFrame to do the work for us.
if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
return;
}
DisplayBorderBackgroundOutline(aBuilder, aLists);
nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) {
// Put the child's background directly onto the content list
nsDisplayListSet set(aLists, aLists.Content());
// The children should be in content order
BuildDisplayListForChild(aBuilder, childFrame, aDirtyRect, set);
}
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
// visual debug
DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
#endif
}
示例12: thumbRect
void
nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
// if we are too small to have a thumb don't paint it.
nsIFrame* thumb = nsBox::GetChildBox(this);
if (thumb) {
nsRect thumbRect(thumb->GetRect());
nsMargin m;
thumb->GetMargin(m);
thumbRect.Inflate(m);
nsRect crect;
GetClientRect(crect);
if (crect.width < thumbRect.width || crect.height < thumbRect.height)
return;
// If this scrollbar is the scrollbar of an actively scrolled scroll frame,
// layerize the scrollbar thumb, wrap it in its own ContainerLayer and
// attach scrolling information to it.
// We do this here and not in the thumb's nsBoxFrame::BuildDisplayList so
// that the event region that gets created for the thumb is included in
// the nsDisplayOwnLayer contents.
uint32_t flags = 0;
mozilla::layers::FrameMetrics::ViewID scrollTargetId =
mozilla::layers::FrameMetrics::NULL_SCROLL_ID;
aBuilder->GetScrollbarInfo(&scrollTargetId, &flags);
bool thumbGetsLayer = (scrollTargetId != layers::FrameMetrics::NULL_SCROLL_ID);
nsLayoutUtils::SetScrollbarThumbLayerization(thumb, thumbGetsLayer);
if (thumbGetsLayer) {
nsDisplayListCollection tempLists;
nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, tempLists);
// This is a bit of a hack. Collect up all descendant display items
// and merge them into a single Content() list.
nsDisplayList masterList;
masterList.AppendToTop(tempLists.BorderBackground());
masterList.AppendToTop(tempLists.BlockBorderBackgrounds());
masterList.AppendToTop(tempLists.Floats());
masterList.AppendToTop(tempLists.Content());
masterList.AppendToTop(tempLists.PositionedDescendants());
masterList.AppendToTop(tempLists.Outlines());
// Wrap the list to make it its own layer.
aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayOwnLayer(aBuilder, this, &masterList, flags, scrollTargetId,
GetThumbRatio()));
return;
}
}
nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
}
示例13: MoveTo
void nsDisplayListSet::MoveTo(const nsDisplayListSet& aDestination) const
{
aDestination.BorderBackground()->AppendToTop(BorderBackground());
aDestination.BlockBorderBackgrounds()->AppendToTop(BlockBorderBackgrounds());
aDestination.Floats()->AppendToTop(Floats());
aDestination.Content()->AppendToTop(Content());
aDestination.PositionedDescendants()->AppendToTop(PositionedDescendants());
aDestination.Outlines()->AppendToTop(Outlines());
}
示例14: clipRect
NS_IMETHODIMP
nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
// box-shadow
if (GetStyleBorder()->mBoxShadow) {
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBoxShadowOuter(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);
}
// Our background is inherited to the text input, and we don't really want to
// paint it or out padding and borders (which we never have anyway, per
// styles in forms.css) -- doing it just makes us look ugly in some cases and
// has no effect in others.
nsDisplayListCollection tempList;
nsresult rv = nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList);
if (NS_FAILED(rv))
return rv;
tempList.BorderBackground()->DeleteAll();
// Clip height only
nsRect clipRect(aBuilder->ToReferenceFrame(this), GetSize());
clipRect.width = GetVisualOverflowRect().XMost();
nscoord radii[8] = {0, 0, 0, 0, 0, 0, 0, 0};
rv = OverflowClip(aBuilder, tempList, aLists, clipRect, radii);
NS_ENSURE_SUCCESS(rv, rv);
// Disabled file controls don't pass mouse events to their children, so we
// put an invisible item in the display list above the children
// just to catch events
nsEventStates eventStates = mContent->AsElement()->State();
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) && IsVisibleForPainting(aBuilder)) {
rv = aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
if (NS_FAILED(rv))
return rv;
}
return DisplaySelectionOverlay(aBuilder, aLists.Content());
}
示例15: DisplayBorderBackgroundOutline
NS_IMETHODIMP
nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (!IsVisibleForPainting(aBuilder))
return NS_OK;
DO_GLOBAL_REFLOW_COUNT_DSP("nsVideoFrame");
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
NS_ENSURE_SUCCESS(rv, rv);
if (!ShouldDisplayPoster() && HasVideoData()) {
rv = aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayGeneric(this, ::PaintVideo, "Video"));
NS_ENSURE_SUCCESS(rv, rv);
}
// Add child frames to display list. We expect up to two children, an image
// frame for the poster, and the box frame for the video controls.
for (nsIFrame *child = mFrames.FirstChild();
child;
child = child->GetNextSibling()) {
if (child->GetType() == nsGkAtoms::imageFrame && ShouldDisplayPoster()) {
rv = child->BuildDisplayListForStackingContext(aBuilder,
aDirtyRect - child->GetOffsetTo(this),
aLists.Content());
NS_ENSURE_SUCCESS(rv,rv);
} else if (child->GetType() == nsGkAtoms::boxFrame) {
rv = child->BuildDisplayListForStackingContext(aBuilder,
aDirtyRect - child->GetOffsetTo(this),
aLists.Content());
NS_ENSURE_SUCCESS(rv,rv);
}
}
return NS_OK;
}