Changeset 123407 in webkit


Ignore:
Timestamp:
Jul 23, 2012 5:12:13 PM (12 years ago)
Author:
hayato@chromium.org
Message:

A FocusScope for a distributed node should not be its TreeScope.
https://bugs.webkit.org/show_bug.cgi?id=91829

Reviewed by Dimitri Glazkov.

Source/WebCore:

Current implementation of FocusScope::focusScopeOf(Node*) returns
the given node's treeScope(). That does not apply if the node is
a distributed node. We should calculate a FocusScope for a
distributed node by traversing ancestor nodes in Composed Shadow
Tree.

Test: fast/dom/shadow/focus-navigation-with-distributed-nodes.html

  • page/FocusController.cpp:

(WebCore::FocusScope::focusScopeOf):

LayoutTests:

  • fast/dom/shadow/focus-navigation-with-distributed-nodes-expected.txt: Added.
  • fast/dom/shadow/focus-navigation-with-distributed-nodes.html: Added.
  • fast/dom/shadow/resources/shadow-dom.js:

(shouldNavigateFocus):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123406 r123407  
     12012-07-23  Hayato Ito  <hayato@chromium.org>
     2
     3        A FocusScope for a distributed node should not be its TreeScope.
     4        https://bugs.webkit.org/show_bug.cgi?id=91829
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        * fast/dom/shadow/focus-navigation-with-distributed-nodes-expected.txt: Added.
     9        * fast/dom/shadow/focus-navigation-with-distributed-nodes.html: Added.
     10        * fast/dom/shadow/resources/shadow-dom.js:
     11        (shouldNavigateFocus):
     12
    1132012-07-23  Douglas Stockwell  <dstockwell@google.com>
    214
  • trunk/LayoutTests/fast/dom/shadow/resources/shadow-dom.js

    r120797 r123407  
    125125    }
    126126    fromElement.focus();
     127    if (!isInnermostActiveElement(from)) {
     128        debug('FAIL: Can not be focused: '+ from);
     129        return;
     130    }
    127131    if (direction == 'forward')
    128132        navigateFocusForward();
  • trunk/Source/WebCore/ChangeLog

    r123406 r123407  
     12012-07-23  Hayato Ito  <hayato@chromium.org>
     2
     3        A FocusScope for a distributed node should not be its TreeScope.
     4        https://bugs.webkit.org/show_bug.cgi?id=91829
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Current implementation of FocusScope::focusScopeOf(Node*) returns
     9        the given node's treeScope().  That does not apply if the node is
     10        a distributed node.  We should calculate a FocusScope for a
     11        distributed node by traversing ancestor nodes in Composed Shadow
     12        Tree.
     13
     14        Test: fast/dom/shadow/focus-navigation-with-distributed-nodes.html
     15
     16        * page/FocusController.cpp:
     17        (WebCore::FocusScope::focusScopeOf):
     18
    1192012-07-23  Douglas Stockwell  <dstockwell@google.com>
    220
  • trunk/Source/WebCore/page/FocusController.cpp

    r117723 r123407  
    120120{
    121121    ASSERT(node);
    122     TreeScope* scope = node->treeScope();
    123     if (scope->rootNode()->isShadowRoot())
    124         return FocusScope(toShadowRoot(scope->rootNode())->owner()->youngestShadowRoot());
    125     return FocusScope(scope);
     122    ComposedShadowTreeWalker walker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
     123    Node* root = node;
     124    while (walker.get()) {
     125        root = walker.get();
     126        walker.parent();
     127    }
     128    // The result is not always a ShadowRoot nor a DocumentNode since
     129    // a starting node is in an orphaned tree in composed shadow tree.
     130    return FocusScope(root->treeScope());
    126131}
    127132
Note: See TracChangeset for help on using the changeset viewer.