OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/accessibility/AXSpinButton.h" | 27 #include "modules/accessibility/AXSpinButton.h" |
28 | 28 |
29 #include "core/rendering/RenderObject.h" | 29 #include "core/rendering/RenderObject.h" |
30 #include "modules/accessibility/AXObjectCacheImpl.h" | 30 #include "modules/accessibility/AXObjectCacheImpl.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 PassRefPtr<AXSpinButton> AXSpinButton::create() | 34 PassRefPtr<AXSpinButton> AXSpinButton::create(AXObjectCache* axObjectCache) |
35 { | 35 { |
36 return adoptRef(new AXSpinButton); | 36 return adoptRef(new AXSpinButton(axObjectCache)); |
37 } | 37 } |
38 | 38 |
39 AXSpinButton::AXSpinButton() | 39 AXSpinButton::AXSpinButton(AXObjectCache* axObjectCache) |
40 : m_spinButtonElement(0) | 40 : AXMockObject(axObjectCache) |
| 41 , m_spinButtonElement(0) |
41 { | 42 { |
42 } | 43 } |
43 | 44 |
44 AXSpinButton::~AXSpinButton() | 45 AXSpinButton::~AXSpinButton() |
45 { | 46 { |
46 } | 47 } |
47 | 48 |
48 LayoutRect AXSpinButton::elementRect() const | 49 LayoutRect AXSpinButton::elementRect() const |
49 { | 50 { |
50 ASSERT(m_spinButtonElement); | 51 ASSERT(m_spinButtonElement); |
(...skipping 23 matching lines...) Expand all Loading... |
74 { | 75 { |
75 ASSERT(m_spinButtonElement); | 76 ASSERT(m_spinButtonElement); |
76 if (!m_spinButtonElement) | 77 if (!m_spinButtonElement) |
77 return; | 78 return; |
78 | 79 |
79 m_spinButtonElement->step(amount); | 80 m_spinButtonElement->step(amount); |
80 } | 81 } |
81 | 82 |
82 // AXSpinButtonPart | 83 // AXSpinButtonPart |
83 | 84 |
84 AXSpinButtonPart::AXSpinButtonPart() | 85 AXSpinButtonPart::AXSpinButtonPart(AXObjectCache* axObjectCache) |
85 : m_isIncrementor(false) | 86 : AXMockObject(axObjectCache) |
| 87 , m_isIncrementor(false) |
86 { | 88 { |
87 } | 89 } |
88 | 90 |
89 PassRefPtr<AXSpinButtonPart> AXSpinButtonPart::create() | 91 PassRefPtr<AXSpinButtonPart> AXSpinButtonPart::create(AXObjectCache* axObjectCac
he) |
90 { | 92 { |
91 return adoptRef(new AXSpinButtonPart); | 93 return adoptRef(new AXSpinButtonPart(axObjectCache)); |
92 } | 94 } |
93 | 95 |
94 LayoutRect AXSpinButtonPart::elementRect() const | 96 LayoutRect AXSpinButtonPart::elementRect() const |
95 { | 97 { |
96 // FIXME: This logic should exist in the render tree or elsewhere, but there
is no | 98 // FIXME: This logic should exist in the render tree or elsewhere, but there
is no |
97 // relationship that exists that can be queried. | 99 // relationship that exists that can be queried. |
98 | 100 |
99 LayoutRect parentRect = parentObject()->elementRect(); | 101 LayoutRect parentRect = parentObject()->elementRect(); |
100 if (m_isIncrementor) { | 102 if (m_isIncrementor) { |
101 parentRect.setHeight(parentRect.height() / 2); | 103 parentRect.setHeight(parentRect.height() / 2); |
(...skipping 13 matching lines...) Expand all Loading... |
115 AXSpinButton* spinButton = toAXSpinButton(parentObject()); | 117 AXSpinButton* spinButton = toAXSpinButton(parentObject()); |
116 if (m_isIncrementor) | 118 if (m_isIncrementor) |
117 spinButton->step(1); | 119 spinButton->step(1); |
118 else | 120 else |
119 spinButton->step(-1); | 121 spinButton->step(-1); |
120 | 122 |
121 return true; | 123 return true; |
122 } | 124 } |
123 | 125 |
124 } // namespace blink | 126 } // namespace blink |
OLD | NEW |