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

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

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 932
933 if (shouldInvalidateStyle) 933 if (shouldInvalidateStyle)
934 setNeedsStyleRecalc(); 934 setNeedsStyleRecalc();
935 935
936 if (AXObjectCache* cache = document()->existingAXObjectCache()) 936 if (AXObjectCache* cache = document()->existingAXObjectCache())
937 cache->handleAttributeChanged(name, this); 937 cache->handleAttributeChanged(name, this);
938 } 938 }
939 939
940 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason) 940 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason)
941 { 941 {
942 if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr) { 942 if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr)
943 document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, ne wValue); 943 document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, ne wValue, true);
944 }
945 attributeChanged(name, newValue, reason); 944 attributeChanged(name, newValue, reason);
946 } 945 }
947 946
948 template <typename CharacterType> 947 template <typename CharacterType>
949 static inline bool classStringHasClassName(const CharacterType* characters, unsi gned length) 948 static inline bool classStringHasClassName(const CharacterType* characters, unsi gned length)
950 { 949 {
951 ASSERT(length > 0); 950 ASSERT(length > 0);
952 951
953 unsigned i = 0; 952 unsigned i = 0;
954 do { 953 do {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 1247
1249 if (Element* after = pseudoElement(AFTER)) 1248 if (Element* after = pseudoElement(AFTER))
1250 after->insertedInto(insertionPoint); 1249 after->insertedInto(insertionPoint);
1251 1250
1252 if (!insertionPoint->isInTreeScope()) 1251 if (!insertionPoint->isInTreeScope())
1253 return InsertionDone; 1252 return InsertionDone;
1254 1253
1255 if (hasRareData()) 1254 if (hasRareData())
1256 elementRareData()->clearClassListValueForQuirksMode(); 1255 elementRareData()->clearClassListValueForQuirksMode();
1257 1256
1257 if (isCustomElement()) {
1258 if (CustomElementRegistry* registry = document()->registry())
1259 registry->customElementWasInsertedIntoDocument(this);
1260 }
1261
1258 TreeScope* scope = insertionPoint->treeScope(); 1262 TreeScope* scope = insertionPoint->treeScope();
1259 if (scope != treeScope()) 1263 if (scope != treeScope())
1260 return InsertionDone; 1264 return InsertionDone;
1261 1265
1262 const AtomicString& idValue = getIdAttribute(); 1266 const AtomicString& idValue = getIdAttribute();
1263 if (!idValue.isNull()) 1267 if (!idValue.isNull())
1264 updateId(scope, nullAtom, idValue); 1268 updateId(scope, nullAtom, idValue);
1265 1269
1266 const AtomicString& nameValue = getNameAttribute(); 1270 const AtomicString& nameValue = getNameAttribute();
1267 if (!nameValue.isNull()) 1271 if (!nameValue.isNull())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 updateName(nameValue, nullAtom); 1308 updateName(nameValue, nullAtom);
1305 1309
1306 if (hasTagName(labelTag)) { 1310 if (hasTagName(labelTag)) {
1307 TreeScope* treeScope = insertionPoint->treeScope(); 1311 TreeScope* treeScope = insertionPoint->treeScope();
1308 if (treeScope->shouldCacheLabelsByForAttribute()) 1312 if (treeScope->shouldCacheLabelsByForAttribute())
1309 updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom); 1313 updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom);
1310 } 1314 }
1311 } 1315 }
1312 1316
1313 ContainerNode::removedFrom(insertionPoint); 1317 ContainerNode::removedFrom(insertionPoint);
1314 if (wasInDocument && hasPendingResources()) 1318 if (wasInDocument) {
1315 document()->accessSVGExtensions()->removeElementFromPendingResources(thi s); 1319 if (hasPendingResources())
1320 document()->accessSVGExtensions()->removeElementFromPendingResources (this);
1321
1322 if (isCustomElement()) {
1323 if (CustomElementRegistry* registry = document()->registry())
1324 registry->customElementWasRemovedFromDocument(this);
1325 }
1326 }
1316 } 1327 }
1317 1328
1318 void Element::createRendererIfNeeded(const AttachContext& context) 1329 void Element::createRendererIfNeeded(const AttachContext& context)
1319 { 1330 {
1320 NodeRenderingContext(this, context).createRendererForElementIfNeeded(); 1331 NodeRenderingContext(this, context).createRendererForElementIfNeeded();
1321 } 1332 }
1322 1333
1323 void Element::attach(const AttachContext& context) 1334 void Element::attach(const AttachContext& context)
1324 { 1335 {
1325 PostAttachCallbackDisabler callbackDisabler(this); 1336 PostAttachCallbackDisabler callbackDisabler(this);
(...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 return 0; 3570 return 0;
3560 } 3571 }
3561 3572
3562 Attribute* UniqueElementData::attributeItem(unsigned index) 3573 Attribute* UniqueElementData::attributeItem(unsigned index)
3563 { 3574 {
3564 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3575 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3565 return &m_attributeVector.at(index); 3576 return &m_attributeVector.at(index);
3566 } 3577 }
3567 3578
3568 } // namespace WebCore 3579 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698