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

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

Issue 1864963002: Rename unchecked functions to appropriate name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo /nextGraphmeBoundaryOf/nextGraphemeBoundaryOf/ Created 4 years, 8 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 m_offsetsInAnchorNode[m_depthToAnchorNode] = 0; 151 m_offsetsInAnchorNode[m_depthToAnchorNode] = 0;
152 return; 152 return;
153 } 153 }
154 154
155 if (m_anchorNode->layoutObject() && !Strategy::hasChildren(*m_anchorNode) && m_offsetInAnchor < Strategy::lastOffsetForEditing(m_anchorNode)) { 155 if (m_anchorNode->layoutObject() && !Strategy::hasChildren(*m_anchorNode) && m_offsetInAnchor < Strategy::lastOffsetForEditing(m_anchorNode)) {
156 // Case #2. This is the next of Case #1 or #2 itself. 156 // Case #2. This is the next of Case #1 or #2 itself.
157 // Position is (|anchor|, |m_offsetInAchor|). 157 // Position is (|anchor|, |m_offsetInAchor|).
158 // In this case |anchor| is a leaf(E,F,C,G or H) and 158 // In this case |anchor| is a leaf(E,F,C,G or H) and
159 // |m_offsetInAnchor| is not on the end of |anchor|. 159 // |m_offsetInAnchor| is not on the end of |anchor|.
160 // Then just increment |m_offsetInAnchor|. 160 // Then just increment |m_offsetInAnchor|.
161 m_offsetInAnchor = uncheckedNextOffset(m_anchorNode, m_offsetInAnchor); 161 m_offsetInAnchor = nextGraphemeBoundaryOf(m_anchorNode, m_offsetInAnchor );
162 } else { 162 } else {
163 // Case #3. This is the next of Case #2 or #3. 163 // Case #3. This is the next of Case #2 or #3.
164 // Position is the end of |anchor|. 164 // Position is the end of |anchor|.
165 // 3-a. If |anchor| has next sibling (let E), 165 // 3-a. If |anchor| has next sibling (let E),
166 // next |anchor| is B and |child| is F (next is Case #1.) 166 // next |anchor| is B and |child| is F (next is Case #1.)
167 // 3-b. If |anchor| doesn't have next sibling (let F), 167 // 3-b. If |anchor| doesn't have next sibling (let F),
168 // next |anchor| is B and |child| is null. (next is Case #3.) 168 // next |anchor| is B and |child| is null. (next is Case #3.)
169 m_nodeAfterPositionInAnchor = m_anchorNode; 169 m_nodeAfterPositionInAnchor = m_anchorNode;
170 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor); 170 m_anchorNode = Strategy::parent(*m_nodeAfterPositionInAnchor);
171 if (!m_anchorNode) 171 if (!m_anchorNode)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 else 257 else
258 m_offsetsInAnchorNode[m_depthToAnchorNode] = kInvalidOffset; 258 m_offsetsInAnchorNode[m_depthToAnchorNode] = kInvalidOffset;
259 ++m_depthToAnchorNode; 259 ++m_depthToAnchorNode;
260 return; 260 return;
261 } else { 261 } else {
262 if (m_offsetInAnchor && m_anchorNode->layoutObject()) { 262 if (m_offsetInAnchor && m_anchorNode->layoutObject()) {
263 // Case #3-a. This is a reverse of increment()::Case#2. 263 // Case #3-a. This is a reverse of increment()::Case#2.
264 // In this case |anchor| is a leaf(E,F,C,G or H) and 264 // In this case |anchor| is a leaf(E,F,C,G or H) and
265 // |m_offsetInAnchor| is not on the beginning of |anchor|. 265 // |m_offsetInAnchor| is not on the beginning of |anchor|.
266 // Then just decrement |m_offsetInAnchor|. 266 // Then just decrement |m_offsetInAnchor|.
267 m_offsetInAnchor = uncheckedPreviousOffset(m_anchorNode, m_offsetInA nchor); 267 m_offsetInAnchor = previousGraphemeBoundaryOf(m_anchorNode, m_offset InAnchor);
268 return; 268 return;
269 } else { 269 } else {
270 // Case #3-b. This is a reverse of increment()::Case#1. 270 // Case #3-b. This is a reverse of increment()::Case#1.
271 // In this case |anchor| is a leaf(E,F,C,G or H) and 271 // In this case |anchor| is a leaf(E,F,C,G or H) and
272 // |m_offsetInAnchor| is on the beginning of |anchor|. 272 // |m_offsetInAnchor| is on the beginning of |anchor|.
273 // Let |anchor| is E, 273 // Let |anchor| is E,
274 // next |anchor| is B and |child| is E. 274 // next |anchor| is B and |child| is E.
275 m_nodeAfterPositionInAnchor = m_anchorNode; 275 m_nodeAfterPositionInAnchor = m_anchorNode;
276 m_anchorNode = Strategy::parent(*m_anchorNode); 276 m_anchorNode = Strategy::parent(*m_anchorNode);
277 if (!m_anchorNode) 277 if (!m_anchorNode)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return true; 325 return true;
326 if (m_nodeAfterPositionInAnchor) 326 if (m_nodeAfterPositionInAnchor)
327 return false; 327 return false;
328 return Strategy::hasChildren(*m_anchorNode) || m_offsetInAnchor >= Strategy: :lastOffsetForEditing(m_anchorNode); 328 return Strategy::hasChildren(*m_anchorNode) || m_offsetInAnchor >= Strategy: :lastOffsetForEditing(m_anchorNode);
329 } 329 }
330 330
331 template class PositionIteratorAlgorithm<EditingStrategy>; 331 template class PositionIteratorAlgorithm<EditingStrategy>;
332 template class PositionIteratorAlgorithm<EditingInFlatTreeStrategy>; 332 template class PositionIteratorAlgorithm<EditingInFlatTreeStrategy>;
333 333
334 } // namespace blink 334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698