Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / html / HTMLButtonElement.h
blobf4c90d59c9eabffc0f61cdb273e3a9a10547d206
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef HTMLButtonElement_h
25 #define HTMLButtonElement_h
27 #include "core/html/HTMLFormControlElement.h"
29 namespace blink {
31 class HTMLButtonElement final : public HTMLFormControlElement {
32 DEFINE_WRAPPERTYPEINFO();
33 public:
34 static PassRefPtrWillBeRawPtr<HTMLButtonElement> create(Document&, HTMLFormElement*);
36 void setType(const AtomicString&);
38 const AtomicString& value() const;
40 bool willRespondToMouseClickEvents() override;
42 private:
43 HTMLButtonElement(Document&, HTMLFormElement*);
45 enum Type { SUBMIT, RESET, BUTTON };
47 const AtomicString& formControlType() const override;
49 LayoutObject* createLayoutObject(const ComputedStyle&) override;
51 // HTMLFormControlElement always creates one, but buttons don't need it.
52 bool alwaysCreateUserAgentShadowRoot() const override { return false; }
54 Node::InsertionNotificationRequest insertedInto(ContainerNode*) override;
55 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue) override;
56 void parseAttribute(const QualifiedName&, const AtomicString&) override;
57 bool isPresentationAttribute(const QualifiedName&) const override;
58 void defaultEventHandler(Event*) override;
60 void appendToFormData(FormData&) override;
62 bool isEnumeratable() const override { return true; }
63 bool supportLabels() const override { return true; }
64 bool isInteractiveContent() const override;
65 bool supportsAutofocus() const override;
67 bool canBeSuccessfulSubmitButton() const override;
68 bool isActivatedSubmit() const override;
69 void setActivatedSubmit(bool flag) override;
71 void accessKeyAction(bool sendMouseEvents) override;
72 bool isURLAttribute(const Attribute&) const override;
74 bool canStartSelection() const override { return false; }
76 bool isOptionalFormControl() const override { return true; }
77 bool recalcWillValidate() const override;
79 Type m_type;
80 bool m_isActivatedSubmit;
83 } // namespace blink
85 #endif // HTMLButtonElement_h