| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 HTMLMetaCharsetParser::~HTMLMetaCharsetParser() | 50 HTMLMetaCharsetParser::~HTMLMetaCharsetParser() |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool HTMLMetaCharsetParser::processMeta() | 54 bool HTMLMetaCharsetParser::processMeta() |
| 55 { | 55 { |
| 56 const HTMLToken::AttributeList& tokenAttributes = m_token.attributes(); | 56 const HTMLToken::AttributeList& tokenAttributes = m_token.attributes(); |
| 57 HTMLAttributeList attributes; | 57 HTMLAttributeList attributes; |
| 58 for (HTMLToken::AttributeList::const_iterator iter = tokenAttributes.begin()
; iter != tokenAttributes.end(); ++iter) { | 58 for (const HTMLToken::Attribute& tokenAttribute : tokenAttributes) { |
| 59 String attributeName = attemptStaticStringCreation(iter->name, Likely8Bi
t); | 59 String attributeName = attemptStaticStringCreation(tokenAttribute.name,
Likely8Bit); |
| 60 String attributeValue = StringImpl::create8BitIfPossible(iter->value); | 60 String attributeValue = StringImpl::create8BitIfPossible(tokenAttribute.
value); |
| 61 attributes.append(std::make_pair(attributeName, attributeValue)); | 61 attributes.append(std::make_pair(attributeName, attributeValue)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 m_encoding = encodingFromMetaAttributes(attributes); | 64 m_encoding = encodingFromMetaAttributes(attributes); |
| 65 return m_encoding.isValid(); | 65 return m_encoding.isValid(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 static const int bytesToCheckUnconditionally = 1024; // That many input bytes wi
ll be checked for meta charset even if <head> section is over. | 68 static const int bytesToCheckUnconditionally = 1024; // That many input bytes wi
ll be checked for meta charset even if <head> section is over. |
| 69 | 69 |
| 70 bool HTMLMetaCharsetParser::checkForMetaCharset(const char* data, size_t length) | 70 bool HTMLMetaCharsetParser::checkForMetaCharset(const char* data, size_t length) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 m_token.clear(); | 123 m_token.clear(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 } | 129 } |
| OLD | NEW |