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

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

Issue 49613005: Have TreeScrope::adoptIfNeeded() take a reference instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/TreeScope.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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 if (index != kNotFound) { 1924 if (index != kNotFound) {
1925 if (oldAttrNode) 1925 if (oldAttrNode)
1926 detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->a ttributeItem(index)->value()); 1926 detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->a ttributeItem(index)->value());
1927 else 1927 else
1928 oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), el ementData->attributeItem(index)->value()); 1928 oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), el ementData->attributeItem(index)->value());
1929 } 1929 }
1930 1930
1931 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No tInSynchronizationOfLazyAttribute); 1931 setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), No tInSynchronizationOfLazyAttribute);
1932 1932
1933 attrNode->attachToElement(this); 1933 attrNode->attachToElement(this);
1934 treeScope().adoptIfNeeded(attrNode); 1934 treeScope().adoptIfNeeded(*attrNode);
1935 ensureAttrNodeListForElement(this).append(attrNode); 1935 ensureAttrNodeListForElement(this).append(attrNode);
1936 1936
1937 return oldAttrNode.release(); 1937 return oldAttrNode.release();
1938 } 1938 }
1939 1939
1940 PassRefPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionState& es) 1940 PassRefPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionState& es)
1941 { 1941 {
1942 return setAttributeNode(attr, es); 1942 return setAttributeNode(attr, es);
1943 } 1943 }
1944 1944
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3055 return findAttrNodeInList(*attrNodeList, name); 3055 return findAttrNodeInList(*attrNodeList, name);
3056 return 0; 3056 return 0;
3057 } 3057 }
3058 3058
3059 PassRefPtr<Attr> Element::ensureAttr(const QualifiedName& name) 3059 PassRefPtr<Attr> Element::ensureAttr(const QualifiedName& name)
3060 { 3060 {
3061 AttrNodeList& attrNodeList = ensureAttrNodeListForElement(this); 3061 AttrNodeList& attrNodeList = ensureAttrNodeListForElement(this);
3062 RefPtr<Attr> attrNode = findAttrNodeInList(attrNodeList, name); 3062 RefPtr<Attr> attrNode = findAttrNodeInList(attrNodeList, name);
3063 if (!attrNode) { 3063 if (!attrNode) {
3064 attrNode = Attr::create(*this, name); 3064 attrNode = Attr::create(*this, name);
3065 treeScope().adoptIfNeeded(attrNode.get()); 3065 treeScope().adoptIfNeeded(*attrNode);
3066 attrNodeList.append(attrNode); 3066 attrNodeList.append(attrNode);
3067 } 3067 }
3068 return attrNode.release(); 3068 return attrNode.release();
3069 } 3069 }
3070 3070
3071 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value) 3071 void Element::detachAttrNodeFromElementWithValue(Attr* attrNode, const AtomicStr ing& value)
3072 { 3072 {
3073 ASSERT(hasSyntheticAttrChildNodes()); 3073 ASSERT(hasSyntheticAttrChildNodes());
3074 attrNode->detachFromElementWithValue(value); 3074 attrNode->detachFromElementWithValue(value);
3075 3075
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3425 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3426 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3426 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3427 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3427 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3428 return false; 3428 return false;
3429 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3429 if (FullscreenElementStack::isActiveFullScreenElement(this))
3430 return false; 3430 return false;
3431 return true; 3431 return true;
3432 } 3432 }
3433 3433
3434 } // namespace WebCore 3434 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698