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

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

Issue 1219063013: Fix virtual/override/final usage in Source/core/dom/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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
« no previous file with comments | « Source/core/dom/DocumentType.h ('k') | Source/core/dom/EmptyNodeList.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 * 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 NumberOfElementFlags = 6, // Required size of bitfield used to store the fla gs. 84 NumberOfElementFlags = 6, // Required size of bitfield used to store the fla gs.
85 }; 85 };
86 86
87 typedef WillBeHeapVector<RefPtrWillBeMember<Attr>> AttrNodeList; 87 typedef WillBeHeapVector<RefPtrWillBeMember<Attr>> AttrNodeList;
88 88
89 class CORE_EXPORT Element : public ContainerNode { 89 class CORE_EXPORT Element : public ContainerNode {
90 DEFINE_WRAPPERTYPEINFO(); 90 DEFINE_WRAPPERTYPEINFO();
91 public: 91 public:
92 static PassRefPtrWillBeRawPtr<Element> create(const QualifiedName&, Document *); 92 static PassRefPtrWillBeRawPtr<Element> create(const QualifiedName&, Document *);
93 virtual ~Element(); 93 ~Element() override;
94 94
95 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy);
96 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut);
97 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste);
98 DEFINE_ATTRIBUTE_EVENT_LISTENER(copy); 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(copy);
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(cut); 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(cut);
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(paste); 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(paste);
101 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
102 DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart);
103 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 ClientRectList* getClientRects(); 200 ClientRectList* getClientRects();
201 ClientRect* getBoundingClientRect(); 201 ClientRect* getBoundingClientRect();
202 202
203 const AtomicString& computedRole(); 203 const AtomicString& computedRole();
204 String computedName(); 204 String computedName();
205 205
206 // Returns the absolute bounding box translated into screen coordinates: 206 // Returns the absolute bounding box translated into screen coordinates:
207 IntRect screenRect() const; 207 IntRect screenRect() const;
208 208
209 virtual void didMoveToNewDocument(Document&) override; 209 void didMoveToNewDocument(Document&) override;
210 210
211 void removeAttribute(const AtomicString& name); 211 void removeAttribute(const AtomicString& name);
212 void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName); 212 void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
213 213
214 PassRefPtrWillBeRawPtr<Attr> detachAttribute(size_t index); 214 PassRefPtrWillBeRawPtr<Attr> detachAttribute(size_t index);
215 215
216 PassRefPtrWillBeRawPtr<Attr> getAttributeNode(const AtomicString& name); 216 PassRefPtrWillBeRawPtr<Attr> getAttributeNode(const AtomicString& name);
217 PassRefPtrWillBeRawPtr<Attr> getAttributeNodeNS(const AtomicString& namespac eURI, const AtomicString& localName); 217 PassRefPtrWillBeRawPtr<Attr> getAttributeNodeNS(const AtomicString& namespac eURI, const AtomicString& localName);
218 PassRefPtrWillBeRawPtr<Attr> setAttributeNode(Attr*, ExceptionState&); 218 PassRefPtrWillBeRawPtr<Attr> setAttributeNode(Attr*, ExceptionState&);
219 PassRefPtrWillBeRawPtr<Attr> setAttributeNodeNS(Attr*, ExceptionState&); 219 PassRefPtrWillBeRawPtr<Attr> setAttributeNodeNS(Attr*, ExceptionState&);
(...skipping 12 matching lines...) Expand all
232 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); } 232 bool hasTagName(const QualifiedName& tagName) const { return m_tagName.match es(tagName); }
233 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); } 233 bool hasTagName(const HTMLQualifiedName& tagName) const { return ContainerNo de::hasTagName(tagName); }
234 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); } 234 bool hasTagName(const SVGQualifiedName& tagName) const { return ContainerNod e::hasTagName(tagName); }
235 235
236 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction. 236 // Should be called only by Document::createElementNS to fix up m_tagName im mediately after construction.
237 void setTagNameForCreateElementNS(const QualifiedName&); 237 void setTagNameForCreateElementNS(const QualifiedName&);
238 238
239 // A fast function for checking the local name against another atomic string . 239 // A fast function for checking the local name against another atomic string .
240 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; } 240 bool hasLocalName(const AtomicString& other) const { return m_tagName.localN ame() == other; }
241 241
242 virtual const AtomicString& localName() const override final { return m_tagN ame.localName(); } 242 const AtomicString& localName() const final { return m_tagName.localName(); }
243 AtomicString localNameForSelectorMatching() const; 243 AtomicString localNameForSelectorMatching() const;
244 const AtomicString& prefix() const { return m_tagName.prefix(); } 244 const AtomicString& prefix() const { return m_tagName.prefix(); }
245 virtual const AtomicString& namespaceURI() const override final { return m_t agName.namespaceURI(); } 245 const AtomicString& namespaceURI() const final { return m_tagName.namespaceU RI(); }
246 246
247 const AtomicString& locateNamespacePrefix(const AtomicString& namespaceURI) const; 247 const AtomicString& locateNamespacePrefix(const AtomicString& namespaceURI) const;
248 248
249 virtual String nodeName() const override; 249 String nodeName() const override;
250 250
251 PassRefPtrWillBeRawPtr<Element> cloneElementWithChildren(); 251 PassRefPtrWillBeRawPtr<Element> cloneElementWithChildren();
252 PassRefPtrWillBeRawPtr<Element> cloneElementWithoutChildren(); 252 PassRefPtrWillBeRawPtr<Element> cloneElementWithoutChildren();
253 253
254 void scheduleSVGFilterLayerUpdateHack(); 254 void scheduleSVGFilterLayerUpdateHack();
255 255
256 void setBooleanAttribute(const QualifiedName& name, bool); 256 void setBooleanAttribute(const QualifiedName& name, bool);
257 257
258 virtual const StylePropertySet* additionalPresentationAttributeStyle() { ret urn nullptr; } 258 virtual const StylePropertySet* additionalPresentationAttributeStyle() { ret urn nullptr; }
259 void invalidateStyleAttribute(); 259 void invalidateStyleAttribute();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // Clones attributes only. 299 // Clones attributes only.
300 void cloneAttributesFromElement(const Element&); 300 void cloneAttributesFromElement(const Element&);
301 301
302 // Clones all attribute-derived data, including subclass specifics (through copyNonAttributeProperties.) 302 // Clones all attribute-derived data, including subclass specifics (through copyNonAttributeProperties.)
303 void cloneDataFromElement(const Element&); 303 void cloneDataFromElement(const Element&);
304 304
305 bool hasEquivalentAttributes(const Element* other) const; 305 bool hasEquivalentAttributes(const Element* other) const;
306 306
307 virtual void copyNonAttributePropertiesFromElement(const Element&) { } 307 virtual void copyNonAttributePropertiesFromElement(const Element&) { }
308 308
309 virtual void attach(const AttachContext& = AttachContext()) override; 309 void attach(const AttachContext& = AttachContext()) override;
310 virtual void detach(const AttachContext& = AttachContext()) override; 310 void detach(const AttachContext& = AttachContext()) override;
311 311
312 virtual LayoutObject* createLayoutObject(const ComputedStyle&); 312 virtual LayoutObject* createLayoutObject(const ComputedStyle&);
313 virtual bool layoutObjectIsNeeded(const ComputedStyle&); 313 virtual bool layoutObjectIsNeeded(const ComputedStyle&);
314 void recalcStyle(StyleRecalcChange, Text* nextTextSibling = nullptr); 314 void recalcStyle(StyleRecalcChange, Text* nextTextSibling = nullptr);
315 void pseudoStateChanged(CSSSelector::PseudoType); 315 void pseudoStateChanged(CSSSelector::PseudoType);
316 void setAnimationStyleChange(bool); 316 void setAnimationStyleChange(bool);
317 void clearAnimationStyleChange(); 317 void clearAnimationStyleChange();
318 void setNeedsAnimationStyleRecalc(); 318 void setNeedsAnimationStyleRecalc();
319 319
320 void setNeedsCompositingUpdate(); 320 void setNeedsCompositingUpdate();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 virtual bool isTextFormControl() const { return false; } 444 virtual bool isTextFormControl() const { return false; }
445 virtual bool isOptionalFormControl() const { return false; } 445 virtual bool isOptionalFormControl() const { return false; }
446 virtual bool isRequiredFormControl() const { return false; } 446 virtual bool isRequiredFormControl() const { return false; }
447 virtual bool isDefaultButtonForForm() const { return false; } 447 virtual bool isDefaultButtonForForm() const { return false; }
448 virtual bool willValidate() const { return false; } 448 virtual bool willValidate() const { return false; }
449 virtual bool isValidElement() { return false; } 449 virtual bool isValidElement() { return false; }
450 virtual bool isInRange() const { return false; } 450 virtual bool isInRange() const { return false; }
451 virtual bool isOutOfRange() const { return false; } 451 virtual bool isOutOfRange() const { return false; }
452 virtual bool isClearButtonElement() const { return false; } 452 virtual bool isClearButtonElement() const { return false; }
453 453
454 virtual bool canContainRangeEndPoint() const override { return true; } 454 bool canContainRangeEndPoint() const override { return true; }
455 455
456 // Used for disabled form elements; if true, prevents mouse events from bein g dispatched 456 // Used for disabled form elements; if true, prevents mouse events from bein g dispatched
457 // to event listeners, and prevents DOMActivate events from being sent at al l. 457 // to event listeners, and prevents DOMActivate events from being sent at al l.
458 virtual bool isDisabledFormControl() const { return false; } 458 virtual bool isDisabledFormControl() const { return false; }
459 459
460 bool hasPendingResources() const { return hasElementFlag(HasPendingResources ); } 460 bool hasPendingResources() const { return hasElementFlag(HasPendingResources ); }
461 void setHasPendingResources() { setElementFlag(HasPendingResources); } 461 void setHasPendingResources() { setElementFlag(HasPendingResources); }
462 void clearHasPendingResources() { clearElementFlag(HasPendingResources); } 462 void clearHasPendingResources() { clearElementFlag(HasPendingResources); }
463 virtual void buildPendingResource() { }; 463 virtual void buildPendingResource() { };
464 464
(...skipping 24 matching lines...) Expand all
489 ElementAnimations* elementAnimations() const; 489 ElementAnimations* elementAnimations() const;
490 ElementAnimations& ensureElementAnimations(); 490 ElementAnimations& ensureElementAnimations();
491 bool hasAnimations() const; 491 bool hasAnimations() const;
492 492
493 void synchronizeAttribute(const AtomicString& localName) const; 493 void synchronizeAttribute(const AtomicString& localName) const;
494 494
495 MutableStylePropertySet& ensureMutableInlineStyle(); 495 MutableStylePropertySet& ensureMutableInlineStyle();
496 void clearMutableInlineStyleIfEmpty(); 496 void clearMutableInlineStyleIfEmpty();
497 497
498 void setTabIndex(int); 498 void setTabIndex(int);
499 virtual short tabIndex() const override; 499 short tabIndex() const override;
500 500
501 void incrementProxyCount(); 501 void incrementProxyCount();
502 void decrementProxyCount(); 502 void decrementProxyCount();
503 503
504 DECLARE_VIRTUAL_TRACE(); 504 DECLARE_VIRTUAL_TRACE();
505 505
506 SpellcheckAttributeState spellcheckAttributeState() const; 506 SpellcheckAttributeState spellcheckAttributeState() const;
507 507
508 protected: 508 protected:
509 Element(const QualifiedName& tagName, Document*, ConstructionType); 509 Element(const QualifiedName& tagName, Document*, ConstructionType);
510 510
511 const ElementData* elementData() const { return m_elementData.get(); } 511 const ElementData* elementData() const { return m_elementData.get(); }
512 UniqueElementData& ensureUniqueElementData(); 512 UniqueElementData& ensureUniqueElementData();
513 513
514 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, CSSValueID identifier); 514 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, CSSValueID identifier);
515 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, double value, CSSPrimitiveValue::UnitType); 515 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, double value, CSSPrimitiveValue::UnitType);
516 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, const String& value); 516 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, const String& value);
517 517
518 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; 518 InsertionNotificationRequest insertedInto(ContainerNode*) override;
519 virtual void removedFrom(ContainerNode*) override; 519 void removedFrom(ContainerNode*) override;
520 virtual void childrenChanged(const ChildrenChange&) override; 520 void childrenChanged(const ChildrenChange&) override;
521 521
522 virtual void willRecalcStyle(StyleRecalcChange); 522 virtual void willRecalcStyle(StyleRecalcChange);
523 virtual void didRecalcStyle(StyleRecalcChange); 523 virtual void didRecalcStyle(StyleRecalcChange);
524 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject(); 524 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject();
525 525
526 virtual bool shouldRegisterAsNamedItem() const { return false; } 526 virtual bool shouldRegisterAsNamedItem() const { return false; }
527 virtual bool shouldRegisterAsExtraNamedItem() const { return false; } 527 virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
528 528
529 bool supportsSpatialNavigationFocus() const; 529 bool supportsSpatialNavigationFocus() const;
530 530
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 void didModifyAttribute(const QualifiedName&, const AtomicString&); 594 void didModifyAttribute(const QualifiedName&, const AtomicString&);
595 void didRemoveAttribute(const QualifiedName&); 595 void didRemoveAttribute(const QualifiedName&);
596 596
597 void synchronizeAllAttributes() const; 597 void synchronizeAllAttributes() const;
598 void synchronizeAttribute(const QualifiedName&) const; 598 void synchronizeAttribute(const QualifiedName&) const;
599 599
600 void updateId(const AtomicString& oldId, const AtomicString& newId); 600 void updateId(const AtomicString& oldId, const AtomicString& newId);
601 void updateId(TreeScope&, const AtomicString& oldId, const AtomicString& new Id); 601 void updateId(TreeScope&, const AtomicString& oldId, const AtomicString& new Id);
602 void updateName(const AtomicString& oldName, const AtomicString& newName); 602 void updateName(const AtomicString& oldName, const AtomicString& newName);
603 603
604 virtual NodeType nodeType() const override final; 604 NodeType nodeType() const final;
605 virtual bool childTypeAllowed(NodeType) const override final; 605 bool childTypeAllowed(NodeType) const final;
606 606
607 void setAttributeInternal(size_t index, const QualifiedName&, const AtomicSt ring& value, SynchronizationOfLazyAttribute); 607 void setAttributeInternal(size_t index, const QualifiedName&, const AtomicSt ring& value, SynchronizationOfLazyAttribute);
608 void appendAttributeInternal(const QualifiedName&, const AtomicString& value , SynchronizationOfLazyAttribute); 608 void appendAttributeInternal(const QualifiedName&, const AtomicString& value , SynchronizationOfLazyAttribute);
609 void removeAttributeInternal(size_t index, SynchronizationOfLazyAttribute); 609 void removeAttributeInternal(size_t index, SynchronizationOfLazyAttribute);
610 void attributeChangedFromParserOrByCloning(const QualifiedName&, const Atomi cString&, AttributeModificationReason); 610 void attributeChangedFromParserOrByCloning(const QualifiedName&, const Atomi cString&, AttributeModificationReason);
611 611
612 #ifndef NDEBUG 612 #ifndef NDEBUG
613 virtual void formatForDebugger(char* buffer, unsigned length) const override ; 613 void formatForDebugger(char* buffer, unsigned length) const override;
614 #endif 614 #endif
615 615
616 bool pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, ComputedSt yle* newStyle); 616 bool pseudoStyleCacheIsInvalid(const ComputedStyle* currentStyle, ComputedSt yle* newStyle);
617 617
618 void cancelFocusAppearanceUpdate(); 618 void cancelFocusAppearanceUpdate();
619 619
620 virtual const ComputedStyle* virtualEnsureComputedStyle(PseudoId pseudoEleme ntSpecifier = NOPSEUDO) override { return ensureComputedStyle(pseudoElementSpeci fier); } 620 const ComputedStyle* virtualEnsureComputedStyle(PseudoId pseudoElementSpecif ier = NOPSEUDO) override { return ensureComputedStyle(pseudoElementSpecifier); }
621 621
622 inline void updateCallbackSelectors(const ComputedStyle* oldStyle, const Com putedStyle* newStyle); 622 inline void updateCallbackSelectors(const ComputedStyle* oldStyle, const Com putedStyle* newStyle);
623 inline void removeCallbackSelectors(); 623 inline void removeCallbackSelectors();
624 inline void addCallbackSelectors(); 624 inline void addCallbackSelectors();
625 625
626 // cloneNode is private so that non-virtual cloneElementWithChildren and clo neElementWithoutChildren 626 // cloneNode is private so that non-virtual cloneElementWithChildren and clo neElementWithoutChildren
627 // are used instead. 627 // are used instead.
628 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep) override; 628 PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep) override;
629 virtual PassRefPtrWillBeRawPtr<Element> cloneElementWithoutAttributesAndChil dren(); 629 virtual PassRefPtrWillBeRawPtr<Element> cloneElementWithoutAttributesAndChil dren();
630 630
631 QualifiedName m_tagName; 631 QualifiedName m_tagName;
632 632
633 void updateNamedItemRegistration(const AtomicString& oldName, const AtomicSt ring& newName); 633 void updateNamedItemRegistration(const AtomicString& oldName, const AtomicSt ring& newName);
634 void updateExtraNamedItemRegistration(const AtomicString& oldName, const Ato micString& newName); 634 void updateExtraNamedItemRegistration(const AtomicString& oldName, const Ato micString& newName);
635 635
636 void createUniqueElementData(); 636 void createUniqueElementData();
637 637
638 bool shouldInvalidateDistributionWhenAttributeChanged(ElementShadow*, const QualifiedName&, const AtomicString&); 638 bool shouldInvalidateDistributionWhenAttributeChanged(ElementShadow*, const QualifiedName&, const AtomicString&);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&) 880 static PassRefPtrWillBeRawPtr<T> create(const QualifiedName&, Document&)
881 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \ 881 #define DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(T) \
882 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \ 882 PassRefPtrWillBeRawPtr<T> T::create(const QualifiedName& tagName, Document& document) \
883 { \ 883 { \
884 return adoptRefWillBeNoop(new T(tagName, document)); \ 884 return adoptRefWillBeNoop(new T(tagName, document)); \
885 } 885 }
886 886
887 } // namespace 887 } // namespace
888 888
889 #endif // Element_h 889 #endif // Element_h
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentType.h ('k') | Source/core/dom/EmptyNodeList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698