зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
9a2fdbcf24
Коммит
79aed9646d
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче