OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 template <typename Strategy> | 66 template <typename Strategy> |
67 PositionTemplate<Strategy> | 67 PositionTemplate<Strategy> |
68 PositionIteratorAlgorithm<Strategy>::deprecatedComputePosition() const { | 68 PositionIteratorAlgorithm<Strategy>::deprecatedComputePosition() const { |
69 // TODO(yoichio): Share code to check domTreeVersion with EphemeralRange. | 69 // TODO(yoichio): Share code to check domTreeVersion with EphemeralRange. |
70 DCHECK(isValid()); | 70 DCHECK(isValid()); |
71 if (m_nodeAfterPositionInAnchor) { | 71 if (m_nodeAfterPositionInAnchor) { |
72 DCHECK_EQ(Strategy::parent(*m_nodeAfterPositionInAnchor), m_anchorNode); | 72 DCHECK_EQ(Strategy::parent(*m_nodeAfterPositionInAnchor), m_anchorNode); |
73 DCHECK_NE(m_offsetsInAnchorNode[m_depthToAnchorNode], kInvalidOffset); | 73 DCHECK_NE(m_offsetsInAnchorNode[m_depthToAnchorNode], kInvalidOffset); |
74 // FIXME: This check is inadaquete because any ancestor could be ignored by | 74 // FIXME: This check is inadaquete because any ancestor could be ignored by |
75 // editing | 75 // editing |
76 if (Strategy::editingIgnoresContent( | 76 if (editingIgnoresContent(Strategy::parent(*m_nodeAfterPositionInAnchor))) |
77 Strategy::parent(*m_nodeAfterPositionInAnchor))) | |
78 return PositionTemplate<Strategy>::beforeNode(m_anchorNode); | 77 return PositionTemplate<Strategy>::beforeNode(m_anchorNode); |
79 return PositionTemplate<Strategy>( | 78 return PositionTemplate<Strategy>( |
80 m_anchorNode, m_offsetsInAnchorNode[m_depthToAnchorNode]); | 79 m_anchorNode, m_offsetsInAnchorNode[m_depthToAnchorNode]); |
81 } | 80 } |
82 if (Strategy::hasChildren(*m_anchorNode)) | 81 if (Strategy::hasChildren(*m_anchorNode)) |
83 return PositionTemplate<Strategy>::lastPositionInOrAfterNode(m_anchorNode); | 82 return PositionTemplate<Strategy>::lastPositionInOrAfterNode(m_anchorNode); |
84 return PositionTemplate<Strategy>::editingPositionOf(m_anchorNode, | 83 return PositionTemplate<Strategy>::editingPositionOf(m_anchorNode, |
85 m_offsetInAnchor); | 84 m_offsetInAnchor); |
86 } | 85 } |
87 | 86 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 if (m_nodeAfterPositionInAnchor) | 343 if (m_nodeAfterPositionInAnchor) |
345 return false; | 344 return false; |
346 return Strategy::hasChildren(*m_anchorNode) || | 345 return Strategy::hasChildren(*m_anchorNode) || |
347 m_offsetInAnchor >= Strategy::lastOffsetForEditing(m_anchorNode); | 346 m_offsetInAnchor >= Strategy::lastOffsetForEditing(m_anchorNode); |
348 } | 347 } |
349 | 348 |
350 template class PositionIteratorAlgorithm<EditingStrategy>; | 349 template class PositionIteratorAlgorithm<EditingStrategy>; |
351 template class PositionIteratorAlgorithm<EditingInFlatTreeStrategy>; | 350 template class PositionIteratorAlgorithm<EditingInFlatTreeStrategy>; |
352 | 351 |
353 } // namespace blink | 352 } // namespace blink |
OLD | NEW |