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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.h

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | third_party/WebKit/Source/core/dom/Element.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 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved. 6 * Copyright (C) 2003-2011, 2013, 2014 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 return false; 350 return false;
351 } 351 }
352 virtual void collectStyleForPresentationAttribute(const QualifiedName&, 352 virtual void collectStyleForPresentationAttribute(const QualifiedName&,
353 const AtomicString&, 353 const AtomicString&,
354 MutableStylePropertySet*) {} 354 MutableStylePropertySet*) {}
355 355
356 // For exposing to DOM only. 356 // For exposing to DOM only.
357 NamedNodeMap* attributesForBindings() const; 357 NamedNodeMap* attributesForBindings() const;
358 358
359 enum class AttributeModificationReason { kDirectly, kByParser, kByCloning }; 359 enum class AttributeModificationReason { kDirectly, kByParser, kByCloning };
360 struct AttributeModificationParams {
361 STACK_ALLOCATED();
362 AttributeModificationParams(const QualifiedName& qname,
363 const AtomicString& oldValue,
364 const AtomicString& newValue,
365 AttributeModificationReason reason)
366 : name(qname), oldValue(oldValue), newValue(newValue), reason(reason) {}
367
368 const QualifiedName& name;
369 const AtomicString& oldValue;
370 const AtomicString& newValue;
371 const AttributeModificationReason reason;
372 };
360 373
361 // |attributeChanged| is called whenever an attribute is added, changed or 374 // |attributeChanged| is called whenever an attribute is added, changed or
362 // removed. It handles very common attributes such as id, class, name, style, 375 // removed. It handles very common attributes such as id, class, name, style,
363 // and slot. 376 // and slot.
364 // 377 //
365 // While the owner document is parsed, this function is called after all 378 // While the owner document is parsed, this function is called after all
366 // attributes in a start tag were added to the element. 379 // attributes in a start tag were added to the element.
367 virtual void attributeChanged(const QualifiedName&, 380 virtual void attributeChanged(const AttributeModificationParams&);
368 const AtomicString& oldValue,
369 const AtomicString& newValue,
370 AttributeModificationReason);
371 381
372 // |parseAttribute| is called by |attributeChanged|. If an element 382 // |parseAttribute| is called by |attributeChanged|. If an element
373 // implementation needs to check an attribute update, override this function. 383 // implementation needs to check an attribute update, override this function.
374 // 384 //
375 // While the owner document is parsed, this function is called after all 385 // While the owner document is parsed, this function is called after all
376 // attributes in a start tag were added to the element. 386 // attributes in a start tag were added to the element.
377 virtual void parseAttribute(const QualifiedName&, 387 virtual void parseAttribute(const AttributeModificationParams&);
378 const AtomicString& oldValue,
379 const AtomicString& newValue);
380 388
381 virtual bool hasLegalLinkAttribute(const QualifiedName&) const; 389 virtual bool hasLegalLinkAttribute(const QualifiedName&) const;
382 virtual const QualifiedName& subResourceAttributeName() const; 390 virtual const QualifiedName& subResourceAttributeName() const;
383 391
384 // Only called by the parser immediately after element construction. 392 // Only called by the parser immediately after element construction.
385 void parserSetAttributes(const Vector<Attribute>&); 393 void parserSetAttributes(const Vector<Attribute>&);
386 394
387 // Remove attributes that might introduce scripting from the vector leaving 395 // Remove attributes that might introduce scripting from the vector leaving
388 // the element unchanged. 396 // the element unchanged.
389 void stripScriptingAttributes(Vector<Attribute>&) const; 397 void stripScriptingAttributes(Vector<Attribute>&) const;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 const QualifiedName& attr1); 719 const QualifiedName& attr1);
712 void logAddElementIfIsolatedWorldAndInDocument(const char element[], 720 void logAddElementIfIsolatedWorldAndInDocument(const char element[],
713 const QualifiedName& attr1, 721 const QualifiedName& attr1,
714 const QualifiedName& attr2); 722 const QualifiedName& attr2);
715 void logAddElementIfIsolatedWorldAndInDocument(const char element[], 723 void logAddElementIfIsolatedWorldAndInDocument(const char element[],
716 const QualifiedName& attr1, 724 const QualifiedName& attr1,
717 const QualifiedName& attr2, 725 const QualifiedName& attr2,
718 const QualifiedName& attr3); 726 const QualifiedName& attr3);
719 void logUpdateAttributeIfIsolatedWorldAndInDocument( 727 void logUpdateAttributeIfIsolatedWorldAndInDocument(
720 const char element[], 728 const char element[],
721 const QualifiedName& attributeName, 729 const AttributeModificationParams&);
722 const AtomicString& oldValue,
723 const AtomicString& newValue);
724 730
725 DECLARE_VIRTUAL_TRACE(); 731 DECLARE_VIRTUAL_TRACE();
726 732
727 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 733 DECLARE_VIRTUAL_TRACE_WRAPPERS();
728 734
729 SpellcheckAttributeState spellcheckAttributeState() const; 735 SpellcheckAttributeState spellcheckAttributeState() const;
730 736
731 ElementIntersectionObserverData* intersectionObserverData() const; 737 ElementIntersectionObserverData* intersectionObserverData() const;
732 ElementIntersectionObserverData& ensureIntersectionObserverData(); 738 ElementIntersectionObserverData& ensureIntersectionObserverData();
733 739
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 1191 #define DECLARE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
1186 static T* create(const QualifiedName&, Document&) 1192 static T* create(const QualifiedName&, Document&)
1187 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 1193 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
1188 T* T::create(const QualifiedName& tagName, Document& document) { \ 1194 T* T::create(const QualifiedName& tagName, Document& document) { \
1189 return new T(tagName, document); \ 1195 return new T(tagName, document); \
1190 } 1196 }
1191 1197
1192 } // namespace blink 1198 } // namespace blink
1193 1199
1194 #endif // Element_h 1200 #endif // Element_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698