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