Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 2556043002: Avoid WTF::Vector::at() and operator[] in core/html. (Closed)
Patch Set: _ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 473
474 template <std::unique_ptr<const QualifiedName* []> getAttrs(), unsigned length> 474 template <std::unique_ptr<const QualifiedName* []> getAttrs(), unsigned length>
475 static void adjustAttributes(AtomicHTMLToken* token) { 475 static void adjustAttributes(AtomicHTMLToken* token) {
476 static PrefixedNameToQualifiedNameMap* caseMap = 0; 476 static PrefixedNameToQualifiedNameMap* caseMap = 0;
477 if (!caseMap) { 477 if (!caseMap) {
478 caseMap = new PrefixedNameToQualifiedNameMap; 478 caseMap = new PrefixedNameToQualifiedNameMap;
479 std::unique_ptr<const QualifiedName* []> attrs = getAttrs(); 479 std::unique_ptr<const QualifiedName* []> attrs = getAttrs();
480 mapLoweredLocalNameToName(caseMap, attrs.get(), length); 480 mapLoweredLocalNameToName(caseMap, attrs.get(), length);
481 } 481 }
482 482
483 for (unsigned i = 0; i < token->attributes().size(); ++i) { 483 for (auto& tokenAttribute : token->attributes()) {
484 Attribute& tokenAttribute = token->attributes().at(i);
485 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName()); 484 const QualifiedName& casedName = caseMap->get(tokenAttribute.localName());
486 if (!casedName.localName().isNull()) 485 if (!casedName.localName().isNull())
487 tokenAttribute.parserSetName(casedName); 486 tokenAttribute.parserSetName(casedName);
488 } 487 }
489 } 488 }
490 489
491 static void adjustSVGAttributes(AtomicHTMLToken* token) { 490 static void adjustSVGAttributes(AtomicHTMLToken* token) {
492 adjustAttributes<SVGNames::getSVGAttrs, SVGNames::SVGAttrsCount>(token); 491 adjustAttributes<SVGNames::getSVGAttrs, SVGNames::SVGAttrsCount>(token);
493 } 492 }
494 493
(...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 DEFINE_STRINGIFY(AfterFramesetMode) 2754 DEFINE_STRINGIFY(AfterFramesetMode)
2756 DEFINE_STRINGIFY(AfterAfterBodyMode) 2755 DEFINE_STRINGIFY(AfterAfterBodyMode)
2757 DEFINE_STRINGIFY(AfterAfterFramesetMode) 2756 DEFINE_STRINGIFY(AfterAfterFramesetMode)
2758 #undef DEFINE_STRINGIFY 2757 #undef DEFINE_STRINGIFY
2759 } 2758 }
2760 return "<unknown>"; 2759 return "<unknown>";
2761 } 2760 }
2762 #endif 2761 #endif
2763 2762
2764 } // namespace blink 2763 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698