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