зеркало из https://github.com/mozilla/pjs.git
Work in progress for frameset detection, bug 14599. r=cmanske
This commit is contained in:
Родитель
dd1e0ed03b
Коммит
9b692e974d
|
@ -48,12 +48,11 @@ nsEditorParserObserver::~nsEditorParserObserver()
|
|||
|
||||
NS_IMETHODIMP_(const char*) nsEditorParserObserver::GetTagNameAt(PRUint32 aTagIndex)
|
||||
{
|
||||
if (aTagIndex < gParserObserver_TagCount)
|
||||
{
|
||||
return gParserObserver_Tags[aTagIndex];
|
||||
} else {
|
||||
nsCString* theString = mWatchTags[aTagIndex];
|
||||
if (theString)
|
||||
return theString->GetBuffer();
|
||||
else
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditorParserObserver::Notify(
|
||||
|
@ -121,4 +120,15 @@ NS_IMETHODIMP nsEditorParserObserver::GetBadTagFound(PRBool *aFound)
|
|||
NS_ENSURE_ARG_POINTER(aFound);
|
||||
*aFound = mBadTagFound;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsEditorParserObserver::RegisterTagToWatch(const char* tagName)
|
||||
{
|
||||
nsCString theTagString(tagName);
|
||||
mWatchTags.AppendCString(theTagString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,14 +24,9 @@
|
|||
#include "nsIElementObserver.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
static const PRInt32 gParserObserver_TagCount=1;
|
||||
static const char * gParserObserver_Tags[1] = {"FRAMESET"};
|
||||
|
||||
|
||||
// this needs to support the weak reference API, so that the parser
|
||||
// does not need to hold a reference
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsEditorParserObserver : public nsSupportsWeakReference,
|
||||
public nsIElementObserver,
|
||||
|
@ -49,29 +44,31 @@ public:
|
|||
NS_IMETHOD Notify(PRUint32 aDocumentID, eHTMLTags aTag, PRUint32 numOfAttributes,
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
NS_IMETHOD Notify(PRUint32 aDocumentID, const PRUnichar* aTag, PRUint32 numOfAttributes,
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
|
||||
/* methods for nsIObserver */
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
/* begin observing */
|
||||
/* begin and end observing */
|
||||
NS_IMETHOD Start();
|
||||
|
||||
/** end observing */
|
||||
NS_IMETHOD End();
|
||||
|
||||
/** query, did we find a bad tag? */
|
||||
/* query, did we find a bad tag? */
|
||||
NS_IMETHOD GetBadTagFound(PRBool *aFound);
|
||||
|
||||
/* register a tag to watch for */
|
||||
NS_IMETHOD RegisterTagToWatch(const char* tagName);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void Notify();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mBadTagFound;
|
||||
|
||||
nsCStringArray mWatchTags;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -48,12 +48,11 @@ nsEditorParserObserver::~nsEditorParserObserver()
|
|||
|
||||
NS_IMETHODIMP_(const char*) nsEditorParserObserver::GetTagNameAt(PRUint32 aTagIndex)
|
||||
{
|
||||
if (aTagIndex < gParserObserver_TagCount)
|
||||
{
|
||||
return gParserObserver_Tags[aTagIndex];
|
||||
} else {
|
||||
nsCString* theString = mWatchTags[aTagIndex];
|
||||
if (theString)
|
||||
return theString->GetBuffer();
|
||||
else
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditorParserObserver::Notify(
|
||||
|
@ -121,4 +120,15 @@ NS_IMETHODIMP nsEditorParserObserver::GetBadTagFound(PRBool *aFound)
|
|||
NS_ENSURE_ARG_POINTER(aFound);
|
||||
*aFound = mBadTagFound;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsEditorParserObserver::RegisterTagToWatch(const char* tagName)
|
||||
{
|
||||
nsCString theTagString(tagName);
|
||||
mWatchTags.AppendCString(theTagString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,14 +24,9 @@
|
|||
#include "nsIElementObserver.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
static const PRInt32 gParserObserver_TagCount=1;
|
||||
static const char * gParserObserver_Tags[1] = {"FRAMESET"};
|
||||
|
||||
|
||||
// this needs to support the weak reference API, so that the parser
|
||||
// does not need to hold a reference
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsEditorParserObserver : public nsSupportsWeakReference,
|
||||
public nsIElementObserver,
|
||||
|
@ -49,29 +44,31 @@ public:
|
|||
NS_IMETHOD Notify(PRUint32 aDocumentID, eHTMLTags aTag, PRUint32 numOfAttributes,
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
NS_IMETHOD Notify(PRUint32 aDocumentID, const PRUnichar* aTag, PRUint32 numOfAttributes,
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
const PRUnichar* nameArray[], const PRUnichar* valueArray[]);
|
||||
|
||||
/* methods for nsIObserver */
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
/* begin observing */
|
||||
/* begin and end observing */
|
||||
NS_IMETHOD Start();
|
||||
|
||||
/** end observing */
|
||||
NS_IMETHOD End();
|
||||
|
||||
/** query, did we find a bad tag? */
|
||||
/* query, did we find a bad tag? */
|
||||
NS_IMETHOD GetBadTagFound(PRBool *aFound);
|
||||
|
||||
/* register a tag to watch for */
|
||||
NS_IMETHOD RegisterTagToWatch(const char* tagName);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void Notify();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mBadTagFound;
|
||||
|
||||
nsCStringArray mWatchTags;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче