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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 2956053005: Keep track of fixed positioning in accessibility tree.
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/accessibility/AXObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
index f7145d1222ce32544ce1452749a5150af2eccd15..6825f6c4c3971660fae8d7f3028f6fa3ee86b8c8 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -1490,10 +1490,12 @@ void AXObject::SetScrollOffset(const IntPoint& offset) const {
void AXObject::GetRelativeBounds(AXObject** out_container,
FloatRect& out_bounds_in_container,
- SkMatrix44& out_container_transform) const {
+ SkMatrix44& out_container_transform,
+ bool& out_is_fixed_positioned) const {
*out_container = nullptr;
out_bounds_in_container = FloatRect();
out_container_transform.setIdentity();
+ out_is_fixed_positioned = false;
// First check if it has explicit bounds, for example if this element is tied
// to a canvas path. When explicit coordinates are provided, the ID of the
@@ -1519,6 +1521,15 @@ void AXObject::GetRelativeBounds(AXObject** out_container,
return;
}
+ // When the object is fixed-positioned, we just need to return our
+ // absolute coordinates and indicate that the position is fixed.
+ if (layout_object->IsFixedPositioned()) {
+ out_bounds_in_container = layout_object->AbsoluteBoundingBoxFloatRect();
+ *out_container = AxObjectCache().Root();
+ out_is_fixed_positioned = true;
+ return;
+ }
+
// First compute the container. The container must be an ancestor in the
// accessibility tree, and its LayoutObject must be an ancestor in the layout
// tree. Get the first such ancestor that's either scrollable or has a paint
@@ -1527,11 +1538,11 @@ void AXObject::GetRelativeBounds(AXObject** out_container,
LayoutObject* container_layout_object = nullptr;
while (container) {
container_layout_object = container->GetLayoutObject();
- if (container_layout_object &&
- container_layout_object->IsBoxModelObject() &&
+ if (container_layout_object && container_layout_object->IsBox() &&
layout_object->IsDescendantOf(container_layout_object)) {
if (container->IsScrollableContainer() ||
- container_layout_object->HasLayer())
+ container_layout_object->HasLayer() ||
+ container_layout_object->IsFixedPositioned())
break;
}
@@ -1569,11 +1580,12 @@ LayoutRect AXObject::GetBoundsInFrameCoordinates() const {
AXObject* container = nullptr;
FloatRect bounds;
SkMatrix44 transform;
- GetRelativeBounds(&container, bounds, transform);
+ bool is_fixed_positioned;
+ GetRelativeBounds(&container, bounds, transform, is_fixed_positioned);
FloatRect computed_bounds(0, 0, bounds.Width(), bounds.Height());
while (container && container != this) {
computed_bounds.Move(bounds.X(), bounds.Y());
- if (!container->IsWebArea()) {
+ if (!container->IsWebArea() && !is_fixed_positioned) {
computed_bounds.Move(-container->GetScrollOffset().X(),
-container->GetScrollOffset().Y());
}
@@ -1581,7 +1593,8 @@ LayoutRect AXObject::GetBoundsInFrameCoordinates() const {
TransformationMatrix transformation_matrix(transform);
transformation_matrix.MapRect(computed_bounds);
}
- container->GetRelativeBounds(&container, bounds, transform);
+ container->GetRelativeBounds(&container, bounds, transform,
+ is_fixed_positioned);
}
return LayoutRect(computed_bounds);
}

Powered by Google App Engine
This is Rietveld 408576698