The code in http://google.com/codesearch/p?vert=chromium#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/dom/EventDispatcher.cpp&l=133 can be sped up and it's legibility improved if we use treeScopes to determine shadow boundaries.
Until bug 62333 is fixed, this is not feasible.
IIRC, this should be fixed as a part of Bug 78586. Please reopen if incorrect.