mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1400148 - Don't use -1 to represent an unset nsCursor. r=karlt.
Because UBSan complains about casting -1: > runtime error: load of value 4294967295, which is not a valid value for type 'nsCursor' --HG-- extra : rebase_source : 037a96700228ea0d427afa7c25c40490c701cdc4
This commit is contained in:
parent
6963fe6cd9
commit
ebf1cb320b
@ -164,7 +164,7 @@ TabParent::TabParent(nsIContentParent* aManager,
|
||||
, mInitedByParent(false)
|
||||
, mTabId(aTabId)
|
||||
, mCreatingWindow(false)
|
||||
, mCursor(nsCursor(-1))
|
||||
, mCursor(eCursorInvalid)
|
||||
, mTabSetsCursor(false)
|
||||
, mHasContentOpener(false)
|
||||
#ifdef DEBUG
|
||||
@ -1131,7 +1131,7 @@ TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
|
||||
if (mCustomCursor) {
|
||||
widget->SetCursor(mCustomCursor,
|
||||
mCustomCursorHotspotX, mCustomCursorHotspotY);
|
||||
} else if (mCursor != nsCursor(-1)) {
|
||||
} else if (mCursor != eCursorInvalid) {
|
||||
widget->SetCursor(mCursor);
|
||||
}
|
||||
} else if (eMouseExitFromWidget == aEvent.mMessage) {
|
||||
@ -1787,7 +1787,7 @@ TabParent::RecvSetCustomCursor(const nsCString& aCursorData,
|
||||
const uint32_t& aHotspotY,
|
||||
const bool& aForce)
|
||||
{
|
||||
mCursor = nsCursor(-1);
|
||||
mCursor = eCursorInvalid;
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
|
@ -1012,7 +1012,7 @@ PuppetWidget::SetCursor(imgIContainer* aCursor,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mCursor = nsCursor(-1);
|
||||
mCursor = eCursorInvalid;
|
||||
mCustomCursor = aCursor;
|
||||
mCursorHotspotX = aHotspotX;
|
||||
mCursorHotspotY = aHotspotY;
|
||||
|
@ -1623,7 +1623,7 @@ nsWindow::SetCursor(imgIContainer* aCursor,
|
||||
return window->SetCursor(aCursor, aHotspotX, aHotspotY);
|
||||
}
|
||||
|
||||
mCursor = nsCursor(-1);
|
||||
mCursor = eCursorInvalid;
|
||||
|
||||
// Get the image's current frame
|
||||
GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(aCursor);
|
||||
|
@ -211,8 +211,12 @@ enum nsCursor { ///(normal cursor, usually rendered as an arrow)
|
||||
eCursor_ns_resize,
|
||||
eCursor_ew_resize,
|
||||
eCursor_none,
|
||||
// This one better be the last one in this list.
|
||||
eCursorCount
|
||||
// This one is used for array sizing, and so better be the last
|
||||
// one in this list...
|
||||
eCursorCount,
|
||||
|
||||
// ...except for this one.
|
||||
eCursorInvalid = eCursorCount + 1
|
||||
};
|
||||
|
||||
enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
|
||||
|
@ -3020,7 +3020,7 @@ nsWindow::SetCursor(imgIContainer* aCursor,
|
||||
rv = nsWindowGfx::CreateIcon(aCursor, true, aHotspotX, aHotspotY, size, &cursor);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mCursor = nsCursor(-1);
|
||||
mCursor = eCursorInvalid;
|
||||
::SetCursor(cursor);
|
||||
|
||||
NS_IF_RELEASE(sCursorImgContainer);
|
||||
@ -7179,7 +7179,7 @@ void nsWindow::OnDestroy()
|
||||
}
|
||||
|
||||
// Destroy any custom cursor resources.
|
||||
if (mCursor == -1)
|
||||
if (mCursor == eCursorInvalid)
|
||||
SetCursor(eCursor_standard);
|
||||
|
||||
if (mCompositorWidgetDelegate) {
|
||||
|
Loading…
Reference in New Issue
Block a user