Chromium Code Reviews| OLD | NEW |
|---|---|
| 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, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e Inc. All rights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 // For exposing to DOM only. | 284 // For exposing to DOM only. |
| 285 NamedNodeMap* attributes() const; | 285 NamedNodeMap* attributes() const; |
| 286 | 286 |
| 287 enum AttributeModificationReason { | 287 enum AttributeModificationReason { |
| 288 ModifiedDirectly, | 288 ModifiedDirectly, |
| 289 ModifiedByCloning | 289 ModifiedByCloning |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 // This method is called whenever an attribute is added, changed or removed. | 292 // This method is called whenever an attribute is added, changed or removed. |
| 293 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att ributeModificationReason = ModifiedDirectly); | 293 virtual void attributeChanged(const QualifiedName&, const AtomicString&, Att ributeModificationReason = ModifiedDirectly); |
| 294 virtual void parseAttribute(const QualifiedName&, const AtomicString&) { } | 294 virtual void parseAttribute(const QualifiedName&, const AtomicString&); |
| 295 | 295 |
| 296 virtual bool hasLegalLinkAttribute(const QualifiedName&) const; | 296 virtual bool hasLegalLinkAttribute(const QualifiedName&) const; |
| 297 virtual const QualifiedName& subResourceAttributeName() const; | 297 virtual const QualifiedName& subResourceAttributeName() const; |
| 298 | 298 |
| 299 // Only called by the parser immediately after element construction. | 299 // Only called by the parser immediately after element construction. |
| 300 void parserSetAttributes(const Vector<Attribute>&); | 300 void parserSetAttributes(const Vector<Attribute>&); |
| 301 | 301 |
| 302 // Remove attributes that might introduce scripting from the vector leaving the element unchanged. | 302 // Remove attributes that might introduce scripting from the vector leaving the element unchanged. |
| 303 void stripScriptingAttributes(Vector<Attribute>&) const; | 303 void stripScriptingAttributes(Vector<Attribute>&) const; |
| 304 | 304 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 virtual const AtomicString imageSourceURL() const; | 367 virtual const AtomicString imageSourceURL() const; |
| 368 virtual Image* imageContents() { return 0; } | 368 virtual Image* imageContents() { return 0; } |
| 369 | 369 |
| 370 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone); | 370 virtual void focus(bool restorePreviousSelection = true, FocusType = FocusTy peNone); |
| 371 virtual void updateFocusAppearance(bool restorePreviousSelection); | 371 virtual void updateFocusAppearance(bool restorePreviousSelection); |
| 372 virtual void blur(); | 372 virtual void blur(); |
| 373 // Whether this element can receive focus at all. Most elements are not | 373 // Whether this element can receive focus at all. Most elements are not |
| 374 // focusable but some elements, such as form controls and links, are. Unlike | 374 // focusable but some elements, such as form controls and links, are. Unlike |
| 375 // rendererIsFocusable(), this method may be called when layout is not up to | 375 // rendererIsFocusable(), this method may be called when layout is not up to |
| 376 // date, so it must not use the renderer to determine focusability. | 376 // date, so it must not use the renderer to determine focusability. |
| 377 virtual bool supportsFocus() const { return hasElementFlag(TabIndexWasSetExp licitly); } | 377 virtual bool supportsFocus() const; |
| 378 // Whether the node can actually be focused. | 378 // Whether the node can actually be focused. |
| 379 bool isFocusable() const; | 379 bool isFocusable() const; |
| 380 virtual bool isKeyboardFocusable() const; | 380 virtual bool isKeyboardFocusable() const; |
| 381 virtual bool isMouseFocusable() const; | 381 virtual bool isMouseFocusable() const; |
| 382 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType); | 382 virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType); |
| 383 virtual void dispatchBlurEvent(Element* newFocusedElement); | 383 virtual void dispatchBlurEvent(Element* newFocusedElement); |
| 384 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); | 384 void dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocused Element); |
| 385 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); | 385 void dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocuse dElement); |
| 386 | 386 |
| 387 String innerText(); | 387 String innerText(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 InputMethodContext& inputMethodContext(); | 503 InputMethodContext& inputMethodContext(); |
| 504 bool hasInputMethodContext() const; | 504 bool hasInputMethodContext() const; |
| 505 | 505 |
| 506 void setPrefix(const AtomicString&, ExceptionState&); | 506 void setPrefix(const AtomicString&, ExceptionState&); |
| 507 | 507 |
| 508 void synchronizeAttribute(const AtomicString& localName) const; | 508 void synchronizeAttribute(const AtomicString& localName) const; |
| 509 | 509 |
| 510 MutableStylePropertySet& ensureMutableInlineStyle(); | 510 MutableStylePropertySet& ensureMutableInlineStyle(); |
| 511 void clearMutableInlineStyleIfEmpty(); | 511 void clearMutableInlineStyleIfEmpty(); |
| 512 | 512 |
| 513 void setTabIndex(int); | |
| 514 virtual short tabIndex() const OVERRIDE; | |
| 515 | |
| 513 protected: | 516 protected: |
| 514 Element(const QualifiedName& tagName, Document* document, ConstructionType t ype) | 517 Element(const QualifiedName& tagName, Document* document, ConstructionType t ype) |
| 515 : ContainerNode(document, type) | 518 : ContainerNode(document, type) |
| 516 , m_tagName(tagName) | 519 , m_tagName(tagName) |
| 517 { | 520 { |
| 518 ScriptWrappable::init(this); | 521 ScriptWrappable::init(this); |
| 519 } | 522 } |
| 520 | 523 |
| 521 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, CSSValueID identifier); | 524 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, CSSValueID identifier); |
| 522 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, double value, CSSPrimitiveValue::UnitTypes); | 525 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, double value, CSSPrimitiveValue::UnitTypes); |
| 523 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, const String& value); | 526 void addPropertyToPresentationAttributeStyle(MutableStylePropertySet*, CSSPr opertyID, const String& value); |
| 524 | 527 |
| 525 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 528 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
| 526 virtual void removedFrom(ContainerNode*) OVERRIDE; | 529 virtual void removedFrom(ContainerNode*) OVERRIDE; |
| 527 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; | 530 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; |
| 528 | 531 |
| 529 virtual void willRecalcStyle(StyleRecalcChange); | 532 virtual void willRecalcStyle(StyleRecalcChange); |
| 530 virtual void didRecalcStyle(StyleRecalcChange); | 533 virtual void didRecalcStyle(StyleRecalcChange); |
| 531 virtual PassRefPtr<RenderStyle> customStyleForRenderer(); | 534 virtual PassRefPtr<RenderStyle> customStyleForRenderer(); |
| 532 | 535 |
| 533 virtual bool shouldRegisterAsNamedItem() const { return false; } | 536 virtual bool shouldRegisterAsNamedItem() const { return false; } |
| 534 virtual bool shouldRegisterAsExtraNamedItem() const { return false; } | 537 virtual bool shouldRegisterAsExtraNamedItem() const { return false; } |
| 535 | 538 |
| 539 bool supportsSpatialNavigationFocus() const; | |
|
fs
2014/04/29 08:30:31
Shouldn't this be virtual? (Used in Element::suppo
Erik Dahlström (inactive)
2014/04/29 12:12:28
Done.
| |
| 540 | |
| 536 void clearTabIndexExplicitlyIfNeeded(); | 541 void clearTabIndexExplicitlyIfNeeded(); |
| 537 void setTabIndexExplicitly(short); | 542 void setTabIndexExplicitly(short); |
| 538 virtual short tabIndex() const OVERRIDE; | |
| 539 // Subclasses may override this method to affect focusability. Unlike | 543 // Subclasses may override this method to affect focusability. Unlike |
| 540 // supportsFocus, this method must be called on an up-to-date layout, so it | 544 // supportsFocus, this method must be called on an up-to-date layout, so it |
| 541 // may use the renderer to reason about focusability. This method cannot be | 545 // may use the renderer to reason about focusability. This method cannot be |
| 542 // moved to RenderObject because some focusable nodes don't have renderers, | 546 // moved to RenderObject because some focusable nodes don't have renderers, |
| 543 // e.g., HTMLOptionElement. | 547 // e.g., HTMLOptionElement. |
| 544 virtual bool rendererIsFocusable() const; | 548 virtual bool rendererIsFocusable() const; |
| 545 PassRefPtr<HTMLCollection> ensureCachedHTMLCollection(CollectionType); | 549 PassRefPtr<HTMLCollection> ensureCachedHTMLCollection(CollectionType); |
| 546 HTMLCollection* cachedHTMLCollection(CollectionType); | 550 HTMLCollection* cachedHTMLCollection(CollectionType); |
| 547 | 551 |
| 548 // classAttributeChanged() exists to share code between | 552 // classAttributeChanged() exists to share code between |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 template <> inline bool isElementOfType<const thisType>(const Element& eleme nt) { return element.predicate; } \ | 879 template <> inline bool isElementOfType<const thisType>(const Element& eleme nt) { return element.predicate; } \ |
| 876 DEFINE_NODE_TYPE_CASTS(thisType, predicate) | 880 DEFINE_NODE_TYPE_CASTS(thisType, predicate) |
| 877 | 881 |
| 878 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 882 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
| 879 template <> inline bool isElementOfType<const thisType>(const Element& eleme nt) { return is##thisType(element); } \ | 883 template <> inline bool isElementOfType<const thisType>(const Element& eleme nt) { return is##thisType(element); } \ |
| 880 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) | 884 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) |
| 881 | 885 |
| 882 } // namespace | 886 } // namespace |
| 883 | 887 |
| 884 #endif | 888 #endif |
| OLD | NEW |