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 20 matching lines...) Expand all Loading... |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 AXSpinButton* AXSpinButton::create(AXObjectCacheImpl& axObjectCache) { | 33 AXSpinButton* AXSpinButton::create(AXObjectCacheImpl& axObjectCache) { |
34 return new AXSpinButton(axObjectCache); | 34 return new AXSpinButton(axObjectCache); |
35 } | 35 } |
36 | 36 |
37 AXSpinButton::AXSpinButton(AXObjectCacheImpl& axObjectCache) | 37 AXSpinButton::AXSpinButton(AXObjectCacheImpl& axObjectCache) |
38 : AXMockObject(axObjectCache), m_spinButtonElement(nullptr) {} | 38 : AXMockObject(axObjectCache), m_spinButtonElement(nullptr) {} |
39 | 39 |
40 AXSpinButton::~AXSpinButton() { | 40 AXSpinButton::~AXSpinButton() { |
41 ASSERT(!m_spinButtonElement); | 41 DCHECK(!m_spinButtonElement); |
42 } | 42 } |
43 | 43 |
44 DEFINE_TRACE(AXSpinButton) { | 44 DEFINE_TRACE(AXSpinButton) { |
45 visitor->trace(m_spinButtonElement); | 45 visitor->trace(m_spinButtonElement); |
46 AXMockObject::trace(visitor); | 46 AXMockObject::trace(visitor); |
47 } | 47 } |
48 | 48 |
49 LayoutObject* AXSpinButton::layoutObjectForRelativeBounds() const { | 49 LayoutObject* AXSpinButton::layoutObjectForRelativeBounds() const { |
50 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject()) | 50 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject()) |
51 return nullptr; | 51 return nullptr; |
52 | 52 |
53 return m_spinButtonElement->layoutObject(); | 53 return m_spinButtonElement->layoutObject(); |
54 } | 54 } |
55 | 55 |
56 void AXSpinButton::detach() { | 56 void AXSpinButton::detach() { |
57 AXObject::detach(); | 57 AXObject::detach(); |
58 m_spinButtonElement = nullptr; | 58 m_spinButtonElement = nullptr; |
59 } | 59 } |
60 | 60 |
61 void AXSpinButton::detachFromParent() { | 61 void AXSpinButton::detachFromParent() { |
62 AXObject::detachFromParent(); | 62 AXObject::detachFromParent(); |
63 m_spinButtonElement = nullptr; | 63 m_spinButtonElement = nullptr; |
64 } | 64 } |
65 | 65 |
66 AccessibilityRole AXSpinButton::roleValue() const { | 66 AccessibilityRole AXSpinButton::roleValue() const { |
67 return m_spinButtonElement ? SpinButtonRole : UnknownRole; | 67 return m_spinButtonElement ? SpinButtonRole : UnknownRole; |
68 } | 68 } |
69 | 69 |
70 void AXSpinButton::addChildren() { | 70 void AXSpinButton::addChildren() { |
71 ASSERT(!isDetached()); | 71 DCHECK(!isDetached()); |
72 m_haveChildren = true; | 72 m_haveChildren = true; |
73 | 73 |
74 AXSpinButtonPart* incrementor = | 74 AXSpinButtonPart* incrementor = |
75 toAXSpinButtonPart(axObjectCache().getOrCreate(SpinButtonPartRole)); | 75 toAXSpinButtonPart(axObjectCache().getOrCreate(SpinButtonPartRole)); |
76 incrementor->setIsIncrementor(true); | 76 incrementor->setIsIncrementor(true); |
77 incrementor->setParent(this); | 77 incrementor->setParent(this); |
78 m_children.push_back(incrementor); | 78 m_children.push_back(incrementor); |
79 | 79 |
80 AXSpinButtonPart* decrementor = | 80 AXSpinButtonPart* decrementor = |
81 toAXSpinButtonPart(axObjectCache().getOrCreate(SpinButtonPartRole)); | 81 toAXSpinButtonPart(axObjectCache().getOrCreate(SpinButtonPartRole)); |
82 decrementor->setIsIncrementor(false); | 82 decrementor->setIsIncrementor(false); |
83 decrementor->setParent(this); | 83 decrementor->setParent(this); |
84 m_children.push_back(decrementor); | 84 m_children.push_back(decrementor); |
85 } | 85 } |
86 | 86 |
87 void AXSpinButton::step(int amount) { | 87 void AXSpinButton::step(int amount) { |
88 ASSERT(m_spinButtonElement); | 88 DCHECK(m_spinButtonElement); |
89 if (!m_spinButtonElement) | 89 if (!m_spinButtonElement) |
90 return; | 90 return; |
91 | 91 |
92 m_spinButtonElement->step(amount); | 92 m_spinButtonElement->step(amount); |
93 } | 93 } |
94 | 94 |
95 // AXSpinButtonPart | 95 // AXSpinButtonPart |
96 | 96 |
97 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& axObjectCache) | 97 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& axObjectCache) |
98 : AXMockObject(axObjectCache), m_isIncrementor(false) {} | 98 : AXMockObject(axObjectCache), m_isIncrementor(false) {} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 AXSpinButton* spinButton = toAXSpinButton(parentObject()); | 135 AXSpinButton* spinButton = toAXSpinButton(parentObject()); |
136 if (m_isIncrementor) | 136 if (m_isIncrementor) |
137 spinButton->step(1); | 137 spinButton->step(1); |
138 else | 138 else |
139 spinButton->step(-1); | 139 spinButton->step(-1); |
140 | 140 |
141 return true; | 141 return true; |
142 } | 142 } |
143 | 143 |
144 } // namespace blink | 144 } // namespace blink |
OLD | NEW |