fixes inconsistent selection schemes in HTML tables; b=261385, r=Neil, sr=roc

git-svn-id: svn://10.0.0.236/trunk@164090 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
daniel%glazman.org
2004-10-20 15:24:11 +00:00
parent afc0f7d4b8
commit 4d558f2a48
2 changed files with 14 additions and 8 deletions

View File

@@ -1290,7 +1290,7 @@ GetCellParent(nsIDOMNode *aDomNode)
while(current)
{
tag = GetTag(current);
if (tag == nsHTMLAtoms::td)
if (tag == nsHTMLAtoms::td || tag == nsHTMLAtoms::th)
return current;
if (NS_FAILED(ParentOffset(current,getter_AddRefs(parent),&childOffset)) || !parent)
return 0;
@@ -3111,7 +3111,8 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
static PRBool IsCell(nsIContent *aContent)
{
return (aContent->Tag() == nsHTMLAtoms::td &&
return ((aContent->Tag() == nsHTMLAtoms::td ||
aContent->Tag() == nsHTMLAtoms::th) &&
aContent->IsContentOfType(nsIContent::eHTML));
}
@@ -5961,7 +5962,8 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
dirtystart = PR_TRUE;
cellMode = PR_FALSE;
}
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
else if (atom == nsHTMLAtoms::td ||
atom == nsHTMLAtoms::th) //you are in "cell" mode put selection to end of cell
{
cellMode = PR_TRUE;
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
@@ -6002,7 +6004,8 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
else
found = PR_FALSE; //didnt find the right cell yet
}
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
else if (atom == nsHTMLAtoms::td ||
atom == nsHTMLAtoms::th) //you are in "cell" mode put selection to end of cell
{
result = ParentOffset(tempNode, getter_AddRefs(endNode), &endOffset);
if (NS_FAILED(result))

View File

@@ -1290,7 +1290,7 @@ GetCellParent(nsIDOMNode *aDomNode)
while(current)
{
tag = GetTag(current);
if (tag == nsHTMLAtoms::td)
if (tag == nsHTMLAtoms::td || tag == nsHTMLAtoms::th)
return current;
if (NS_FAILED(ParentOffset(current,getter_AddRefs(parent),&childOffset)) || !parent)
return 0;
@@ -3111,7 +3111,8 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
static PRBool IsCell(nsIContent *aContent)
{
return (aContent->Tag() == nsHTMLAtoms::td &&
return ((aContent->Tag() == nsHTMLAtoms::td ||
aContent->Tag() == nsHTMLAtoms::th) &&
aContent->IsContentOfType(nsIContent::eHTML));
}
@@ -5961,7 +5962,8 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
dirtystart = PR_TRUE;
cellMode = PR_FALSE;
}
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
else if (atom == nsHTMLAtoms::td ||
atom == nsHTMLAtoms::th) //you are in "cell" mode put selection to end of cell
{
cellMode = PR_TRUE;
result = ParentOffset(tempNode, getter_AddRefs(startNode), &startOffset);
@@ -6002,7 +6004,8 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
else
found = PR_FALSE; //didnt find the right cell yet
}
else if (atom == nsHTMLAtoms::td) //you are in "cell" mode put selection to end of cell
else if (atom == nsHTMLAtoms::td ||
atom == nsHTMLAtoms::th) //you are in "cell" mode put selection to end of cell
{
result = ParentOffset(tempNode, getter_AddRefs(endNode), &endOffset);
if (NS_FAILED(result))