OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 12 matching lines...) Expand all Loading... |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "core/html/parser/HTMLTokenizer.h" | 29 #include "core/html/parser/HTMLTokenizer.h" |
30 | 30 |
31 #include "HTMLNames.h" | 31 #include "HTMLNames.h" |
32 #include "core/html/parser/HTMLEntityParser.h" | 32 #include "core/html/parser/HTMLEntityParser.h" |
33 #include "core/html/parser/HTMLParserIdioms.h" | |
34 #include "core/html/parser/HTMLTreeBuilder.h" | 33 #include "core/html/parser/HTMLTreeBuilder.h" |
35 #include "platform/NotImplemented.h" | 34 #include "platform/NotImplemented.h" |
36 #include "core/xml/parser/MarkupTokenizerInlines.h" | 35 #include "core/xml/parser/MarkupTokenizerInlines.h" |
37 #include "wtf/ASCIICType.h" | 36 #include "wtf/ASCIICType.h" |
38 #include "wtf/text/AtomicString.h" | 37 #include "wtf/text/AtomicString.h" |
39 #include "wtf/unicode/Unicode.h" | 38 #include "wtf/unicode/Unicode.h" |
40 | 39 |
41 using namespace WTF; | 40 using namespace WTF; |
42 | 41 |
43 namespace WebCore { | 42 namespace WebCore { |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 { | 1589 { |
1591 // FIXME: Add an assert about m_state. | 1590 // FIXME: Add an assert about m_state. |
1592 StringBuilder characters; | 1591 StringBuilder characters; |
1593 characters.reserveCapacity(numberOfBufferedCharacters()); | 1592 characters.reserveCapacity(numberOfBufferedCharacters()); |
1594 characters.append('<'); | 1593 characters.append('<'); |
1595 characters.append('/'); | 1594 characters.append('/'); |
1596 characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size()); | 1595 characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size()); |
1597 return characters.toString(); | 1596 return characters.toString(); |
1598 } | 1597 } |
1599 | 1598 |
1600 void HTMLTokenizer::updateStateFor(const String& tagName) | 1599 void HTMLTokenizer::updateStateFor(const AtomicString& tagName) |
1601 { | 1600 { |
1602 if (threadSafeMatch(tagName, textareaTag) || threadSafeMatch(tagName, titleT
ag)) | 1601 if (tagName == textareaTag || tagName == titleTag) |
1603 setState(HTMLTokenizer::RCDATAState); | 1602 setState(HTMLTokenizer::RCDATAState); |
1604 else if (threadSafeMatch(tagName, plaintextTag)) | 1603 else if (tagName == plaintextTag) |
1605 setState(HTMLTokenizer::PLAINTEXTState); | 1604 setState(HTMLTokenizer::PLAINTEXTState); |
1606 else if (threadSafeMatch(tagName, scriptTag)) | 1605 else if (tagName == scriptTag) |
1607 setState(HTMLTokenizer::ScriptDataState); | 1606 setState(HTMLTokenizer::ScriptDataState); |
1608 else if (threadSafeMatch(tagName, styleTag) | 1607 else if (tagName == styleTag |
1609 || threadSafeMatch(tagName, iframeTag) | 1608 || tagName == iframeTag |
1610 || threadSafeMatch(tagName, xmpTag) | 1609 || tagName == xmpTag |
1611 || (threadSafeMatch(tagName, noembedTag) && m_options.pluginsEnabled) | 1610 || (tagName == noembedTag && m_options.pluginsEnabled) |
1612 || threadSafeMatch(tagName, noframesTag) | 1611 || tagName == noframesTag |
1613 || (threadSafeMatch(tagName, noscriptTag) && m_options.scriptEnabled)) | 1612 || (tagName == noscriptTag && m_options.scriptEnabled)) |
1614 setState(HTMLTokenizer::RAWTEXTState); | 1613 setState(HTMLTokenizer::RAWTEXTState); |
1615 } | 1614 } |
1616 | 1615 |
1617 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) | 1616 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) |
1618 { | 1617 { |
1619 return vectorEqualsString(m_temporaryBuffer, expectedString); | 1618 return vectorEqualsString(m_temporaryBuffer, expectedString); |
1620 } | 1619 } |
1621 | 1620 |
1622 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) | 1621 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) |
1623 { | 1622 { |
(...skipping 15 matching lines...) Expand all Loading... |
1639 | 1638 |
1640 return true; | 1639 return true; |
1641 } | 1640 } |
1642 | 1641 |
1643 inline void HTMLTokenizer::parseError() | 1642 inline void HTMLTokenizer::parseError() |
1644 { | 1643 { |
1645 notImplemented(); | 1644 notImplemented(); |
1646 } | 1645 } |
1647 | 1646 |
1648 } | 1647 } |
OLD | NEW |