| 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" |
| 33 #include "core/html/parser/HTMLTreeBuilder.h" | 34 #include "core/html/parser/HTMLTreeBuilder.h" |
| 34 #include "platform/NotImplemented.h" | 35 #include "platform/NotImplemented.h" |
| 35 #include "core/xml/parser/MarkupTokenizerInlines.h" | 36 #include "core/xml/parser/MarkupTokenizerInlines.h" |
| 36 #include "wtf/ASCIICType.h" | 37 #include "wtf/ASCIICType.h" |
| 37 #include "wtf/text/AtomicString.h" | 38 #include "wtf/text/AtomicString.h" |
| 38 #include "wtf/unicode/Unicode.h" | 39 #include "wtf/unicode/Unicode.h" |
| 39 | 40 |
| 40 using namespace WTF; | 41 using namespace WTF; |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 { | 1590 { |
| 1590 // FIXME: Add an assert about m_state. | 1591 // FIXME: Add an assert about m_state. |
| 1591 StringBuilder characters; | 1592 StringBuilder characters; |
| 1592 characters.reserveCapacity(numberOfBufferedCharacters()); | 1593 characters.reserveCapacity(numberOfBufferedCharacters()); |
| 1593 characters.append('<'); | 1594 characters.append('<'); |
| 1594 characters.append('/'); | 1595 characters.append('/'); |
| 1595 characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size()); | 1596 characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size()); |
| 1596 return characters.toString(); | 1597 return characters.toString(); |
| 1597 } | 1598 } |
| 1598 | 1599 |
| 1599 void HTMLTokenizer::updateStateFor(const AtomicString& tagName) | 1600 void HTMLTokenizer::updateStateFor(const String& tagName) |
| 1600 { | 1601 { |
| 1601 if (tagName == textareaTag || tagName == titleTag) | 1602 if (threadSafeMatch(tagName, textareaTag) || threadSafeMatch(tagName, titleT
ag)) |
| 1602 setState(HTMLTokenizer::RCDATAState); | 1603 setState(HTMLTokenizer::RCDATAState); |
| 1603 else if (tagName == plaintextTag) | 1604 else if (threadSafeMatch(tagName, plaintextTag)) |
| 1604 setState(HTMLTokenizer::PLAINTEXTState); | 1605 setState(HTMLTokenizer::PLAINTEXTState); |
| 1605 else if (tagName == scriptTag) | 1606 else if (threadSafeMatch(tagName, scriptTag)) |
| 1606 setState(HTMLTokenizer::ScriptDataState); | 1607 setState(HTMLTokenizer::ScriptDataState); |
| 1607 else if (tagName == styleTag | 1608 else if (threadSafeMatch(tagName, styleTag) |
| 1608 || tagName == iframeTag | 1609 || threadSafeMatch(tagName, iframeTag) |
| 1609 || tagName == xmpTag | 1610 || threadSafeMatch(tagName, xmpTag) |
| 1610 || (tagName == noembedTag && m_options.pluginsEnabled) | 1611 || (threadSafeMatch(tagName, noembedTag) && m_options.pluginsEnabled) |
| 1611 || tagName == noframesTag | 1612 || threadSafeMatch(tagName, noframesTag) |
| 1612 || (tagName == noscriptTag && m_options.scriptEnabled)) | 1613 || (threadSafeMatch(tagName, noscriptTag) && m_options.scriptEnabled)) |
| 1613 setState(HTMLTokenizer::RAWTEXTState); | 1614 setState(HTMLTokenizer::RAWTEXTState); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) | 1617 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) |
| 1617 { | 1618 { |
| 1618 return vectorEqualsString(m_temporaryBuffer, expectedString); | 1619 return vectorEqualsString(m_temporaryBuffer, expectedString); |
| 1619 } | 1620 } |
| 1620 | 1621 |
| 1621 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) | 1622 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) |
| 1622 { | 1623 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1638 | 1639 |
| 1639 return true; | 1640 return true; |
| 1640 } | 1641 } |
| 1641 | 1642 |
| 1642 inline void HTMLTokenizer::parseError() | 1643 inline void HTMLTokenizer::parseError() |
| 1643 { | 1644 { |
| 1644 notImplemented(); | 1645 notImplemented(); |
| 1645 } | 1646 } |
| 1646 | 1647 |
| 1647 } | 1648 } |
| OLD | NEW |