Repaired cursor discovery logic to handle A tag oddities

git-svn-id: svn://10.0.0.236/trunk@654 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp
1998-04-25 18:40:01 +00:00
parent aad54f55e7
commit 3bfe67cad5
2 changed files with 56 additions and 12 deletions

View File

@@ -30,7 +30,6 @@
#include "nsIDocument.h"
#include "nsIURL.h"
static NS_DEFINE_IID(kStyleMoleculeSID, NS_STYLEMOLECULE_SID);
static NS_DEFINE_IID(kStyleBorderSID, NS_STYLEBORDER_SID);
static NS_DEFINE_IID(kStyleColorSID, NS_STYLECOLOR_SID);
@@ -136,16 +135,39 @@ NS_METHOD nsHTMLContainerFrame::GetCursorAt(nsIPresContext& aPresContext,
nsIFrame** aFrame,
PRInt32& aCursor)
{
nsStyleMolecule* mol = (nsStyleMolecule*)
mStyleContext->GetData(kStyleMoleculeSID);
if (mol->cursor != NS_STYLE_CURSOR_INHERIT) {
// Get my cursor
nsStyleColor* styleColor = (nsStyleColor*)
mStyleContext->GetData(kStyleColorSID);
PRInt32 myCursor = styleColor->mCursor;
// Get child's cursor, if any
nsresult rv = nsContainerFrame::GetCursorAt(aPresContext, aPoint, aFrame,
aCursor);
if (NS_OK != rv) return rv;
if (aCursor != NS_STYLE_CURSOR_INHERIT) {
nsIAtom* tag = mContent->GetTag();
if (nsHTMLAtoms::a == tag) {
// Anchor tags override their child cursors in some cases.
if ((NS_STYLE_CURSOR_IBEAM == aCursor) &&
(NS_STYLE_CURSOR_INHERIT != myCursor)) {
aCursor = myCursor;
}
}
NS_RELEASE(tag);
return rv;
}
if (NS_STYLE_CURSOR_INHERIT != myCursor) {
// If this container has a particular cursor, use it, otherwise
// let the child decide.
*aFrame = this;
aCursor = (PRInt32)mol->cursor;
aCursor = myCursor;
return NS_OK;
}
return nsContainerFrame::GetCursorAt(aPresContext, aPoint, aFrame, aCursor);
// No specific cursor for us
aCursor = NS_STYLE_CURSOR_INHERIT;
return NS_OK;
}
#if 0