From 8c86fef2cd64f29ae14f87911413601b66f8e3cd Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Mon, 23 Nov 1998 22:21:13 +0000 Subject: [PATCH] Let style override the cursor choice when using an image map git-svn-id: svn://10.0.0.236/trunk@15182 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsImageFrame.cpp | 9 ++++++++- mozilla/layout/html/base/src/nsImageFrame.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 3d6cddd1f7e..bd27e0befe6 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -917,7 +917,14 @@ nsImageFrame::GetCursor(nsIPresContext& aPresContext, 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; + // Use style defined cursor if one is provided, otherwise when + // the cursor style is "auto" we use the pointer cursor. + const nsStyleColor* styleColor; + GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)styleColor); + aCursor = styleColor->mCursor; + if (NS_STYLE_CURSOR_AUTO == aCursor) { + aCursor = NS_STYLE_CURSOR_POINTER; + } } NS_RELEASE(map); return NS_OK; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 3d6cddd1f7e..bd27e0befe6 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -917,7 +917,14 @@ nsImageFrame::GetCursor(nsIPresContext& aPresContext, 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; + // Use style defined cursor if one is provided, otherwise when + // the cursor style is "auto" we use the pointer cursor. + const nsStyleColor* styleColor; + GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)styleColor); + aCursor = styleColor->mCursor; + if (NS_STYLE_CURSOR_AUTO == aCursor) { + aCursor = NS_STYLE_CURSOR_POINTER; + } } NS_RELEASE(map); return NS_OK;