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

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

Issue 2956053005: Keep track of fixed positioning in accessibility tree.
Patch Set: GetSimpleRelativeBounds, add failing test for fixed with transform Created 3 years, 5 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 8a991938814dfc4e34e238e9bf31a03c04240a13..b4a2752b059e43becb874433f55ec086854a44ff 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -1490,10 +1490,15 @@ 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;
+
+ if (GetSimpleRelativeBounds(out_container, out_bounds_in_container))
+ return;
// 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 +1524,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
@@ -1530,7 +1544,8 @@ void AXObject::GetRelativeBounds(AXObject** out_container,
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;
}
@@ -1568,11 +1583,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());
}
@@ -1580,7 +1596,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