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

Side by Side Diff: Source/core/html/parser/HTMLConstructionSite.cpp

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 dispatchDocumentElementAvailableIfNeeded(); 400 dispatchDocumentElementAvailableIfNeeded();
401 } 401 }
402 402
403 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken* token, Element* element) 403 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken* token, Element* element)
404 { 404 {
405 if (token->attributes().isEmpty()) 405 if (token->attributes().isEmpty())
406 return; 406 return;
407 407
408 for (unsigned i = 0; i < token->attributes().size(); ++i) { 408 for (unsigned i = 0; i < token->attributes().size(); ++i) {
409 const Attribute& tokenAttribute = token->attributes().at(i); 409 const Attribute& tokenAttribute = token->attributes().at(i);
410 if (!element->elementData() || element->attributes().findIndex(tokenAttr ibute.name()) == kNotFound) 410 if (element->attributesWithoutUpdate().findIndex(tokenAttribute.name()) == kNotFound)
411 element->setAttribute(tokenAttribute.name(), tokenAttribute.value()) ; 411 element->setAttribute(tokenAttribute.name(), tokenAttribute.value()) ;
412 } 412 }
413 } 413 }
414 414
415 void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken* token) 415 void HTMLConstructionSite::insertHTMLHtmlStartTagInBody(AtomicHTMLToken* token)
416 { 416 {
417 // Fragments do not have a root HTML element, so any additional HTML element s 417 // Fragments do not have a root HTML element, so any additional HTML element s
418 // encountered during fragment parsing should be ignored. 418 // encountered during fragment parsing should be ignored.
419 if (m_isParsingFragment) 419 if (m_isParsingFragment)
420 return; 420 return;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 869 }
870 870
871 void HTMLConstructionSite::PendingText::trace(Visitor* visitor) 871 void HTMLConstructionSite::PendingText::trace(Visitor* visitor)
872 { 872 {
873 visitor->trace(parent); 873 visitor->trace(parent);
874 visitor->trace(nextChild); 874 visitor->trace(nextChild);
875 } 875 }
876 876
877 877
878 } 878 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698