NS_IMETHODIMP nsLineIterator::GetLine(PRInt32 aLineNumber, nsIFrame** aFirstFrameOnLine, PRInt32* aNumFramesOnLine, nsRect& aLineBounds, PRUint32* aLineFlags) { NS_ENSURE_ARG_POINTER(aFirstFrameOnLine); NS_ENSURE_ARG_POINTER(aNumFramesOnLine); NS_ENSURE_ARG_POINTER(aLineFlags); if ((aLineNumber < 0) || (aLineNumber >= mNumLines)) { *aFirstFrameOnLine = nsnull; *aNumFramesOnLine = 0; aLineBounds.SetRect(0, 0, 0, 0); return NS_OK; } nsLineBox* line = mLines[aLineNumber]; *aFirstFrameOnLine = line->mFirstChild; *aNumFramesOnLine = line->GetChildCount(); aLineBounds = line->mBounds; PRUint32 flags = 0; if (line->IsBlock()) { flags |= NS_LINE_FLAG_IS_BLOCK; } else { if (line->HasBreakAfter()) flags |= NS_LINE_FLAG_ENDS_IN_BREAK; } *aLineFlags = flags; return NS_OK; }
NS_IMETHODIMP nsRenderingContextPh :: GetClipRect( nsRect &aRect, PRBool &aClipValid ) { PRInt32 x, y, w, h; if ( !mClipRegion ) return NS_ERROR_FAILURE; if( !mClipRegion->IsEmpty() ) { mClipRegion->GetBoundingBox( &x, &y, &w, &h ); aRect.SetRect( x, y, w, h ); aClipValid = PR_TRUE; } else { aRect.SetRect(0,0,0,0); aClipValid = PR_FALSE; } return NS_OK; }
nsresult nsDeviceContext::GetRect(nsRect &aRect) { if (IsPrinterContext()) { aRect.SetRect(0, 0, mWidth, mHeight); } else ComputeFullAreaUsingScreen ( &aRect ); return NS_OK; }
void CircleArea::GetRect(nsIFrame* aFrame, nsRect& aRect) { if (mNumCoords >= 3) { nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]); nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]); nscoord radius = nsPresContext::CSSPixelsToAppUnits(mCoords[2]); if (radius < 0) { return; } aRect.SetRect(x1 - radius, y1 - radius, x1 + radius, y1 + radius); } }
void RectArea::GetRect(nsIFrame* aFrame, nsRect& aRect) { if (mNumCoords >= 4) { nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]); nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]); nscoord x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[2]); nscoord y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[3]); NS_ASSERTION(x1 <= x2 && y1 <= y2, "Someone screwed up RectArea::ParseCoords"); aRect.SetRect(x1, y1, x2, y2); } }
void PolyArea::GetRect(nsIFrame* aFrame, nsRect& aRect) { if (mNumCoords >= 6) { nscoord x1, x2, y1, y2, xtmp, ytmp; x1 = x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]); y1 = y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]); for (PRInt32 i = 2; i < mNumCoords; i += 2) { xtmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i]); ytmp = nsPresContext::CSSPixelsToAppUnits(mCoords[i+1]); x1 = x1 < xtmp ? x1 : xtmp; y1 = y1 < ytmp ? y1 : ytmp; x2 = x2 > xtmp ? x2 : xtmp; y2 = y2 > ytmp ? y2 : ytmp; } aRect.SetRect(x1, y1, x2, y2); } }