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

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

Issue 1189543002: Do not traverse nodes not having a layout object while searching editable visible position. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Resolved conflicts. Created 5 years, 5 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 | « no previous file | Source/core/editing/htmlediting.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)) {
yosin_UTC9 2015/07/17 12:00:21 Please check layoutObject() only for nodes which r
changseok 2015/07/28 05:05:37 Done.
81 m_offsetInAnchor = PositionAlgorithm<Strategy>::uncheckedNextOffset(m_an chorNode, m_offsetInAnchor); 81 m_offsetInAnchor = PositionAlgorithm<Strategy>::uncheckedNextOffset(m_an chorNode, m_offsetInAnchor);
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
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()) {
yosin_UTC9 2015/07/17 12:00:21 Same as L80
changseok 2015/07/28 05:05:37 Done.
114 m_offsetInAnchor = PositionAlgorithm<Strategy>::uncheckedPreviousOff set(m_anchorNode, m_offsetInAnchor); 114 m_offsetInAnchor = PositionAlgorithm<Strategy>::uncheckedPreviousOff set(m_anchorNode, 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 } 207 }
208 208
209 return false; 209 return false;
210 } 210 }
211 211
212 template class PositionIteratorAlgorithm<EditingStrategy>; 212 template class PositionIteratorAlgorithm<EditingStrategy>;
213 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>; 213 template class PositionIteratorAlgorithm<EditingInComposedTreeStrategy>;
214 214
215 } // namespace blink 215 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698