| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 455 |
| 456 static void adjustSVGTagNameCase(AtomicHTMLToken* token) { | 456 static void adjustSVGTagNameCase(AtomicHTMLToken* token) { |
| 457 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 457 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 458 if (!caseMap) { | 458 if (!caseMap) { |
| 459 caseMap = new PrefixedNameToQualifiedNameMap; | 459 caseMap = new PrefixedNameToQualifiedNameMap; |
| 460 std::unique_ptr<const SVGQualifiedName* []> svgTags = | 460 std::unique_ptr<const SVGQualifiedName* []> svgTags = |
| 461 SVGNames::getSVGTags(); | 461 SVGNames::getSVGTags(); |
| 462 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount); | 462 mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount); |
| 463 } | 463 } |
| 464 | 464 |
| 465 const QualifiedName& casedName = caseMap->get(token->name()); | 465 const QualifiedName& casedName = caseMap->at(token->name()); |
| 466 if (casedName.localName().isNull()) | 466 if (casedName.localName().isNull()) |
| 467 return; | 467 return; |
| 468 token->setName(casedName.localName()); | 468 token->setName(casedName.localName()); |
| 469 } | 469 } |
| 470 | 470 |
| 471 template <std::unique_ptr<const QualifiedName* []> getAttrs(), unsigned length> | 471 template <std::unique_ptr<const QualifiedName* []> getAttrs(), unsigned length> |
| 472 static void adjustAttributes(AtomicHTMLToken* token) { | 472 static void adjustAttributes(AtomicHTMLToken* token) { |
| 473 static PrefixedNameToQualifiedNameMap* caseMap = 0; | 473 static PrefixedNameToQualifiedNameMap* caseMap = 0; |
| 474 if (!caseMap) { | 474 if (!caseMap) { |
| 475 caseMap = new PrefixedNameToQualifiedNameMap; | 475 caseMap = new PrefixedNameToQualifiedNameMap; |
| 476 std::unique_ptr<const QualifiedName* []> attrs = getAttrs(); | 476 std::unique_ptr<const QualifiedName* []> attrs = getAttrs(); |
| 477 mapLoweredLocalNameToName(caseMap, attrs.get(), length); | 477 mapLoweredLocalNameToName(caseMap, attrs.get(), length); |
| 478 } | 478 } |
| 479 | 479 |
| 480 for (auto& tokenAttribute : token->attributes()) { | 480 for (auto& tokenAttribute : token->attributes()) { |
| 481 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()); | 481 const QualifiedName& casedName = caseMap->at(tokenAttribute.localName()); |
| 482 if (!casedName.localName().isNull()) | 482 if (!casedName.localName().isNull()) |
| 483 tokenAttribute.parserSetName(casedName); | 483 tokenAttribute.parserSetName(casedName); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 | 486 |
| 487 static void adjustSVGAttributes(AtomicHTMLToken* token) { | 487 static void adjustSVGAttributes(AtomicHTMLToken* token) { |
| 488 adjustAttributes<SVGNames::getSVGAttrs, SVGNames::SVGAttrsCount>(token); | 488 adjustAttributes<SVGNames::getSVGAttrs, SVGNames::SVGAttrsCount>(token); |
| 489 } | 489 } |
| 490 | 490 |
| 491 static void adjustMathMLAttributes(AtomicHTMLToken* token) { | 491 static void adjustMathMLAttributes(AtomicHTMLToken* token) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 519 std::unique_ptr<const QualifiedName* []> xmlAttrs = XMLNames::getXMLAttrs(); | 519 std::unique_ptr<const QualifiedName* []> xmlAttrs = XMLNames::getXMLAttrs(); |
| 520 addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount); | 520 addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount); |
| 521 | 521 |
| 522 map->insert(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); | 522 map->insert(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr); |
| 523 map->insert("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, | 523 map->insert("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, |
| 524 XMLNSNames::xmlnsNamespaceURI)); | 524 XMLNSNames::xmlnsNamespaceURI)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 527 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
| 528 Attribute& tokenAttribute = token->attributes().at(i); | 528 Attribute& tokenAttribute = token->attributes().at(i); |
| 529 const QualifiedName& name = map->get(tokenAttribute.localName()); | 529 const QualifiedName& name = map->at(tokenAttribute.localName()); |
| 530 if (!name.localName().isNull()) | 530 if (!name.localName().isNull()) |
| 531 tokenAttribute.parserSetName(name); | 531 tokenAttribute.parserSetName(name); |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 | 534 |
| 535 void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) { | 535 void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) { |
| 536 ASSERT(token->type() == HTMLToken::StartTag); | 536 ASSERT(token->type() == HTMLToken::StartTag); |
| 537 if (token->name() == htmlTag) { | 537 if (token->name() == htmlTag) { |
| 538 processHtmlStartTagForInBody(token); | 538 processHtmlStartTagForInBody(token); |
| 539 return; | 539 return; |
| (...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 DEFINE_STRINGIFY(AfterFramesetMode) | 2755 DEFINE_STRINGIFY(AfterFramesetMode) |
| 2756 DEFINE_STRINGIFY(AfterAfterBodyMode) | 2756 DEFINE_STRINGIFY(AfterAfterBodyMode) |
| 2757 DEFINE_STRINGIFY(AfterAfterFramesetMode) | 2757 DEFINE_STRINGIFY(AfterAfterFramesetMode) |
| 2758 #undef DEFINE_STRINGIFY | 2758 #undef DEFINE_STRINGIFY |
| 2759 } | 2759 } |
| 2760 return "<unknown>"; | 2760 return "<unknown>"; |
| 2761 } | 2761 } |
| 2762 #endif | 2762 #endif |
| 2763 | 2763 |
| 2764 } // namespace blink | 2764 } // namespace blink |
| OLD | NEW |