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

Unified 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: Fix a loop issue caused by document-fragment Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/editing/htmlediting.cpp » ('j') | Source/core/editing/htmlediting.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/PositionIterator.cpp
diff --git a/Source/core/dom/PositionIterator.cpp b/Source/core/dom/PositionIterator.cpp
index b5799d3e9c2f5dd562657ff8965c81cbb3c348e8..a00076c809df271e1eb9c6281ff1c80201a69298 100644
--- a/Source/core/dom/PositionIterator.cpp
+++ b/Source/core/dom/PositionIterator.cpp
@@ -77,7 +77,7 @@ void PositionIteratorAlgorithm<Strategy>::increment()
return;
}
- if (!Strategy::hasChildren(*m_anchorNode) && m_offsetInAnchor < Strategy::lastOffsetForEditing(m_anchorNode)) {
+ if (m_anchorNode->layoutObject() && !Strategy::hasChildren(*m_anchorNode) && m_offsetInAnchor < Strategy::lastOffsetForEditing(m_anchorNode)) {
m_offsetInAnchor = PositionType::uncheckedNextOffset(m_anchorNode, m_offsetInAnchor);
} else {
m_nodeAfterPositionInAnchor = m_anchorNode;
@@ -110,7 +110,7 @@ void PositionIteratorAlgorithm<Strategy>::decrement()
m_anchorNode = Strategy::lastChild(*m_anchorNode);
m_offsetInAnchor = Strategy::hasChildren(*m_anchorNode)? 0 : Strategy::lastOffsetForEditing(m_anchorNode);
} else {
- if (m_offsetInAnchor) {
+ if (m_offsetInAnchor && m_anchorNode->layoutObject()) {
m_offsetInAnchor = PositionType::uncheckedPreviousOffset(m_anchorNode, m_offsetInAnchor);
} else {
m_nodeAfterPositionInAnchor = m_anchorNode;
« no previous file with comments | « no previous file | Source/core/editing/htmlediting.cpp » ('j') | Source/core/editing/htmlediting.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698