| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return m_data; | 89 return m_data; |
| 90 } | 90 } |
| 91 | 91 |
| 92 const String& comment() const | 92 const String& comment() const |
| 93 { | 93 { |
| 94 ASSERT(m_type == HTMLToken::Comment); | 94 ASSERT(m_type == HTMLToken::Comment); |
| 95 return m_data; | 95 return m_data; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // FIXME: Distinguish between a missing public identifer and an empty one. | 98 // FIXME: Distinguish between a missing public identifer and an empty one. |
| 99 Vector<UChar>& publicIdentifier() const | 99 String& publicIdentifier() const |
| 100 { | 100 { |
| 101 ASSERT(m_type == HTMLToken::DOCTYPE); | 101 ASSERT(m_type == HTMLToken::DOCTYPE); |
| 102 return m_doctypeData->m_publicIdentifier; | 102 return m_doctypeData->m_publicIdentifier; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // FIXME: Distinguish between a missing system identifer and an empty one. | 105 // FIXME: Distinguish between a missing system identifer and an empty one. |
| 106 Vector<UChar>& systemIdentifier() const | 106 String& systemIdentifier() const |
| 107 { | 107 { |
| 108 ASSERT(m_type == HTMLToken::DOCTYPE); | 108 ASSERT(m_type == HTMLToken::DOCTYPE); |
| 109 return m_doctypeData->m_systemIdentifier; | 109 return m_doctypeData->m_systemIdentifier; |
| 110 } | 110 } |
| 111 | 111 |
| 112 explicit AtomicHTMLToken(HTMLToken& token) | 112 explicit AtomicHTMLToken(HTMLToken& token) |
| 113 : m_type(token.type()) | 113 : m_type(token.type()) |
| 114 { | 114 { |
| 115 switch (m_type) { | 115 switch (m_type) { |
| 116 case HTMLToken::Uninitialized: | 116 case HTMLToken::Uninitialized: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 146 : m_type(token.type()) | 146 : m_type(token.type()) |
| 147 { | 147 { |
| 148 switch (m_type) { | 148 switch (m_type) { |
| 149 case HTMLToken::Uninitialized: | 149 case HTMLToken::Uninitialized: |
| 150 ASSERT_NOT_REACHED(); | 150 ASSERT_NOT_REACHED(); |
| 151 break; | 151 break; |
| 152 case HTMLToken::DOCTYPE: | 152 case HTMLToken::DOCTYPE: |
| 153 m_name = AtomicString(token.data()); | 153 m_name = AtomicString(token.data()); |
| 154 m_doctypeData = adoptPtr(new DoctypeData()); | 154 m_doctypeData = adoptPtr(new DoctypeData()); |
| 155 m_doctypeData->m_hasPublicIdentifier = true; | 155 m_doctypeData->m_hasPublicIdentifier = true; |
| 156 append(m_doctypeData->m_publicIdentifier, token.publicIdentifier()); | 156 m_doctypeData->m_publicIdentifier = token.publicIdentifier(); |
| 157 m_doctypeData->m_hasSystemIdentifier = true; | 157 m_doctypeData->m_hasSystemIdentifier = true; |
| 158 append(m_doctypeData->m_systemIdentifier, token.systemIdentifier()); | 158 m_doctypeData->m_systemIdentifier = token.systemIdentifier(); |
| 159 m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks(); | 159 m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks(); |
| 160 break; | 160 break; |
| 161 case HTMLToken::EndOfFile: | 161 case HTMLToken::EndOfFile: |
| 162 break; | 162 break; |
| 163 case HTMLToken::StartTag: | 163 case HTMLToken::StartTag: |
| 164 m_attributes.reserveInitialCapacity(token.attributes().size()); | 164 m_attributes.reserveInitialCapacity(token.attributes().size()); |
| 165 for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.
attributes().begin(); it != token.attributes().end(); ++it) { | 165 for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.
attributes().begin(); it != token.attributes().end(); ++it) { |
| 166 QualifiedName name(nullAtom, AtomicString(it->name), nullAtom); | 166 QualifiedName name(nullAtom, AtomicString(it->name), nullAtom); |
| 167 // FIXME: This is N^2 for the number of attributes. | 167 // FIXME: This is N^2 for the number of attributes. |
| 168 if (!findAttributeInVector(m_attributes, name)) | 168 if (!findAttributeInVector(m_attributes, name)) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 const QualifiedName& name = nameForAttribute(attribute); | 244 const QualifiedName& name = nameForAttribute(attribute); |
| 245 // FIXME: This is N^2 for the number of attributes. | 245 // FIXME: This is N^2 for the number of attributes. |
| 246 if (!findAttributeInVector(m_attributes, name)) | 246 if (!findAttributeInVector(m_attributes, name)) |
| 247 m_attributes.append(Attribute(name, value)); | 247 m_attributes.append(Attribute(name, value)); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 } | 251 } |
| 252 | 252 |
| 253 #endif | 253 #endif |
| OLD | NEW |