OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #ifndef SpinButtonElement_h | 27 #ifndef SpinButtonElement_h |
28 #define SpinButtonElement_h | 28 #define SpinButtonElement_h |
29 | 29 |
30 #include "core/html/HTMLDivElement.h" | 30 #include "core/html/HTMLDivElement.h" |
31 #include "core/page/PopupOpeningObserver.h" | 31 #include "core/page/PopupOpeningObserver.h" |
32 #include "platform/Timer.h" | 32 #include "platform/Timer.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class SpinButtonElement FINAL : public HTMLDivElement, public PopupOpeningObserv
er { | 36 class SpinButtonElement final : public HTMLDivElement, public PopupOpeningObserv
er { |
37 public: | 37 public: |
38 enum UpDownState { | 38 enum UpDownState { |
39 Indeterminate, // Hovered, but the event is not handled. | 39 Indeterminate, // Hovered, but the event is not handled. |
40 Down, | 40 Down, |
41 Up, | 41 Up, |
42 }; | 42 }; |
43 enum EventDispatch { | 43 enum EventDispatch { |
44 EventDispatchAllowed, | 44 EventDispatchAllowed, |
45 EventDispatchDisallowed, | 45 EventDispatchDisallowed, |
46 }; | 46 }; |
(...skipping 11 matching lines...) Expand all Loading... |
58 // The owner of SpinButtonElement must call removeSpinButtonOwner | 58 // The owner of SpinButtonElement must call removeSpinButtonOwner |
59 // because SpinButtonElement can be outlive SpinButtonOwner | 59 // because SpinButtonElement can be outlive SpinButtonOwner |
60 // implementation, e.g. during event handling. | 60 // implementation, e.g. during event handling. |
61 static PassRefPtrWillBeRawPtr<SpinButtonElement> create(Document&, SpinButto
nOwner&); | 61 static PassRefPtrWillBeRawPtr<SpinButtonElement> create(Document&, SpinButto
nOwner&); |
62 UpDownState upDownState() const { return m_upDownState; } | 62 UpDownState upDownState() const { return m_upDownState; } |
63 void releaseCapture(EventDispatch = EventDispatchAllowed); | 63 void releaseCapture(EventDispatch = EventDispatchAllowed); |
64 void removeSpinButtonOwner() { m_spinButtonOwner = nullptr; } | 64 void removeSpinButtonOwner() { m_spinButtonOwner = nullptr; } |
65 | 65 |
66 void step(int amount); | 66 void step(int amount); |
67 | 67 |
68 virtual bool willRespondToMouseMoveEvents() OVERRIDE; | 68 virtual bool willRespondToMouseMoveEvents() override; |
69 virtual bool willRespondToMouseClickEvents() OVERRIDE; | 69 virtual bool willRespondToMouseClickEvents() override; |
70 | 70 |
71 void forwardEvent(Event*); | 71 void forwardEvent(Event*); |
72 | 72 |
73 virtual void trace(Visitor*) OVERRIDE; | 73 virtual void trace(Visitor*) override; |
74 | 74 |
75 private: | 75 private: |
76 SpinButtonElement(Document&, SpinButtonOwner&); | 76 SpinButtonElement(Document&, SpinButtonOwner&); |
77 | 77 |
78 virtual void detach(const AttachContext&) OVERRIDE; | 78 virtual void detach(const AttachContext&) override; |
79 virtual bool isSpinButtonElement() const OVERRIDE { return true; } | 79 virtual bool isSpinButtonElement() const override { return true; } |
80 virtual bool isDisabledFormControl() const OVERRIDE { return shadowHost() &&
shadowHost()->isDisabledFormControl(); } | 80 virtual bool isDisabledFormControl() const override { return shadowHost() &&
shadowHost()->isDisabledFormControl(); } |
81 virtual bool matchesReadOnlyPseudoClass() const OVERRIDE; | 81 virtual bool matchesReadOnlyPseudoClass() const override; |
82 virtual bool matchesReadWritePseudoClass() const OVERRIDE; | 82 virtual bool matchesReadWritePseudoClass() const override; |
83 virtual void defaultEventHandler(Event*) OVERRIDE; | 83 virtual void defaultEventHandler(Event*) override; |
84 virtual void willOpenPopup() OVERRIDE; | 84 virtual void willOpenPopup() override; |
85 void doStepAction(int); | 85 void doStepAction(int); |
86 void startRepeatingTimer(); | 86 void startRepeatingTimer(); |
87 void stopRepeatingTimer(); | 87 void stopRepeatingTimer(); |
88 void repeatingTimerFired(Timer<SpinButtonElement>*); | 88 void repeatingTimerFired(Timer<SpinButtonElement>*); |
89 virtual void setHovered(bool = true) OVERRIDE; | 89 virtual void setHovered(bool = true) override; |
90 bool shouldRespondToMouseEvents(); | 90 bool shouldRespondToMouseEvents(); |
91 virtual bool isMouseFocusable() const OVERRIDE { return false; } | 91 virtual bool isMouseFocusable() const override { return false; } |
92 | 92 |
93 RawPtrWillBeMember<SpinButtonOwner> m_spinButtonOwner; | 93 RawPtrWillBeMember<SpinButtonOwner> m_spinButtonOwner; |
94 bool m_capturing; | 94 bool m_capturing; |
95 UpDownState m_upDownState; | 95 UpDownState m_upDownState; |
96 UpDownState m_pressStartingState; | 96 UpDownState m_pressStartingState; |
97 Timer<SpinButtonElement> m_repeatingTimer; | 97 Timer<SpinButtonElement> m_repeatingTimer; |
98 }; | 98 }; |
99 | 99 |
100 DEFINE_TYPE_CASTS(SpinButtonElement, Node, node, toElement(node)->isSpinButtonEl
ement(), toElement(node).isSpinButtonElement()); | 100 DEFINE_TYPE_CASTS(SpinButtonElement, Node, node, toElement(node)->isSpinButtonEl
ement(), toElement(node).isSpinButtonElement()); |
101 | 101 |
102 } // namespace | 102 } // namespace |
103 | 103 |
104 #endif | 104 #endif |
OLD | NEW |