| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef LabelableElement_h | 31 #ifndef LabelableElement_h |
| 32 #define LabelableElement_h | 32 #define LabelableElement_h |
| 33 | 33 |
| 34 #include "core/html/HTMLElement.h" | 34 #include "core/html/HTMLElement.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 class LabelsNodeList; |
| 39 |
| 38 // LabelableElement represents "labelable element" defined in the HTML | 40 // LabelableElement represents "labelable element" defined in the HTML |
| 39 // specification, and provides the implementation of the "labels" attribute. | 41 // specification, and provides the implementation of the "labels" attribute. |
| 40 class LabelableElement : public HTMLElement { | 42 class LabelableElement : public HTMLElement { |
| 41 public: | 43 public: |
| 42 virtual ~LabelableElement(); | 44 virtual ~LabelableElement(); |
| 43 PassRefPtrWillBeRawPtr<NodeList> labels(); | 45 PassRefPtrWillBeRawPtr<LabelsNodeList> labels(); |
| 44 virtual bool supportLabels() const { return false; } | 46 virtual bool supportLabels() const { return false; } |
| 45 | 47 |
| 46 virtual void trace(Visitor*) OVERRIDE; | 48 virtual void trace(Visitor*) OVERRIDE; |
| 47 | 49 |
| 48 protected: | 50 protected: |
| 49 LabelableElement(const QualifiedName& tagName, Document&); | 51 LabelableElement(const QualifiedName& tagName, Document&); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 virtual bool isLabelable() const OVERRIDE FINAL { return true; } | 54 virtual bool isLabelable() const OVERRIDE FINAL { return true; } |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 inline bool isLabelableElement(const Element& element) | 57 inline bool isLabelableElement(const Element& element) |
| 56 { | 58 { |
| 57 return element.isHTMLElement() && toHTMLElement(element).isLabelable(); | 59 return element.isHTMLElement() && toHTMLElement(element).isLabelable(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 inline bool isLabelableElement(const HTMLElement& element) | 62 inline bool isLabelableElement(const HTMLElement& element) |
| 61 { | 63 { |
| 62 return element.isLabelable(); | 64 return element.isLabelable(); |
| 63 } | 65 } |
| 64 | 66 |
| 65 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(LabelableElement); | 67 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(LabelableElement); |
| 66 | 68 |
| 67 } // namespace WebCore | 69 } // namespace WebCore |
| 68 | 70 |
| 69 #endif | 71 #endif |
| OLD | NEW |