| 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 PassRefPtrWillBeRawPtr<AXSpinButton> AXSpinButton::create(AXObjectCacheImpl& axO
bjectCache) |
| 35 { | 35 { |
| 36 return adoptRef(new AXSpinButton(axObjectCache)); | 36 return adoptRefWillBeNoop(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(nullptr) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 AXSpinButton::~AXSpinButton() | 45 AXSpinButton::~AXSpinButton() |
| 46 { | 46 { |
| 47 ASSERT(!m_spinButtonElement); |
| 48 } |
| 49 |
| 50 DEFINE_TRACE(AXSpinButton) |
| 51 { |
| 52 visitor->trace(m_spinButtonElement); |
| 53 AXMockObject::trace(visitor); |
| 47 } | 54 } |
| 48 | 55 |
| 49 LayoutRect AXSpinButton::elementRect() const | 56 LayoutRect AXSpinButton::elementRect() const |
| 50 { | 57 { |
| 51 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject()) | 58 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject()) |
| 52 return LayoutRect(); | 59 return LayoutRect(); |
| 53 | 60 |
| 54 return LayoutRect(m_spinButtonElement->layoutObject()->absoluteFocusRingBoun
dingBoxRect()); | 61 return LayoutRect(m_spinButtonElement->layoutObject()->absoluteFocusRingBoun
dingBoxRect()); |
| 55 } | 62 } |
| 56 | 63 |
| 57 void AXSpinButton::detach() | 64 void AXSpinButton::detach() |
| 58 { | 65 { |
| 59 AXObject::detach(); | 66 AXObject::detach(); |
| 60 m_spinButtonElement = 0; | 67 m_spinButtonElement = nullptr; |
| 61 } | 68 } |
| 62 | 69 |
| 63 void AXSpinButton::detachFromParent() | 70 void AXSpinButton::detachFromParent() |
| 64 { | 71 { |
| 65 AXObject::detachFromParent(); | 72 AXObject::detachFromParent(); |
| 66 m_spinButtonElement = 0; | 73 m_spinButtonElement = nullptr; |
| 67 } | 74 } |
| 68 | 75 |
| 69 AccessibilityRole AXSpinButton::roleValue() const | 76 AccessibilityRole AXSpinButton::roleValue() const |
| 70 { | 77 { |
| 71 return m_spinButtonElement ? SpinButtonRole : UnknownRole; | 78 return m_spinButtonElement ? SpinButtonRole : UnknownRole; |
| 72 } | 79 } |
| 73 | 80 |
| 74 void AXSpinButton::addChildren() | 81 void AXSpinButton::addChildren() |
| 75 { | 82 { |
| 76 m_haveChildren = true; | 83 m_haveChildren = true; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 96 } | 103 } |
| 97 | 104 |
| 98 // AXSpinButtonPart | 105 // AXSpinButtonPart |
| 99 | 106 |
| 100 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& axObjectCache) | 107 AXSpinButtonPart::AXSpinButtonPart(AXObjectCacheImpl& axObjectCache) |
| 101 : AXMockObject(axObjectCache) | 108 : AXMockObject(axObjectCache) |
| 102 , m_isIncrementor(false) | 109 , m_isIncrementor(false) |
| 103 { | 110 { |
| 104 } | 111 } |
| 105 | 112 |
| 106 PassRefPtr<AXSpinButtonPart> AXSpinButtonPart::create(AXObjectCacheImpl& axObjec
tCache) | 113 PassRefPtrWillBeRawPtr<AXSpinButtonPart> AXSpinButtonPart::create(AXObjectCacheI
mpl& axObjectCache) |
| 107 { | 114 { |
| 108 return adoptRef(new AXSpinButtonPart(axObjectCache)); | 115 return adoptRefWillBeNoop(new AXSpinButtonPart(axObjectCache)); |
| 109 } | 116 } |
| 110 | 117 |
| 111 LayoutRect AXSpinButtonPart::elementRect() const | 118 LayoutRect AXSpinButtonPart::elementRect() const |
| 112 { | 119 { |
| 113 // FIXME: This logic should exist in the layout tree or elsewhere, but there
is no | 120 // FIXME: This logic should exist in the layout tree or elsewhere, but there
is no |
| 114 // relationship that exists that can be queried. | 121 // relationship that exists that can be queried. |
| 115 | 122 |
| 116 LayoutRect parentRect = parentObject()->elementRect(); | 123 LayoutRect parentRect = parentObject()->elementRect(); |
| 117 if (m_isIncrementor) { | 124 if (m_isIncrementor) { |
| 118 parentRect.setHeight(parentRect.height() / 2); | 125 parentRect.setHeight(parentRect.height() / 2); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 AXSpinButton* spinButton = toAXSpinButton(parentObject()); | 139 AXSpinButton* spinButton = toAXSpinButton(parentObject()); |
| 133 if (m_isIncrementor) | 140 if (m_isIncrementor) |
| 134 spinButton->step(1); | 141 spinButton->step(1); |
| 135 else | 142 else |
| 136 spinButton->step(-1); | 143 spinButton->step(-1); |
| 137 | 144 |
| 138 return true; | 145 return true; |
| 139 } | 146 } |
| 140 | 147 |
| 141 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |