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

Unified Diff: third_party/WebKit/Source/core/editing/Position.cpp

Issue 2772233002: EXPERIMENT Make toPositionInFlatTree() to return null for DOM position not in flat tree (Closed)
Patch Set: 2017-03-27T18:24:23 Created 3 years, 9 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
Index: third_party/WebKit/Source/core/editing/Position.cpp
diff --git a/third_party/WebKit/Source/core/editing/Position.cpp b/third_party/WebKit/Source/core/editing/Position.cpp
index c2d3e6d0e318a359e6c23725bc00cdfafb4acd47..f561a912bf9a474152ffc9134e0e917658d1da21 100644
--- a/third_party/WebKit/Source/core/editing/Position.cpp
+++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -541,6 +541,12 @@ PositionInFlatTree toPositionInFlatTree(const Position& pos) {
if (anchor->isShadowRoot())
return PositionInFlatTree(anchor->ownerShadowHost(), pos.anchorType());
+ if (anchor->canParticipateInFlatTree() &&
+ !FlatTreeTraversal::parent(*anchor)) {
+ // Since this function is a primitive function, we do not adjust |pos|
+ // to somewhere in flat tree.
+ return PositionInFlatTree();
+ }
// TODO(yosin): Once we have a test case for SLOT or active insertion point,
// this function should handle it.
return PositionInFlatTree(anchor, pos.anchorType());

Powered by Google App Engine
This is Rietveld 408576698