38447 layout,content,dom and xpwidget part: Implement Handling of URI Values on

CSS "cursor" Properties
for dom,layout,content: r+sr=bz
for widget: r+sr=roc
This commit is contained in:
cbiesinger%web.de 2004-12-30 21:56:11 +00:00
Родитель 50a7d761d9
Коммит e42c2d976d
30 изменённых файлов: 204 добавлений и 105 удалений

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

@ -48,6 +48,7 @@ class nsIDOMEvent;
class nsIFrame;
class nsIView;
class nsIWidget;
class imgIContainer;
/*
* Event state manager interface.
@ -122,7 +123,7 @@ public:
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor) = 0;
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer, nsIWidget* aWidget, PRBool aLockCursor) = 0;
//Method for centralized distribution of new DOM events
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool* aPreventDefault) = 0;

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

@ -61,6 +61,7 @@ REQUIRES = xpcom \
view \
necko \
unicharutil \
imglib2 \
$(NULL)
CPPSRCS = \

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

@ -119,6 +119,8 @@
#include "nsUnicharUtils.h"
#include "nsContentUtils.h"
#include "imgIContainer.h"
#if defined (XP_MAC) || defined(XP_MACOSX)
#include <Events.h>
#endif
@ -2312,6 +2314,7 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
nsEventStatus* aStatus)
{
PRInt32 cursor;
imgIContainer* container = nsnull;
//If cursor is locked just use the locked one
if (mLockCursor) {
@ -2331,8 +2334,11 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
//If not disabled, check for the right cursor.
else {
if (aTargetFrame) {
if (NS_FAILED(aTargetFrame->GetCursor(aPresContext, aEvent->point, cursor)))
nsIFrame::Cursor framecursor;
if (NS_FAILED(aTargetFrame->GetCursor(aEvent->point, framecursor)))
return; // don't update the cursor if we failed to get it from the frame see bug 118877
cursor = framecursor.mCursor;
container = framecursor.mContainer;
}
}
}
@ -2350,10 +2356,11 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
(cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT))
{
cursor = NS_STYLE_CURSOR_SPINNING;
container = nsnull;
}
if (aTargetFrame) {
SetCursor(cursor, aTargetFrame->GetWindow(), PR_FALSE);
SetCursor(cursor, container, aTargetFrame->GetWindow(), PR_FALSE);
}
if (mLockCursor || NS_STYLE_CURSOR_AUTO != cursor) {
@ -2362,7 +2369,8 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsEventStateManager::SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor)
nsEventStateManager::SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
nsIWidget* aWidget, PRBool aLockCursor)
{
nsCursor c;
@ -2483,7 +2491,13 @@ nsEventStateManager::SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLock
break;
}
aWidget->SetCursor(c);
// First, try the imgIContainer, if non-null
nsresult rv = NS_ERROR_FAILURE;
if (aContainer)
rv = aWidget->SetCursor(aContainer);
if (NS_FAILED(rv))
aWidget->SetCursor(c);
return NS_OK;
}

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

@ -56,6 +56,7 @@ class nsIDocShell;
class nsIDocShellTreeNode;
class nsIDocShellTreeItem;
class nsIFocusController;
class imgIContainer;
// mac uses click-hold context menus, a holdover from 4.x
#if defined(XP_MAC) || defined(XP_MACOSX)
@ -127,7 +128,7 @@ public:
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor);
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer, nsIWidget* aWidget, PRBool aLockCursor);
//Method for centralized distribution of new DOM events
NS_IMETHOD DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent, PRBool *aPreventDefault);

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

@ -5917,7 +5917,7 @@ nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
// Call esm and set cursor.
rv = presContext->EventStateManager()->SetCursor(cursor, widget, PR_TRUE);
rv = presContext->EventStateManager()->SetCursor(cursor, nsnull, widget, PR_TRUE);
}
return rv;

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

@ -95,9 +95,8 @@ public:
}
#endif
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
virtual void MouseClicked(nsPresContext* aPresContext);
@ -299,16 +298,17 @@ nsImageControlFrame::GetName(nsAString* aResult)
}
NS_IMETHODIMP
nsImageControlFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsImageControlFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
FillCursorInformationFromStyle(GetStyleUserInterface(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_POINTER;
}
return NS_OK;
}

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

@ -98,6 +98,7 @@
#include "nsIServiceManager.h"
#include "nsISelectionImageService.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "gfxIImageFrame.h"
#include "nsILookAndFeel.h"
#include "nsLayoutCID.h"
@ -2027,14 +2028,15 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsPresContext* aCX,
}
NS_IMETHODIMP
nsFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_DEFAULT;
FillCursorInformationFromStyle(GetStyleUserInterface(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
}
return NS_OK;
}
@ -4700,6 +4702,24 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
return isFocusable;
}
/* static */
void nsFrame::FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
nsIFrame::Cursor& aCursor)
{
aCursor.mCursor = ui->mCursor;
PRInt32 count = ui->mCursorArray.Count();
for (int i = 0; i < count; i++) {
PRUint32 status;
nsresult rv = ui->mCursorArray[i]->GetImageStatus(&status);
if (NS_SUCCEEDED(rv) && (status & imgIRequest::STATUS_FRAME_COMPLETE)) {
// This is the one we want
ui->mCursorArray[i]->GetImage(getter_AddRefs(aCursor.mContainer));
break;
}
}
}
PRBool
nsFrame::HasStyleChange()
{

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

@ -206,9 +206,8 @@ public:
NS_IMETHOD GetContentForEvent(nsPresContext* aPresContext,
nsEvent* aEvent,
nsIContent** aContent);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD GetFrameForPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsFramePaintLayer aWhichLayer,
@ -522,6 +521,9 @@ protected:
// applies to its situation.
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
// Fills aCursor with the appropriate information from ui
static void FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
nsIFrame::Cursor& aCursor);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
#ifdef DEBUG_LAYOUT

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

@ -139,9 +139,8 @@ public:
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD Paint(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -794,14 +793,13 @@ nsHTMLFramesetFrame::IsGrabbingMouse()
#endif
NS_IMETHODIMP
nsHTMLFramesetFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsHTMLFramesetFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
if (mDragger) {
aCursor = (mDragger->mVertical) ? NS_STYLE_CURSOR_W_RESIZE : NS_STYLE_CURSOR_N_RESIZE;
aCursor.mCursor = (mDragger->mVertical) ? NS_STYLE_CURSOR_W_RESIZE : NS_STYLE_CURSOR_N_RESIZE;
} else {
aCursor = NS_STYLE_CURSOR_DEFAULT;
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
}
return NS_OK;
}
@ -1739,14 +1737,13 @@ nsHTMLFramesetBorderFrame::GetFrameForPoint(nsPresContext* aPresContext,
}
NS_IMETHODIMP
nsHTMLFramesetBorderFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsHTMLFramesetBorderFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
if (!mCanResize) {
aCursor = NS_STYLE_CURSOR_DEFAULT;
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
} else {
aCursor = (mVertical) ? NS_STYLE_CURSOR_W_RESIZE : NS_STYLE_CURSOR_N_RESIZE;
aCursor.mCursor = (mVertical) ? NS_STYLE_CURSOR_W_RESIZE : NS_STYLE_CURSOR_N_RESIZE;
}
return NS_OK;
}

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

@ -140,9 +140,8 @@ public:
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD Paint(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,

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

@ -747,13 +747,20 @@ public:
PRInt32& aContentOffsetEnd,
PRBool& aBeginFrameContent) = 0;
/**
* This structure holds information about a cursor. mContainer represents a
* loaded image that should be preferred. If it is not possible to use it, or
* if it is null, mCursor should be used.
*/
struct Cursor {
nsCOMPtr<imgIContainer> mContainer;
PRInt32 mCursor;
};
/**
* Get the cursor for a given frame.
*/
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor) = 0;
NS_IMETHOD GetCursor(const nsPoint& aPoint,
Cursor& aCursor) = 0;
/**
* Get the frame that should receive events for a given point in the

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

@ -1735,26 +1735,26 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext,
//XXX This will need to be rewritten once we have content for areas
//XXXbz We have content for areas now....
NS_METHOD
nsImageFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsImageFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
nsImageMap* map = GetImageMap(aPresContext);
nsPresContext* context = GetPresContext();
nsImageMap* map = GetImageMap(context);
if (nsnull != map) {
nsPoint p;
TranslateEventCoords(aPoint, p);
aCursor = NS_STYLE_CURSOR_DEFAULT;
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
if (map->IsInside(p.x, p.y)) {
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
FillCursorInformationFromStyle(GetStyleUserInterface(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_POINTER;
}
}
return NS_OK;
}
return nsFrame::GetCursor(aPresContext, aPoint, aCursor);
return nsFrame::GetCursor(aPoint, aCursor);
}
NS_IMETHODIMP

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

@ -113,9 +113,8 @@ public:
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD AttributeChanged(nsPresContext* aPresContext,
nsIContent* aChild,
PRInt32 aNameSpaceID,

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

@ -96,7 +96,7 @@ public:
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
/* fail on any requests to get a cursor from us because plugins set their own! see bug 118877 */
NS_IMETHOD GetCursor(nsPresContext* aPresContext, nsPoint& aPoint, PRInt32& aCursor)
NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor)
{ return NS_ERROR_NOT_IMPLEMENTED; };
//i18n helper

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

@ -396,9 +396,8 @@ public:
NS_IMETHOD Destroy(nsPresContext* aPresContext);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD CharacterDataChanged(nsPresContext* aPresContext,
nsIContent* aChild,
@ -1339,13 +1338,12 @@ nsTextFrame::GetDocument(nsPresContext* aPresContext)
}
NS_IMETHODIMP
nsTextFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsTextFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_TEXT;
FillCursorInformationFromStyle(GetStyleUserInterface(), aCursor);
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
aCursor.mCursor = NS_STYLE_CURSOR_TEXT;
// If tabindex >= 0, use default cursor to indicate it's not selectable
nsIFrame *ancestorFrame = this;
@ -1357,13 +1355,14 @@ nsTextFrame::GetCursor(nsPresContext* aPresContext,
if (!tabIndexStr.IsEmpty()) {
PRInt32 rv, tabIndexVal = tabIndexStr.ToInteger(&rv);
if (NS_SUCCEEDED(rv) && tabIndexVal >= 0) {
aCursor = NS_STYLE_CURSOR_DEFAULT;
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
break;
}
}
}
}
}
return NS_OK;
}

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

@ -243,7 +243,8 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
} break;
case eCSSType_ValueList:
if (iProp == eCSSProperty_content) {
if (iProp == eCSSProperty_content ||
iProp == eCSSProperty_cursor) {
for (nsCSSValueList* l = ValueListAtCursor(cursor);
l; l = l->mNext)
if (l->mValue.GetUnit() == eCSSUnit_URL)

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

@ -2012,13 +2012,32 @@ nsComputedDOMStyle::GetCursor(nsIFrame *aFrame,
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)ui, aFrame);
if (ui) {
if (ui->mCursor == NS_STYLE_CURSOR_AUTO) {
val->SetIdent(nsLayoutAtoms::autoAtom);
} else {
const nsAFlatCString& cursor =
nsCSSProps::ValueToKeyword(ui->mCursor,
nsCSSProps::kCursorKTable);
val->SetIdent(cursor);
PRBool found = PR_FALSE;
PRInt32 count = ui->mCursorArray.Count();
for (PRInt32 i = 0; i < count; i++) {
PRUint32 status;
nsresult rv = ui->mCursorArray[i]->GetImageStatus(&status);
if (NS_SUCCEEDED(rv) && (status & imgIRequest::STATUS_FRAME_COMPLETE)) {
// This is the one we want
nsCOMPtr<nsIURI> uri;
ui->mCursorArray[i]->GetURI(getter_AddRefs(uri));
if (uri) {
val->SetURI(uri);
found = PR_TRUE;
break;
}
}
}
if (!found) {
if (ui->mCursor == NS_STYLE_CURSOR_AUTO) {
val->SetIdent(nsLayoutAtoms::autoAtom);
} else {
const nsAFlatCString& cursor =
nsCSSProps::ValueToKeyword(ui->mCursor,
nsCSSProps::kCursorKTable);
val->SetIdent(cursor);
}
}
}

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

@ -2358,13 +2358,23 @@ nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartData,
if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
inherited = PR_TRUE;
ui->mCursor = parentUI->mCursor;
if (ui->mCursorArray.Count() == 0) {
// What's going on here is this- If we have any entries, then they were
// copied above in the copy ctor from the parent UI. So, we don't need
// to do that here.
// If we don't have any entries yet, have to copy them here.
ui->mCursorArray.AppendObjects(parentUI->mCursorArray);
}
}
else {
// Since we don't support URL values, just skip them.
// The parser will never create a list that is *all* URL values --
// that's invalid.
while (list->mValue.GetUnit() == eCSSUnit_URL)
while (list->mValue.GetUnit() == eCSSUnit_Image) {
imgIRequest* req = list->mValue.GetImageValue();
if (req)
ui->mCursorArray.AppendObject(req);
list = list->mNext;
}
if (eCSSUnit_Enumerated == list->mValue.GetUnit()) {
ui->mCursor = list->mValue.GetIntValue();

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

@ -384,6 +384,9 @@ nsStyleContext::ApplyStyleFixups(nsPresContext* aPresContext)
mutable_display->mDisplay = NS_STYLE_DISPLAY_BLOCK;
}
}
// Computer User Interface style, to trigger loads of cursors
GetStyleUserInterface();
}
void

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

@ -1697,7 +1697,8 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
mUserInput(aSource.mUserInput),
mUserModify(aSource.mUserModify),
mUserFocus(aSource.mUserFocus),
mCursor(aSource.mCursor)
mCursor(aSource.mCursor),
mCursorArray(aSource.mCursorArray)
{
}
@ -1711,6 +1712,11 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
if (mCursor != aOther.mCursor)
NS_UpdateHint(hint, nsChangeHint_UpdateCursor);
// We could do better. But it wouldn't be worth it, URL-specified cursors are
// rare.
if (mCursorArray.Count() > 0 || aOther.mCursorArray.Count() > 0)
NS_UpdateHint(hint, nsChangeHint_UpdateCursor);
if (mUserModify != aOther.mUserModify)
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);

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

@ -49,6 +49,7 @@
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsIAtom.h"
#include "nsIURI.h"
@ -1142,6 +1143,12 @@ struct nsStyleUserInterface: public nsStyleStruct {
PRUint8 mUserFocus; // [inherited] (auto-select)
PRUint8 mCursor; // [inherited] See nsStyleConsts.h
nsCOMArray<imgIRequest> mCursorArray; // [inherited] The specified URL values. Takes precedence over mCursor.
// NOTE: Using nsCOMArray here means that copying this struct is slower (and
// takes more memory) than it could be if we used nsISupportsArray, because
// we have to append all objects to the new array. However, since these
// properties are rarely set, they are usually cached, and thus this is not
// much of a problem.
};
struct nsStyleXUL : public nsStyleStruct {

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

@ -1872,9 +1872,8 @@ nsBoxFrame::GetMouseThrough(PRBool& aMouseThrough)
NS_IMETHODIMP
nsBoxFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsBoxFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
/*
#ifdef NS_DEBUG
@ -1885,21 +1884,23 @@ nsBoxFrame::GetCursor(nsPresContext* aPresContext,
#endif
*/
#ifdef DEBUG_LAYOUT
nsPoint newPoint;
TranslateEventCoords(aPoint, newPoint);
#ifdef DEBUG_LAYOUT
// if we are in debug and we are in the debug area
// return our own cursor and dump the debug information.
if (mState & NS_STATE_CURRENTLY_IN_DEBUG)
{
nsresult rv = DisplayDebugInfoFor(this, aPresContext, newPoint, aCursor);
// XXX aCursor is not yet inited??
nsresult rv = DisplayDebugInfoFor(this, GetPresContext(), newPoint,
aCursor.mCursor);
if (rv == NS_OK)
return rv;
}
#endif
nsresult rv = nsContainerFrame::GetCursor(aPresContext, aPoint, aCursor);
nsresult rv = nsContainerFrame::GetCursor(aPoint, aCursor);
return rv;
}

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

@ -128,9 +128,8 @@ public:
nsFramePaintLayer aWhichLayer,
nsIFrame** aFrame);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);

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

@ -267,11 +267,10 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
NS_IMETHODIMP
nsSplitterFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsSplitterFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
return nsBoxFrame::GetCursor(aPresContext, aPoint, aCursor);
return nsBoxFrame::GetCursor(aPoint, aCursor);
/*
if (IsHorizontal())

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

@ -75,9 +75,8 @@ public:
nsStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);

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

@ -1868,9 +1868,8 @@ void nsTreeBodyFrame::CalcInnerBox()
}
NS_IMETHODIMP
nsTreeBodyFrame::GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor)
{
if (mView) {
PRInt32 row;
@ -1882,15 +1881,16 @@ nsTreeBodyFrame::GetCursor(nsPresContext* aPresContext,
// Our scratch array is already prefilled.
nsStyleContext* childContext = GetPseudoStyleContext(child);
aCursor = childContext->GetStyleUserInterface()->mCursor;
if (aCursor == NS_STYLE_CURSOR_AUTO)
aCursor = NS_STYLE_CURSOR_DEFAULT;
FillCursorInformationFromStyle(childContext->GetStyleUserInterface(),
aCursor);
if (aCursor.mCursor == NS_STYLE_CURSOR_AUTO)
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
return NS_OK;
}
}
return nsLeafBoxFrame::GetCursor(aPresContext, aPoint, aCursor);
return nsLeafBoxFrame::GetCursor(aPoint, aCursor);
}
NS_IMETHODIMP

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

@ -88,9 +88,8 @@ public:
NS_IMETHOD Init(nsPresContext* aPresContext, nsIContent* aContent,
nsIFrame* aParent, nsStyleContext* aContext, nsIFrame* aPrevInFlow);
NS_IMETHOD Destroy(nsPresContext* aPresContext);
NS_IMETHOD GetCursor(nsPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
nsIFrame::Cursor& aCursor);
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
nsGUIEvent* aEvent,

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

@ -64,6 +64,7 @@ class nsIEventListener;
class nsIRollupListener;
struct nsGUIEvent;
struct nsColorMap;
class imgIContainer;
/**
* Callback function that processes events.
@ -644,6 +645,15 @@ class nsIWidget : public nsISupports {
NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
/**
* Sets an image as the cursor for this widget.
*
* @param aCursor the cursor to set
* @retval NS_ERROR_NOT_IMPLEMENTED if setting images as cursors is not
* supported
*/
NS_IMETHOD SetCursor(imgIContainer* aCursor) = 0;
/**
* Get the window type of this widget
*

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

@ -489,6 +489,11 @@ NS_METHOD nsBaseWidget::SetCursor(nsCursor aCursor)
mCursor = aCursor;
return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::SetCursor(imgIContainer* aCursor)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//-------------------------------------------------------------------------
//

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

@ -96,6 +96,7 @@ public:
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
virtual nsCursor GetCursor();
NS_IMETHOD SetCursor(nsCursor aCursor);
NS_IMETHOD SetCursor(imgIContainer* aCursor);
NS_IMETHOD GetWindowType(nsWindowType& aWindowType);
NS_IMETHOD SetWindowType(nsWindowType aWindowType);
NS_IMETHOD SetWindowTranslucency(PRBool aTranslucent);