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

Issue 2737043003: Add support for attribute change callbacks in AXNodeData. (Closed)

Created:
3 years, 9 months ago by dmazzoni
Modified:
3 years, 9 months ago
Reviewers:
aboxhall
CC:
chromium-reviews, aboxhall+watch_chromium.org, nektar+watch_chromium.org, yuzo+watch_chromium.org, je_julie, dmazzoni+watch_chromium.org, dtseng+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add support for attribute change callbacks in AXNodeData. The idea here is that instead of Blink firing events like "name changed", "value changed", or "checked state changed", Blink should be able to just fire a generic notification that a node changed, and then each platform should be able to trigger platform-specific events as needed, based on actual changes to the attributes of an accessibilitiy node. This change just adds support for attribute change callbacks, so it's easy to write code that gets called whenever any particular attribute changes. Quite tedious, but I wanted to make sure this was both comprehensive and exhaustively tested so we can feel confident using it. BUG=699438 Review-Url: https://codereview.chromium.org/2737043003 Cr-Commit-Position: refs/heads/master@{#456425} Committed: https://chromium.googlesource.com/chromium/src/+/3ab5385cf6be9069d26b135647dc2df6e1f33e3f

Patch Set 1 #

Total comments: 2

Patch Set 2 : Yay for template magic #

Total comments: 10

Patch Set 3 : Address feedback, lambda in local var #

Unified diffs Side-by-side diffs Delta from patch set Stats (+421 lines, -3 lines) Patch
M ui/accessibility/ax_tree.h View 2 chunks +37 lines, -0 lines 0 comments Download
M ui/accessibility/ax_tree.cc View 1 2 3 chunks +123 lines, -3 lines 0 comments Download
M ui/accessibility/ax_tree_unittest.cc View 5 chunks +261 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (13 generated)
dmazzoni
3 years, 9 months ago (2017-03-08 07:26:00 UTC) #3
aboxhall
Still going through tests but otherwise looks great, with one possibly infeasible suggestion. https://codereview.chromium.org/2737043003/diff/1/ui/accessibility/ax_tree.cc File ...
3 years, 9 months ago (2017-03-09 00:46:06 UTC) #7
dmazzoni
https://codereview.chromium.org/2737043003/diff/1/ui/accessibility/ax_tree.cc File ui/accessibility/ax_tree.cc (right): https://codereview.chromium.org/2737043003/diff/1/ui/accessibility/ax_tree.cc#newcode338 ui/accessibility/ax_tree.cc:338: delegate_->OnStringAttributeChanged(this, node, old_strings[i].first, On 2017/03/09 00:46:06, aboxhall wrote: > ...
3 years, 9 months ago (2017-03-10 23:40:26 UTC) #10
aboxhall
LGTM with suggestions. https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tree.cc File ui/accessibility/ax_tree.cc (right): https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tree.cc#newcode50 ui/accessibility/ax_tree.cc:50: template <typename K, typename V, typename ...
3 years, 9 months ago (2017-03-13 03:29:30 UTC) #13
dmazzoni
Thanks! https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tree.cc File ui/accessibility/ax_tree.cc (right): https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tree.cc#newcode50 ui/accessibility/ax_tree.cc:50: template <typename K, typename V, typename F> On ...
3 years, 9 months ago (2017-03-13 16:32:37 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2737043003/40001
3 years, 9 months ago (2017-03-13 16:33:33 UTC) #17
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/3ab5385cf6be9069d26b135647dc2df6e1f33e3f
3 years, 9 months ago (2017-03-13 18:07:52 UTC) #20
aboxhall
3 years, 9 months ago (2017-03-13 20:43:22 UTC) #21
Message was sent while issue was closed.
(Still lgtm)

https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tre...
File ui/accessibility/ax_tree.cc (right):

https://codereview.chromium.org/2737043003/diff/20001/ui/accessibility/ax_tre...
ui/accessibility/ax_tree.cc:50: template <typename K, typename V, typename F>
On 2017/03/13 16:32:37, dmazzoni wrote:
> On 2017/03/13 03:29:29, aboxhall wrote:
> > On 2017/03/10 23:40:26, dmazzoni wrote:
> > > The typename F here is the only part I'm not thrilled about.
> > > I couldn't figure out the right signature for F since
> > > because a lamba that captures is not interchangeable with
> > > a function pointer. I could probably use std::function, but
> > > I'm not sure that would compile away.
> > > 
> > > Apparently using <typename F> when you want to pass a
> > > lambda is a pretty common trick - just let the compiler
> > > figure out what the type is.
> > 
> > I had a play with this because I wanted to understand everything going on
> here!
> > 
> > I don't understand what you mean about the lambda "compiling away". Do
lambdas
> > have some kind of "pretend I'm not here" magic?
> 
> No, but presumably the overhead of a lambda is not much
> more than any other function call, whereas std::function is
> a whole object and comes with more overhead.
> 
> > Otherwise, yeah, the typename F is a bit weird but I think it's ok.
> 
> Sounds good

Oh! In that case would base::BindRepeating() have worked? I had a play with that
yesterday. You would have to make some local wrapper functions to get a
consistent type signature, but then you could get rid of the F magic. Not really
a clear win.

Powered by Google App Engine
This is Rietveld 408576698