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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (!m_anchorNode) | 70 if (!m_anchorNode) |
71 return; | 71 return; |
72 | 72 |
73 if (m_nodeAfterPositionInAnchor) { | 73 if (m_nodeAfterPositionInAnchor) { |
74 m_anchorNode = m_nodeAfterPositionInAnchor; | 74 m_anchorNode = m_nodeAfterPositionInAnchor; |
75 m_nodeAfterPositionInAnchor = Strategy::firstChild(*m_anchorNode); | 75 m_nodeAfterPositionInAnchor = Strategy::firstChild(*m_anchorNode); |
76 m_offsetInAnchor = 0; | 76 m_offsetInAnchor = 0; |
77 return; | 77 return; |
78 } | 78 } |
79 | 79 |
80 if (!Strategy::hasChildren(*m_anchorNode) && m_offsetInAnchor < Strategy::la
stOffsetForEditing(m_anchorNode)) { | 80 if (m_anchorNode->layoutObject() && !Strategy::hasChildren(*m_anchorNode) &&
m_offsetInAnchor < Strategy::lastOffsetForEditing(m_anchorNode)) { |
81 m_offsetInAnchor = PositionType::uncheckedNextOffset(m_anchorNode, m_off
setInAnchor); | 81 m_offsetInAnchor = PositionType::uncheckedNextOffset(m_anchorNode, m_off
setInAnchor); |
82 } else { | 82 } else { |
83 m_nodeAfterPositionInAnchor = m_anchorNode; | 83 m_nodeAfterPositionInAnchor = m_anchorNode; |
84 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor); | 84 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor); |
85 m_nodeAfterPositionInAnchor = Strategy::nextSibling(*m_nodeAfterPosition
InAnchor); | 85 m_nodeAfterPositionInAnchor = Strategy::nextSibling(*m_nodeAfterPosition
InAnchor); |
86 m_offsetInAnchor = 0; | 86 m_offsetInAnchor = 0; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 template <typename Strategy> | 90 template <typename Strategy> |
(...skipping 12 matching lines...) Expand all Loading... |
103 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor); | 103 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor); |
104 m_offsetInAnchor = 0; | 104 m_offsetInAnchor = 0; |
105 } | 105 } |
106 return; | 106 return; |
107 } | 107 } |
108 | 108 |
109 if (Strategy::hasChildren(*m_anchorNode)) { | 109 if (Strategy::hasChildren(*m_anchorNode)) { |
110 m_anchorNode = Strategy::lastChild(*m_anchorNode); | 110 m_anchorNode = Strategy::lastChild(*m_anchorNode); |
111 m_offsetInAnchor = Strategy::hasChildren(*m_anchorNode)? 0 : Strategy::l
astOffsetForEditing(m_anchorNode); | 111 m_offsetInAnchor = Strategy::hasChildren(*m_anchorNode)? 0 : Strategy::l
astOffsetForEditing(m_anchorNode); |
112 } else { | 112 } else { |
113 if (m_offsetInAnchor) { | 113 if (m_offsetInAnchor && m_anchorNode->layoutObject()) { |
114 m_offsetInAnchor = PositionType::uncheckedPreviousOffset(m_anchorNod
e, m_offsetInAnchor); | 114 m_offsetInAnchor = PositionType::uncheckedPreviousOffset(m_anchorNod
e, m_offsetInAnchor); |
115 } else { | 115 } else { |
116 m_nodeAfterPositionInAnchor = m_anchorNode; | 116 m_nodeAfterPositionInAnchor = m_anchorNode; |
117 m_anchorNode = Strategy::parent(*m_anchorNode); | 117 m_anchorNode = Strategy::parent(*m_anchorNode); |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 template <typename Strategy> | 122 template <typename Strategy> |
123 bool PositionIteratorAlgorithm<Strategy>::atStart() const | 123 bool PositionIteratorAlgorithm<Strategy>::atStart() const |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 return false; | 208 return false; |
209 } | 209 } |
210 | 210 |
211 template class PositionIteratorAlgorithm<EditingStrategy>; | 211 template class PositionIteratorAlgorithm<EditingStrategy>; |
212 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>; | 212 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>; |
213 | 213 |
214 } // namespace blink | 214 } // namespace blink |
OLD | NEW |