| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 inline SpinButtonElement::SpinButtonElement(Document& document, SpinButtonOwner&
spinButtonOwner) | 44 inline SpinButtonElement::SpinButtonElement(Document& document, SpinButtonOwner&
spinButtonOwner) |
| 45 : HTMLDivElement(document) | 45 : HTMLDivElement(document) |
| 46 , m_spinButtonOwner(&spinButtonOwner) | 46 , m_spinButtonOwner(&spinButtonOwner) |
| 47 , m_capturing(false) | 47 , m_capturing(false) |
| 48 , m_upDownState(Indeterminate) | 48 , m_upDownState(Indeterminate) |
| 49 , m_pressStartingState(Indeterminate) | 49 , m_pressStartingState(Indeterminate) |
| 50 , m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired) | 50 , m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired) |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 PassRefPtrWillBeRawPtr<SpinButtonElement> SpinButtonElement::create(Document& do
cument, SpinButtonOwner& spinButtonOwner) | 54 RawPtr<SpinButtonElement> SpinButtonElement::create(Document& document, SpinButt
onOwner& spinButtonOwner) |
| 55 { | 55 { |
| 56 RefPtrWillBeRawPtr<SpinButtonElement> element = adoptRefWillBeNoop(new SpinB
uttonElement(document, spinButtonOwner)); | 56 RawPtr<SpinButtonElement> element = new SpinButtonElement(document, spinButt
onOwner); |
| 57 element->setShadowPseudoId(AtomicString("-webkit-inner-spin-button", AtomicS
tring::ConstructFromLiteral)); | 57 element->setShadowPseudoId(AtomicString("-webkit-inner-spin-button", AtomicS
tring::ConstructFromLiteral)); |
| 58 element->setAttribute(idAttr, ShadowElementNames::spinButton()); | 58 element->setAttribute(idAttr, ShadowElementNames::spinButton()); |
| 59 return element.release(); | 59 return element.release(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SpinButtonElement::detach(const AttachContext& context) | 62 void SpinButtonElement::detach(const AttachContext& context) |
| 63 { | 63 { |
| 64 releaseCapture(EventDispatchDisallowed); | 64 releaseCapture(EventDispatchDisallowed); |
| 65 HTMLDivElement::detach(context); | 65 HTMLDivElement::detach(context); |
| 66 } | 66 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 MouseEvent* mouseEvent = toMouseEvent(event); | 89 MouseEvent* mouseEvent = toMouseEvent(event); |
| 90 IntPoint local = roundedIntPoint(box->absoluteToLocal(FloatPoint(mouseEvent-
>absoluteLocation()), UseTransforms)); | 90 IntPoint local = roundedIntPoint(box->absoluteToLocal(FloatPoint(mouseEvent-
>absoluteLocation()), UseTransforms)); |
| 91 if (mouseEvent->type() == EventTypeNames::mousedown && mouseEvent->button()
== LeftButton) { | 91 if (mouseEvent->type() == EventTypeNames::mousedown && mouseEvent->button()
== LeftButton) { |
| 92 if (box->pixelSnappedBorderBoxRect().contains(local)) { | 92 if (box->pixelSnappedBorderBoxRect().contains(local)) { |
| 93 // The following functions of HTMLInputElement may run JavaScript | 93 // The following functions of HTMLInputElement may run JavaScript |
| 94 // code which detaches this shadow node. We need to take a reference | 94 // code which detaches this shadow node. We need to take a reference |
| 95 // and check layoutObject() after such function calls. | 95 // and check layoutObject() after such function calls. |
| 96 RefPtrWillBeRawPtr<Node> protector(this); | 96 RawPtr<Node> protector(this); |
| 97 if (m_spinButtonOwner) | 97 if (m_spinButtonOwner) |
| 98 m_spinButtonOwner->focusAndSelectSpinButtonOwner(); | 98 m_spinButtonOwner->focusAndSelectSpinButtonOwner(); |
| 99 if (layoutObject()) { | 99 if (layoutObject()) { |
| 100 if (m_upDownState != Indeterminate) { | 100 if (m_upDownState != Indeterminate) { |
| 101 // A JavaScript event handler called in doStepAction() below | 101 // A JavaScript event handler called in doStepAction() below |
| 102 // might change the element state and we might need to | 102 // might change the element state and we might need to |
| 103 // cancel the repeating timer by the state change. If we | 103 // cancel the repeating timer by the state change. If we |
| 104 // started the timer after doStepAction(), we would have no | 104 // started the timer after doStepAction(), we would have no |
| 105 // chance to cancel the timer. | 105 // chance to cancel the timer. |
| 106 startRepeatingTimer(); | 106 startRepeatingTimer(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou
seEvents(); | 256 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou
seEvents(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 DEFINE_TRACE(SpinButtonElement) | 259 DEFINE_TRACE(SpinButtonElement) |
| 260 { | 260 { |
| 261 visitor->trace(m_spinButtonOwner); | 261 visitor->trace(m_spinButtonOwner); |
| 262 HTMLDivElement::trace(visitor); | 262 HTMLDivElement::trace(visitor); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace blink | 265 } // namespace blink |
| OLD | NEW |