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