Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXSpinButton.cpp

Issue 2287433003: Get rid of remaining uses of AXObject::elementRect (Closed)
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 { 45 {
46 ASSERT(!m_spinButtonElement); 46 ASSERT(!m_spinButtonElement);
47 } 47 }
48 48
49 DEFINE_TRACE(AXSpinButton) 49 DEFINE_TRACE(AXSpinButton)
50 { 50 {
51 visitor->trace(m_spinButtonElement); 51 visitor->trace(m_spinButtonElement);
52 AXMockObject::trace(visitor); 52 AXMockObject::trace(visitor);
53 } 53 }
54 54
55 LayoutRect AXSpinButton::elementRect() const 55 LayoutObject* AXSpinButton::layoutObjectForRelativeBounds() const
56 { 56 {
57 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject()) 57 if (!m_spinButtonElement || !m_spinButtonElement->layoutObject())
58 return LayoutRect(); 58 return nullptr;
59 59
60 return LayoutRect(m_spinButtonElement->layoutObject()->absoluteElementBoundi ngBoxRect()); 60 return m_spinButtonElement->layoutObject();
61 } 61 }
62 62
63 void AXSpinButton::detach() 63 void AXSpinButton::detach()
64 { 64 {
65 AXObject::detach(); 65 AXObject::detach();
66 m_spinButtonElement = nullptr; 66 m_spinButtonElement = nullptr;
67 } 67 }
68 68
69 void AXSpinButton::detachFromParent() 69 void AXSpinButton::detachFromParent()
70 { 70 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 : AXMockObject(axObjectCache) 108 : AXMockObject(axObjectCache)
109 , m_isIncrementor(false) 109 , m_isIncrementor(false)
110 { 110 {
111 } 111 }
112 112
113 AXSpinButtonPart* AXSpinButtonPart::create(AXObjectCacheImpl& axObjectCache) 113 AXSpinButtonPart* AXSpinButtonPart::create(AXObjectCacheImpl& axObjectCache)
114 { 114 {
115 return new AXSpinButtonPart(axObjectCache); 115 return new AXSpinButtonPart(axObjectCache);
116 } 116 }
117 117
118 LayoutRect AXSpinButtonPart::elementRect() const 118 void AXSpinButtonPart::getRelativeBounds(AXObject** outContainer, FloatRect& out BoundsInContainer, SkMatrix44& outContainerTransform) const
119 { 119 {
120 *outContainer = nullptr;
121 outBoundsInContainer = FloatRect();
122 outContainerTransform.setIdentity();
123
124 if (!parentObject())
125 return;
126
120 // FIXME: This logic should exist in the layout tree or elsewhere, but there is no 127 // FIXME: This logic should exist in the layout tree or elsewhere, but there is no
121 // relationship that exists that can be queried. 128 // relationship that exists that can be queried.
122 129 parentObject()->getRelativeBounds(outContainer, outBoundsInContainer, outCon tainerTransform);
123 LayoutRect parentRect = parentObject()->elementRect(); 130 outBoundsInContainer = FloatRect(0, 0, outBoundsInContainer.width(), outBoun dsInContainer.height());
124 if (m_isIncrementor) { 131 if (m_isIncrementor) {
125 parentRect.setHeight(parentRect.height() / 2); 132 outBoundsInContainer.setHeight(outBoundsInContainer.height() / 2);
126 } else { 133 } else {
127 parentRect.setY(parentRect.y() + parentRect.height() / 2); 134 outBoundsInContainer.setY(outBoundsInContainer.y() + outBoundsInContaine r.height() / 2);
128 parentRect.setHeight(parentRect.height() / 2); 135 outBoundsInContainer.setHeight(outBoundsInContainer.height() / 2);
129 } 136 }
130 137 *outContainer = parentObject();
131 return parentRect;
132 } 138 }
133 139
134 bool AXSpinButtonPart::press() const 140 bool AXSpinButtonPart::press() const
135 { 141 {
136 if (!m_parent || !m_parent->isSpinButton()) 142 if (!m_parent || !m_parent->isSpinButton())
137 return false; 143 return false;
138 144
139 AXSpinButton* spinButton = toAXSpinButton(parentObject()); 145 AXSpinButton* spinButton = toAXSpinButton(parentObject());
140 if (m_isIncrementor) 146 if (m_isIncrementor)
141 spinButton->step(1); 147 spinButton->step(1);
142 else 148 else
143 spinButton->step(-1); 149 spinButton->step(-1);
144 150
145 return true; 151 return true;
146 } 152 }
147 153
148 } // namespace blink 154 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698