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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 m_repeatingTimer.stop(); | 229 m_repeatingTimer.stop(); |
230 } | 230 } |
231 | 231 |
232 void SpinButtonElement::step(int amount) | 232 void SpinButtonElement::step(int amount) |
233 { | 233 { |
234 if (!shouldRespondToMouseEvents()) | 234 if (!shouldRespondToMouseEvents()) |
235 return; | 235 return; |
236 // On Mac OS, NSStepper updates the value for the button under the mouse | 236 // On Mac OS, NSStepper updates the value for the button under the mouse |
237 // cursor regardless of the button pressed at the beginning. So the | 237 // cursor regardless of the button pressed at the beginning. So the |
238 // following check is not needed for Mac OS. | 238 // following check is not needed for Mac OS. |
239 #if !OS(MAC_OS_X) | 239 #if !OS(DARWIN) |
240 if (m_upDownState != m_pressStartingState) | 240 if (m_upDownState != m_pressStartingState) |
241 return; | 241 return; |
242 #endif | 242 #endif |
243 doStepAction(amount); | 243 doStepAction(amount); |
244 } | 244 } |
245 | 245 |
246 void SpinButtonElement::repeatingTimerFired(Timer<SpinButtonElement>*) | 246 void SpinButtonElement::repeatingTimerFired(Timer<SpinButtonElement>*) |
247 { | 247 { |
248 if (m_upDownState != Indeterminate) | 248 if (m_upDownState != Indeterminate) |
249 step(m_upDownState == Up ? 1 : -1); | 249 step(m_upDownState == Up ? 1 : -1); |
250 } | 250 } |
251 | 251 |
252 void SpinButtonElement::setHovered(bool flag) | 252 void SpinButtonElement::setHovered(bool flag) |
253 { | 253 { |
254 if (!flag) | 254 if (!flag) |
255 m_upDownState = Indeterminate; | 255 m_upDownState = Indeterminate; |
256 HTMLDivElement::setHovered(flag); | 256 HTMLDivElement::setHovered(flag); |
257 } | 257 } |
258 | 258 |
259 bool SpinButtonElement::shouldRespondToMouseEvents() | 259 bool SpinButtonElement::shouldRespondToMouseEvents() |
260 { | 260 { |
261 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou
seEvents(); | 261 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou
seEvents(); |
262 } | 262 } |
263 | 263 |
264 } | 264 } |
OLD | NEW |