Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: Source/core/editing/PositionIterator.cpp

Issue 1300823002: Introduce PositionAlgorithm<Strategy>::editingPositionOf() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T17:38:11 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/editing/Position.cpp ('k') | Source/core/editing/RenderedPosition.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 { 54 {
55 if (m_nodeAfterPositionInAnchor) { 55 if (m_nodeAfterPositionInAnchor) {
56 ASSERT(Strategy::parent(*m_nodeAfterPositionInAnchor) == m_anchorNode); 56 ASSERT(Strategy::parent(*m_nodeAfterPositionInAnchor) == m_anchorNode);
57 // FIXME: This check is inadaquete because any ancestor could be ignored by editing 57 // FIXME: This check is inadaquete because any ancestor could be ignored by editing
58 if (Strategy::editingIgnoresContent(Strategy::parent(*m_nodeAfterPositio nInAnchor))) 58 if (Strategy::editingIgnoresContent(Strategy::parent(*m_nodeAfterPositio nInAnchor)))
59 return PositionAlgorithm<Strategy>::beforeNode(m_anchorNode); 59 return PositionAlgorithm<Strategy>::beforeNode(m_anchorNode);
60 return PositionAlgorithm<Strategy>::inParentBeforeNode(*m_nodeAfterPosit ionInAnchor); 60 return PositionAlgorithm<Strategy>::inParentBeforeNode(*m_nodeAfterPosit ionInAnchor);
61 } 61 }
62 if (Strategy::hasChildren(*m_anchorNode)) 62 if (Strategy::hasChildren(*m_anchorNode))
63 return PositionAlgorithm<Strategy>::lastPositionInOrAfterNode(m_anchorNo de); 63 return PositionAlgorithm<Strategy>::lastPositionInOrAfterNode(m_anchorNo de);
64 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(m_anchorNode , m_offsetInAnchor); 64 return PositionAlgorithm<Strategy>::editingPositionOf(m_anchorNode, m_offset InAnchor);
65 } 65 }
66 66
67 template <typename Strategy> 67 template <typename Strategy>
68 PositionAlgorithm<Strategy> PositionIteratorAlgorithm<Strategy>::computePosition () const 68 PositionAlgorithm<Strategy> PositionIteratorAlgorithm<Strategy>::computePosition () const
69 { 69 {
70 if (m_nodeAfterPositionInAnchor) { 70 if (m_nodeAfterPositionInAnchor) {
71 ASSERT(Strategy::parent(*m_nodeAfterPositionInAnchor) == m_anchorNode); 71 ASSERT(Strategy::parent(*m_nodeAfterPositionInAnchor) == m_anchorNode);
72 return PositionAlgorithm<Strategy>::inParentBeforeNode(*m_nodeAfterPosit ionInAnchor); 72 return PositionAlgorithm<Strategy>::inParentBeforeNode(*m_nodeAfterPosit ionInAnchor);
73 } 73 }
74 if (Strategy::hasChildren(*m_anchorNode)) 74 if (Strategy::hasChildren(*m_anchorNode))
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return true; 172 return true;
173 if (m_nodeAfterPositionInAnchor) 173 if (m_nodeAfterPositionInAnchor)
174 return false; 174 return false;
175 return Strategy::hasChildren(*m_anchorNode) || m_offsetInAnchor >= Strategy: :lastOffsetForEditing(m_anchorNode); 175 return Strategy::hasChildren(*m_anchorNode) || m_offsetInAnchor >= Strategy: :lastOffsetForEditing(m_anchorNode);
176 } 176 }
177 177
178 template class PositionIteratorAlgorithm<EditingStrategy>; 178 template class PositionIteratorAlgorithm<EditingStrategy>;
179 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>; 179 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>;
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/Position.cpp ('k') | Source/core/editing/RenderedPosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698