Commit 9b4b71e5 authored by Katie Dektar's avatar Katie Dektar Committed by Commit Bot

Fixes clipping on fixed and absolutely positioned elements.

Fixed positioned elements are not clipped by their ancestors,
except by the rootWebArea. Similarly with absolutely positioned
elements, except if they have an ancestor with some non-static
positioning.

Bug: 792124
Change-Id: I9c31c90fed89179434ae7f89aa18528e929348da
Reviewed-on: https://chromium-review.googlesource.com/809828
Commit-Queue: Katie D <katie@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522162}
parent 427067e8
...@@ -957,6 +957,14 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibiltyBoundsClips) { ...@@ -957,6 +957,14 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibiltyBoundsClips) {
RunHtmlTest(FILE_PATH_LITERAL("bounds-clips.html")); RunHtmlTest(FILE_PATH_LITERAL("bounds-clips.html"));
} }
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBoundsAbsolute) {
RunHtmlTest(FILE_PATH_LITERAL("bounds-absolute.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessiblitiyBoundsFixed) {
RunHtmlTest(FILE_PATH_LITERAL("bounds-fixed.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBR) { IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBR) {
RunHtmlTest(FILE_PATH_LITERAL("br.html")); RunHtmlTest(FILE_PATH_LITERAL("br.html"));
} }
......
rootWebArea clipsChildren=true
++genericContainer size=(200, 200) pageSize=(200, 200) unclippedSize=(200, 200) clipsChildren=true
++++dialog size=(200, 200) pageLocation=(150, 50) pageSize=(200, 200) unclippedLocation=(150, 50) unclippedSize=(200, 200)
++++++button size=(160, 50) pageSize=(160, 50) name='Button 1'
++++++button size=(160, 50) pageSize=(160, 50) name='Button 2'
<-- End-of-file -->
\ No newline at end of file
<!--
@BLINK-ALLOW:size=(200, 200)
@BLINK-ALLOW:size=(160, 50)
@BLINK-ALLOW:pageSize=(200, 200)
@BLINK-ALLOW:pageSize=(160, 50)
@BLINK-ALLOW:unclippedSize=(200, 200)
@BLINK-ALLOW:unclippedSize=(150, 50)
@BLINK-ALLOW:pageLocation=(150, 50)
@BLINK-ALLOW:unclippedLocation=(150, 50)
@BLINK-ALLOW:offscreen;
@BLINK-ALLOW:clipsChildren*
-->
<html>
<head>
<style>
#outer {
height: 200px;
width: 200px;
background-color: #fe9;
overflow: hidden;
}
#dialog {
background-color: #edf;
position: absolute;
top: 50px;
left: 50px;
width: 200px;
height: 200px;
margin-left: 100px;
}
button {
display: block;
margin: 20px;
width: 160px;
height: 50px;
}
body {
}
</style>
</head>
<body>
<div id="outer">
<div id="dialog" role="dialog">
<button>Button 1</button>
<button>Button 2</button>
</div>
</div>
</body>
rootWebArea clipsChildren=true
++genericContainer size=(200, 200) pageSize=(200, 200) unclippedSize=(200, 200) clipsChildren=true
++++dialog size=(200, 200) pageLocation=(150, 50) pageSize=(200, 200) unclippedLocation=(150, 50) unclippedSize=(200, 200)
++++++button size=(160, 50) pageSize=(160, 50) name='Button 1'
++++++button size=(160, 50) pageSize=(160, 50) name='Button 2'
<-- End-of-file -->
\ No newline at end of file
<!--
@BLINK-ALLOW:size=(200, 200)
@BLINK-ALLOW:size=(160, 50)
@BLINK-ALLOW:pageSize=(200, 200)
@BLINK-ALLOW:pageSize=(160, 50)
@BLINK-ALLOW:unclippedSize=(200, 200)
@BLINK-ALLOW:unclippedSize=(150, 50)
@BLINK-ALLOW:pageLocation=(150, 50)
@BLINK-ALLOW:unclippedLocation=(150, 50)
@BLINK-ALLOW:offscreen;
@BLINK-ALLOW:clipsChildren*
-->
<html>
<head>
<style>
#outer {
position: fixed;
top: 100px;
height: 200px;
width: 200px;
background-color: #fe9;
overflow: hidden;
}
#dialog {
background-color: #edf;
position: fixed;
top: 50px;
left: 50px;
width: 200px;
height: 200px;
margin-left: 100px;
}
button {
display: block;
margin: 20px;
width: 160px;
height: 50px;
}
body {
}
</style>
</head>
<body>
<div id="outer">
<div id="dialog" role="dialog">
<button>Button 1</button>
<button>Button 2</button>
</div>
</div>
</body>
...@@ -1936,16 +1936,32 @@ void AXObject::GetRelativeBounds(AXObject** out_container, ...@@ -1936,16 +1936,32 @@ void AXObject::GetRelativeBounds(AXObject** out_container,
// layer. // layer.
AXObject* container = ParentObjectUnignored(); AXObject* container = ParentObjectUnignored();
LayoutObject* container_layout_object = nullptr; LayoutObject* container_layout_object = nullptr;
while (container) { if (layout_object->IsFixedPositioned()) {
container_layout_object = container->GetLayoutObject(); // If it's a fixed position element, the container should simply be the
if (container_layout_object && container_layout_object->IsBox() && // root web area.
layout_object->IsDescendantOf(container_layout_object)) { container = AXObjectCache().GetOrCreate(GetDocument());
if (container->IsScrollableContainer() || } else {
container_layout_object->HasLayer()) while (container) {
break; container_layout_object = container->GetLayoutObject();
} if (container_layout_object && container_layout_object->IsBox() &&
layout_object->IsDescendantOf(container_layout_object)) {
if (container->IsScrollableContainer() ||
container_layout_object->HasLayer()) {
if (layout_object->IsAbsolutePositioned()) {
// If it's absolutely positioned, the container must be the
// nearest positioned container, or the root.
if (container->IsWebArea())
break;
if (container_layout_object->IsPositioned())
break;
} else {
break;
}
}
}
container = container->ParentObjectUnignored(); container = container->ParentObjectUnignored();
}
} }
if (!container) if (!container)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment