Bug: 156203(copy/paste doesn't always copy numbers/letters in <OL>)

Patch: t_mutreja@yahoo.com, r=akkana, sr=jst, a=asa.
This commit is contained in:
t_mutreja%yahoo.com 2002-09-15 13:14:14 +00:00
parent 6ee82128ba
commit 5594f693c7
2 changed files with 22 additions and 1 deletions

View File

@ -680,7 +680,7 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag)
mIndent += kIndentSizeList; // see ul
}
else if (type == eHTMLTag_li) {
if (mTagStackIndex > 1 && mTagStack[mTagStackIndex-2] == eHTMLTag_ol) {
if (mTagStackIndex > 1 && IsInOL()) {
if (mOLStackIndex > 0) {
nsAutoString valueAttr;
if(NS_SUCCEEDED(GetAttributeValue(nsHTMLAtoms::value, valueAttr))){
@ -1833,6 +1833,26 @@ nsPlainTextSerializer::IsInPre()
return PR_FALSE;
}
/**
* This method is required only to indentify LI's inside OL.
* Returns TRUE if we are inside an OL tag and FALSE otherwise.
*/
PRBool
nsPlainTextSerializer::IsInOL()
{
PRInt32 i = mTagStackIndex;
while(--i >= 0) {
if(mTagStack[i] == eHTMLTag_ol)
return PR_TRUE;
if (mTagStack[i] == eHTMLTag_ul) {
// If a UL is reached first, LI belongs the UL nested in OL.
return PR_FALSE;
}
}
// We may reach here for orphan LI's.
return PR_FALSE;
}
/*
@return 0 = no header, 1 = h1, ..., 6 = h6
*/

View File

@ -146,6 +146,7 @@ protected:
PRBool IsBlockLevel(PRInt32 aId);
PRBool IsContainer(PRInt32 aId);
PRBool IsInPre();
PRBool IsInOL();
PRBool IsCurrentNodeConverted();
nsresult GetIdForContent(nsIContent* aContent, PRInt32* aID);
nsresult GetParserService(nsIParserService** aParserService);