| 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 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 |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 if (loweredLocalName != localName) | 562 if (loweredLocalName != localName) |
| 563 map->add(loweredLocalName, name); | 563 map->add(loweredLocalName, name); |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 | 566 |
| 567 static void adjustSVGTagNameCase(AtomicHTMLToken* token) | 567 static void adjustSVGTagNameCase(AtomicHTMLToken* token) |
| 568 { | 568 { |
| 569 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 569 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 570 if (!caseMap) { | 570 if (!caseMap) { |
| 571 caseMap = new PrefixedNameToQualifiedNameMap; | 571 caseMap = new PrefixedNameToQualifiedNameMap; |
| 572 const QualifiedName* const* svgTags = SVGNames::getSVGTags(); | 572 OwnPtr<const QualifiedName*[]> svgTags = SVGNames::getSVGTags(); |
| 573 mapLoweredLocalNameToName(caseMap, svgTags, SVGNames::SVGTagsCount); | 573 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount
); |
| 574 } | 574 } |
| 575 | 575 |
| 576 const QualifiedName& casedName = caseMap->get(token->name()); | 576 const QualifiedName& casedName = caseMap->get(token->name()); |
| 577 if (casedName.localName().isNull()) | 577 if (casedName.localName().isNull()) |
| 578 return; | 578 return; |
| 579 token->setName(casedName.localName()); | 579 token->setName(casedName.localName()); |
| 580 } | 580 } |
| 581 | 581 |
| 582 template<const QualifiedName* const* getAttrs(), unsigned length> | 582 template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> |
| 583 static void adjustAttributes(AtomicHTMLToken* token) | 583 static void adjustAttributes(AtomicHTMLToken* token) |
| 584 { | 584 { |
| 585 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 585 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 586 if (!caseMap) { | 586 if (!caseMap) { |
| 587 caseMap = new PrefixedNameToQualifiedNameMap; | 587 caseMap = new PrefixedNameToQualifiedNameMap; |
| 588 const QualifiedName* const* attrs = getAttrs(); | 588 OwnPtr<const QualifiedName*[]> attrs = getAttrs(); |
| 589 mapLoweredLocalNameToName(caseMap, attrs, length); | 589 mapLoweredLocalNameToName(caseMap, attrs.get(), length); |
| 590 } | 590 } |
| 591 | 591 |
| 592 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 592 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
| 593 Attribute& tokenAttribute = token->attributes().at(i); | 593 Attribute& tokenAttribute = token->attributes().at(i); |
| 594 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()
); | 594 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()
); |
| 595 if (!casedName.localName().isNull()) | 595 if (!casedName.localName().isNull()) |
| 596 tokenAttribute.parserSetName(casedName); | 596 tokenAttribute.parserSetName(casedName); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 617 map->add(prefixColonLocalName, nameWithPrefix); | 617 map->add(prefixColonLocalName, nameWithPrefix); |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 static void adjustForeignAttributes(AtomicHTMLToken* token) | 621 static void adjustForeignAttributes(AtomicHTMLToken* token) |
| 622 { | 622 { |
| 623 static PrefixedNameToQualifiedNameMap* map = 0; | 623 static PrefixedNameToQualifiedNameMap* map = 0; |
| 624 if (!map) { | 624 if (!map) { |
| 625 map = new PrefixedNameToQualifiedNameMap; | 625 map = new PrefixedNameToQualifiedNameMap; |
| 626 | 626 |
| 627 const QualifiedName* const* attrs = XLinkNames::getXLinkAttrs(); | 627 OwnPtr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); |
| 628 addNamesWithPrefix(map, xlinkAtom, attrs, XLinkNames::XLinkAttrsCount); | 628 addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCo
unt); |
| 629 | 629 |
| 630 attrs = XMLNames::getXMLAttrs(); | 630 OwnPtr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); |
| 631 addNamesWithPrefix(map, xmlAtom, attrs, XMLNames::XMLAttrsCount); | 631 addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount
); |
| 632 | 632 |
| 633 map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); | 633 map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); |
| 634 map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::
xmlnsNamespaceURI)); | 634 map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::
xmlnsNamespaceURI)); |
| 635 } | 635 } |
| 636 | 636 |
| 637 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 637 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
| 638 Attribute& tokenAttribute = token->attributes().at(i); | 638 Attribute& tokenAttribute = token->attributes().at(i); |
| 639 const QualifiedName& name = map->get(tokenAttribute.localName()); | 639 const QualifiedName& name = map->get(tokenAttribute.localName()); |
| 640 if (!name.localName().isNull()) | 640 if (!name.localName().isNull()) |
| 641 tokenAttribute.parserSetName(name); | 641 tokenAttribute.parserSetName(name); |
| (...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 ASSERT(m_isAttached); | 2845 ASSERT(m_isAttached); |
| 2846 // Warning, this may detach the parser. Do not do anything else after this. | 2846 // Warning, this may detach the parser. Do not do anything else after this. |
| 2847 m_tree.finishedParsing(); | 2847 m_tree.finishedParsing(); |
| 2848 } | 2848 } |
| 2849 | 2849 |
| 2850 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2850 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2851 { | 2851 { |
| 2852 } | 2852 } |
| 2853 | 2853 |
| 2854 } // namespace WebCore | 2854 } // namespace WebCore |
| OLD | NEW |