| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 if (!pos.node()) | 1690 if (!pos.node()) |
| 1691 return true; | 1691 return true; |
| 1692 | 1692 |
| 1693 if (isAtomicNode(pos.node())) | 1693 if (isAtomicNode(pos.node())) |
| 1694 return true; | 1694 return true; |
| 1695 | 1695 |
| 1696 return pos.atStartOfNode(); | 1696 return pos.atStartOfNode(); |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 template <typename Strategy> | 1699 template <typename Strategy> |
| 1700 static PositionAlgorithm<Strategy> mostForwardCaretPosition(const PositionAlgori
thm<Strategy>& position, EditingBoundaryCrossingRule rule) | 1700 static PositionAlgorithm<Strategy> mostBackwardCaretPosition(const PositionAlgor
ithm<Strategy>& position, EditingBoundaryCrossingRule rule) |
| 1701 { | 1701 { |
| 1702 TRACE_EVENT0("blink", "Position::upstream"); | 1702 TRACE_EVENT0("blink", "Position::upstream"); |
| 1703 | 1703 |
| 1704 Node* startNode = position.anchorNode(); | 1704 Node* startNode = position.anchorNode(); |
| 1705 if (!startNode) | 1705 if (!startNode) |
| 1706 return PositionAlgorithm<Strategy>(); | 1706 return PositionAlgorithm<Strategy>(); |
| 1707 | 1707 |
| 1708 // iterate backward from there, looking for a qualified position | 1708 // iterate backward from there, looking for a qualified position |
| 1709 Node* boundary = enclosingVisualBoundary<Strategy>(startNode); | 1709 Node* boundary = enclosingVisualBoundary<Strategy>(startNode); |
| 1710 // FIXME: PositionIterator should respect Before and After positions. | 1710 // FIXME: PositionIterator should respect Before and After positions. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 if (continuesOnNextLine) | 1808 if (continuesOnNextLine) |
| 1809 return currentPos.computePosition(); | 1809 return currentPos.computePosition(); |
| 1810 } | 1810 } |
| 1811 } | 1811 } |
| 1812 } | 1812 } |
| 1813 return lastVisible.deprecatedComputePosition(); | 1813 return lastVisible.deprecatedComputePosition(); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 Position mostForwardCaretPosition(const Position& position, EditingBoundaryCross
ingRule rule) | 1816 Position mostBackwardCaretPosition(const Position& position, EditingBoundaryCros
singRule rule) |
| 1817 { | 1817 { |
| 1818 return mostForwardCaretPosition<EditingStrategy>(position, rule); | 1818 return mostBackwardCaretPosition<EditingStrategy>(position, rule); |
| 1819 } | 1819 } |
| 1820 | 1820 |
| 1821 PositionInComposedTree mostForwardCaretPosition(const PositionInComposedTree& po
sition, EditingBoundaryCrossingRule rule) | 1821 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) |
| 1822 { | 1822 { |
| 1823 return mostForwardCaretPosition<EditingInComposedTreeStrategy>(position, rul
e); | 1823 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 template <typename Strategy> | 1826 template <typename Strategy> |
| 1827 PositionAlgorithm<Strategy> mostBackwardCaretPosition(const PositionAlgorithm<St
rategy>& position, EditingBoundaryCrossingRule rule) | 1827 PositionAlgorithm<Strategy> mostForwardCaretPosition(const PositionAlgorithm<Str
ategy>& position, EditingBoundaryCrossingRule rule) |
| 1828 { | 1828 { |
| 1829 TRACE_EVENT0("blink", "Position::downstream"); | 1829 TRACE_EVENT0("blink", "Position::downstream"); |
| 1830 | 1830 |
| 1831 Node* startNode = position.anchorNode(); | 1831 Node* startNode = position.anchorNode(); |
| 1832 if (!startNode) | 1832 if (!startNode) |
| 1833 return PositionAlgorithm<Strategy>(); | 1833 return PositionAlgorithm<Strategy>(); |
| 1834 | 1834 |
| 1835 // iterate forward from there, looking for a qualified position | 1835 // iterate forward from there, looking for a qualified position |
| 1836 Node* boundary = enclosingVisualBoundary<Strategy>(startNode); | 1836 Node* boundary = enclosingVisualBoundary<Strategy>(startNode); |
| 1837 // FIXME: PositionIterator should respect Before and After positions. | 1837 // FIXME: PositionIterator should respect Before and After positions. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 | 1935 |
| 1936 if (continuesOnNextLine) | 1936 if (continuesOnNextLine) |
| 1937 return currentPos.computePosition(); | 1937 return currentPos.computePosition(); |
| 1938 } | 1938 } |
| 1939 } | 1939 } |
| 1940 } | 1940 } |
| 1941 | 1941 |
| 1942 return lastVisible.deprecatedComputePosition(); | 1942 return lastVisible.deprecatedComputePosition(); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 Position mostBackwardCaretPosition(const Position& position, EditingBoundaryCros
singRule rule) | 1945 Position mostForwardCaretPosition(const Position& position, EditingBoundaryCross
ingRule rule) |
| 1946 { | 1946 { |
| 1947 return mostBackwardCaretPosition<EditingStrategy>(position, rule); | 1947 return mostForwardCaretPosition<EditingStrategy>(position, rule); |
| 1948 } | 1948 } |
| 1949 | 1949 |
| 1950 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) | 1950 PositionInComposedTree mostForwardCaretPosition(const PositionInComposedTree& po
sition, EditingBoundaryCrossingRule rule) |
| 1951 { | 1951 { |
| 1952 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); | 1952 return mostForwardCaretPosition<EditingInComposedTreeStrategy>(position, rul
e); |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 } | 1955 } |
| OLD | NEW |