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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
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 28 matching lines...) Expand all Loading... |
39 : HTMLElement(legendTag, document) | 39 : HTMLElement(legendTag, document) |
40 { | 40 { |
41 ScriptWrappable::init(this); | 41 ScriptWrappable::init(this); |
42 } | 42 } |
43 | 43 |
44 DEFINE_NODE_FACTORY(HTMLLegendElement) | 44 DEFINE_NODE_FACTORY(HTMLLegendElement) |
45 | 45 |
46 HTMLFormControlElement* HTMLLegendElement::associatedControl() | 46 HTMLFormControlElement* HTMLLegendElement::associatedControl() |
47 { | 47 { |
48 // Check if there's a fieldset belonging to this legend. | 48 // Check if there's a fieldset belonging to this legend. |
49 Element* fieldset = parentElement(); | 49 HTMLFieldSetElement* fieldset = Traversal<HTMLFieldSetElement>::firstAncesto
r(*this); |
50 while (fieldset && !isHTMLFieldSetElement(*fieldset)) | |
51 fieldset = fieldset->parentElement(); | |
52 if (!fieldset) | 50 if (!fieldset) |
53 return 0; | 51 return 0; |
54 | 52 |
55 // Find first form element inside the fieldset that is not a legend element. | 53 // Find first form element inside the fieldset that is not a legend element. |
56 // FIXME: Should we consider tabindex? | 54 // FIXME: Should we consider tabindex? |
57 return Traversal<HTMLFormControlElement>::next(*fieldset, fieldset); | 55 return Traversal<HTMLFormControlElement>::next(*fieldset, fieldset); |
58 } | 56 } |
59 | 57 |
60 void HTMLLegendElement::focus(bool, FocusType type) | 58 void HTMLLegendElement::focus(bool, FocusType type) |
61 { | 59 { |
(...skipping 17 matching lines...) Expand all Loading... |
79 // its parent, then the form attribute must return the same value as the | 77 // its parent, then the form attribute must return the same value as the |
80 // form attribute on that fieldset element. Otherwise, it must return null. | 78 // form attribute on that fieldset element. Otherwise, it must return null. |
81 ContainerNode* fieldset = parentNode(); | 79 ContainerNode* fieldset = parentNode(); |
82 if (!isHTMLFieldSetElement(fieldset)) | 80 if (!isHTMLFieldSetElement(fieldset)) |
83 return 0; | 81 return 0; |
84 | 82 |
85 return toHTMLFieldSetElement(fieldset)->formOwner(); | 83 return toHTMLFieldSetElement(fieldset)->formOwner(); |
86 } | 84 } |
87 | 85 |
88 } // namespace | 86 } // namespace |
OLD | NEW |