| 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, 2014 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "core/html/HTMLDocument.h" | 39 #include "core/html/HTMLDocument.h" |
| 40 #include "core/html/HTMLFormElement.h" | 40 #include "core/html/HTMLFormElement.h" |
| 41 #include "core/html/parser/AtomicHTMLToken.h" | 41 #include "core/html/parser/AtomicHTMLToken.h" |
| 42 #include "core/html/parser/HTMLDocumentParser.h" | 42 #include "core/html/parser/HTMLDocumentParser.h" |
| 43 #include "core/html/parser/HTMLParserIdioms.h" | 43 #include "core/html/parser/HTMLParserIdioms.h" |
| 44 #include "core/html/parser/HTMLStackItem.h" | 44 #include "core/html/parser/HTMLStackItem.h" |
| 45 #include "core/html/parser/HTMLToken.h" | 45 #include "core/html/parser/HTMLToken.h" |
| 46 #include "core/html/parser/HTMLTokenizer.h" | 46 #include "core/html/parser/HTMLTokenizer.h" |
| 47 #include "platform/text/PlatformLocale.h" | 47 #include "platform/text/PlatformLocale.h" |
| 48 #include "wtf/text/CharacterNames.h" | 48 #include "wtf/text/CharacterNames.h" |
| 49 #include <memory> | |
| 50 | 49 |
| 51 namespace blink { | 50 namespace blink { |
| 52 | 51 |
| 53 using namespace HTMLNames; | 52 using namespace HTMLNames; |
| 54 | 53 |
| 55 namespace { | 54 namespace { |
| 56 | 55 |
| 57 inline bool isHTMLSpaceOrReplacementCharacter(UChar character) | 56 inline bool isHTMLSpaceOrReplacementCharacter(UChar character) |
| 58 { | 57 { |
| 59 return isHTMLSpace<UChar>(character) || character == replacementCharacter; | 58 return isHTMLSpace<UChar>(character) || character == replacementCharacter; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 if (loweredLocalName != localName) | 521 if (loweredLocalName != localName) |
| 523 map->add(loweredLocalName, name); | 522 map->add(loweredLocalName, name); |
| 524 } | 523 } |
| 525 } | 524 } |
| 526 | 525 |
| 527 static void adjustSVGTagNameCase(AtomicHTMLToken* token) | 526 static void adjustSVGTagNameCase(AtomicHTMLToken* token) |
| 528 { | 527 { |
| 529 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 528 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 530 if (!caseMap) { | 529 if (!caseMap) { |
| 531 caseMap = new PrefixedNameToQualifiedNameMap; | 530 caseMap = new PrefixedNameToQualifiedNameMap; |
| 532 std::unique_ptr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTag
s(); | 531 OwnPtr<const SVGQualifiedName*[]> svgTags = SVGNames::getSVGTags(); |
| 533 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount
); | 532 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount
); |
| 534 } | 533 } |
| 535 | 534 |
| 536 const QualifiedName& casedName = caseMap->get(token->name()); | 535 const QualifiedName& casedName = caseMap->get(token->name()); |
| 537 if (casedName.localName().isNull()) | 536 if (casedName.localName().isNull()) |
| 538 return; | 537 return; |
| 539 token->setName(casedName.localName()); | 538 token->setName(casedName.localName()); |
| 540 } | 539 } |
| 541 | 540 |
| 542 template<std::unique_ptr<const QualifiedName*[]> getAttrs(), unsigned length> | 541 template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length> |
| 543 static void adjustAttributes(AtomicHTMLToken* token) | 542 static void adjustAttributes(AtomicHTMLToken* token) |
| 544 { | 543 { |
| 545 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 544 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 546 if (!caseMap) { | 545 if (!caseMap) { |
| 547 caseMap = new PrefixedNameToQualifiedNameMap; | 546 caseMap = new PrefixedNameToQualifiedNameMap; |
| 548 std::unique_ptr<const QualifiedName*[]> attrs = getAttrs(); | 547 OwnPtr<const QualifiedName*[]> attrs = getAttrs(); |
| 549 mapLoweredLocalNameToName(caseMap, attrs.get(), length); | 548 mapLoweredLocalNameToName(caseMap, attrs.get(), length); |
| 550 } | 549 } |
| 551 | 550 |
| 552 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 551 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
| 553 Attribute& tokenAttribute = token->attributes().at(i); | 552 Attribute& tokenAttribute = token->attributes().at(i); |
| 554 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()
); | 553 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()
); |
| 555 if (!casedName.localName().isNull()) | 554 if (!casedName.localName().isNull()) |
| 556 tokenAttribute.parserSetName(casedName); | 555 tokenAttribute.parserSetName(casedName); |
| 557 } | 556 } |
| 558 } | 557 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 577 map->add(prefixColonLocalName, nameWithPrefix); | 576 map->add(prefixColonLocalName, nameWithPrefix); |
| 578 } | 577 } |
| 579 } | 578 } |
| 580 | 579 |
| 581 static void adjustForeignAttributes(AtomicHTMLToken* token) | 580 static void adjustForeignAttributes(AtomicHTMLToken* token) |
| 582 { | 581 { |
| 583 static PrefixedNameToQualifiedNameMap* map = 0; | 582 static PrefixedNameToQualifiedNameMap* map = 0; |
| 584 if (!map) { | 583 if (!map) { |
| 585 map = new PrefixedNameToQualifiedNameMap; | 584 map = new PrefixedNameToQualifiedNameMap; |
| 586 | 585 |
| 587 std::unique_ptr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttr
s(); | 586 OwnPtr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs(); |
| 588 addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCo
unt); | 587 addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCo
unt); |
| 589 | 588 |
| 590 std::unique_ptr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs
(); | 589 OwnPtr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs(); |
| 591 addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount
); | 590 addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount
); |
| 592 | 591 |
| 593 map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); | 592 map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); |
| 594 map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::
xmlnsNamespaceURI)); | 593 map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::
xmlnsNamespaceURI)); |
| 595 } | 594 } |
| 596 | 595 |
| 597 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 596 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
| 598 Attribute& tokenAttribute = token->attributes().at(i); | 597 Attribute& tokenAttribute = token->attributes().at(i); |
| 599 const QualifiedName& name = map->get(tokenAttribute.localName()); | 598 const QualifiedName& name = map->get(tokenAttribute.localName()); |
| 600 if (!name.localName().isNull()) | 599 if (!name.localName().isNull()) |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 ASSERT(m_isAttached); | 2819 ASSERT(m_isAttached); |
| 2821 // Warning, this may detach the parser. Do not do anything else after this. | 2820 // Warning, this may detach the parser. Do not do anything else after this. |
| 2822 m_tree.finishedParsing(); | 2821 m_tree.finishedParsing(); |
| 2823 } | 2822 } |
| 2824 | 2823 |
| 2825 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2824 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2826 { | 2825 { |
| 2827 } | 2826 } |
| 2828 | 2827 |
| 2829 } // namespace blink | 2828 } // namespace blink |
| OLD | NEW |