OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return node; | 538 return node; |
539 } | 539 } |
540 return 0; | 540 return 0; |
541 } | 541 } |
542 | 542 |
543 static Node* nextNodeWithGreaterTabIndex(Node* start, int tabIndex) | 543 static Node* nextNodeWithGreaterTabIndex(Node* start, int tabIndex) |
544 { | 544 { |
545 // Search is inclusive of start | 545 // Search is inclusive of start |
546 int winningTabIndex = std::numeric_limits<short>::max() + 1; | 546 int winningTabIndex = std::numeric_limits<short>::max() + 1; |
547 Node* winner = 0; | 547 Node* winner = 0; |
548 for (Node& node : NodeTraversal::from(start)) { | 548 for (Node& node : NodeTraversal::startsAt(start)) { |
549 if (shouldVisit(&node) && node.tabIndex() > tabIndex && node.tabIndex()
< winningTabIndex) { | 549 if (shouldVisit(&node) && node.tabIndex() > tabIndex && node.tabIndex()
< winningTabIndex) { |
550 winner = &node; | 550 winner = &node; |
551 winningTabIndex = node.tabIndex(); | 551 winningTabIndex = node.tabIndex(); |
552 } | 552 } |
553 } | 553 } |
554 | 554 |
555 return winner; | 555 return winner; |
556 } | 556 } |
557 | 557 |
558 static Node* previousNodeWithLowerTabIndex(Node* start, int tabIndex) | 558 static Node* previousNodeWithLowerTabIndex(Node* start, int tabIndex) |
(...skipping 10 matching lines...) Expand all Loading... |
569 } | 569 } |
570 return winner; | 570 return winner; |
571 } | 571 } |
572 | 572 |
573 Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start
) | 573 Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start
) |
574 { | 574 { |
575 if (start) { | 575 if (start) { |
576 int tabIndex = adjustedTabIndex(start); | 576 int tabIndex = adjustedTabIndex(start); |
577 // If a node is excluded from the normal tabbing cycle, the next focusab
le node is determined by tree order | 577 // If a node is excluded from the normal tabbing cycle, the next focusab
le node is determined by tree order |
578 if (tabIndex < 0) { | 578 if (tabIndex < 0) { |
579 for (Node& node : NodeTraversal::fromNext(*start)) { | 579 for (Node& node : NodeTraversal::startsAfter(*start)) { |
580 if (shouldVisit(&node) && adjustedTabIndex(&node) >= 0) | 580 if (shouldVisit(&node) && adjustedTabIndex(&node) >= 0) |
581 return &node; | 581 return &node; |
582 } | 582 } |
583 } else { | 583 } else { |
584 // First try to find a node with the same tabindex as start that com
es after start in the scope. | 584 // First try to find a node with the same tabindex as start that com
es after start in the scope. |
585 if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*st
art), tabIndex, FocusTypeForward)) | 585 if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*st
art), tabIndex, FocusTypeForward)) |
586 return winner; | 586 return winner; |
587 } | 587 } |
588 if (!tabIndex) | 588 if (!tabIndex) |
589 // We've reached the last node in the document with a tabindex of 0.
This is the end of the tabbing order. | 589 // We've reached the last node in the document with a tabindex of 0.
This is the end of the tabbing order. |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 return consumed; | 926 return consumed; |
927 } | 927 } |
928 | 928 |
929 void FocusController::trace(Visitor* visitor) | 929 void FocusController::trace(Visitor* visitor) |
930 { | 930 { |
931 visitor->trace(m_page); | 931 visitor->trace(m_page); |
932 visitor->trace(m_focusedFrame); | 932 visitor->trace(m_focusedFrame); |
933 } | 933 } |
934 | 934 |
935 } // namespace blink | 935 } // namespace blink |
OLD | NEW |