Fix line numbers in html. b=111576, r=heikki, sr=jst, a=asa,chofmann

git-svn-id: svn://10.0.0.236/trunk@118658 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
harishd%netscape.com
2002-04-10 22:16:46 +00:00
parent f593eeea73
commit a6dd951b3e
58 changed files with 1468 additions and 1306 deletions

View File

@@ -58,10 +58,8 @@ const nsString& GetEmptyString() {
* Default Constructor
*/
nsCParserNode::nsCParserNode()
: mLineNumber(1),
mToken(nsnull),
: mToken(nsnull),
mAttributes(nsnull),
mSkippedContent(nsnull),
mUseCount(0),
mGenericState(PR_FALSE),
mTokenAllocator(nsnull)
@@ -79,7 +77,9 @@ nsCParserNode::nsCParserNode()
* @param aToken -- token to init internal token
* @return
*/
nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsTokenAllocator* aTokenAllocator,nsNodeAllocator* aNodeAllocator):
nsCParserNode::nsCParserNode(CToken* aToken,
nsTokenAllocator* aTokenAllocator,
nsNodeAllocator* aNodeAllocator):
nsIParserNode() {
mRefCnt = 0;
MOZ_COUNT_CTOR(nsCParserNode);
@@ -87,12 +87,10 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsTokenAllocator
static int theNodeCount=0;
theNodeCount++;
mAttributes=0;
mLineNumber=aLineNumber;
mToken=aToken;
IF_HOLD(mToken);
mTokenAllocator=aTokenAllocator;
mUseCount=0;
mSkippedContent=0;
mGenericState=PR_FALSE;
#ifdef HEAP_ALLOCATED_NODES
mNodeAllocator=aNodeAllocator;
@@ -117,7 +115,6 @@ nsCParserNode::~nsCParserNode() {
mNodeAllocator=nsnull;
#endif
mTokenAllocator=0;
mLineNumber=0;
}
@@ -129,7 +126,9 @@ nsCParserNode::~nsCParserNode() {
* @return
*/
nsresult nsCParserNode::Init(CToken* aToken,PRInt32 aLineNumber,nsTokenAllocator* aTokenAllocator,nsNodeAllocator* aNodeAllocator) {
nsresult nsCParserNode::Init(CToken* aToken,
nsTokenAllocator* aTokenAllocator,
nsNodeAllocator* aNodeAllocator) {
if(mAttributes && (mAttributes->GetSize())) {
NS_ASSERTION(0!=mTokenAllocator, "Error: Attribute tokens on node without token allocator");
if(mTokenAllocator) {
@@ -139,15 +138,11 @@ nsresult nsCParserNode::Init(CToken* aToken,PRInt32 aLineNumber,nsTokenAllocator
}
}
}
mLineNumber=aLineNumber;
mTokenAllocator=aTokenAllocator;
mToken=aToken;
IF_HOLD(mToken);
mGenericState=PR_FALSE;
mUseCount=0;
if(mSkippedContent) {
mSkippedContent->Truncate();
}
#ifdef HEAP_ALLOCATED_NODES
mNodeAllocator=aNodeAllocator;
#endif
@@ -201,36 +196,6 @@ const nsAString& nsCParserNode::GetText() const {
return (mToken) ? mToken->GetStringValue() : NS_STATIC_CAST(const nsAString&,GetEmptyString());
}
/**
* Get text value of this node, which translates into
* getting the text value of the underlying token
*
* @update gess 3/25/98
* @param
* @return string ref of text from internal token
*/
const nsString& nsCParserNode::GetSkippedContent() const {
if(mSkippedContent)
return *mSkippedContent;
return GetEmptyString();
}
/**
* Get text value of this node, which translates into
* getting the text value of the underlying token
*
* @update gess 3/25/98
* @param
* @return string ref of text from internal token
*/
void nsCParserNode::SetSkippedContent(nsString& aString) {
if(!mSkippedContent) {
mSkippedContent=new nsString(aString);
}
else *mSkippedContent=aString;
}
/**
* Get node type, meaning, get the tag type of the
* underlying token
@@ -328,7 +293,7 @@ PRInt32 nsCParserNode::TranslateToUnicodeStr(nsString& aString) const
* @return int containing the line number the token was found on
*/
PRInt32 nsCParserNode::GetSourceLineNumber(void) const {
return mLineNumber;
return mToken ? mToken->GetLineNumber() : 0;
}
/**
@@ -364,7 +329,7 @@ void nsCParserNode::GetSource(nsString& aString) {
for(index=0;index<mAttributes->GetSize();index++) {
CAttributeToken *theToken=(CAttributeToken*)mAttributes->ObjectAt(index);
if(theToken) {
theToken->AppendSource(aString);
theToken->AppendSourceTo(aString);
aString.Append(PRUnichar(' ')); //this will get removed...
}
}
@@ -389,10 +354,6 @@ nsresult nsCParserNode::ReleaseAll() {
delete mAttributes;
mAttributes=0;
}
if(mSkippedContent) {
delete mSkippedContent;
mSkippedContent=0;
}
if(mTokenAllocator) {
// It was heap allocated, so free it!