1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/accessibility/browser_accessibility.h"
9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "content/browser/accessibility/browser_accessibility_manager.h"
14 #include "content/common/accessibility_messages.h"
15 #include "ui/accessibility/ax_text_utils.h"
19 #if !defined(OS_MACOSX) && \
22 // We have subclassess of BrowserAccessibility on Mac and Win. For any other
23 // platform, instantiate the base class.
25 BrowserAccessibility
* BrowserAccessibility::Create() {
26 return new BrowserAccessibility();
30 BrowserAccessibility::BrowserAccessibility()
35 BrowserAccessibility::~BrowserAccessibility() {
38 void BrowserAccessibility::Init(BrowserAccessibilityManager
* manager
,
44 bool BrowserAccessibility::PlatformIsLeaf() const {
45 if (InternalChildCount() == 0)
48 // All of these roles may have children that we use as internal
49 // implementation details, but we want to expose them as leaves
50 // to platform accessibility APIs.
52 case ui::AX_ROLE_LINE_BREAK
:
53 case ui::AX_ROLE_SLIDER
:
54 case ui::AX_ROLE_STATIC_TEXT
:
55 case ui::AX_ROLE_TEXT_FIELD
:
62 uint32
BrowserAccessibility::PlatformChildCount() const {
63 return PlatformIsLeaf() ? 0 : InternalChildCount();
66 bool BrowserAccessibility::IsNative() const {
70 bool BrowserAccessibility::IsDescendantOf(
71 BrowserAccessibility
* ancestor
) {
72 if (this == ancestor
) {
74 } else if (GetParent()) {
75 return GetParent()->IsDescendantOf(ancestor
);
81 BrowserAccessibility
* BrowserAccessibility::PlatformGetChild(
82 uint32 child_index
) const {
83 DCHECK(child_index
< InternalChildCount());
84 BrowserAccessibility
* result
= InternalGetChild(child_index
);
86 if (result
->HasBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST
)) {
87 BrowserAccessibilityManager
* child_manager
=
88 manager_
->delegate()->AccessibilityGetChildFrame(result
->GetId());
90 result
= child_manager
->GetRoot();
96 bool BrowserAccessibility::PlatformIsChildOfLeaf() const {
97 BrowserAccessibility
* ancestor
= GetParent();
99 if (ancestor
->PlatformIsLeaf())
101 ancestor
= ancestor
->GetParent();
107 BrowserAccessibility
* BrowserAccessibility::GetPreviousSibling() {
108 if (GetParent() && GetIndexInParent() > 0)
109 return GetParent()->InternalGetChild(GetIndexInParent() - 1);
114 BrowserAccessibility
* BrowserAccessibility::GetNextSibling() {
116 GetIndexInParent() >= 0 &&
117 GetIndexInParent() < static_cast<int>(
118 GetParent()->InternalChildCount() - 1)) {
119 return GetParent()->InternalGetChild(GetIndexInParent() + 1);
125 uint32
BrowserAccessibility::InternalChildCount() const {
126 if (!node_
|| !manager_
)
128 return static_cast<uint32
>(node_
->child_count());
131 BrowserAccessibility
* BrowserAccessibility::InternalGetChild(
132 uint32 child_index
) const {
133 if (!node_
|| !manager_
)
135 return manager_
->GetFromAXNode(node_
->ChildAtIndex(child_index
));
138 BrowserAccessibility
* BrowserAccessibility::GetParent() const {
139 if (!node_
|| !manager_
)
141 ui::AXNode
* parent
= node_
->parent();
143 return manager_
->GetFromAXNode(parent
);
145 if (!manager_
->delegate())
148 BrowserAccessibility
* host_node
=
149 manager_
->delegate()->AccessibilityGetParentFrame();
153 return host_node
->GetParent();
156 int32
BrowserAccessibility::GetIndexInParent() const {
157 return node_
? node_
->index_in_parent() : -1;
160 int32
BrowserAccessibility::GetId() const {
161 return node_
? node_
->id() : -1;
164 const ui::AXNodeData
& BrowserAccessibility::GetData() const {
165 CR_DEFINE_STATIC_LOCAL(ui::AXNodeData
, empty_data
, ());
167 return node_
->data();
172 gfx::Rect
BrowserAccessibility::GetLocation() const {
173 return GetData().location
;
176 int32
BrowserAccessibility::GetRole() const {
177 return GetData().role
;
180 int32
BrowserAccessibility::GetState() const {
181 return GetData().state
;
184 const BrowserAccessibility::HtmlAttributes
&
185 BrowserAccessibility::GetHtmlAttributes() const {
186 return GetData().html_attributes
;
189 gfx::Rect
BrowserAccessibility::GetLocalBoundsRect() const {
190 gfx::Rect bounds
= GetLocation();
191 return ElementBoundsToLocalBounds(bounds
);
194 gfx::Rect
BrowserAccessibility::GetGlobalBoundsRect() const {
195 gfx::Rect bounds
= GetLocalBoundsRect();
197 // Adjust the bounds by the top left corner of the containing view's bounds
198 // in screen coordinates.
199 bounds
.Offset(manager_
->GetViewBounds().OffsetFromOrigin());
204 gfx::Rect
BrowserAccessibility::GetLocalBoundsForRange(int start
, int len
)
206 if (GetRole() != ui::AX_ROLE_STATIC_TEXT
) {
207 // Apply recursively to all static text descendants. For example, if
208 // you call it on a div with two text node children, it just calls
209 // GetLocalBoundsForRange on each of the two children (adjusting
210 // |start| for each one) and unions the resulting rects.
212 for (size_t i
= 0; i
< InternalChildCount(); ++i
) {
213 BrowserAccessibility
* child
= InternalGetChild(i
);
214 int child_len
= child
->GetStaticTextLenRecursive();
215 if (start
< child_len
&& start
+ len
> 0) {
216 gfx::Rect child_rect
= child
->GetLocalBoundsForRange(start
, len
);
217 bounds
.Union(child_rect
);
221 return ElementBoundsToLocalBounds(bounds
);
224 int end
= start
+ len
;
229 for (size_t i
= 0; i
< InternalChildCount() && child_end
< start
+ len
; ++i
) {
230 BrowserAccessibility
* child
= InternalGetChild(i
);
231 DCHECK_EQ(child
->GetRole(), ui::AX_ROLE_INLINE_TEXT_BOX
);
232 std::string child_text
;
233 child
->GetStringAttribute(ui::AX_ATTR_VALUE
, &child_text
);
234 int child_len
= static_cast<int>(child_text
.size());
235 child_start
= child_end
;
236 child_end
+= child_len
;
238 if (child_end
< start
)
241 int overlap_start
= std::max(start
, child_start
);
242 int overlap_end
= std::min(end
, child_end
);
244 int local_start
= overlap_start
- child_start
;
245 int local_end
= overlap_end
- child_start
;
247 gfx::Rect child_rect
= child
->GetLocation();
248 int text_direction
= child
->GetIntAttribute(
249 ui::AX_ATTR_TEXT_DIRECTION
);
250 const std::vector
<int32
>& character_offsets
= child
->GetIntListAttribute(
251 ui::AX_ATTR_CHARACTER_OFFSETS
);
252 int start_pixel_offset
=
253 local_start
> 0 ? character_offsets
[local_start
- 1] : 0;
254 int end_pixel_offset
=
255 local_end
> 0 ? character_offsets
[local_end
- 1] : 0;
257 gfx::Rect child_overlap_rect
;
258 switch (text_direction
) {
259 case ui::AX_TEXT_DIRECTION_NONE
:
260 case ui::AX_TEXT_DIRECTION_LR
: {
261 int left
= child_rect
.x() + start_pixel_offset
;
262 int right
= child_rect
.x() + end_pixel_offset
;
263 child_overlap_rect
= gfx::Rect(left
, child_rect
.y(),
264 right
- left
, child_rect
.height());
267 case ui::AX_TEXT_DIRECTION_RL
: {
268 int right
= child_rect
.right() - start_pixel_offset
;
269 int left
= child_rect
.right() - end_pixel_offset
;
270 child_overlap_rect
= gfx::Rect(left
, child_rect
.y(),
271 right
- left
, child_rect
.height());
274 case ui::AX_TEXT_DIRECTION_TB
: {
275 int top
= child_rect
.y() + start_pixel_offset
;
276 int bottom
= child_rect
.y() + end_pixel_offset
;
277 child_overlap_rect
= gfx::Rect(child_rect
.x(), top
,
278 child_rect
.width(), bottom
- top
);
281 case ui::AX_TEXT_DIRECTION_BT
: {
282 int bottom
= child_rect
.bottom() - start_pixel_offset
;
283 int top
= child_rect
.bottom() - end_pixel_offset
;
284 child_overlap_rect
= gfx::Rect(child_rect
.x(), top
,
285 child_rect
.width(), bottom
- top
);
292 if (bounds
.width() == 0 && bounds
.height() == 0)
293 bounds
= child_overlap_rect
;
295 bounds
.Union(child_overlap_rect
);
298 return ElementBoundsToLocalBounds(bounds
);
301 gfx::Rect
BrowserAccessibility::GetGlobalBoundsForRange(int start
, int len
)
303 gfx::Rect bounds
= GetLocalBoundsForRange(start
, len
);
305 // Adjust the bounds by the top left corner of the containing view's bounds
306 // in screen coordinates.
307 bounds
.Offset(manager_
->GetViewBounds().OffsetFromOrigin());
312 int BrowserAccessibility::GetWordStartBoundary(
313 int start
, ui::TextBoundaryDirection direction
) const {
315 int prev_word_start
= 0;
316 if (GetRole() != ui::AX_ROLE_STATIC_TEXT
) {
317 for (size_t i
= 0; i
< InternalChildCount(); ++i
) {
318 BrowserAccessibility
* child
= InternalGetChild(i
);
319 int child_len
= child
->GetStaticTextLenRecursive();
320 int child_word_start
= child
->GetWordStartBoundary(start
, direction
);
321 word_start
+= child_word_start
;
322 if (child_word_start
!= child_len
)
331 for (size_t i
= 0; i
< InternalChildCount(); ++i
) {
332 // The next child starts where the previous one ended.
333 child_start
= child_end
;
334 BrowserAccessibility
* child
= InternalGetChild(i
);
335 DCHECK_EQ(child
->GetRole(), ui::AX_ROLE_INLINE_TEXT_BOX
);
336 const std::string
& child_text
= child
->GetStringAttribute(
338 int child_len
= static_cast<int>(child_text
.size());
339 child_end
+= child_len
; // End is one past the last character.
341 const std::vector
<int32
>& word_starts
= child
->GetIntListAttribute(
342 ui::AX_ATTR_WORD_STARTS
);
343 if (word_starts
.empty()) {
344 word_start
= child_end
;
348 int local_start
= start
- child_start
;
349 std::vector
<int32
>::const_iterator iter
= std::upper_bound(
350 word_starts
.begin(), word_starts
.end(), local_start
);
351 if (iter
!= word_starts
.end()) {
352 if (direction
== ui::FORWARDS_DIRECTION
) {
353 word_start
= child_start
+ *iter
;
354 } else if (direction
== ui::BACKWARDS_DIRECTION
) {
355 if (iter
== word_starts
.begin()) {
356 // Return the position of the last word in the previous child.
357 word_start
= prev_word_start
;
359 word_start
= child_start
+ *(iter
- 1);
367 // No word start that is >= to the requested offset has been found.
368 prev_word_start
= child_start
+ *(iter
- 1);
369 if (direction
== ui::FORWARDS_DIRECTION
) {
370 word_start
= child_end
;
371 } else if (direction
== ui::BACKWARDS_DIRECTION
) {
372 word_start
= prev_word_start
;
381 BrowserAccessibility
* BrowserAccessibility::BrowserAccessibilityForPoint(
382 const gfx::Point
& point
) {
383 // The best result found that's a child of this object.
384 BrowserAccessibility
* child_result
= NULL
;
385 // The best result that's an indirect descendant like grandchild, etc.
386 BrowserAccessibility
* descendant_result
= NULL
;
388 // Walk the children recursively looking for the BrowserAccessibility that
389 // most tightly encloses the specified point. Walk backwards so that in
390 // the absence of any other information, we assume the object that occurs
391 // later in the tree is on top of one that comes before it.
392 for (int i
= static_cast<int>(PlatformChildCount()) - 1; i
>= 0; --i
) {
393 BrowserAccessibility
* child
= PlatformGetChild(i
);
395 // Skip table columns because cells are only contained in rows,
397 if (child
->GetRole() == ui::AX_ROLE_COLUMN
)
400 if (child
->GetGlobalBoundsRect().Contains(point
)) {
401 BrowserAccessibility
* result
= child
->BrowserAccessibilityForPoint(point
);
402 if (result
== child
&& !child_result
)
403 child_result
= result
;
404 if (result
!= child
&& !descendant_result
)
405 descendant_result
= result
;
408 if (child_result
&& descendant_result
)
412 // Explanation of logic: it's possible that this point overlaps more than
413 // one child of this object. If so, as a heuristic we prefer if the point
414 // overlaps a descendant of one of the two children and not the other.
415 // As an example, suppose you have two rows of buttons - the buttons don't
416 // overlap, but the rows do. Without this heuristic, we'd greedily only
417 // consider one of the containers.
418 if (descendant_result
)
419 return descendant_result
;
426 void BrowserAccessibility::Destroy() {
427 // Allow the object to fire a TextRemoved notification.
428 manager_
->NotifyAccessibilityEvent(ui::AX_EVENT_HIDE
, this);
432 NativeReleaseReference();
435 void BrowserAccessibility::NativeReleaseReference() {
439 bool BrowserAccessibility::HasBoolAttribute(
440 ui::AXBoolAttribute attribute
) const {
441 const ui::AXNodeData
& data
= GetData();
442 for (size_t i
= 0; i
< data
.bool_attributes
.size(); ++i
) {
443 if (data
.bool_attributes
[i
].first
== attribute
)
451 bool BrowserAccessibility::GetBoolAttribute(
452 ui::AXBoolAttribute attribute
) const {
453 const ui::AXNodeData
& data
= GetData();
454 for (size_t i
= 0; i
< data
.bool_attributes
.size(); ++i
) {
455 if (data
.bool_attributes
[i
].first
== attribute
)
456 return data
.bool_attributes
[i
].second
;
462 bool BrowserAccessibility::GetBoolAttribute(
463 ui::AXBoolAttribute attribute
, bool* value
) const {
464 const ui::AXNodeData
& data
= GetData();
465 for (size_t i
= 0; i
< data
.bool_attributes
.size(); ++i
) {
466 if (data
.bool_attributes
[i
].first
== attribute
) {
467 *value
= data
.bool_attributes
[i
].second
;
475 bool BrowserAccessibility::HasFloatAttribute(
476 ui::AXFloatAttribute attribute
) const {
477 const ui::AXNodeData
& data
= GetData();
478 for (size_t i
= 0; i
< data
.float_attributes
.size(); ++i
) {
479 if (data
.float_attributes
[i
].first
== attribute
)
486 float BrowserAccessibility::GetFloatAttribute(
487 ui::AXFloatAttribute attribute
) const {
488 const ui::AXNodeData
& data
= GetData();
489 for (size_t i
= 0; i
< data
.float_attributes
.size(); ++i
) {
490 if (data
.float_attributes
[i
].first
== attribute
)
491 return data
.float_attributes
[i
].second
;
497 bool BrowserAccessibility::GetFloatAttribute(
498 ui::AXFloatAttribute attribute
, float* value
) const {
499 const ui::AXNodeData
& data
= GetData();
500 for (size_t i
= 0; i
< data
.float_attributes
.size(); ++i
) {
501 if (data
.float_attributes
[i
].first
== attribute
) {
502 *value
= data
.float_attributes
[i
].second
;
510 bool BrowserAccessibility::HasIntAttribute(
511 ui::AXIntAttribute attribute
) const {
512 const ui::AXNodeData
& data
= GetData();
513 for (size_t i
= 0; i
< data
.int_attributes
.size(); ++i
) {
514 if (data
.int_attributes
[i
].first
== attribute
)
521 int BrowserAccessibility::GetIntAttribute(ui::AXIntAttribute attribute
) const {
522 const ui::AXNodeData
& data
= GetData();
523 for (size_t i
= 0; i
< data
.int_attributes
.size(); ++i
) {
524 if (data
.int_attributes
[i
].first
== attribute
)
525 return data
.int_attributes
[i
].second
;
531 bool BrowserAccessibility::GetIntAttribute(
532 ui::AXIntAttribute attribute
, int* value
) const {
533 const ui::AXNodeData
& data
= GetData();
534 for (size_t i
= 0; i
< data
.int_attributes
.size(); ++i
) {
535 if (data
.int_attributes
[i
].first
== attribute
) {
536 *value
= data
.int_attributes
[i
].second
;
544 bool BrowserAccessibility::HasStringAttribute(
545 ui::AXStringAttribute attribute
) const {
546 const ui::AXNodeData
& data
= GetData();
547 for (size_t i
= 0; i
< data
.string_attributes
.size(); ++i
) {
548 if (data
.string_attributes
[i
].first
== attribute
)
555 const std::string
& BrowserAccessibility::GetStringAttribute(
556 ui::AXStringAttribute attribute
) const {
557 const ui::AXNodeData
& data
= GetData();
558 CR_DEFINE_STATIC_LOCAL(std::string
, empty_string
, ());
559 for (size_t i
= 0; i
< data
.string_attributes
.size(); ++i
) {
560 if (data
.string_attributes
[i
].first
== attribute
)
561 return data
.string_attributes
[i
].second
;
567 bool BrowserAccessibility::GetStringAttribute(
568 ui::AXStringAttribute attribute
, std::string
* value
) const {
569 const ui::AXNodeData
& data
= GetData();
570 for (size_t i
= 0; i
< data
.string_attributes
.size(); ++i
) {
571 if (data
.string_attributes
[i
].first
== attribute
) {
572 *value
= data
.string_attributes
[i
].second
;
580 base::string16
BrowserAccessibility::GetString16Attribute(
581 ui::AXStringAttribute attribute
) const {
582 std::string value_utf8
;
583 if (!GetStringAttribute(attribute
, &value_utf8
))
584 return base::string16();
585 return base::UTF8ToUTF16(value_utf8
);
588 bool BrowserAccessibility::GetString16Attribute(
589 ui::AXStringAttribute attribute
,
590 base::string16
* value
) const {
591 std::string value_utf8
;
592 if (!GetStringAttribute(attribute
, &value_utf8
))
594 *value
= base::UTF8ToUTF16(value_utf8
);
598 bool BrowserAccessibility::HasIntListAttribute(
599 ui::AXIntListAttribute attribute
) const {
600 const ui::AXNodeData
& data
= GetData();
601 for (size_t i
= 0; i
< data
.intlist_attributes
.size(); ++i
) {
602 if (data
.intlist_attributes
[i
].first
== attribute
)
609 const std::vector
<int32
>& BrowserAccessibility::GetIntListAttribute(
610 ui::AXIntListAttribute attribute
) const {
611 const ui::AXNodeData
& data
= GetData();
612 CR_DEFINE_STATIC_LOCAL(std::vector
<int32
>, empty_vector
, ());
613 for (size_t i
= 0; i
< data
.intlist_attributes
.size(); ++i
) {
614 if (data
.intlist_attributes
[i
].first
== attribute
)
615 return data
.intlist_attributes
[i
].second
;
621 bool BrowserAccessibility::GetIntListAttribute(
622 ui::AXIntListAttribute attribute
,
623 std::vector
<int32
>* value
) const {
624 const ui::AXNodeData
& data
= GetData();
625 for (size_t i
= 0; i
< data
.intlist_attributes
.size(); ++i
) {
626 if (data
.intlist_attributes
[i
].first
== attribute
) {
627 *value
= data
.intlist_attributes
[i
].second
;
635 bool BrowserAccessibility::GetHtmlAttribute(
636 const char* html_attr
, std::string
* value
) const {
637 for (size_t i
= 0; i
< GetHtmlAttributes().size(); ++i
) {
638 const std::string
& attr
= GetHtmlAttributes()[i
].first
;
639 if (LowerCaseEqualsASCII(attr
, html_attr
)) {
640 *value
= GetHtmlAttributes()[i
].second
;
648 bool BrowserAccessibility::GetHtmlAttribute(
649 const char* html_attr
, base::string16
* value
) const {
650 std::string value_utf8
;
651 if (!GetHtmlAttribute(html_attr
, &value_utf8
))
653 *value
= base::UTF8ToUTF16(value_utf8
);
657 bool BrowserAccessibility::GetAriaTristate(
658 const char* html_attr
,
660 bool* is_mixed
) const {
664 base::string16 value
;
665 if (!GetHtmlAttribute(html_attr
, &value
) ||
667 EqualsASCII(value
, "undefined")) {
668 return false; // Not set (and *is_defined is also false)
673 if (EqualsASCII(value
, "true"))
676 if (EqualsASCII(value
, "mixed"))
679 return false; // Not set
682 bool BrowserAccessibility::HasState(ui::AXState state_enum
) const {
683 return (GetState() >> state_enum
) & 1;
686 bool BrowserAccessibility::IsCellOrTableHeaderRole() const {
687 return (GetRole() == ui::AX_ROLE_CELL
||
688 GetRole() == ui::AX_ROLE_COLUMN_HEADER
||
689 GetRole() == ui::AX_ROLE_ROW_HEADER
);
692 bool BrowserAccessibility::IsEditableText() const {
693 // These roles don't have readonly set, but they're not editable text.
694 if (GetRole() == ui::AX_ROLE_SCROLL_AREA
||
695 GetRole() == ui::AX_ROLE_COLUMN
||
696 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER
) {
700 // Note: WebAXStateReadonly being false means it's either a text control,
701 // or contenteditable. We also check for editable text roles to cover
702 // another element that has role=textbox set on it.
703 return (!HasState(ui::AX_STATE_READ_ONLY
) ||
704 GetRole() == ui::AX_ROLE_TEXT_FIELD
);
707 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const {
708 if (GetRole() != ui::AX_ROLE_WEB_AREA
&&
709 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA
) {
713 BrowserAccessibility
* parent
= GetParent();
717 BrowserAccessibility
* grandparent
= parent
->GetParent();
721 return grandparent
->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL
;
724 int BrowserAccessibility::GetStaticTextLenRecursive() const {
725 if (GetRole() == ui::AX_ROLE_STATIC_TEXT
)
726 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE
).size());
729 for (size_t i
= 0; i
< InternalChildCount(); ++i
)
730 len
+= InternalGetChild(i
)->GetStaticTextLenRecursive();
734 BrowserAccessibility
* BrowserAccessibility::GetParentForBoundsCalculation()
736 if (!node_
|| !manager_
)
738 ui::AXNode
* parent
= node_
->parent();
740 return manager_
->GetFromAXNode(parent
);
742 if (!manager_
->delegate())
745 return manager_
->delegate()->AccessibilityGetParentFrame();
748 gfx::Rect
BrowserAccessibility::ElementBoundsToLocalBounds(gfx::Rect bounds
)
750 // Walk up the parent chain. Every time we encounter a Web Area, offset
751 // based on the scroll bars and then offset based on the origin of that
753 BrowserAccessibility
* parent
= GetParentForBoundsCalculation();
754 bool need_to_offset_web_area
=
755 (GetRole() == ui::AX_ROLE_WEB_AREA
||
756 GetRole() == ui::AX_ROLE_ROOT_WEB_AREA
);
758 if (need_to_offset_web_area
&&
759 parent
->GetLocation().width() > 0 &&
760 parent
->GetLocation().height() > 0) {
761 bounds
.Offset(parent
->GetLocation().x(), parent
->GetLocation().y());
762 need_to_offset_web_area
= false;
765 // On some platforms, we don't want to take the root scroll offsets
767 if (parent
->GetRole() == ui::AX_ROLE_ROOT_WEB_AREA
&&
768 !manager()->UseRootScrollOffsetsWhenComputingBounds()) {
772 if (parent
->GetRole() == ui::AX_ROLE_WEB_AREA
||
773 parent
->GetRole() == ui::AX_ROLE_ROOT_WEB_AREA
) {
776 if (parent
->GetIntAttribute(ui::AX_ATTR_SCROLL_X
, &sx
) &&
777 parent
->GetIntAttribute(ui::AX_ATTR_SCROLL_Y
, &sy
)) {
778 bounds
.Offset(-sx
, -sy
);
780 need_to_offset_web_area
= true;
782 parent
= parent
->GetParentForBoundsCalculation();
788 } // namespace content