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); }
NS_IMETHODIMP nsInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { nsresult rv = nsHTMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); NS_ENSURE_SUCCESS(rv, rv); // The sole purpose of this is to trigger display of the selection // window for Named Anchors, which don't have any children and // normally don't have any size, but in Editor we use CSS to display // an image to represent this "hidden" element. if (!mFrames.FirstChild()) { rv = DisplaySelectionOverlay(aBuilder, aLists); } return rv; }
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()); }
NS_IMETHODIMP nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { nsDisplayList onTop; if (IsVisibleForPainting(aBuilder)) { nsresult rv = mRenderer.DisplayButton(aBuilder, aLists.BorderBackground(), &onTop); NS_ENSURE_SUCCESS(rv, rv); } nsDisplayListCollection set; // Do not allow the child subtree to receive events. if (!aBuilder->IsForEventDelivery()) { nsresult rv = BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), aDirtyRect, set, DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT); NS_ENSURE_SUCCESS(rv, rv); // That should put the display items in set.Content() } // Put the foreground outline and focus rects on top of the children set.Content()->AppendToTop(&onTop); // clips to our padding box for <input>s but not <button>s, unless // they have non-visible overflow.. if (IsInput() || GetStyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE) { nsMargin border = GetStyleBorder()->GetActualBorder(); nsRect rect(aBuilder->ToReferenceFrame(this), GetSize()); rect.Deflate(border); nsresult rv = OverflowClip(aBuilder, set, aLists, rect); NS_ENSURE_SUCCESS(rv, rv); } else { set.MoveTo(aLists); } nsresult rv = DisplayOutline(aBuilder, aLists); NS_ENSURE_SUCCESS(rv, rv); // to draw border when selected in editor return DisplaySelectionOverlay(aBuilder, aLists); }
NS_IMETHODIMP nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { // 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 = nsAreaFrame::BuildDisplayList(aBuilder, aDirtyRect, tempList); if (NS_FAILED(rv)) return rv; tempList.BorderBackground()->DeleteAll(); // Clip height only nsRect clipRect(aBuilder->ToReferenceFrame(this), GetSize()); clipRect.width = GetOverflowRect().XMost(); rv = OverflowClip(aBuilder, tempList, aLists, clipRect); 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 // REVIEW: I'm not sure why we do this, but that's what nsFileControlFrame:: // GetFrameForPoint was doing if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled) && IsVisibleForPainting(aBuilder)) { nsDisplayItem* item = new (aBuilder) nsDisplayEventReceiver(this); if (!item) return NS_ERROR_OUT_OF_MEMORY; aLists.Content()->AppendToTop(item); } return DisplaySelectionOverlay(aBuilder, aLists); }