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

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

Issue 135273010: Enable HTMLImageElement to avoid immediate src loading when parsed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLImageElement.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) 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 } 909 }
910 910
911 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const Atom icString& value) 911 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const Atom icString& value)
912 { 912 {
913 size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : kNotFound; 913 size_t index = elementData() ? elementData()->getAttributeItemIndex(name) : kNotFound;
914 setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute); 914 setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute);
915 } 915 }
916 916
917 ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedNa me& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchro nizationOfLazyAttribute) 917 ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedNa me& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchro nizationOfLazyAttribute)
918 { 918 {
919 m_parserSet = false;
920
919 if (newValue.isNull()) { 921 if (newValue.isNull()) {
920 if (index != kNotFound) 922 if (index != kNotFound)
921 removeAttributeInternal(index, inSynchronizationOfLazyAttribute); 923 removeAttributeInternal(index, inSynchronizationOfLazyAttribute);
922 return; 924 return;
923 } 925 }
924 926
925 if (index == kNotFound) { 927 if (index == kNotFound) {
926 addAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute); 928 addAttributeInternal(name, newValue, inSynchronizationOfLazyAttribute);
927 return; 929 return;
928 } 930 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 ASSERT(!m_elementData); 1193 ASSERT(!m_elementData);
1192 1194
1193 if (attributeVector.isEmpty()) 1195 if (attributeVector.isEmpty())
1194 return; 1196 return;
1195 1197
1196 if (document().sharedObjectPool()) 1198 if (document().sharedObjectPool())
1197 m_elementData = document().sharedObjectPool()->cachedShareableElementDat aWithAttributes(attributeVector); 1199 m_elementData = document().sharedObjectPool()->cachedShareableElementDat aWithAttributes(attributeVector);
1198 else 1200 else
1199 m_elementData = ShareableElementData::createWithAttributes(attributeVect or); 1201 m_elementData = ShareableElementData::createWithAttributes(attributeVect or);
1200 1202
1203 m_parserSet = true;
1204
1201 // Use attributeVector instead of m_elementData because attributeChanged mig ht modify m_elementData. 1205 // Use attributeVector instead of m_elementData because attributeChanged mig ht modify m_elementData.
1202 for (unsigned i = 0; i < attributeVector.size(); ++i) 1206 for (unsigned i = 0; i < attributeVector.size(); ++i)
1203 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu teVector[i].value(), ModifiedDirectly); 1207 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu teVector[i].value(), ModifiedDirectly);
1204 } 1208 }
1205 1209
1206 bool Element::hasAttributes() const 1210 bool Element::hasAttributes() const
1207 { 1211 {
1208 synchronizeAllAttributes(); 1212 synchronizeAllAttributes();
1209 return elementData() && elementData()->length(); 1213 return elementData() && elementData()->length();
1210 } 1214 }
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 QualifiedName parsedName = anyName; 2092 QualifiedName parsedName = anyName;
2089 if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, exceptionSt ate)) 2093 if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, exceptionSt ate))
2090 return; 2094 return;
2091 setAttribute(parsedName, value); 2095 setAttribute(parsedName, value);
2092 } 2096 }
2093 2097
2094 void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu te inSynchronizationOfLazyAttribute) 2098 void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu te inSynchronizationOfLazyAttribute)
2095 { 2099 {
2096 ASSERT_WITH_SECURITY_IMPLICATION(index < attributeCount()); 2100 ASSERT_WITH_SECURITY_IMPLICATION(index < attributeCount());
2097 2101
2102 m_parserSet = false;
2103
2098 UniqueElementData* elementData = ensureUniqueElementData(); 2104 UniqueElementData* elementData = ensureUniqueElementData();
2099 2105
2100 QualifiedName name = elementData->attributeItem(index)->name(); 2106 QualifiedName name = elementData->attributeItem(index)->name();
2101 AtomicString valueBeingRemoved = elementData->attributeItem(index)->value(); 2107 AtomicString valueBeingRemoved = elementData->attributeItem(index)->value();
2102 2108
2103 if (!inSynchronizationOfLazyAttribute) { 2109 if (!inSynchronizationOfLazyAttribute) {
2104 if (!valueBeingRemoved.isNull()) 2110 if (!valueBeingRemoved.isNull())
2105 willModifyAttribute(name, valueBeingRemoved, nullAtom); 2111 willModifyAttribute(name, valueBeingRemoved, nullAtom);
2106 } 2112 }
2107 2113
2108 if (RefPtr<Attr> attrNode = attrIfExists(name)) 2114 if (RefPtr<Attr> attrNode = attrIfExists(name))
2109 detachAttrNodeFromElementWithValue(attrNode.get(), elementData->attribut eItem(index)->value()); 2115 detachAttrNodeFromElementWithValue(attrNode.get(), elementData->attribut eItem(index)->value());
2110 2116
2111 elementData->removeAttribute(index); 2117 elementData->removeAttribute(index);
2112 2118
2113 if (!inSynchronizationOfLazyAttribute) 2119 if (!inSynchronizationOfLazyAttribute)
2114 didRemoveAttribute(name); 2120 didRemoveAttribute(name);
2115 } 2121 }
2116 2122
2117 void Element::addAttributeInternal(const QualifiedName& name, const AtomicString & value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute) 2123 void Element::addAttributeInternal(const QualifiedName& name, const AtomicString & value, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
2118 { 2124 {
2125 m_parserSet = false;
2126
2119 if (!inSynchronizationOfLazyAttribute) 2127 if (!inSynchronizationOfLazyAttribute)
2120 willModifyAttribute(name, nullAtom, value); 2128 willModifyAttribute(name, nullAtom, value);
2121 ensureUniqueElementData()->addAttribute(name, value); 2129 ensureUniqueElementData()->addAttribute(name, value);
2122 if (!inSynchronizationOfLazyAttribute) 2130 if (!inSynchronizationOfLazyAttribute)
2123 didAddAttribute(name, value); 2131 didAddAttribute(name, value);
2124 } 2132 }
2125 2133
2126 void Element::removeAttribute(const AtomicString& name) 2134 void Element::removeAttribute(const AtomicString& name)
2127 { 2135 {
2128 if (!elementData()) 2136 if (!elementData())
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3634 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3627 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3635 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3628 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3636 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3629 return false; 3637 return false;
3630 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3638 if (FullscreenElementStack::isActiveFullScreenElement(this))
3631 return false; 3639 return false;
3632 return true; 3640 return true;
3633 } 3641 }
3634 3642
3635 } // namespace WebCore 3643 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698