Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/DateTimeFieldElement.h

Issue 2815263002: Move form-related files in core/html/shadow to core/html/forms. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26 #ifndef DateTimeFieldElement_h
27 #define DateTimeFieldElement_h
28
29 #include "core/html/HTMLDivElement.h"
30 #include "core/html/HTMLSpanElement.h"
31 #include "public/platform/WebFocusType.h"
32
33 namespace blink {
34
35 class DateComponents;
36 class DateTimeFieldsState;
37
38 // DateTimeFieldElement is base class of date time field element.
39 class DateTimeFieldElement : public HTMLSpanElement {
40 WTF_MAKE_NONCOPYABLE(DateTimeFieldElement);
41
42 public:
43 enum EventBehavior {
44 kDispatchNoEvent,
45 kDispatchEvent,
46 };
47
48 // FieldOwner implementer must call removeEventHandler when
49 // it doesn't handle event, e.g. at destruction.
50 class FieldOwner : public GarbageCollectedMixin {
51 public:
52 virtual ~FieldOwner();
53 virtual void DidBlurFromField(WebFocusType) = 0;
54 virtual void DidFocusOnField(WebFocusType) = 0;
55 virtual void FieldValueChanged() = 0;
56 virtual bool FocusOnNextField(const DateTimeFieldElement&) = 0;
57 virtual bool FocusOnPreviousField(const DateTimeFieldElement&) = 0;
58 virtual bool IsFieldOwnerDisabled() const = 0;
59 virtual bool IsFieldOwnerReadOnly() const = 0;
60 virtual AtomicString LocaleIdentifier() const = 0;
61 virtual void FieldDidChangeValueByKeyboard() = 0;
62 };
63
64 void DefaultEventHandler(Event*) override;
65 virtual bool HasValue() const = 0;
66 bool IsDisabled() const;
67 virtual float MaximumWidth(const ComputedStyle&);
68 virtual void PopulateDateTimeFieldsState(DateTimeFieldsState&) = 0;
69 void RemoveEventHandler() { field_owner_ = nullptr; }
70 void SetDisabled();
71 virtual void SetEmptyValue(EventBehavior = kDispatchNoEvent) = 0;
72 virtual void SetValueAsDate(const DateComponents&) = 0;
73 virtual void SetValueAsDateTimeFieldsState(const DateTimeFieldsState&) = 0;
74 virtual void SetValueAsInteger(int, EventBehavior = kDispatchNoEvent) = 0;
75 virtual void StepDown() = 0;
76 virtual void StepUp() = 0;
77 virtual String Value() const = 0;
78 virtual String VisibleValue() const = 0;
79 DECLARE_VIRTUAL_TRACE();
80
81 static float ComputeTextWidth(const ComputedStyle&, const String&);
82
83 protected:
84 DateTimeFieldElement(Document&, FieldOwner&);
85 void FocusOnNextField();
86 virtual void HandleKeyboardEvent(KeyboardEvent*) = 0;
87 void Initialize(const AtomicString& pseudo,
88 const String& ax_help_text,
89 int ax_minimum,
90 int ax_maximum);
91 Locale& LocaleForOwner() const;
92 AtomicString LocaleIdentifier() const;
93 void UpdateVisibleValue(EventBehavior);
94 virtual int ValueAsInteger() const = 0;
95 virtual int ValueForARIAValueNow() const;
96
97 // Node functions.
98 void SetFocused(bool, WebFocusType) override;
99
100 private:
101 void DefaultKeyboardEventHandler(KeyboardEvent*);
102 bool IsDateTimeFieldElement() const final;
103 bool IsFieldOwnerDisabled() const;
104 bool IsFieldOwnerReadOnly() const;
105 bool SupportsFocus() const final;
106
107 Member<FieldOwner> field_owner_;
108 };
109
110 } // namespace blink
111
112 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698