remove unused prescontext argument from GetOffsetFromView bug 276015 r/sr=dbaron

This commit is contained in:
bmlk%gmx.de 2004-12-26 19:48:54 +00:00
Родитель 9528772921
Коммит ef4604f958
32 изменённых файлов: 130 добавлений и 162 удалений

Просмотреть файл

@ -526,7 +526,7 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
nsPoint frameOffset;
nsIView *containingView = frame->GetViewExternal();
if (!containingView) {
frame->GetOffsetFromView(presContext, frameOffset, &containingView);
frame->GetOffsetFromView(frameOffset, &containingView);
if (!containingView)
return PR_FALSE; // no view -- not visible
relFrameRect.x = frameOffset.x;
@ -646,7 +646,7 @@ void nsAccessible::GetScreenOrigin(nsPresContext *aPresContext, nsIFrame *aFrame
nsPoint origin(0,0);
nsIView *view = aFrame->GetViewExternal();
if (!view) {
aFrame->GetOffsetFromView(aPresContext, origin, &view);
aFrame->GetOffsetFromView(origin, &view);
NS_ASSERTION(view, "Frame has no view");
}

Просмотреть файл

@ -289,7 +289,7 @@ nsHTMLImageElement::GetXY()
nsPoint origin(0, 0);
nsIView* parentView;
nsresult rv = frame->GetOffsetFromView(context, origin, &parentView);
nsresult rv = frame->GetOffsetFromView(origin, &parentView);
if (NS_FAILED(rv)) {
return point;
}

Просмотреть файл

@ -181,7 +181,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
}
// get view bounds in case this frame is being scrolled
nsRect rect = frame->GetRect();
nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame);
nsPoint origin = inLayoutUtils::GetClientOrigin(frame);
rect.MoveTo(origin);
mCSSUtils->AdjustRectForMargins(frame, rect);

Просмотреть файл

@ -129,12 +129,11 @@ inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
}
nsPoint
inLayoutUtils::GetClientOrigin(nsPresContext* aPresContext,
nsIFrame* aFrame)
inLayoutUtils::GetClientOrigin(nsIFrame* aFrame)
{
nsPoint result(0,0);
nsIView* view;
aFrame->GetOffsetFromView(aPresContext, result, &view);
aFrame->GetOffsetFromView(result, &view);
nsIView* rootView = nsnull;
if (view) {
nsIViewManager* viewManager = view->GetViewManager();

Просмотреть файл

@ -69,8 +69,7 @@ public:
* @param aPresContext the presentation context
* @return the offset
*/
static nsPoint GetClientOrigin(nsPresContext* aPresContext,
nsIFrame* aFrame);
static nsPoint GetClientOrigin(nsIFrame* aFrame);
static nsRect& GetScreenOrigin(nsIDOMElement* aElement);
};

Просмотреть файл

@ -2619,7 +2619,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
if (!aGetTopVisibleLeaf) {
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
frame->GetOffsetFromView(frameOffset, &containingView);
if (!containingView) {
// no view -- not visible
@ -2664,7 +2664,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
}
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
frame->GetOffsetFromView(frameOffset, &containingView);
if (containingView) {
relFrameRect.x = frameOffset.x;
relFrameRect.y = frameOffset.y;

Просмотреть файл

@ -361,7 +361,7 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
// we don't need drawingView anymore so reuse that; reset viewOffset values for our purposes
if (aRelativeToType == eClosestViewCoordinates)
{
theFrame->GetOffsetFromView(presContext, viewOffset, &drawingView);
theFrame->GetOffsetFromView(viewOffset, &drawingView);
if (outView)
*outView = drawingView;
}
@ -737,18 +737,14 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy
*outRelativeView = nsnull;
NS_ASSERTION(caretFrame, "Should have frame here");
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
if (!presShell)
return;
viewOffset.x = 0;
viewOffset.y = 0;
nsPoint withinViewOffset(0, 0);
// get the offset of this frame from its parent view (walks up frame hierarchy)
nsIView* theView = nsnull;
caretFrame->GetOffsetFromView(presShell->GetPresContext(),
withinViewOffset, &theView);
caretFrame->GetOffsetFromView(withinViewOffset, &theView);
if (theView == nsnull) return;
if (outRelativeView && coordType == eClosestViewCoordinates)

Просмотреть файл

@ -3254,7 +3254,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum)
// find offset from view
nsPoint pnt;
nsIView * view;
fndPageFrame->GetOffsetFromView(mPresContext, pnt, &view);
fndPageFrame->GetOffsetFromView(pnt, &view);
nscoord deadSpaceGap = 0;
nsIPageSequenceFrame * sqf;

Просмотреть файл

@ -4162,7 +4162,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
nsRect frameBounds = aFrame->GetRect();
nsPoint offset;
nsIView* closestView;
aFrame->GetOffsetFromView(mPresContext, offset, &closestView);
aFrame->GetOffsetFromView(offset, &closestView);
frameBounds.MoveTo(offset);
// If this is an inline frame and either the bounds height is 0 (quirks
@ -4198,7 +4198,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
lineBounds, &trash3))) {
nsPoint blockOffset;
nsIView* blockView;
frame->GetOffsetFromView(mPresContext, blockOffset, &blockView);
frame->GetOffsetFromView(blockOffset, &blockView);
if (blockView == closestView) {
// XXX If views not equal, this is hard. Do we want to bother?
@ -5781,8 +5781,7 @@ PresShell::HandleEvent(nsIView *aView,
mCurrentTargetRect = mCurrentEventFrame->GetRect();
mCurrentTargetView = mCurrentEventFrame->GetView();
if (!mCurrentTargetView ) {
mCurrentEventFrame->GetOffsetFromView(mPresContext, offset,
&mCurrentTargetView);
mCurrentEventFrame->GetOffsetFromView(offset, &mCurrentTargetView);
}
if (mCurrentTargetView) {
mCurrentTargetRect.x = offset.x;

Просмотреть файл

@ -894,7 +894,7 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsPresContext* aPresContext,
// Start with frame's offset from it it's containing view
nsIView *view = nsnull;
nsPoint frameOffset;
rv = aFrame->GetOffsetFromView(aPresContext, frameOffset, &view);
rv = aFrame->GetOffsetFromView(frameOffset, &view);
if (NS_SUCCEEDED(rv) && view) {
aAbsoluteTwipsRect.MoveTo(frameOffset);

Просмотреть файл

@ -261,7 +261,7 @@ nsImageControlFrame::HandleEvent(nsPresContext* aPresContext,
{
// Store click point for GetNamesValues
// Do this on MouseUp because the specs don't say and that's what IE does
TranslateEventCoords(aPresContext, aEvent->point, mLastClickPoint);
TranslateEventCoords(aEvent->point, mLastClickPoint);
break;
}
}

Просмотреть файл

@ -2735,7 +2735,6 @@ nsresult
nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
{
nsIScrollableView* scrollableView = GetScrollableView();
nsPresContext* presContext = GetPresContext();
if (scrollableView) {
// if null is passed in we scroll to 0,0
@ -2745,7 +2744,7 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
}
// otherwise we find the content's frame and scroll to it
nsIPresShell *presShell = presContext->PresShell();
nsIPresShell *presShell = GetPresContext()->PresShell();
nsIFrame * childframe;
nsresult result;
if (aOptElement) {
@ -2769,7 +2768,7 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
nsRect fRect = childframe->GetRect();
nsPoint pnt;
nsIView * view;
childframe->GetOffsetFromView(presContext, pnt, &view);
childframe->GetOffsetFromView(pnt, &view);
// This change for 33421 (remove this comment later)

Просмотреть файл

@ -6228,7 +6228,7 @@ nsBlockFrame::HandleEvent(nsPresContext* aPresContext,
while(NS_OK == result)
{ //we are starting aloop to allow us to "drill down to the one we want"
mainframe->GetOffsetFromView(aPresContext, origin, &parentWithView);
mainframe->GetOffsetFromView(origin, &parentWithView);
if (NS_FAILED(result))
return NS_OK;//do not handle

Просмотреть файл

@ -450,7 +450,7 @@ nsContainerFrame::PositionFrameView(nsPresContext* aPresContext,
nsIView* containingView;
nsPoint origin;
aKidFrame->GetOffsetFromView(aPresContext, origin, &containingView);
aKidFrame->GetOffsetFromView(origin, &containingView);
nsIViewManager* vm = view->GetViewManager();

Просмотреть файл

@ -1205,7 +1205,7 @@ ContentContainsPoint(nsPresContext *aPresContext,
// Get the view that contains the content's frame.
rv = frame->GetOffsetFromView(aPresContext, offsetPoint, &frameView);
rv = frame->GetOffsetFromView(offsetPoint, &frameView);
if (NS_FAILED(rv) || !frameView) return PR_FALSE;
@ -1283,7 +1283,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
nsRect frameRect = mRect;
nsPoint offsetPoint;
GetOffsetFromView(aPresContext, offsetPoint, &dummyView);
GetOffsetFromView(offsetPoint, &dummyView);
frameRect.x = offsetPoint.x;
frameRect.y = offsetPoint.y;
@ -1497,7 +1497,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// frame's parent view. Unfortunately, the only way to get
// the parent view is to call GetOffsetFromView().
GetOffsetFromView(aPresContext, dummyPoint, &view);
GetOffsetFromView(dummyPoint, &view);
// Now check to see if the point is truly within the bounds
// of any of the frames that make up the -moz-user-select:all subtree:
@ -1739,7 +1739,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
// Get the view that aEvent->point is relative to. This is disgusting.
nsPoint dummyPoint;
nsIView* eventView;
GetOffsetFromView(aPresContext, dummyPoint, &eventView);
GetOffsetFromView(dummyPoint, &eventView);
nsPoint pt = aEvent->point + eventView->GetOffsetTo(captureView);
frameselection->StartAutoScrollTimer(aPresContext, captureView, pt, 30);
}
@ -1920,7 +1920,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsPresContext* aCX,
nsPoint offsetPoint(0,0);
nsIView * kidView = nsnull;
kid->GetOffsetFromView(aCX, offsetPoint, &kidView);
kid->GetOffsetFromView(offsetPoint, &kidView);
nsRect rect = kid->GetRect();
rect.x = offsetPoint.x;
@ -1991,7 +1991,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsPresContext* aCX,
return NS_ERROR_NULL_POINTER;
nsPoint offsetPoint;
GetOffsetFromView(aCX, offsetPoint, &view);
GetOffsetFromView(offsetPoint, &view);
nsRect thisRect = GetRect();
thisRect.x = offsetPoint.x;
thisRect.y = offsetPoint.y;
@ -2329,9 +2329,8 @@ nsIntRect nsIFrame::GetScreenRect() const
// Returns the offset from this frame to the closest geometric parent that
// has a view. Also returns the containing view or null in case of error
NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPresContext* aPresContext,
nsPoint& aOffset,
nsIView** aView) const
NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset,
nsIView** aView) const
{
NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer");
nsIFrame* frame = (nsIFrame*)this;
@ -2384,7 +2383,7 @@ NS_IMETHODIMP nsFrame::GetOriginToViewOffset(nsPresContext* aPresContext,
nsIView *view = GetView();
nsIView *parentView = nsnull;
nsPoint offsetToParentView;
rv = GetOffsetFromView(aPresContext, offsetToParentView, &parentView);
rv = GetOffsetFromView(offsetToParentView, &parentView);
if (NS_SUCCEEDED(rv)) {
nsPoint viewOffsetFromParent(0,0);
@ -2503,7 +2502,7 @@ nsIFrame::Invalidate(const nsRect& aDamageRect,
nsPoint offset;
nsIView *view;
GetOffsetFromView(GetPresContext(), offset, &view);
GetOffsetFromView(offset, &view);
NS_ASSERTION(view, "no view");
rect += offset;
view->GetViewManager()->UpdateView(view, rect, flags);
@ -3207,7 +3206,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
}
nsPoint offset;
nsIView * view; //used for call of get offset from view
aBlockFrame->GetOffsetFromView(aPresContext, offset,&view);
aBlockFrame->GetOffsetFromView(offset,&view);
nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates!
#ifdef IBMBIDI
result = it->FindFrameAt(searchingLine, newDesiredX, aPresContext->BidiEnabled(), &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame);
@ -3245,7 +3244,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
nsRect tempRect = resultFrame->GetRect();
nsPoint offset;
nsIView * view; //used for call of get offset from view
result = resultFrame->GetOffsetFromView(aPresContext, offset, &view);
result = resultFrame->GetOffsetFromView(offset, &view);
if (NS_FAILED(result))
return result;
point.y = tempRect.height + offset.y;
@ -3600,8 +3599,7 @@ nsFrame::PeekOffsetParagraph(nsPresContext* aPresContext,
// Alas, this doesn't entirely work; it's blocked by some style changes.
static nsresult
DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount,
nsRect& aUsedRect,
nsPresContext* aPresContext, nsPeekOffsetStruct* aPos)
nsRect& aUsedRect, nsPeekOffsetStruct* aPos)
{
if (!aFrame)
return NS_ERROR_UNEXPECTED;
@ -3634,7 +3632,7 @@ DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount,
nsPoint offsetPoint; //used for offset of result frame
nsIView * view; //used for call of get offset from view
nextFrame->GetOffsetFromView(aPresContext, offsetPoint, &view);
nextFrame->GetOffsetFromView(offsetPoint, &view);
offsetPoint.x += 2* aUsedRect.width; //2* just to be sure we are off the edge
// This doesn't seem very efficient since GetPosition
@ -3886,7 +3884,7 @@ nsFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
nsPoint offsetPoint; //used for offset of result frame
nsIView * view; //used for call of get offset from view
firstFrame->GetOffsetFromView(aPresContext, offsetPoint, &view);
firstFrame->GetOffsetFromView(offsetPoint, &view);
offsetPoint.x = 0;//all the way to the left
result = firstFrame->GetContentAndOffsetsFromPoint(context,
@ -3908,7 +3906,7 @@ nsFrame::PeekOffset(nsPresContext* aPresContext, nsPeekOffsetStruct *aPos)
// to get the last offset in the last content represented
// by that frame.
return DrillDownToEndOfLine(firstFrame, thisLine, lineFrameCount,
usedRect, aPresContext, aPos);
usedRect, aPos);
}
return result;
}

Просмотреть файл

@ -243,7 +243,7 @@ public:
NS_IMETHOD SetPrevInFlow(nsIFrame*);
virtual nsIFrame* GetNextInFlow() const;
NS_IMETHOD SetNextInFlow(nsIFrame*);
NS_IMETHOD GetOffsetFromView(nsPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const;
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const;
NS_IMETHOD GetOriginToViewOffset(nsPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const;
virtual nsIAtom* GetType() const;
virtual PRBool IsContainingBlock() const;

Просмотреть файл

@ -1010,9 +1010,8 @@ public:
* Returns the offset from this frame to the closest geometric parent that
* has a view. Also returns the containing view or null in case of error
*/
NS_IMETHOD GetOffsetFromView(nsPresContext* aPresContext,
nsPoint& aOffset,
nsIView** aView) const = 0;
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset,
nsIView** aView) const = 0;
/**
* Returns the offset from this frame's upper left corner to the upper

Просмотреть файл

@ -911,16 +911,17 @@ nsImageFrame::GetDesiredSize(nsPresContext* aPresContext,
aDesiredSize.height = mComputedSize.height;
}
void
nsImageFrame::GetInnerArea(nsPresContext* aPresContext,
nsRect& aInnerArea) const
nsRect
nsImageFrame::GetInnerArea() const
{
aInnerArea.x = mBorderPadding.left;
aInnerArea.y = mPrevInFlow ? 0 : mBorderPadding.top;
aInnerArea.width = mRect.width - mBorderPadding.left - mBorderPadding.right;
aInnerArea.height = mRect.height -
nsRect r;
r.x = mBorderPadding.left;
r.y = mPrevInFlow ? 0 : mBorderPadding.top;
r.width = mRect.width - mBorderPadding.left - mBorderPadding.right;
r.height = mRect.height -
(mPrevInFlow ? 0 : mBorderPadding.top) -
(mNextInFlow ? 0 : mBorderPadding.bottom);
return r;
}
// get the offset into the content area of the image where aImg starts if it is a continuation.
@ -1177,8 +1178,7 @@ nsImageFrame::DisplayAltFeedback(nsPresContext* aPresContext,
imgIRequest* aRequest)
{
// Calculate the inner area
nsRect inner;
GetInnerArea(aPresContext, inner);
nsRect inner = GetInnerArea();
// Display a recessed one pixel border
nscoord borderEdgeWidth;
@ -1340,8 +1340,7 @@ nsImageFrame::Paint(nsPresContext* aPresContext,
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer && imgCon) {
// Render the image into our content area (the area inside
// the borders and padding)
nsRect inner;
GetInnerArea(aPresContext, inner);
nsRect inner = GetInnerArea();
nsRect paintArea(inner);
nscoord offsetY = 0;
@ -1398,8 +1397,7 @@ nsImageFrame::Paint(nsPresContext* aPresContext,
nsImageMap* map = GetImageMap(aPresContext);
if (nsnull != map) {
nsRect inner;
GetInnerArea(aPresContext, inner);
nsRect inner = GetInnerArea();
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
aRenderingContext.PushState();
@ -1413,8 +1411,7 @@ nsImageFrame::Paint(nsPresContext* aPresContext,
GetShowFrameBorders()) {
nsImageMap* map = GetImageMap(aPresContext);
if (nsnull != map) {
nsRect inner;
GetInnerArea(aPresContext, inner);
nsRect inner = GetInnerArea();
aRenderingContext.SetColor(NS_RGB(0, 0, 0));
aRenderingContext.PushState();
aRenderingContext.Translate(inner.x, inner.y);
@ -1573,9 +1570,8 @@ nsImageFrame::IsServerImageMap()
// view) into a localized pixel coordinate that is relative to the
// content area of this frame (inside the border+padding).
void
nsImageFrame::TranslateEventCoords(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsPoint& aResult)
nsImageFrame::TranslateEventCoords(const nsPoint& aPoint,
nsPoint& aResult)
{
nscoord x = aPoint.x;
nscoord y = aPoint.y;
@ -1586,7 +1582,7 @@ nsImageFrame::TranslateEventCoords(nsPresContext* aPresContext,
if (!HasView()) {
nsPoint offset;
nsIView *view;
GetOffsetFromView(aPresContext, offset, &view);
GetOffsetFromView(offset, &view);
if (nsnull != view) {
x -= offset.x;
y -= offset.y;
@ -1595,14 +1591,13 @@ nsImageFrame::TranslateEventCoords(nsPresContext* aPresContext,
// Subtract out border and padding here so that the coordinates are
// now relative to the content area of this frame.
nsRect inner;
GetInnerArea(aPresContext, inner);
nsRect inner = GetInnerArea();
x -= inner.x;
y -= inner.y;
// Translate the coordinates from twips to pixels
float t2p;
t2p = aPresContext->TwipsToPixels();
t2p = GetPresContext()->TwipsToPixels();
aResult.x = NSTwipsToIntPixels(x, t2p);
aResult.y = NSTwipsToIntPixels(y, t2p);
}
@ -1656,7 +1651,7 @@ nsImageFrame::GetContentForEvent(nsPresContext* aPresContext,
if (nsnull != map) {
nsPoint p;
TranslateEventCoords(aPresContext, aEvent->point, p);
TranslateEventCoords(aEvent->point, p);
PRBool inside = PR_FALSE;
nsCOMPtr<nsIContent> area;
inside = map->IsInside(p.x, p.y, getter_AddRefs(area));
@ -1689,7 +1684,7 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext,
PRBool isServerMap = IsServerImageMap();
if ((nsnull != map) || isServerMap) {
nsPoint p;
TranslateEventCoords(aPresContext, aEvent->point, p);
TranslateEventCoords(aEvent->point, p);
PRBool inside = PR_FALSE;
// Even though client-side image map triggering happens
// through content, we need to make sure we're not inside
@ -1747,7 +1742,7 @@ nsImageFrame::GetCursor(nsPresContext* aPresContext,
nsImageMap* map = GetImageMap(aPresContext);
if (nsnull != map) {
nsPoint p;
TranslateEventCoords(aPresContext, aPoint, p);
TranslateEventCoords(aPoint, p);
aCursor = NS_STYLE_CURSOR_DEFAULT;
if (map->IsInside(p.x, p.y)) {
// Use style defined cursor if one is provided, otherwise when
@ -1995,8 +1990,7 @@ void nsImageFrame::InvalidateIcon()
nsPresContext *presContext = GetPresContext();
float p2t = presContext->ScaledPixelsToTwips();
nsRect inner;
GetInnerArea(presContext, inner);
nsRect inner = GetInnerArea();
nsRect rect(inner.x,
inner.y,

Просмотреть файл

@ -163,8 +163,7 @@ protected:
PRBool IsServerImageMap();
void TranslateEventCoords(nsPresContext* aPresContext,
const nsPoint& aPoint,
void TranslateEventCoords(const nsPoint& aPoint,
nsPoint& aResult);
PRBool GetAnchorHREFAndTarget(nsIURI** aHref, nsString& aTarget);
@ -184,8 +183,7 @@ protected:
nsIRenderingContext& aRenderingContext,
imgIRequest* aRequest);
void GetInnerArea(nsPresContext* aPresContext,
nsRect& aInnerArea) const;
nsRect GetInnerArea() const;
protected:
friend class nsImageListener;

Просмотреть файл

@ -386,7 +386,7 @@ static void ConvertTwipsToPixels(nsPresContext& aPresContext, nsRect& aTwipsRect
#ifdef DO_DIRTY_INTERSECT
// convert relative coordinates to absolute
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame, nsPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs, nsIWidget *&aContainerWidget);
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame, nsPoint& aRel, nsPoint& aAbs, nsIWidget *&aContainerWidget);
#endif
enum { ePluginPaintIgnore, ePluginPaintEnable, ePluginPaintDisable };
@ -758,10 +758,9 @@ nsObjectFrame::GetFrameName(nsAString& aResult) const
#endif
nsresult
nsObjectFrame::CreateWidget(nsPresContext* aPresContext,
nscoord aWidth,
nsObjectFrame::CreateWidget(nscoord aWidth,
nscoord aHeight,
PRBool aViewOnly)
PRBool aViewOnly)
{
// Create our view and widget
@ -840,7 +839,7 @@ nsObjectFrame::CreateWidget(nsPresContext* aPresContext,
nsRect r(0, 0, mRect.width, mRect.height);
viewMan->SetViewVisibility(view, nsViewVisibility_kShow);
GetOffsetFromView(aPresContext, origin, &parentWithView);
GetOffsetFromView(origin, &parentWithView);
viewMan->ResizeView(view, r);
viewMan->MoveViewTo(view, origin.x, origin.y);
}
@ -1187,7 +1186,7 @@ nsObjectFrame::InstantiateWidget(nsPresContext* aPresContext,
GetDesiredSize(aPresContext, aReflowState, aMetrics);
nsIView *parentWithView;
nsPoint origin;
GetOffsetFromView(aPresContext, origin, &parentWithView);
GetOffsetFromView(origin, &parentWithView);
// Just make the frigging widget
float t2p;
@ -1233,7 +1232,7 @@ nsObjectFrame::InstantiatePlugin(nsPresContext* aPresContext,
NS_ENSURE_TRUE(window, NS_ERROR_NULL_POINTER);
GetOffsetFromView(aPresContext, origin, &parentWithView);
GetOffsetFromView(origin, &parentWithView);
window->x = NSTwipsToIntPixels(origin.x, t2p);
window->y = NSTwipsToIntPixels(origin.y, t2p);
window->width = NSTwipsToIntPixels(aMetrics.width, t2p);
@ -1322,7 +1321,7 @@ nsObjectFrame::ReinstantiatePlugin(nsPresContext* aPresContext, nsHTMLReflowMetr
NS_ENSURE_TRUE(window, NS_ERROR_NULL_POINTER);
GetOffsetFromView(aPresContext, origin, &parentWithView);
GetOffsetFromView(origin, &parentWithView);
window->x = NSTwipsToIntPixels(origin.x, t2p);
window->y = NSTwipsToIntPixels(origin.y, t2p);
@ -1401,8 +1400,7 @@ nsPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
nsIView * parentWithView;
nsPoint origin(0,0);
nsPresContext *presContext = GetPresContext();
GetOffsetFromView(presContext, origin, &parentWithView);
GetOffsetFromView(origin, &parentWithView);
// if it's windowless, let's make sure we have our origin set right
// it may need to be corrected, like after scrolling
@ -1422,7 +1420,7 @@ nsPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
}
float t2p;
t2p = presContext->TwipsToPixels();
t2p = GetPresContext()->TwipsToPixels();
origin.x = NSTwipsToIntPixels(origin.x, t2p);
origin.y = NSTwipsToIntPixels(origin.y, t2p);
@ -3612,7 +3610,7 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, PRUint32 ndc)
nsCOMPtr<nsIWidget> containerWidget;
// Convert dirty rect relative coordinates to absolute and also get the containerWidget
ConvertRelativeToWindowAbsolute(mOwner, mContext, rel, abs, *getter_AddRefs(containerWidget));
ConvertRelativeToWindowAbsolute(mOwner, rel, abs, *getter_AddRefs(containerWidget));
nsRect absDirtyRect = nsRect(abs.x, abs.y, aDirtyRect.width, aDirtyRect.height);
@ -3875,8 +3873,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
// always create widgets in Twips, not pixels
float p2t = mContext->ScaledPixelsToTwips();
rv = mOwner->CreateWidget(mContext,
NSIntPixelsToTwips(mPluginWindow->width, p2t),
rv = mOwner->CreateWidget(NSIntPixelsToTwips(mPluginWindow->width, p2t),
NSIntPixelsToTwips(mPluginWindow->height, p2t),
windowless);
if (NS_OK == rv)
@ -3944,9 +3941,10 @@ static void ConvertTwipsToPixels(nsPresContext& aPresContext, nsRect& aTwipsRect
#ifdef DO_DIRTY_INTERSECT
// Convert from a frame relative coordinate to a coordinate relative to its
// containing window
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
nsPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs,
nsIWidget *& aContainerWidget)
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
nsPoint& aRel,
nsPoint& aAbs,
nsIWidget*& aContainerWidget)
{
// See if this frame has a view
nsIView *view = aFrame->GetView();
@ -3954,9 +3952,7 @@ static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
aAbs.x = 0;
aAbs.y = 0;
// Calculate frames offset from its nearest view
aFrame->GetOffsetFromView(aPresContext,
aAbs,
&view);
aFrame->GetOffsetFromView(aAbs, &view);
} else {
// Store frames offset from its view.
aAbs = aFrame->GetPosition();

Просмотреть файл

@ -112,10 +112,9 @@ public:
#endif
//local methods
nsresult CreateWidget(nsPresContext* aPresContext,
nscoord aWidth,
nsresult CreateWidget(nscoord aWidth,
nscoord aHeight,
PRBool aViewOnly);
PRBool aViewOnly);
nsIURI* GetFullURL() { return mFullURL; }
static PRBool IsSupportedImage(nsIContent* aContent);

Просмотреть файл

@ -6666,8 +6666,7 @@ nsTypedSelection::GetFrameToScrolledViewOffsets(nsIScrollableView *aScrollableVi
if (!shell)
return NS_ERROR_NULL_POINTER;
nsPresContext *presContext = shell->GetPresContext();
aFrame->GetOffsetFromView(presContext, offset, &closestView);
aFrame->GetOffsetFromView(offset, &closestView);
// XXX Deal with the case where there is a scrolled element, e.g., a
// DIV in the middle...
@ -6713,7 +6712,7 @@ nsTypedSelection::GetPointFromOffset(nsIFrame *aFrame, PRInt32 aContentOffset, n
nsIView *closestView = nsnull;
nsPoint offset(0, 0);
rv = aFrame->GetOffsetFromView(presContext, offset, &closestView);
rv = aFrame->GetOffsetFromView(offset, &closestView);
while (!widget && closestView)
{

Просмотреть файл

@ -431,20 +431,20 @@ public:
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const ;
#endif
NS_IMETHOD GetPosition(nsPresContext* aCX,
NS_IMETHOD GetPosition(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsIContent ** aNewContent,
PRInt32& aContentOffset,
PRInt32& aContentOffsetEnd);
NS_IMETHOD GetContentAndOffsetsFromPoint(nsPresContext* aCX,
NS_IMETHOD GetContentAndOffsetsFromPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsIContent ** aNewContent,
PRInt32& aContentOffset,
PRInt32& aContentOffsetEnd,
PRBool& aBeginFrameContent);
NS_IMETHOD GetPositionSlowly(nsPresContext* aCX,
NS_IMETHOD GetPositionSlowly(nsPresContext* aPresContext,
nsIRenderingContext * aRendContext,
const nsPoint& aPoint,
nsIContent ** aNewContent,
@ -2518,7 +2518,7 @@ nsTextFrame::GetPositionSlowly(nsPresContext* aPresContext,
}
nsIView * view;
nsPoint origin;
GetOffsetFromView(aPresContext, origin, &view);
GetOffsetFromView(origin, &view);
/* This if clause is the cause of much pain. If aNewContent is set, then any
* code path that returns an error must set aNewContent to null before returning,
@ -3371,7 +3371,7 @@ nsTextFrame::PaintAsciiText(nsPresContext* aPresContext,
// aTextWidth returns the (in twips) the length of the text that falls before the cursor
// aIndex contains the index of the text where the cursor falls
PRBool
BinarySearchForPosition(nsIRenderingContext* acx,
BinarySearchForPosition(nsIRenderingContext* aRendContext,
const PRUnichar* aText,
PRInt32 aBaseWidth,
PRInt32 aBaseInx,
@ -3384,7 +3384,7 @@ BinarySearchForPosition(nsIRenderingContext* acx,
PRInt32 range = aEndInx - aStartInx;
if ((range == 1) || (range == 2 && IS_HIGH_SURROGATE(aText[aStartInx]))) {
aIndex = aStartInx + aBaseInx;
acx->GetWidth(aText, aIndex, aTextWidth);
aRendContext->GetWidth(aText, aIndex, aTextWidth);
return PR_TRUE;
}
@ -3395,7 +3395,7 @@ BinarySearchForPosition(nsIRenderingContext* acx,
inx++;
PRInt32 textWidth = 0;
acx->GetWidth(aText, inx, textWidth);
aRendContext->GetWidth(aText, inx, textWidth);
PRInt32 fullWidth = aBaseWidth + textWidth;
if (fullWidth == aCursorPos) {
@ -3404,12 +3404,12 @@ BinarySearchForPosition(nsIRenderingContext* acx,
return PR_TRUE;
} else if (aCursorPos < fullWidth) {
aTextWidth = aBaseWidth;
if (BinarySearchForPosition(acx, aText, aBaseWidth, aBaseInx, aStartInx, inx, aCursorPos, aIndex, aTextWidth)) {
if (BinarySearchForPosition(aRendContext, aText, aBaseWidth, aBaseInx, aStartInx, inx, aCursorPos, aIndex, aTextWidth)) {
return PR_TRUE;
}
} else {
aTextWidth = fullWidth;
if (BinarySearchForPosition(acx, aText, aBaseWidth, aBaseInx, inx, aEndInx, aCursorPos, aIndex, aTextWidth)) {
if (BinarySearchForPosition(aRendContext, aText, aBaseWidth, aBaseInx, inx, aEndInx, aCursorPos, aIndex, aTextWidth)) {
return PR_TRUE;
}
}
@ -3423,7 +3423,7 @@ BinarySearchForPosition(nsIRenderingContext* acx,
// display of selection is based on the compressed text.
//---------------------------------------------------------------------------
NS_IMETHODIMP
nsTextFrame::GetPosition(nsPresContext* aCX,
nsTextFrame::GetPosition(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsIContent ** aNewContent,
PRInt32& aContentOffset,
@ -3431,21 +3431,21 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
{
// pre-condition tests
NS_PRECONDITION(aCX && aNewContent, "null arg");
if (!aCX || !aNewContent) {
NS_PRECONDITION(aPresContext && aNewContent, "null arg");
if (!aPresContext || !aNewContent) {
return NS_ERROR_NULL_POINTER;
}
// initialize out param
*aNewContent = nsnull;
nsIPresShell *shell = aCX->GetPresShell();
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsCOMPtr<nsIRenderingContext> acx;
nsresult rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
nsCOMPtr<nsIRenderingContext> rendContext;
nsresult rv = shell->CreateRenderingContext(this, getter_AddRefs(rendContext));
if (NS_SUCCEEDED(rv)) {
TextStyle ts(aCX, *acx, mStyleContext);
TextStyle ts(aPresContext, *rendContext, mStyleContext);
if (ts.mSmallCaps || ts.mWordSpacing || ts.mLetterSpacing || ts.mJustifying) {
nsresult result = GetPositionSlowly(aCX, acx, aPoint, aNewContent,
nsresult result = GetPositionSlowly(aPresContext, rendContext, aPoint, aNewContent,
aContentOffset);
aContentOffsetEnd = aContentOffset;
return result;
@ -3460,11 +3460,11 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
}
// Find the font metrics for this text
SetFontFromStyle(acx, mStyleContext);
SetFontFromStyle(rendContext, mStyleContext);
// Get the renderable form of the text
nsIDocument *doc = GetDocument(aCX);
nsTextTransformer tx(doc->GetLineBreaker(), nsnull, aCX);
nsIDocument *doc = GetDocument(aPresContext);
nsTextTransformer tx(doc->GetLineBreaker(), nsnull, aPresContext);
PRInt32 textLength;
// no need to worry about justification, that's always on the slow path
PrepareUnicodeText(tx, &indexBuffer, &paintBuffer, &textLength);
@ -3476,7 +3476,7 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
nsPoint origin;
nsIView * view;
GetOffsetFromView(aCX, origin, &view);
GetOffsetFromView(origin, &view);
//IF STYLE SAYS TO SELECT TO END OF FRAME HERE...
PRInt32 prefInt =
@ -3513,13 +3513,13 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
nscoord posX = (getReversedPos) ?
(mRect.width + origin.x) - (aPoint.x - origin.x) : aPoint.x;
PRBool found = BinarySearchForPosition(acx, text, origin.x, 0, 0,
PRBool found = BinarySearchForPosition(rendContext, text, origin.x, 0, 0,
PRInt32(textLength),
PRInt32(posX) , //go to local coordinates
indx, textWidth);
#else
PRBool found = BinarySearchForPosition(acx, text, origin.x, 0, 0,
PRBool found = BinarySearchForPosition(rendContext, text, origin.x, 0, 0,
PRInt32(textLength),
PRInt32(aPoint.x) , //go to local coordinates
indx, textWidth);
@ -3527,9 +3527,9 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
if (found) {
PRInt32 charWidth;
if (IS_HIGH_SURROGATE(text[indx]))
acx->GetWidth(&text[indx], 2, charWidth);
rendContext->GetWidth(&text[indx], 2, charWidth);
else
acx->GetWidth(text[indx], charWidth);
rendContext->GetWidth(text[indx], charWidth);
charWidth /= 2;
#ifdef IBMBIDI
@ -3580,7 +3580,7 @@ nsTextFrame::GetPosition(nsPresContext* aCX,
}
NS_IMETHODIMP
nsTextFrame::GetContentAndOffsetsFromPoint(nsPresContext* aCX,
nsTextFrame::GetContentAndOffsetsFromPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsIContent ** aNewContent,
PRInt32& aContentOffset,
@ -3600,7 +3600,7 @@ nsTextFrame::GetContentAndOffsetsFromPoint(nsPresContext* aCX,
newPoint.x = 0;
else
newPoint.x = aPoint.x;
nsresult rv = GetPosition(aCX, newPoint, aNewContent, aContentOffset, aContentOffsetEnd);
nsresult rv = GetPosition(aPresContext, newPoint, aNewContent, aContentOffset, aContentOffsetEnd);
if (NS_FAILED(rv))
return rv;
if (aContentOffset == mContentOffset)

Просмотреть файл

@ -230,7 +230,7 @@ nsSVGGFrame::SetMatrixPropagation(PRBool aPropagate)
return NS_OK;
}
NS_IMETHODIMP_(already_AddRefed<nsIDOMSVGMatrix>)
already_AddRefed<nsIDOMSVGMatrix>
nsSVGGFrame::GetCanvasTM()
{
if (!mPropagateTransform) {

Просмотреть файл

@ -1886,7 +1886,7 @@ nsBoxFrame::GetCursor(nsPresContext* aPresContext,
*/
nsPoint newPoint;
TranslateEventCoords(aPresContext, aPoint, newPoint);
TranslateEventCoords(aPoint, newPoint);
#ifdef DEBUG_LAYOUT
// if we are in debug and we are in the debug area
@ -1912,8 +1912,7 @@ nsBoxFrame::GetCursor(nsPresContext* aPresContext,
// view) into a localized pixel coordinate that is relative to the
// content area of this frame (inside the border+padding).
void
nsBoxFrame::TranslateEventCoords(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsBoxFrame::TranslateEventCoords(const nsPoint& aPoint,
nsPoint& aResult)
{
nscoord x = aPoint.x;
@ -1925,7 +1924,7 @@ nsBoxFrame::TranslateEventCoords(nsPresContext* aPresContext,
if (!HasView()) {
nsPoint offset;
nsIView* view;
GetOffsetFromView(aPresContext, offset, &view);
GetOffsetFromView(offset, &view);
if (nsnull != view) {
x -= offset.x;
y -= offset.y;

Просмотреть файл

@ -272,8 +272,7 @@ protected:
private:
// helper methods
void TranslateEventCoords(nsPresContext* aPresContext,
const nsPoint& aPoint,
void TranslateEventCoords(const nsPoint& aPoint,
nsPoint& aResult);
static PRBool AdjustTargetToScope(nsIFrame* aParent, nsIFrame*& aTargetFrame);

Просмотреть файл

@ -467,9 +467,8 @@ nsMenuPopupFrame::GetViewOffset(nsIView* aView, nsPoint& aPoint)
// viewmanager if aStopAtViewManagerRoot is true; otherwise it's the
// root view of the root viewmanager.
void
nsMenuPopupFrame::GetRootViewForPopup(nsPresContext* aPresContext,
nsIFrame* aStartFrame,
PRBool aStopAtViewManagerRoot,
nsMenuPopupFrame::GetRootViewForPopup(nsIFrame* aStartFrame,
PRBool aStopAtViewManagerRoot,
nsIView** aResult)
{
*aResult = nsnull;
@ -566,12 +565,9 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
shell->GetPrimaryFrameFor(targetAsContent, &targetFrame);
nsIView* parentView = nsnull;
if (targetFrame) {
nsPresContext *targetContext = shell->GetPresContext();
if (targetContext) {
GetRootViewForPopup(targetContext, targetFrame, PR_TRUE, &parentView);
if (parentView) {
targetDocumentWidget = parentView->GetNearestWidget(nsnull);
}
GetRootViewForPopup(targetFrame, PR_TRUE, &parentView);
if (parentView) {
targetDocumentWidget = parentView->GetNearestWidget(nsnull);
}
}
if (!targetDocumentWidget) {
@ -823,7 +819,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsPresContext* aPresContext,
nsIView* containingView = nsnull;
nsPoint offset;
nsMargin margin;
aFrame->GetOffsetFromView(aPresContext, offset, &containingView);
aFrame->GetOffsetFromView(offset, &containingView);
if (!containingView)
return NS_OK;
@ -993,7 +989,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsPresContext* aPresContext,
// frames inside a toplevel window, this is the root view of the toplevel
// window.
nsIView* parentView = nsnull;
GetRootViewForPopup(aPresContext, aFrame, PR_FALSE, &parentView);
GetRootViewForPopup(aFrame, PR_FALSE, &parentView);
if (!parentView)
return NS_OK;
@ -1927,7 +1923,7 @@ nsMenuPopupFrame::GetWidget(nsIWidget **aWidget)
// Get parent view
nsIView * view = nsnull;
// XXX should this be passing PR_FALSE or PR_TRUE for aStopAtViewManagerRoot?
nsMenuPopupFrame::GetRootViewForPopup(mPresContext, this, PR_FALSE, &view);
nsMenuPopupFrame::GetRootViewForPopup(this, PR_FALSE, &view);
if (!view)
return NS_OK;

Просмотреть файл

@ -144,8 +144,7 @@ public:
NS_IMETHOD RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild);
void GetViewOffset(nsIView* aView, nsPoint& aPoint);
static void GetRootViewForPopup(nsPresContext* aPresContext,
nsIFrame* aStartFrame,
static void GetRootViewForPopup(nsIFrame* aStartFrame,
PRBool aStopAtViewManagerRoot,
nsIView** aResult);

Просмотреть файл

@ -1025,7 +1025,7 @@ nsSplitterFrameInner::AdjustChildren(nsPresContext* aPresContext)
if (!view) {
nsPoint offset;
mParentBox->GetOffsetFromView(aPresContext, offset, &view);
mParentBox->GetOffsetFromView(offset, &view);
NS_ASSERTION(nsnull != view, "no view");
}
aPresContext->PresShell()->FlushPendingNotifications(Flush_Display);

Просмотреть файл

@ -142,7 +142,7 @@ GetScreenOrigin(nsIDOMElement* aElement)
nsIView* view;
nsPoint offset;
frame->GetOffsetFromView(presContext, offset, &view);
frame->GetOffsetFromView(offset, &view);
if (view) {
nsPoint widgetOffset(0, 0);
nsIWidget* widget = view->GetNearestWidget(&widgetOffset);

Просмотреть файл

@ -1054,7 +1054,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
if (!aGetTopVisibleLeaf) {
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
frame->GetOffsetFromView(frameOffset, &containingView);
if (!containingView)
return PR_FALSE; // no view -- not visible
@ -1091,7 +1091,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return PR_FALSE;
nsRect relFrameRect = frame->GetRect();
frame->GetOffsetFromView(aPresContext, frameOffset, &containingView);
frame->GetOffsetFromView(frameOffset, &containingView);
if (containingView) {
relFrameRect.x = frameOffset.x;
relFrameRect.y = frameOffset.y;

Просмотреть файл

@ -176,7 +176,7 @@ nsDragService::ComputeGlobalRectFromFrame ( nsIDOMNode* aDOMNode, Rect & outScre
// Find offset from our view
nsIView *containingView = nsnull;
nsPoint viewOffset(0,0);
aFrame->GetOffsetFromView(presContext, viewOffset, &containingView);
aFrame->GetOffsetFromView(viewOffset, &containingView);
NS_ASSERTION(containingView, "No containing view!");
if ( !containingView )
return PR_FALSE;