提交 2e40b826 编写于 作者: A Adam Barth

Remove more unused HTMLTokenizer features

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/678903002
上级 ff813964
......@@ -243,14 +243,6 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
}
END_STATE()
HTML_BEGIN_STATE(PLAINTEXTState) {
if (cc == kEndOfFileMarker)
return emitEndOfFile(source);
bufferCharacter(cc);
HTML_ADVANCE_TO(PLAINTEXTState);
}
END_STATE()
HTML_BEGIN_STATE(TagOpenState) {
if (cc == '!')
HTML_ADVANCE_TO(MarkupDeclarationOpenState);
......@@ -1077,25 +1069,6 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
return false;
}
String HTMLTokenizer::bufferedCharacters() const
{
// FIXME: Add an assert about m_state.
StringBuilder characters;
characters.reserveCapacity(numberOfBufferedCharacters());
characters.append('<');
characters.append('/');
characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size());
return characters.toString();
}
void HTMLTokenizer::updateStateFor(const String& tagName)
{
if (threadSafeMatch(tagName, HTMLNames::scriptTag))
setState(HTMLTokenizer::ScriptDataState);
else if (threadSafeMatch(tagName, HTMLNames::styleTag))
setState(HTMLTokenizer::RAWTEXTState);
}
inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString)
{
return vectorEqualsString(m_temporaryBuffer, expectedString);
......
......@@ -47,7 +47,6 @@ public:
CharacterReferenceInDataState,
RAWTEXTState,
ScriptDataState,
PLAINTEXTState,
TagOpenState,
EndTagOpenState,
TagNameState,
......@@ -100,35 +99,6 @@ public:
// they call reset() first).
bool nextToken(SegmentedString&, HTMLToken&);
// Returns a copy of any characters buffered internally by the tokenizer.
// The tokenizer buffers characters when searching for the </script> token
// that terminates a script element.
String bufferedCharacters() const;
size_t numberOfBufferedCharacters() const
{
// Notice that we add 2 to the length of the m_temporaryBuffer to
// account for the "</" characters, which are effecitvely buffered in
// the tokenizer's state machine.
return m_temporaryBuffer.size() ? m_temporaryBuffer.size() + 2 : 0;
}
// Updates the tokenizer's state according to the given tag name. This is
// an approximation of how the tree builder would update the tokenizer's
// state. This method is useful for approximating HTML tokenization. To
// get exactly the correct tokenization, you need the real tree builder.
//
// The main failures in the approximation are as follows:
//
// * The first set of character tokens emitted for a <pre> element might
// contain an extra leading newline.
// * The replacement of U+0000 with U+FFFD will not be sensitive to the
// tree builder's insertion mode.
// * CDATA sections in foreign content will be tokenized as bogus comments
// instead of as character tokens.
//
void updateStateFor(const String& tagName);
State state() const { return m_state; }
void setState(State state) { m_state = state; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册