| 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/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.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(AXObjectCacheImpl* axObjectCache) | 34 PassRefPtr<AXSpinButton> AXSpinButton::create(AXObjectCacheImpl& axObjectCache) |
| 35 { | 35 { |
| 36 return adoptRef(new AXSpinButton(axObjectCache)); | 36 return adoptRef(new AXSpinButton(axObjectCache)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 AXSpinButton::AXSpinButton(AXObjectCacheImpl* axObjectCache) | 39 AXSpinButton::AXSpinButton(AXObjectCacheImpl& axObjectCache) |
| 40 : AXMockObject(axObjectCache) | 40 : AXMockObject(axObjectCache) |
| 41 , m_spinButtonElement(0) | 41 , m_spinButtonElement(0) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 AXSpinButton::~AXSpinButton() | 45 AXSpinButton::~AXSpinButton() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 LayoutRect AXSpinButton::elementRect() const | 49 LayoutRect AXSpinButton::elementRect() const |
| (...skipping 18 matching lines...) Expand all Loading... |
| 68 | 68 |
| 69 AccessibilityRole AXSpinButton::roleValue() const | 69 AccessibilityRole AXSpinButton::roleValue() const |
| 70 { | 70 { |
| 71 return m_spinButtonElement ? SpinButtonRole : UnknownRole; | 71 return m_spinButtonElement ? SpinButtonRole : UnknownRole; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void AXSpinButton::addChildren() | 74 void AXSpinButton::addChildren() |
| 75 { | 75 { |
| 76 m_haveChildren = true; | 76 m_haveChildren = true; |
| 77 | 77 |
| 78 AXSpinButtonPart* incrementor = toAXSpinButtonPart(axObjectCache()->getOrCre
ate(SpinButtonPartRole)); | 78 AXSpinButtonPart* incrementor = toAXSpinButtonPart(axObjectCache().getOrCrea
te(SpinButtonPartRole)); |
| 79 incrementor->setIsIncrementor(true); | 79 incrementor->setIsIncrementor(true); |
| 80 incrementor->setParent(this); | 80 incrementor->setParent(this); |
| 81 m_children.append(incrementor); | 81 m_children.append(incrementor); |
| 82 | 82 |
| 83 AXSpinButtonPart* decrementor = toAXSpinButtonPart(axObjectCache()->getOrCre
ate(SpinButtonPartRole)); | 83 AXSpinButtonPart* decrementor = toAXSpinButtonPart(axObjectCache().getOrCrea
te(SpinButtonPartRole)); |
| 84 decrementor->setIsIncrementor(false); | 84 decrementor->setIsIncrementor(false); |
| 85 decrementor->setParent(this); | 85 decrementor->setParent(this); |
| 86 m_children.append(decrementor); | 86 m_children.append(decrementor); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void AXSpinButton::step(int amount) | 89 void AXSpinButton::step(int amount) |
| 90 { | 90 { |
| 91 ASSERT(m_spinButtonElement); | 91 ASSERT(m_spinButtonElement); |
| 92 if (!m_spinButtonElement) | 92 if (!m_spinButtonElement) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 m_spinButtonElement->step(amount); | 95 m_spinButtonElement->step(amount); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // AXSpinButtonPart | 98 // AXSpinButtonPart |
| 99 | 99 |
| 100 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl* axObjectCache) | 100 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& axObjectCache) |
| 101 : AXMockObject(axObjectCache) | 101 : AXMockObject(axObjectCache) |
| 102 , m_isIncrementor(false) | 102 , m_isIncrementor(false) |
| 103 { | 103 { |
| 104 } | 104 } |
| 105 | 105 |
| 106 PassRefPtr<AXSpinButtonPart> AXSpinButtonPart::create(AXObjectCacheImpl* axObjec
tCache) | 106 PassRefPtr<AXSpinButtonPart> AXSpinButtonPart::create(AXObjectCacheImpl& axObjec
tCache) |
| 107 { | 107 { |
| 108 return adoptRef(new AXSpinButtonPart(axObjectCache)); | 108 return adoptRef(new AXSpinButtonPart(axObjectCache)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 LayoutRect AXSpinButtonPart::elementRect() const | 111 LayoutRect AXSpinButtonPart::elementRect() const |
| 112 { | 112 { |
| 113 // FIXME: This logic should exist in the layout tree or elsewhere, but there
is no | 113 // FIXME: This logic should exist in the layout tree or elsewhere, but there
is no |
| 114 // relationship that exists that can be queried. | 114 // relationship that exists that can be queried. |
| 115 | 115 |
| 116 LayoutRect parentRect = parentObject()->elementRect(); | 116 LayoutRect parentRect = parentObject()->elementRect(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 132 AXSpinButton* spinButton = toAXSpinButton(parentObject()); | 132 AXSpinButton* spinButton = toAXSpinButton(parentObject()); |
| 133 if (m_isIncrementor) | 133 if (m_isIncrementor) |
| 134 spinButton->step(1); | 134 spinButton->step(1); |
| 135 else | 135 else |
| 136 spinButton->step(-1); | 136 spinButton->step(-1); |
| 137 | 137 |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |