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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 1195583002: Measure the impact of a propsed change to createAttribute() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: check attr's document Created 5 years, 6 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/dom/Document.cpp ('k') | Source/core/frame/UseCounter.h » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 if (oldAttrNode.get() == attrNode) 1995 if (oldAttrNode.get() == attrNode)
1996 return attrNode; // This Attr is already attached to the element. 1996 return attrNode; // This Attr is already attached to the element.
1997 1997
1998 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object. 1998 // InUseAttributeError: Raised if node is an Attr that is already an attribu te of another Element object.
1999 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments. 1999 // The DOM user must explicitly clone Attr nodes to re-use them in other ele ments.
2000 if (attrNode->ownerElement()) { 2000 if (attrNode->ownerElement()) {
2001 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned."); 2001 exceptionState.throwDOMException(InUseAttributeError, "The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned.");
2002 return nullptr; 2002 return nullptr;
2003 } 2003 }
2004 2004
2005 if (!isHTMLElement() && attrNode->document().isHTMLDocument() && attrNode->n ame() != attrNode->name().lower())
2006 UseCounter::count(document(), UseCounter::NonHTMLElementSetAttributeNode FromHTMLDocumentNameNotLowercase);
2007
2005 synchronizeAllAttributes(); 2008 synchronizeAllAttributes();
2006 const UniqueElementData& elementData = ensureUniqueElementData(); 2009 const UniqueElementData& elementData = ensureUniqueElementData();
2007 2010
2008 AttributeCollection attributes = elementData.attributes(); 2011 AttributeCollection attributes = elementData.attributes();
2009 size_t index = attributes.findIndex(attrNode->qualifiedName(), shouldIgnoreA ttributeCase()); 2012 size_t index = attributes.findIndex(attrNode->qualifiedName(), shouldIgnoreA ttributeCase());
2010 AtomicString localName; 2013 AtomicString localName;
2011 if (index != kNotFound) { 2014 if (index != kNotFound) {
2012 const Attribute& attr = attributes[index]; 2015 const Attribute& attr = attributes[index];
2013 2016
2014 // If the name of the ElementData attribute doesn't 2017 // If the name of the ElementData attribute doesn't
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3429 { 3432 {
3430 #if ENABLE(OILPAN) 3433 #if ENABLE(OILPAN)
3431 if (hasRareData()) 3434 if (hasRareData())
3432 visitor->trace(elementRareData()); 3435 visitor->trace(elementRareData());
3433 visitor->trace(m_elementData); 3436 visitor->trace(m_elementData);
3434 #endif 3437 #endif
3435 ContainerNode::trace(visitor); 3438 ContainerNode::trace(visitor);
3436 } 3439 }
3437 3440
3438 } // namespace blink 3441 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698