| 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 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 enum UpDownState { | 39 enum UpDownState { |
| 40 Indeterminate, // Hovered, but the event is not handled. | 40 Indeterminate, // Hovered, but the event is not handled. |
| 41 Down, | 41 Down, |
| 42 Up, | 42 Up, |
| 43 }; | 43 }; |
| 44 enum EventDispatch { | 44 enum EventDispatch { |
| 45 EventDispatchAllowed, | 45 EventDispatchAllowed, |
| 46 EventDispatchDisallowed, | 46 EventDispatchDisallowed, |
| 47 }; | 47 }; |
| 48 class SpinButtonOwner : public WillBeGarbageCollectedMixin { | 48 class SpinButtonOwner : public GarbageCollectedMixin { |
| 49 public: | 49 public: |
| 50 virtual ~SpinButtonOwner() { } | 50 virtual ~SpinButtonOwner() { } |
| 51 virtual void focusAndSelectSpinButtonOwner() = 0; | 51 virtual void focusAndSelectSpinButtonOwner() = 0; |
| 52 virtual bool shouldSpinButtonRespondToMouseEvents() = 0; | 52 virtual bool shouldSpinButtonRespondToMouseEvents() = 0; |
| 53 virtual bool shouldSpinButtonRespondToWheelEvents() = 0; | 53 virtual bool shouldSpinButtonRespondToWheelEvents() = 0; |
| 54 virtual void spinButtonDidReleaseMouseCapture(EventDispatch) = 0; | 54 virtual void spinButtonDidReleaseMouseCapture(EventDispatch) = 0; |
| 55 virtual void spinButtonStepDown() = 0; | 55 virtual void spinButtonStepDown() = 0; |
| 56 virtual void spinButtonStepUp() = 0; | 56 virtual void spinButtonStepUp() = 0; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // The owner of SpinButtonElement must call removeSpinButtonOwner | 59 // The owner of SpinButtonElement must call removeSpinButtonOwner |
| 60 // because SpinButtonElement can be outlive SpinButtonOwner | 60 // because SpinButtonElement can be outlive SpinButtonOwner |
| 61 // implementation, e.g. during event handling. | 61 // implementation, e.g. during event handling. |
| 62 static PassRefPtrWillBeRawPtr<SpinButtonElement> create(Document&, SpinButto
nOwner&); | 62 static RawPtr<SpinButtonElement> create(Document&, SpinButtonOwner&); |
| 63 UpDownState getUpDownState() const { return m_upDownState; } | 63 UpDownState getUpDownState() const { return m_upDownState; } |
| 64 void releaseCapture(EventDispatch = EventDispatchAllowed); | 64 void releaseCapture(EventDispatch = EventDispatchAllowed); |
| 65 void removeSpinButtonOwner() { m_spinButtonOwner = nullptr; } | 65 void removeSpinButtonOwner() { m_spinButtonOwner = nullptr; } |
| 66 | 66 |
| 67 void step(int amount); | 67 void step(int amount); |
| 68 | 68 |
| 69 bool willRespondToMouseMoveEvents() override; | 69 bool willRespondToMouseMoveEvents() override; |
| 70 bool willRespondToMouseClickEvents() override; | 70 bool willRespondToMouseClickEvents() override; |
| 71 | 71 |
| 72 void forwardEvent(Event*); | 72 void forwardEvent(Event*); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 void defaultEventHandler(Event*) override; | 84 void defaultEventHandler(Event*) override; |
| 85 void willOpenPopup() override; | 85 void willOpenPopup() override; |
| 86 void doStepAction(int); | 86 void doStepAction(int); |
| 87 void startRepeatingTimer(); | 87 void startRepeatingTimer(); |
| 88 void stopRepeatingTimer(); | 88 void stopRepeatingTimer(); |
| 89 void repeatingTimerFired(Timer<SpinButtonElement>*); | 89 void repeatingTimerFired(Timer<SpinButtonElement>*); |
| 90 void setHovered(bool = true) override; | 90 void setHovered(bool = true) override; |
| 91 bool shouldRespondToMouseEvents(); | 91 bool shouldRespondToMouseEvents(); |
| 92 bool isMouseFocusable() const override { return false; } | 92 bool isMouseFocusable() const override { return false; } |
| 93 | 93 |
| 94 RawPtrWillBeMember<SpinButtonOwner> m_spinButtonOwner; | 94 Member<SpinButtonOwner> m_spinButtonOwner; |
| 95 bool m_capturing; | 95 bool m_capturing; |
| 96 UpDownState m_upDownState; | 96 UpDownState m_upDownState; |
| 97 UpDownState m_pressStartingState; | 97 UpDownState m_pressStartingState; |
| 98 Timer<SpinButtonElement> m_repeatingTimer; | 98 Timer<SpinButtonElement> m_repeatingTimer; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 DEFINE_TYPE_CASTS(SpinButtonElement, Node, node, toElement(node)->isSpinButtonEl
ement(), toElement(node).isSpinButtonElement()); | 101 DEFINE_TYPE_CASTS(SpinButtonElement, Node, node, toElement(node)->isSpinButtonEl
ement(), toElement(node).isSpinButtonElement()); |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| 104 | 104 |
| 105 #endif | 105 #endif |
| OLD | NEW |