Changeset 139325 in webkit


Ignore:
Timestamp:
Jan 10, 2013 9:44:05 AM (11 years ago)
Author:
morrita@google.com
Message:

ComposedShadowTreeWalker shouldn't be exposed to non-ShadowDOM classes
https://bugs.webkit.org/show_bug.cgi?id=106505

Reviewed by Dimitri Glazkov.

This change hides ComposedShadowTreeWalker from non-ShadowDOM classes by

  • introducing thin wrapper functions on NodeRenderingTraversal and relacing CSTW callsites with it,
  • replacing ComposedShadowTreeWalker usage with AncestorChainWalker if possible and
  • moving AncestorChainWalker to its own file and including it on files which needs only AncestorChainWalker. This eliminates ComposedShadowTreeWalker.h inclusions.

No new tests. No behavior change.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/AncestorChainWalker.cpp: Added. Extracted from ComposedShadowTreeWalker.cpp

(WebCore):
(WebCore::AncestorChainWalker::AncestorChainWalker):
(WebCore::AncestorChainWalker::parent):

  • dom/AncestorChainWalker.h: Added. Extracted from ComposedShadowTreeWalker.h

(WebCore):
(AncestorChainWalker):
(WebCore::AncestorChainWalker::get):
(WebCore::AncestorChainWalker::crossingInsertionPoint):

  • dom/ComposedShadowTreeWalker.cpp:
  • dom/ComposedShadowTreeWalker.h:
  • dom/DOMAllInOne.cpp:
  • dom/ElementShadow.h:

(WebCore::shadowOfParent):
(WebCore):

  • dom/EventDispatcher.cpp:
  • dom/Node.cpp:
  • dom/NodeRenderingTraversal.cpp:

(WebCore::NodeRenderingTraversal::nextInScope):
(NodeRenderingTraversal):
(WebCore::NodeRenderingTraversal::previousInScope): Added.
(WebCore::NodeRenderingTraversal::parentInScope): Added.
(WebCore::NodeRenderingTraversal::lastChildInScope): Added.

  • dom/NodeRenderingTraversal.h:

(NodeRenderingTraversal):

  • dom/TreeScope.cpp:
  • html/HTMLLIElement.cpp:

(WebCore::HTMLLIElement::attach):

  • page/EventHandler.cpp:
  • page/FocusController.cpp: Replacing CSTW with NRT

(WebCore):
(WebCore::FocusNavigationScope::focusNavigationScopeOf):
(WebCore::FocusController::findNodeWithExactTabIndex):
(WebCore::nextNodeWithGreaterTabIndex):
(WebCore::previousNodeWithLowerTabIndex):
(WebCore::FocusController::nextFocusableNode):
(WebCore::FocusController::previousFocusableNode):

Location:
trunk/Source/WebCore
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r139289 r139325  
    11101110
    11111111    dom/ActiveDOMObject.cpp
     1112    dom/AncestorChainWalker.cpp
    11121113    dom/Attr.cpp
    11131114    dom/BeforeTextInsertedEvent.cpp
  • trunk/Source/WebCore/ChangeLog

    r139324 r139325  
     12013-01-10  Hajime Morrita  <morrita@google.com>
     2
     3        ComposedShadowTreeWalker shouldn't be exposed to non-ShadowDOM classes
     4        https://bugs.webkit.org/show_bug.cgi?id=106505
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        This change hides ComposedShadowTreeWalker from non-ShadowDOM classes by
     9
     10        - introducing thin wrapper functions on NodeRenderingTraversal and relacing
     11          CSTW callsites with it,
     12        - replacing ComposedShadowTreeWalker usage with AncestorChainWalker if possible and
     13        - moving AncestorChainWalker to its own file and including it on files
     14          which needs only AncestorChainWalker. This eliminates ComposedShadowTreeWalker.h inclusions.
     15
     16        No new tests. No behavior change.
     17
     18        * CMakeLists.txt:
     19        * GNUmakefile.list.am:
     20        * Target.pri:
     21        * WebCore.gypi:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * dom/AncestorChainWalker.cpp: Added. Extracted from ComposedShadowTreeWalker.cpp
     24        (WebCore):
     25        (WebCore::AncestorChainWalker::AncestorChainWalker):
     26        (WebCore::AncestorChainWalker::parent):
     27        * dom/AncestorChainWalker.h: Added. Extracted from ComposedShadowTreeWalker.h
     28        (WebCore):
     29        (AncestorChainWalker):
     30        (WebCore::AncestorChainWalker::get):
     31        (WebCore::AncestorChainWalker::crossingInsertionPoint):
     32        * dom/ComposedShadowTreeWalker.cpp:
     33        * dom/ComposedShadowTreeWalker.h:
     34        * dom/DOMAllInOne.cpp:
     35        * dom/ElementShadow.h:
     36        (WebCore::shadowOfParent):
     37        (WebCore):
     38        * dom/EventDispatcher.cpp:
     39        * dom/Node.cpp:
     40        * dom/NodeRenderingTraversal.cpp:
     41        (WebCore::NodeRenderingTraversal::nextInScope):
     42        (NodeRenderingTraversal):
     43        (WebCore::NodeRenderingTraversal::previousInScope): Added.
     44        (WebCore::NodeRenderingTraversal::parentInScope): Added.
     45        (WebCore::NodeRenderingTraversal::lastChildInScope): Added.
     46        * dom/NodeRenderingTraversal.h:
     47        (NodeRenderingTraversal):
     48        * dom/TreeScope.cpp:
     49        * html/HTMLLIElement.cpp:
     50        (WebCore::HTMLLIElement::attach):
     51        * page/EventHandler.cpp:
     52        * page/FocusController.cpp: Replacing CSTW with NRT
     53        (WebCore):
     54        (WebCore::FocusNavigationScope::focusNavigationScopeOf):
     55        (WebCore::FocusController::findNodeWithExactTabIndex):
     56        (WebCore::nextNodeWithGreaterTabIndex):
     57        (WebCore::previousNodeWithLowerTabIndex):
     58        (WebCore::FocusController::nextFocusableNode):
     59        (WebCore::FocusController::previousFocusableNode):
     60
    1612013-01-10  Zan Dobersek  <zandobersek@gmail.com>
    262
  • trunk/Source/WebCore/GNUmakefile.list.am

    r139289 r139325  
    26972697        Source/WebCore/dom/ActiveDOMObject.cpp \
    26982698        Source/WebCore/dom/ActiveDOMObject.h \
     2699        Source/WebCore/dom/AncestorChainWalker.cpp \
     2700        Source/WebCore/dom/AncestorChainWalker.h \
    26992701        Source/WebCore/dom/Attr.cpp \
    27002702        Source/WebCore/dom/Attr.h \
  • trunk/Source/WebCore/Target.pri

    r139289 r139325  
    336336    css/WebKitCSSViewportRule.cpp \
    337337    dom/ActiveDOMObject.cpp \
     338    dom/AncestorChainWalker.cpp \
    338339    dom/Attr.cpp \
    339340    dom/BeforeTextInsertedEvent.cpp \
     
    15431544    css/WebKitCSSViewportRule.h \
    15441545    dom/ActiveDOMObject.h \
     1546    dom/AncestorChainWalker.h \
    15451547    dom/Attr.h \
    15461548    dom/Attribute.h \
  • trunk/Source/WebCore/WebCore.gypi

    r139289 r139325  
    27052705        'webcore_dom_files': [
    27062706            'dom/ActiveDOMObject.cpp',
     2707            'dom/AncestorChainWalker.cpp',
     2708            'dom/AncestorChainWalker.h',
    27072709            'dom/Attr.cpp',
    27082710            'dom/BeforeLoadEvent.h',
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r139289 r139325  
    39333933                A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A781C6A613828B5D0012A62A /* DocumentMarker.cpp */; };
    39343934                A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; };
     3935                A78CDD2E169E91A1009136F3 /* AncestorChainWalker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75CBE43169E913D0003A60F /* AncestorChainWalker.cpp */; };
     3936                A78CDD30169E91A4009136F3 /* AncestorChainWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = A75CBE44169E913D0003A60F /* AncestorChainWalker.h */; };
    39353937                A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */; };
    39363938                A78E52701346BD1700AD9C31 /* MeterShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A78E526E1346BD1700AD9C31 /* MeterShadowElement.h */; };
     
    1128411286                A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedRect.h; sourceTree = "<group>"; };
    1128511287                A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodePlaceholder.h; sourceTree = "<group>"; };
     11288                A75CBE43169E913D0003A60F /* AncestorChainWalker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AncestorChainWalker.cpp; sourceTree = "<group>"; };
     11289                A75CBE44169E913D0003A60F /* AncestorChainWalker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AncestorChainWalker.h; sourceTree = "<group>"; };
    1128611290                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
    1128711291                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; };
     
    2199121995                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
    2199221996                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
     21997                                A75CBE43169E913D0003A60F /* AncestorChainWalker.cpp */,
     21998                                A75CBE44169E913D0003A60F /* AncestorChainWalker.h */,
    2199321999                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
    2199422000                                A8C4A7FB09D563270003AC8D /* Attr.h */,
     
    2276422770                                CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */,
    2276522771                                FD31603E12B0267600C1A359 /* AnalyserNode.h in Headers */,
     22772                                A78CDD30169E91A4009136F3 /* AncestorChainWalker.h in Headers */,
    2276622773                                490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */,
    2276722774                                49E912AB0EFAC906009D0CAF /* Animation.h in Headers */,
     
    2644526452                                CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
    2644626453                                FD31603D12B0267600C1A359 /* AnalyserNode.cpp in Sources */,
     26454                                A78CDD2E169E91A1009136F3 /* AncestorChainWalker.cpp in Sources */,
    2644726455                                490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */,
    2644826456                                49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
  • trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp

    r139128 r139325  
    4646}
    4747
    48 static inline ElementShadow* shadowOfParent(const Node* node)
    49 {
    50     if (!node)
    51         return 0;
    52     if (Node* parent = node->parentNode())
    53         if (parent->isElementNode())
    54             return toElement(parent)->shadow();
    55     return 0;
    56 }
    57 
    5848static inline bool nodeCanBeDistributed(const Node* node)
    5949{
     
    323313}
    324314
    325 AncestorChainWalker::AncestorChainWalker(const Node* node)
    326     : m_node(node)
    327     , m_distributedNode(node)
    328     , m_isCrossingInsertionPoint(false)
    329 {
    330     ASSERT(node);
    331 }
    332 
    333 void AncestorChainWalker::parent()
    334 {
    335     ASSERT(m_node);
    336     ASSERT(m_distributedNode);
    337     if (ElementShadow* shadow = shadowOfParent(m_node)) {
    338         if (InsertionPoint* insertionPoint = shadow->distributor().findInsertionPointFor(m_distributedNode)) {
    339             m_node = insertionPoint;
    340             m_isCrossingInsertionPoint = true;
    341             return;
    342         }
    343     }
    344     if (!m_node->isShadowRoot()) {
    345         m_node = m_node->parentNode();
    346         if (!(m_node && m_node->isShadowRoot() && ScopeContentDistribution::assignedTo(toShadowRoot(m_node))))
    347             m_distributedNode = m_node;
    348         m_isCrossingInsertionPoint = false;
    349         return;
    350     }
    351 
    352     const ShadowRoot* shadowRoot = toShadowRoot(m_node);
    353     if (InsertionPoint* insertionPoint = ScopeContentDistribution::assignedTo(shadowRoot)) {
    354         m_node = insertionPoint;
    355         m_isCrossingInsertionPoint = true;
    356         return;
    357     }
    358     m_node = shadowRoot->host();
    359     m_distributedNode = m_node;
    360     m_isCrossingInsertionPoint = false;
    361 }
    362 
    363315} // namespace
  • trunk/Source/WebCore/dom/ComposedShadowTreeWalker.h

    r137715 r139325  
    142142}
    143143
    144 class AncestorChainWalker {
    145 public:
    146     explicit AncestorChainWalker(const Node*);
    147     void parent();
    148     Node* get() const { return const_cast<Node*>(m_node); }
    149     bool crossingInsertionPoint() { return m_isCrossingInsertionPoint; }
    150 
    151 private:
    152     const Node* m_node;
    153     const Node* m_distributedNode;
    154     bool m_isCrossingInsertionPoint;
    155 };
    156 
    157144} // namespace
    158145
  • trunk/Source/WebCore/dom/DOMAllInOne.cpp

    r138515 r139325  
    2727
    2828#include "ActiveDOMObject.cpp"
     29#include "AncestorChainWalker.cpp"
    2930#include "Attr.cpp"
    3031#include "BeforeTextInsertedEvent.cpp"
  • trunk/Source/WebCore/dom/ElementShadow.h

    r139269 r139325  
    131131};
    132132
     133inline ElementShadow* shadowOfParent(const Node* node)
     134{
     135    if (!node)
     136        return 0;
     137    if (Node* parent = node->parentNode())
     138        if (parent->isElementNode())
     139            return toElement(parent)->shadow();
     140    return 0;
     141}
     142
     143
    133144} // namespace
    134145
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r137680 r139325  
    2727#include "EventDispatcher.h"
    2828
    29 #include "ComposedShadowTreeWalker.h"
     29#include "AncestorChainWalker.h"
    3030#include "ContainerNode.h"
    3131#include "ElementShadow.h"
  • trunk/Source/WebCore/dom/Node.cpp

    r139273 r139325  
    4141#include "ChildNodeList.h"
    4242#include "ClassNodeList.h"
    43 #include "ComposedShadowTreeWalker.h"
    4443#include "ContainerNodeAlgorithms.h"
    4544#include "ContextMenuController.h"
  • trunk/Source/WebCore/dom/NodeRenderingTraversal.cpp

    r138909 r139325  
    9393}
    9494
     95Node* nextInScope(const Node* node)
     96{
     97    // FIXME: ComposedShadowTreeWalker shouldn't be used when !ENABLE(SHADOW_DOM) https://bugs.webkit.org/show_bug.cgi?id=103339
     98    ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
     99    walker.next();
     100    return walker.get();
     101}
     102
     103Node* previousInScope(const Node* node)
     104{
     105    // FIXME: ComposedShadowTreeWalker shouldn't be used when !ENABLE(SHADOW_DOM) https://bugs.webkit.org/show_bug.cgi?id=103339
     106    ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
     107    walker.previous();
     108    return walker.get();
     109}
     110
     111Node* parentInScope(const Node* node)
     112{
     113    // FIXME: ComposedShadowTreeWalker shouldn't be used when !ENABLE(SHADOW_DOM) https://bugs.webkit.org/show_bug.cgi?id=103339
     114    ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
     115    walker.parent();
     116    return walker.get();
     117}
     118
     119Node* lastChildInScope(const Node* node)
     120{
     121    // FIXME: ComposedShadowTreeWalker shouldn't be used when !ENABLE(SHADOW_DOM) https://bugs.webkit.org/show_bug.cgi?id=103339
     122    ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
     123    walker.lastChild();
     124    return walker.get();
     125}
     126
    95127}
    96128
  • trunk/Source/WebCore/dom/NodeRenderingTraversal.h

    r137715 r139325  
    7272Node* previousSiblingSlow(const Node*);
    7373
     74Node* nextInScope(const Node*);
     75Node* previousInScope(const Node*);
     76Node* parentInScope(const Node*);
     77Node* lastChildInScope(const Node*);
    7478
    7579inline ContainerNode* parent(const Node* node, ParentDetails* details)
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r139310 r139325  
    2828#include "TreeScope.h"
    2929
    30 #include "ComposedShadowTreeWalker.h"
     30#include "AncestorChainWalker.h"
    3131#include "ContainerNode.h"
    3232#include "DOMSelection.h"
  • trunk/Source/WebCore/html/HTMLLIElement.cpp

    r135069 r139325  
    2424#include "HTMLLIElement.h"
    2525
     26#include "AncestorChainWalker.h"
    2627#include "Attribute.h"
    2728#include "CSSPropertyNames.h"
    2829#include "CSSValueKeywords.h"
    29 #include "ComposedShadowTreeWalker.h"
    3030#include "HTMLNames.h"
    3131#include "RenderListItem.h"
     
    9797        // Find the enclosing list node.
    9898        Node* listNode = 0;
    99         ComposedShadowTreeWalker walker(this);
     99        AncestorChainWalker walker(this);
    100100        while (!listNode) {
    101101            walker.parent();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r139044 r139325  
    3030
    3131#include "AXObjectCache.h"
     32#include "AncestorChainWalker.h"
    3233#include "AutoscrollController.h"
    3334#include "CachedImage.h"
    3435#include "Chrome.h"
    3536#include "ChromeClient.h"
    36 #include "ComposedShadowTreeWalker.h"
    3737#include "Cursor.h"
    3838#include "CursorList.h"
  • trunk/Source/WebCore/page/FocusController.cpp

    r137406 r139325  
    3030#include "AXObjectCache.h"
    3131#include "Chrome.h"
    32 #include "ComposedShadowTreeWalker.h"
    3332#include "Document.h"
    3433#include "Editor.h"
     
    4948#include "HitTestResult.h"
    5049#include "KeyboardEvent.h"
     50#include "NodeRenderingTraversal.h"
    5151#include "NodeTraversal.h"
    5252#include "Page.h"
     
    6767using namespace std;
    6868
    69 static inline ComposedShadowTreeWalker walkerFrom(const Node* node)
    70 {
    71     return ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
    72 }
    73 
    74 static inline ComposedShadowTreeWalker walkerFromNext(const Node* node)
    75 {
    76     ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
    77     walker.next();
    78     return walker;
    79 }
    80 
    81 static inline ComposedShadowTreeWalker walkerFromPrevious(const Node* node)
    82 {
    83     ComposedShadowTreeWalker walker = ComposedShadowTreeWalker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
    84     walker.previous();
    85     return walker;
    86 }
    87 
    88 static inline Node* nextNode(const Node* node)
    89 {
    90     return walkerFromNext(node).get();
    91 }
    92 
    93 static inline Node* previousNode(const Node* node)
    94 {
    95     return walkerFromPrevious(node).get();
    96 }
    97 
    9869FocusNavigationScope::FocusNavigationScope(TreeScope* treeScope)
    9970    : m_rootTreeScope(treeScope)
     
    12192{
    12293    ASSERT(node);
    123     ComposedShadowTreeWalker walker(node, ComposedShadowTreeWalker::DoNotCrossUpperBoundary);
    12494    Node* root = node;
    125     while (walker.get()) {
    126         root = walker.get();
    127         walker.parent();
    128     }
     95    for (Node* n = node; n; n = NodeRenderingTraversal::parentInScope(n))
     96        root = n;
    12997    // The result is not always a ShadowRoot nor a DocumentNode since
    13098    // a starting node is in an orphaned tree in composed shadow tree.
     
    450418{
    451419    // Search is inclusive of start
    452     for (ComposedShadowTreeWalker walker = walkerFrom(start); walker.get(); direction == FocusDirectionForward ? walker.next() : walker.previous()) {
    453         if (shouldVisit(walker.get(), event) && adjustedTabIndex(walker.get(), event) == tabIndex)
    454             return walker.get();
     420    using namespace NodeRenderingTraversal;
     421    for (Node* node = start; node; node = direction == FocusDirectionForward ? nextInScope(node) : previousInScope(node)) {
     422        if (shouldVisit(node, event) && adjustedTabIndex(node, event) == tabIndex)
     423            return node;
    455424    }
    456425    return 0;
     
    462431    int winningTabIndex = std::numeric_limits<short>::max() + 1;
    463432    Node* winner = 0;
    464     for (ComposedShadowTreeWalker walker = walkerFrom(start); walker.get(); walker.next()) {
    465         Node* node = walker.get();
     433    for (Node* node = start; node; node = NodeRenderingTraversal::nextInScope(node)) {
    466434        if (shouldVisit(node, event) && node->tabIndex() > tabIndex && node->tabIndex() < winningTabIndex) {
    467435            winner = node;
     
    478446    int winningTabIndex = 0;
    479447    Node* winner = 0;
    480     for (ComposedShadowTreeWalker walker = walkerFrom(start); walker.get(); walker.previous()) {
    481         Node* node = walker.get();
     448    for (Node* node = start; node; node = NodeRenderingTraversal::previousInScope(node)) {
    482449        int currentTabIndex = adjustedTabIndex(node, event);
    483450        if ((shouldVisit(node, event) || isNonFocusableShadowHost(node, event)) && currentTabIndex < tabIndex && currentTabIndex > winningTabIndex) {
     
    491458Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start, KeyboardEvent* event)
    492459{
     460    using namespace NodeRenderingTraversal;
     461
    493462    if (start) {
    494463        int tabIndex = adjustedTabIndex(start, event);
    495464        // If a node is excluded from the normal tabbing cycle, the next focusable node is determined by tree order
    496465        if (tabIndex < 0) {
    497             for (ComposedShadowTreeWalker walker = walkerFromNext(start); walker.get(); walker.next()) {
    498                 if (shouldVisit(walker.get(), event) && adjustedTabIndex(walker.get(), event) >= 0)
    499                     return walker.get();
     466            for (Node* node = nextInScope(start); node; node = nextInScope(node)) {
     467                if (shouldVisit(node, event) && adjustedTabIndex(node, event) >= 0)
     468                    return node;
    500469            }
    501470        }
    502471
    503472        // First try to find a node with the same tabindex as start that comes after start in the scope.
    504         if (Node* winner = findNodeWithExactTabIndex(nextNode(start), tabIndex, event, FocusDirectionForward))
     473        if (Node* winner = findNodeWithExactTabIndex(nextInScope(start), tabIndex, event, FocusDirectionForward))
    505474            return winner;
    506475
     
    523492Node* FocusController::previousFocusableNode(FocusNavigationScope scope, Node* start, KeyboardEvent* event)
    524493{
     494    using namespace NodeRenderingTraversal;
     495
    525496    Node* last = 0;
    526     for (ComposedShadowTreeWalker walker = walkerFrom(scope.rootNode()); walker.get(); walker.lastChild())
    527         last = walker.get();
     497    for (Node* node = scope.rootNode(); node; node = lastChildInScope(node))
     498        last = node;
    528499    ASSERT(last);
    529500
     
    533504    int startingTabIndex;
    534505    if (start) {
    535         startingNode = previousNode(start);
     506        startingNode = previousInScope(start);
    536507        startingTabIndex = adjustedTabIndex(start, event);
    537508    } else {
     
    542513    // However, if a node is excluded from the normal tabbing cycle, the previous focusable node is determined by tree order
    543514    if (startingTabIndex < 0) {
    544         for (ComposedShadowTreeWalker walker = walkerFrom(startingNode); walker.get(); walker.previous()) {
    545             if (shouldVisit(walker.get(), event) && adjustedTabIndex(walker.get(), event) >= 0)
    546                 return walker.get();
     515        for (Node* node = startingNode; node; node = previousInScope(node)) {
     516            if (shouldVisit(node, event) && adjustedTabIndex(node, event) >= 0)
     517                return node;
    547518        }
    548519    }
Note: See TracChangeset for help on using the changeset viewer.