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

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

Issue 60143002: Minimize performance regression caused by r157508 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reworked patch 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 | « no previous file | no next file » | 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 static void removeAttrNodeListForElement(Element* element) 173 static void removeAttrNodeListForElement(Element* element)
174 { 174 {
175 ASSERT(element->hasSyntheticAttrChildNodes()); 175 ASSERT(element->hasSyntheticAttrChildNodes());
176 ASSERT(attrNodeListMap().contains(element)); 176 ASSERT(attrNodeListMap().contains(element));
177 attrNodeListMap().remove(element); 177 attrNodeListMap().remove(element);
178 element->setHasSyntheticAttrChildNodes(false); 178 element->setHasSyntheticAttrChildNodes(false);
179 } 179 }
180 180
181 static Attr* findAttrNodeInList(AttrNodeList& attrNodeList, const QualifiedName& name) 181 static Attr* findAttrNodeInList(const AttrNodeList& attrNodeList, const Qualifie dName& name)
182 { 182 {
183 for (unsigned i = 0; i < attrNodeList.size(); ++i) { 183 AttrNodeList::const_iterator end = attrNodeList.end();
184 if (attrNodeList[i]->qualifiedName() == name) 184 for (AttrNodeList::const_iterator it = attrNodeList.begin(); it != end; ++it ) {
185 return attrNodeList[i].get(); 185 if ((*it)->qualifiedName() == name)
eseidel 2013/11/06 03:12:24 I wonder if this really wants matches() :) Which
186 return it->get();
186 } 187 }
187 return 0; 188 return 0;
188 } 189 }
189 190
190 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu ment) 191 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu ment)
191 { 192 {
192 return adoptRef(new Element(tagName, document, CreateElement)); 193 return adoptRef(new Element(tagName, document, CreateElement));
193 } 194 }
194 195
195 Element::~Element() 196 Element::~Element()
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 if (index != kNotFound) 917 if (index != kNotFound)
917 removeAttributeInternal(index, inSynchronizationOfLazyAttribute); 918 removeAttributeInternal(index, inSynchronizationOfLazyAttribute);
918 return; 919 return;
919 } 920 }
920 921
921 if (index == kNotFound) { 922 if (index == kNotFound) {
922 addAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute); 923 addAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute);
923 return; 924 return;
924 } 925 }
925 926
926 QualifiedName existingAttributeName = attributeItem(index)->name(); 927 const Attribute* existingAttribute = attributeItem(index);
928 QualifiedName existingAttributeName = existingAttribute->name();
927 929
928 if (!inSynchronizationOfLazyAttribute) 930 if (!inSynchronizationOfLazyAttribute)
929 willModifyAttribute(existingAttributeName, attributeItem(index)->value() , newValue); 931 willModifyAttribute(existingAttributeName, existingAttribute->value(), n ewValue);
930 932
931 if (newValue != attributeItem(index)->value()) { 933 if (newValue != existingAttribute->value()) {
932 // If there is an Attr node hooked to this attribute, the Attr::setValue () call below 934 // If there is an Attr node hooked to this attribute, the Attr::setValue () call below
933 // will write into the ElementData. 935 // will write into the ElementData.
934 // FIXME: Refactor this so it makes some sense. 936 // FIXME: Refactor this so it makes some sense.
935 if (RefPtr<Attr> attrNode = inSynchronizationOfLazyAttribute ? 0 : attrI fExists(existingAttributeName)) 937 if (RefPtr<Attr> attrNode = inSynchronizationOfLazyAttribute ? 0 : attrI fExists(existingAttributeName))
936 attrNode->setValue(newValue); 938 attrNode->setValue(newValue);
937 else 939 else
938 ensureUniqueElementData()->attributeItem(index)->setValue(newValue); 940 ensureUniqueElementData()->attributeItem(index)->setValue(newValue);
939 } 941 }
940 942
941 if (!inSynchronizationOfLazyAttribute) 943 if (!inSynchronizationOfLazyAttribute)
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3478 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3477 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3479 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3478 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3480 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3479 return false; 3481 return false;
3480 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3482 if (FullscreenElementStack::isActiveFullScreenElement(this))
3481 return false; 3483 return false;
3482 return true; 3484 return true;
3483 } 3485 }
3484 3486
3485 } // namespace WebCore 3487 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698