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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start ) | 572 Node* FocusController::nextFocusableNode(FocusNavigationScope scope, Node* start ) |
573 { | 573 { |
574 if (start) { | 574 if (start) { |
575 int tabIndex = adjustedTabIndex(start); | 575 int tabIndex = adjustedTabIndex(start); |
576 // If a node is excluded from the normal tabbing cycle, the next focusab le node is determined by tree order | 576 // If a node is excluded from the normal tabbing cycle, the next focusab le node is determined by tree order |
577 if (tabIndex < 0) { | 577 if (tabIndex < 0) { |
578 for (Node* node = NodeTraversal::next(*start); node; node = NodeTrav ersal::next(*node)) { | 578 for (Node* node = NodeTraversal::next(*start); node; node = NodeTrav ersal::next(*node)) { |
579 if (shouldVisit(node) && adjustedTabIndex(node) >= 0) | 579 if (shouldVisit(node) && adjustedTabIndex(node) >= 0) |
580 return node; | 580 return node; |
581 } | 581 } |
582 } else { | |
583 // First try to find a node with the same tabindex as start that comes a fter start in the scope. | |
hayato
2014/09/12 06:24:13
Please fix the indent.
yanagawa
2014/09/12 07:09:46
Done.
| |
584 if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*st art), tabIndex, FocusTypeForward)) | |
585 return winner; | |
582 } | 586 } |
583 | |
584 // First try to find a node with the same tabindex as start that comes a fter start in the scope. | |
585 if (Node* winner = findNodeWithExactTabIndex(NodeTraversal::next(*start) , tabIndex, FocusTypeForward)) | |
586 return winner; | |
587 | |
588 if (!tabIndex) | 587 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. | 588 // We've reached the last node in the document with a tabindex of 0. This is the end of the tabbing order. |
590 return 0; | 589 return 0; |
591 } | 590 } |
592 | 591 |
593 // Look for the first node in the scope that: | 592 // Look for the first node in the scope that: |
594 // 1) has the lowest tabindex that is higher than start's tabindex (or 0, if start is null), and | 593 // 1) has the lowest tabindex that is higher than start's tabindex (or 0, if start is null), and |
595 // 2) comes first in the scope, if there's a tie. | 594 // 2) comes first in the scope, if there's a tie. |
596 if (Node* winner = nextNodeWithGreaterTabIndex(scope.rootNode(), start ? adj ustedTabIndex(start) : 0)) | 595 if (Node* winner = nextNodeWithGreaterTabIndex(scope.rootNode(), start ? adj ustedTabIndex(start) : 0)) |
597 return winner; | 596 return winner; |
(...skipping 21 matching lines...) Expand all Loading... | |
619 startingNode = last; | 618 startingNode = last; |
620 startingTabIndex = 0; | 619 startingTabIndex = 0; |
621 } | 620 } |
622 | 621 |
623 // However, if a node is excluded from the normal tabbing cycle, the previou s focusable node is determined by tree order | 622 // However, if a node is excluded from the normal tabbing cycle, the previou s focusable node is determined by tree order |
624 if (startingTabIndex < 0) { | 623 if (startingTabIndex < 0) { |
625 for (Node* node = startingNode; node; node = NodeTraversal::previous(*no de)) { | 624 for (Node* node = startingNode; node; node = NodeTraversal::previous(*no de)) { |
626 if (shouldVisit(node) && adjustedTabIndex(node) >= 0) | 625 if (shouldVisit(node) && adjustedTabIndex(node) >= 0) |
627 return node; | 626 return node; |
628 } | 627 } |
628 } else { | |
629 if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIn dex, FocusTypeBackward)) | |
630 return winner; | |
629 } | 631 } |
630 | 632 |
631 if (Node* winner = findNodeWithExactTabIndex(startingNode, startingTabIndex, FocusTypeBackward)) | |
632 return winner; | |
633 | |
634 // There are no nodes before start with the same tabindex as start, so look for a node that: | 633 // There are no nodes before start with the same tabindex as start, so look for a node that: |
635 // 1) has the highest non-zero tabindex (that is less than start's tabindex) , and | 634 // 1) has the highest non-zero tabindex (that is less than start's tabindex) , and |
636 // 2) comes last in the scope, if there's a tie. | 635 // 2) comes last in the scope, if there's a tie. |
637 startingTabIndex = (start && startingTabIndex) ? startingTabIndex : std::num eric_limits<short>::max(); | 636 startingTabIndex = (start && startingTabIndex) ? startingTabIndex : std::num eric_limits<short>::max(); |
638 return previousNodeWithLowerTabIndex(last, startingTabIndex); | 637 return previousNodeWithLowerTabIndex(last, startingTabIndex); |
639 } | 638 } |
640 | 639 |
641 static bool relinquishesEditingFocus(Node *node) | 640 static bool relinquishesEditingFocus(Node *node) |
642 { | 641 { |
643 ASSERT(node); | 642 ASSERT(node); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); | 918 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); |
920 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); | 919 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); |
921 if (container && container->isDocumentNode()) | 920 if (container && container->isDocumentNode()) |
922 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 921 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
923 } while (!consumed && container); | 922 } while (!consumed && container); |
924 | 923 |
925 return consumed; | 924 return consumed; |
926 } | 925 } |
927 | 926 |
928 } // namespace blink | 927 } // namespace blink |
OLD | NEW |