This source file includes following definitions.
- create
- associatedControl
- focus
- accessKeyAction
- form
#include "config.h"
#include "core/html/HTMLLegendElement.h"
#include "HTMLNames.h"
#include "core/dom/ElementTraversal.h"
#include "core/html/HTMLFieldSetElement.h"
#include "core/html/HTMLFormControlElement.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLLegendElement::HTMLLegendElement(Document& document)
: HTMLElement(legendTag, document)
{
ScriptWrappable::init(this);
}
PassRefPtr<HTMLLegendElement> HTMLLegendElement::create(Document& document)
{
return adoptRef(new HTMLLegendElement(document));
}
HTMLFormControlElement* HTMLLegendElement::associatedControl()
{
Element* fieldset = parentElement();
while (fieldset && !isHTMLFieldSetElement(*fieldset))
fieldset = fieldset->parentElement();
if (!fieldset)
return 0;
return Traversal<HTMLFormControlElement>::next(*fieldset, fieldset);
}
void HTMLLegendElement::focus(bool, FocusType type)
{
if (isFocusable())
Element::focus(true, type);
if (HTMLFormControlElement* control = associatedControl())
control->focus(false, type);
}
void HTMLLegendElement::accessKeyAction(bool sendMouseEvents)
{
if (HTMLFormControlElement* control = associatedControl())
control->accessKeyAction(sendMouseEvents);
}
HTMLFormElement* HTMLLegendElement::form() const
{
ContainerNode* fieldset = parentNode();
if (!isHTMLFieldSetElement(fieldset))
return 0;
return toHTMLFieldSetElement(fieldset)->formOwner();
}
}