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

Issue 2956053005: Keep track of fixed positioning in accessibility tree.

Created:
3 years, 5 months ago by dmazzoni
Modified:
3 years, 5 months ago
CC:
chromium-reviews, dougt+watch_chromium.org, dmazzoni+watch_chromium.org, extensions-reviews_chromium.org, aboxhall, aboxhall+watch_chromium.org, jam, dglazkov+blink, je_julie, darin-cc_chromium.org, blink-reviews, chromium-apps-reviews_chromium.org, blink-reviews-api_chromium.org, mlamouri+watch-content_chromium.org, Peter Beverloo, yuzo+watch_chromium.org, aleventhal+watch_chromium.org, haraken, jochen+watch_chromium.org, nektar+watch_chromium.org, nektarios, dtseng+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Keep track of fixed positioning in accessibility tree. For efficiency, the accessibility tree keeps track of the relative coordinates of nodes. That makes things like scrolling and other layer transformations more efficient; only the container needs to be updated, and all of the coordinates of objects within that container will be updated on-the-fly. We weren't handling fixed-positioned elements correctly, though. Fixed-positioned elements don't move when the root element scrolls, so there's no way they could be properly encoded. Fix this by explicitly identifying fixed-positioned elements. The algorithm change is really simple - fixed-positioned elements ignore scroll offsets of their containers. That's it. Everything else just works. This bug wasn't caught for a while because it only manifests when layout doesn't change. Any time there's a layout, existing code detects the new location of the fixed-positioned element and updates it. So the only case that was broken was when you scroll a page and then navigate assistive technology to a fixed-position element without triggering layout first. Note that it's not really appropriate to unit-test within Blink because the Blink functions were essentially returning correct coordinates; the bug was due to the fact that when the page scrolled, the previously computed relative coordinates of the fixed-positioned element are now wrong. So this change is covered by a browser test only, plus by dozens of other existing tests that this patch doesn't break. BUG=732346

Patch Set 1 #

Total comments: 4

Patch Set 2 : GetSimpleRelativeBounds, add failing test for fixed with transform #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -78 lines) Patch
M chrome/common/extensions/chrome_extension_messages.h View 1 2 chunks +1 line, -1 line 0 comments Download
M chrome/renderer/extensions/automation_internal_custom_bindings.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/accessibility/browser_accessibility_manager.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/accessibility/dump_accessibility_tree_browsertest.cc View 1 1 chunk +10 lines, -0 lines 0 comments Download
M content/common/accessibility_messages.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/common/common_param_traits_macros.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/accessibility/blink_ax_tree_source.cc View 1 chunk +3 lines, -1 line 0 comments Download
M content/renderer/accessibility/render_accessibility_impl.cc View 1 2 chunks +4 lines, -1 line 0 comments Download
M content/shell/test_runner/web_ax_object_proxy.cc View 7 chunks +25 lines, -10 lines 0 comments Download
A content/test/data/accessibility/css/fixed-transformed-with-scrolling.html View 1 1 chunk +47 lines, -0 lines 0 comments Download
A content/test/data/accessibility/css/fixed-transformed-with-scrolling-expected-blink.txt View 1 1 chunk +9 lines, -0 lines 0 comments Download
A content/test/data/accessibility/css/fixed-with-scrolling.html View 1 chunk +46 lines, -0 lines 0 comments Download
A content/test/data/accessibility/css/fixed-with-scrolling-expected-blink.txt View 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXImageMapLink.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXImageMapLink.cpp View 1 2 chunks +5 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp View 1 2 chunks +4 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXMenuListOption.h View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXMenuListOption.cpp View 2 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXNodeObject.h View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp View 1 3 chunks +10 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXObject.h View 1 2 chunks +13 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXObject.cpp View 1 5 chunks +22 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXSpinButton.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/accessibility/AXSpinButton.cpp View 1 2 chunks +7 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/modules/exported/WebAXObject.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/public/web/WebAXObject.h View 1 chunk +2 lines, -1 line 0 comments Download
M ui/accessibility/ax_node.h View 1 chunk +2 lines, -1 line 0 comments Download
M ui/accessibility/ax_node.cc View 1 chunk +3 lines, -1 line 0 comments Download
M ui/accessibility/ax_node_data.h View 1 2 chunks +4 lines, -1 line 0 comments Download
M ui/accessibility/ax_node_data.cc View 1 4 chunks +7 lines, -1 line 0 comments Download
M ui/accessibility/ax_relative_bounds.h View 3 chunks +12 lines, -2 lines 0 comments Download
M ui/accessibility/ax_relative_bounds.cc View 5 chunks +8 lines, -2 lines 0 comments Download
M ui/accessibility/ax_tree.cc View 1 1 chunk +9 lines, -6 lines 0 comments Download

Messages

Total messages: 22 (12 generated)
dmazzoni
3 years, 5 months ago (2017-06-28 19:12:06 UTC) #4
aboxhall
https://codereview.chromium.org/2956053005/diff/1/content/browser/accessibility/accessibility_tree_formatter_blink.cc File content/browser/accessibility/accessibility_tree_formatter_blink.cc (right): https://codereview.chromium.org/2956053005/diff/1/content/browser/accessibility/accessibility_tree_formatter_blink.cc#newcode63 content/browser/accessibility/accessibility_tree_formatter_blink.cc:63: LOG(ERROR) << page_bounds.y() << " page bounds for " ...
3 years, 5 months ago (2017-06-30 06:07:41 UTC) #7
aleventhal
> Fixed-positioned elements don't move when the root element scrolls Unfortunately this is only true ...
3 years, 5 months ago (2017-07-05 13:09:58 UTC) #8
dmazzoni
https://codereview.chromium.org/2956053005/diff/1/content/browser/accessibility/accessibility_tree_formatter_blink.cc File content/browser/accessibility/accessibility_tree_formatter_blink.cc (right): https://codereview.chromium.org/2956053005/diff/1/content/browser/accessibility/accessibility_tree_formatter_blink.cc#newcode63 content/browser/accessibility/accessibility_tree_formatter_blink.cc:63: LOG(ERROR) << page_bounds.y() << " page bounds for " ...
3 years, 5 months ago (2017-07-06 07:20:22 UTC) #9
dmazzoni
On 2017/07/05 13:09:58, aleventhal wrote: > > Fixed-positioned elements don't move when the root element ...
3 years, 5 months ago (2017-07-06 07:20:40 UTC) #10
dmazzoni
Actually adding ikilpatrick - see above comment, thanks!
3 years, 5 months ago (2017-07-06 07:21:06 UTC) #14
ikilpatrick
+flackr who knows a bunch more than me around fixed/sticky.
3 years, 5 months ago (2017-07-06 22:16:32 UTC) #19
flackr
On 2017/07/06 07:20:40, dmazzoni wrote: > On 2017/07/05 13:09:58, aleventhal wrote: > > > Fixed-positioned ...
3 years, 5 months ago (2017-07-07 14:52:43 UTC) #20
dmazzoni
On 2017/07/07 14:52:43, flackr wrote: > PaintLayer::fixedToViewport will tell you whether the fixed position element ...
3 years, 5 months ago (2017-07-07 15:18:49 UTC) #21
flackr
3 years, 5 months ago (2017-07-07 17:31:42 UTC) #22
On 2017/07/07 15:18:49, dmazzoni wrote:
> On 2017/07/07 14:52:43, flackr wrote:
> > PaintLayer::fixedToViewport will tell you whether the fixed position element
> is
> > actually contained by the viewport (and hence doesn't move with scroll). In
> the
> > general case though you need to find it's container to know which scroller
it
> > moves with (if there are nested scrollers). Also, it seems like you'll have
> the
> > same issue with position sticky, except that for sticky it sometimes moves
> with
> > scroll and sometimes doesn't. It seems really unfortunate that you have to
> > reproduce this positioning logic outside of blink. Can you perhaps record
the
> > items which have special scroll movement behavior and ask blink for their
> > position after scroll?
> 
> Thanks for the info and the alternative idea! I was actually having basically
> the same thought ever since Ian pointed out that "sticky" would be an
> issue too, it'd be simpler to just keep track of elements with
> special scroll movement behavior and update all of them any time
> there's a scroll event. We could try to be more efficient than that, but as
> long as the total number of such elements is typically small there's no need
> to be overly clever.
> 
> Are LayoutObject::IsStickyPositioned() and LayoutObject::IsFixedPositioned()
> sufficient to cover the elements that have special scroll behavior?

Yes, although if you're looking at the scroller on the containing block chain it
may be more efficient to use PaintLayer::SticksToScroller /
PaintLayer::FixedToViewport, or even more efficient just to use blink's lists
which keep track of these. i.e. the combination of
LocalFrameView::ViewportConstrainedObjects() and on each overflow scroller,
PaintLayerScrollableArea::GetStickyConstraintsMap() will give you all of the
sticky / fixed position objects which have "special" movement for that view or
scroller.

The issue with fixed made me wonder - are you respecting the containing block
rules for position? Absolute position will not move with scroll when its
containing block is above the scroller (e.g. the red box in
http://jsbin.com/mujayikogu/edit?html,css,output is nested in the inner scroller
but does not move with it because it's contained outside of it and the red box
in http://jsbin.com/wanokib/1/edit?html,css,output only moves with the body
scroll).

Powered by Google App Engine
This is Rietveld 408576698