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); }
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; }
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()); }
void nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { if (aBuilder->IsForEventDelivery() && isDraggingThumb()) { // This is EVIL, we shouldn't be messing with event delivery just to get // thumb mouse drag events to arrive at the slider! aLists.Outlines()->AppendToTop(new (aBuilder) nsDisplayEventReceiver(aBuilder, this)); return; } nsBoxFrame::BuildDisplayList(aBuilder, aLists); }
void nsPlaceholderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { DO_GLOBAL_REFLOW_COUNT_DSP("nsPlaceholderFrame"); #ifdef DEBUG if (GetShowFrameBorders()) { aLists.Outlines()->AppendNewToTop( new (aBuilder) nsDisplayGeneric(aBuilder, this, PaintDebugPlaceholder, "DebugPlaceholder", nsDisplayItem::TYPE_DEBUG_PLACEHOLDER)); } #endif }
void nsSplitterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { nsBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); // if the mouse is captured always return us as the frame. if (mInner->mDragging) { // XXX It's probably better not to check visibility here, right? aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayEventReceiver(aBuilder, this)); return; } }
void nsSelectsAreaFrame::BuildDisplayListInternal(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { nsBlockFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); nsListControlFrame* listFrame = GetEnclosingListFrame(this); if (listFrame && listFrame->IsFocused()) { // we can't just associate the display item with the list frame, // because then the list's scrollframe won't clip it (the scrollframe // only clips contained descendants). aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayListFocus(aBuilder, this)); } }
NS_IMETHODIMP nsPlaceholderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { DO_GLOBAL_REFLOW_COUNT_DSP("nsPlaceholderFrame"); #ifdef DEBUG if (!GetShowFrameBorders()) return NS_OK; return aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayGeneric(this, PaintDebugPlaceholder, "DebugPlaceholder")); #else // DEBUG return NS_OK; #endif // DEBUG }
NS_IMETHODIMP nsSplitterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { nsresult rv = nsBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); NS_ENSURE_SUCCESS(rv, rv); // if the mouse is captured always return us as the frame. if (mInner->mDragging) { // XXX It's probably better not to check visibility here, right? return aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayEventReceiver(aBuilder, this)); } return NS_OK; }
void nsFrame::PrintDisplayListSet(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aSet, std::stringstream& aStream, bool aDumpHtml) { if (aDumpHtml) { aStream << "<ul>"; } PrintDisplayListSetItem(aBuilder, "[BorderBackground]", *(aSet.BorderBackground()), aStream, aDumpHtml); PrintDisplayListSetItem(aBuilder, "[BlockBorderBackgrounds]", *(aSet.BlockBorderBackgrounds()), aStream, aDumpHtml); PrintDisplayListSetItem(aBuilder, "[Floats]", *(aSet.Floats()), aStream, aDumpHtml); PrintDisplayListSetItem(aBuilder, "[PositionedDescendants]", *(aSet.PositionedDescendants()), aStream, aDumpHtml); PrintDisplayListSetItem(aBuilder, "[Outlines]", *(aSet.Outlines()), aStream, aDumpHtml); PrintDisplayListSetItem(aBuilder, "[Content]", *(aSet.Content()), aStream, aDumpHtml); if (aDumpHtml) { aStream << "</ul>"; } }
nsresult nsDisplayWrapper::WrapListsInPlace(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsDisplayListSet& aLists) { nsresult rv; if (WrapBorderBackground()) { // Our border-backgrounds are in-flow rv = WrapDisplayList(aBuilder, aFrame, aLists.BorderBackground(), this); NS_ENSURE_SUCCESS(rv, rv); } // Our block border-backgrounds are in-flow rv = WrapDisplayList(aBuilder, aFrame, aLists.BlockBorderBackgrounds(), this); NS_ENSURE_SUCCESS(rv, rv); // The floats are not in flow rv = WrapEachDisplayItem(aBuilder, aLists.Floats(), this); NS_ENSURE_SUCCESS(rv, rv); // Our child content is in flow rv = WrapDisplayList(aBuilder, aFrame, aLists.Content(), this); NS_ENSURE_SUCCESS(rv, rv); // The positioned descendants may not be in-flow rv = WrapEachDisplayItem(aBuilder, aLists.PositionedDescendants(), this); NS_ENSURE_SUCCESS(rv, rv); // The outlines may not be in-flow return WrapEachDisplayItem(aBuilder, aLists.Outlines(), this); }
void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aDirtyRect, aLists); } // Force a background to be shown. We may have a background propagated to us, // in which case StyleBackground wouldn't have the right background // and the code in nsFrame::DisplayBorderBackgroundOutline might not give us // a background. // We don't have any border or outline, and our background draws over // the overflow area, so just add nsDisplayCanvasBackground instead of // calling DisplayBorderBackgroundOutline. if (IsVisibleForPainting(aBuilder)) { nsStyleContext* bgSC; const nsStyleBackground* bg = nullptr; bool isThemed = IsThemed(); if (!isThemed && nsCSSRendering::FindBackground(this, &bgSC)) { bg = bgSC->StyleBackground(); } aLists.BorderBackground()->AppendNewToTop( new (aBuilder) nsDisplayCanvasBackgroundColor(aBuilder, this)); if (isThemed) { aLists.BorderBackground()->AppendNewToTop( new (aBuilder) nsDisplayCanvasThemedBackground(aBuilder, this)); return; } if (!bg) { return; } // Create separate items for each background layer. NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) { if (bg->mLayers[i].mImage.IsEmpty()) { continue; } aLists.BorderBackground()->AppendNewToTop( new (aBuilder) nsDisplayCanvasBackgroundImage(aBuilder, this, i, bg)); } } nsIFrame* kid; for (kid = GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) { // Put our child into its own pseudo-stack. BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); } #ifdef DEBUG_CANVAS_FOCUS nsCOMPtr<nsIContent> focusContent; aPresContext->EventStateManager()-> GetFocusedContent(getter_AddRefs(focusContent)); bool hasFocus = false; nsCOMPtr<nsISupports> container; aPresContext->GetContainer(getter_AddRefs(container)); nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container)); if (docShell) { docShell->GetHasFocus(&hasFocus); printf("%p - nsCanvasFrame::Paint R:%d,%d,%d,%d DR: %d,%d,%d,%d\n", this, mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); } printf("%p - Focus: %s c: %p DoPaint:%s\n", docShell.get(), hasFocus?"Y":"N", focusContent.get(), mDoPaintFocus?"Y":"N"); #endif if (!mDoPaintFocus) return; // Only paint the focus if we're visible if (!StyleVisibility()->IsVisible()) return; aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayCanvasFocus(aBuilder, this)); }
void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aDirtyRect, aLists); } // Force a background to be shown. We may have a background propagated to us, // in which case StyleBackground wouldn't have the right background // and the code in nsFrame::DisplayBorderBackgroundOutline might not give us // a background. // We don't have any border or outline, and our background draws over // the overflow area, so just add nsDisplayCanvasBackground instead of // calling DisplayBorderBackgroundOutline. if (IsVisibleForPainting(aBuilder)) { nsStyleContext* bgSC; const nsStyleBackground* bg = nullptr; bool isThemed = IsThemed(); if (!isThemed && nsCSSRendering::FindBackground(this, &bgSC)) { bg = bgSC->StyleBackground(); } aLists.BorderBackground()->AppendNewToTop( new (aBuilder) nsDisplayCanvasBackgroundColor(aBuilder, this)); if (isThemed) { aLists.BorderBackground()->AppendNewToTop( new (aBuilder) nsDisplayCanvasThemedBackground(aBuilder, this)); return; } if (!bg) { return; } const DisplayItemScrollClip* scrollClip = aBuilder->ClipState().GetCurrentInnermostScrollClip(); bool needBlendContainer = false; // Create separate items for each background layer. const nsStyleImageLayers& layers = bg->mImage; NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, layers) { if (layers.mLayers[i].mImage.IsEmpty()) { continue; } if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) { needBlendContainer = true; } nsDisplayList thisItemList; nsDisplayCanvasBackgroundImage* bgItem = new (aBuilder) nsDisplayCanvasBackgroundImage(aBuilder, this, i, bg); if (bgItem->ShouldFixToViewport(aBuilder)) { thisItemList.AppendNewToTop( nsDisplayFixedPosition::CreateForFixedBackground(aBuilder, this, bgItem, i)); } else { thisItemList.AppendNewToTop(bgItem); } if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) { thisItemList.AppendNewToTop( new (aBuilder) nsDisplayBlendMode(aBuilder, this, &thisItemList, layers.mLayers[i].mBlendMode, scrollClip, i + 1)); } aLists.BorderBackground()->AppendToTop(&thisItemList); } if (needBlendContainer) { aLists.BorderBackground()->AppendNewToTop( nsDisplayBlendContainer::CreateForBackgroundBlendMode(aBuilder, this, aLists.BorderBackground(), scrollClip)); } } for (nsIFrame* kid : PrincipalChildList()) { // Put our child into its own pseudo-stack. BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); } #ifdef DEBUG_CANVAS_FOCUS nsCOMPtr<nsIContent> focusContent; aPresContext->EventStateManager()-> GetFocusedContent(getter_AddRefs(focusContent)); bool hasFocus = false; nsCOMPtr<nsISupports> container; aPresContext->GetContainer(getter_AddRefs(container)); nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container)); if (docShell) { docShell->GetHasFocus(&hasFocus); printf("%p - nsCanvasFrame::Paint R:%d,%d,%d,%d DR: %d,%d,%d,%d\n", this, mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); } printf("%p - Focus: %s c: %p DoPaint:%s\n", docShell.get(), hasFocus?"Y":"N", focusContent.get(), mDoPaintFocus?"Y":"N"); #endif if (!mDoPaintFocus) return; // Only paint the focus if we're visible if (!StyleVisibility()->IsVisible()) return; aLists.Outlines()->AppendNewToTop(new (aBuilder) nsDisplayCanvasFocus(aBuilder, this)); }