OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (item->isSpecialNode() && !item->hasTagName(addressTag) && !item->has
TagName(divTag) && !item->hasTagName(pTag)) | 501 if (item->isSpecialNode() && !item->hasTagName(addressTag) && !item->has
TagName(divTag) && !item->hasTagName(pTag)) |
502 break; | 502 break; |
503 nodeRecord = nodeRecord->next(); | 503 nodeRecord = nodeRecord->next(); |
504 } | 504 } |
505 processFakePEndTagIfPInButtonScope(); | 505 processFakePEndTagIfPInButtonScope(); |
506 m_tree.insertHTMLElement(token); | 506 m_tree.insertHTMLElement(token); |
507 } | 507 } |
508 | 508 |
509 typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap; | 509 typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap; |
510 | 510 |
511 static void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, const
QualifiedName* const* names, size_t length) | 511 template <typename TableQualifiedName> |
| 512 static void mapLoweredLocalNameToName(PrefixedNameToQualifiedNameMap* map, const
TableQualifiedName* const* names, size_t length) |
512 { | 513 { |
513 for (size_t i = 0; i < length; ++i) { | 514 for (size_t i = 0; i < length; ++i) { |
514 const QualifiedName& name = *names[i]; | 515 const QualifiedName& name = *names[i]; |
515 const AtomicString& localName = name.localName(); | 516 const AtomicString& localName = name.localName(); |
516 AtomicString loweredLocalName = localName.lower(); | 517 AtomicString loweredLocalName = localName.lower(); |
517 if (loweredLocalName != localName) | 518 if (loweredLocalName != localName) |
518 map->add(loweredLocalName, name); | 519 map->add(loweredLocalName, name); |
519 } | 520 } |
520 } | 521 } |
521 | 522 |
522 static void adjustSVGTagNameCase(AtomicHTMLToken* token) | 523 static void adjustSVGTagNameCase(AtomicHTMLToken* token) |
523 { | 524 { |
524 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 525 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
525 if (!caseMap) { | 526 if (!caseMap) { |
526 caseMap = new PrefixedNameToQualifiedNameMap; | 527 caseMap = new PrefixedNameToQualifiedNameMap; |
527 OwnPtr<const QualifiedName*[]> svgTags = SVGNames::getSVGTags(); | 528 OwnPtr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); |
528 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount
); | 529 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount
); |
529 } | 530 } |
530 | 531 |
531 const QualifiedName& casedName = caseMap->get(token->name()); | 532 const QualifiedName& casedName = caseMap->get(token->name()); |
532 if (casedName.localName().isNull()) | 533 if (casedName.localName().isNull()) |
533 return; | 534 return; |
534 token->setName(casedName.localName()); | 535 token->setName(casedName.localName()); |
535 } | 536 } |
536 | 537 |
537 template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> | 538 template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> |
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 ASSERT(m_isAttached); | 2795 ASSERT(m_isAttached); |
2795 // Warning, this may detach the parser. Do not do anything else after this. | 2796 // Warning, this may detach the parser. Do not do anything else after this. |
2796 m_tree.finishedParsing(); | 2797 m_tree.finishedParsing(); |
2797 } | 2798 } |
2798 | 2799 |
2799 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2800 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
2800 { | 2801 { |
2801 } | 2802 } |
2802 | 2803 |
2803 } // namespace blink | 2804 } // namespace blink |
OLD | NEW |