Bug 710292 - Add a common HTMLSplitOnSpacesTokenizer tokenizer. r=khuey

This commit is contained in:
Santiago Gimeno 2012-01-04 05:08:00 -05:00
parent 1e06975ffc
commit c5a094d7d4
3 changed files with 7 additions and 8 deletions

View File

@ -82,6 +82,7 @@ static fp_except_t oldmask = fpsetmask(~allmask);
#include "nsHtml5Parser.h"
#include "nsIFragmentContentSink.h"
#include "nsMathUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/GuardObjects.h"
@ -1942,6 +1943,9 @@ private:
static nsString* sModifierSeparator;
};
typedef nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
HTMLSplitOnSpacesTokenizer;
#define NS_HOLD_JS_OBJECTS(obj, clazz) \
nsContentUtils::HoldJSObjects(NS_CYCLE_COLLECTION_UPCAST(obj, clazz), \
&NS_CYCLE_COLLECTION_NAME(clazz))

View File

@ -114,7 +114,6 @@
#include "mozAutoDocUpdate.h"
#include "nsContentCreatorFunctions.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentUtils.h"
#include "nsRadioVisitor.h"
@ -3904,8 +3903,7 @@ nsHTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
bool
nsHTMLInputElement::IsValidEmailAddressList(const nsAString& aValue)
{
nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
tokenizer(aValue, ',');
HTMLSplitOnSpacesTokenizer tokenizer(aValue, ',');
while (tokenizer.hasMoreTokens()) {
if (!IsValidEmailAddress(tokenizer.nextToken())) {
@ -4124,8 +4122,7 @@ nsHTMLInputElement::GetFilterFromAccept()
nsAutoString accept;
GetAttr(kNameSpaceID_None, nsGkAtoms::accept, accept);
nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
tokenizer(accept, ',');
HTMLSplitOnSpacesTokenizer tokenizer(accept, ',');
while (tokenizer.hasMoreTokens()) {
const nsDependentSubstring token = tokenizer.nextToken();

View File

@ -84,7 +84,6 @@
#include "nsIVariant.h"
#include "mozilla/Services.h"
#include "nsDirectoryServiceDefs.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsHTMLInputElement.h"
#include "nsICapturePicker.h"
#include "nsIFileURL.h"
@ -759,8 +758,7 @@ nsFileControlFrame::ParseAcceptAttribute(AcceptAttrCallback aCallback,
nsAutoString accept;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accept, accept);
nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace>
tokenizer(accept, ',');
HTMLSplitOnSpacesTokenizer tokenizer(accept, ',');
// Empty loop body because aCallback is doing the work
while (tokenizer.hasMoreTokens() &&
(*aCallback)(tokenizer.nextToken(), aClosure));