Added temporary workaround to image frame code to compensate for the fact

that HandleEvent() and GetCursor() are being called with the point not being
translated to the frame's local coordinate space
This commit is contained in:
troy%netscape.com 1998-11-20 06:31:55 +00:00
Родитель 9a2fdbcf24
Коммит 79aed9646d
4 изменённых файлов: 58 добавлений и 4 удалений

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

@ -1049,6 +1049,8 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView,
NS_RELEASE(targetContent);
}
//3. Give event to the Frames for browser default processing.
// XXX The event isn't translated into the local coordinate space
// of the frame...
if (NS_OK == rv) {
rv = targetFrame->HandleEvent(*mPresContext, aEvent, aEventStatus);
}

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

@ -785,6 +785,18 @@ ImageFrame::HandleEvent(nsIPresContext& aPresContext,
// the image's borders.
nsRect inner;
GetInnerArea(&aPresContext, inner);
// XXX Event isn't in our local coordinate space like it should be...
nsIView* view;
GetView(view);
if (nsnull == view) {
nsPoint offset;
GetOffsetFromView(offset, view);
if (nsnull != view) {
aEvent->point -= offset;
}
}
PRInt32 x = NSTwipsToIntPixels((aEvent->point.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((aEvent->point.y - inner.y), t2p);
nsresult r = map->IsInside(x, y, docURL, absURL, target, altText,
@ -846,8 +858,21 @@ ImageFrame::GetCursor(nsIPresContext& aPresContext,
GetInnerArea(&aPresContext, inner);
aCursor = NS_STYLE_CURSOR_DEFAULT;
float t2p = aPresContext.GetTwipsToPixels();
PRInt32 x = NSTwipsToIntPixels((aPoint.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((aPoint.y - inner.y), t2p);
// XXX Event isn't in our local coordinate space like it should be...
nsPoint pt = aPoint;
nsIView* view;
GetView(view);
if (nsnull == view) {
nsPoint offset;
GetOffsetFromView(offset, view);
if (nsnull != view) {
pt -= offset;
}
}
PRInt32 x = NSTwipsToIntPixels((pt.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((pt.y - inner.y), t2p);
if (NS_OK == map->IsInside(x, y)) {
aCursor = NS_STYLE_CURSOR_POINTER;
}

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

@ -785,6 +785,18 @@ ImageFrame::HandleEvent(nsIPresContext& aPresContext,
// the image's borders.
nsRect inner;
GetInnerArea(&aPresContext, inner);
// XXX Event isn't in our local coordinate space like it should be...
nsIView* view;
GetView(view);
if (nsnull == view) {
nsPoint offset;
GetOffsetFromView(offset, view);
if (nsnull != view) {
aEvent->point -= offset;
}
}
PRInt32 x = NSTwipsToIntPixels((aEvent->point.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((aEvent->point.y - inner.y), t2p);
nsresult r = map->IsInside(x, y, docURL, absURL, target, altText,
@ -846,8 +858,21 @@ ImageFrame::GetCursor(nsIPresContext& aPresContext,
GetInnerArea(&aPresContext, inner);
aCursor = NS_STYLE_CURSOR_DEFAULT;
float t2p = aPresContext.GetTwipsToPixels();
PRInt32 x = NSTwipsToIntPixels((aPoint.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((aPoint.y - inner.y), t2p);
// XXX Event isn't in our local coordinate space like it should be...
nsPoint pt = aPoint;
nsIView* view;
GetView(view);
if (nsnull == view) {
nsPoint offset;
GetOffsetFromView(offset, view);
if (nsnull != view) {
pt -= offset;
}
}
PRInt32 x = NSTwipsToIntPixels((pt.x - inner.x), t2p);
PRInt32 y = NSTwipsToIntPixels((pt.y - inner.y), t2p);
if (NS_OK == map->IsInside(x, y)) {
aCursor = NS_STYLE_CURSOR_POINTER;
}

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

@ -1049,6 +1049,8 @@ NS_IMETHODIMP PresShell :: HandleEvent(nsIView *aView,
NS_RELEASE(targetContent);
}
//3. Give event to the Frames for browser default processing.
// XXX The event isn't translated into the local coordinate space
// of the frame...
if (NS_OK == rv) {
rv = targetFrame->HandleEvent(*mPresContext, aEvent, aEventStatus);
}