| 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 01f0364a006e652f08bdf32c1affcd23bf5451aa..c0a6bf2259c17821451675d374f728b81f9839a9 100644
|
| --- a/third_party/WebKit/Source/core/editing/Position.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/Position.cpp
|
| @@ -513,8 +513,8 @@ PositionInFlatTree toPositionInFlatTree(const Position& pos)
|
| if (pos.isNull())
|
| return PositionInFlatTree();
|
|
|
| + Node* const anchor = pos.anchorNode();
|
| if (pos.isOffsetInAnchor()) {
|
| - Node* anchor = pos.anchorNode();
|
| if (anchor->isCharacterDataNode())
|
| return PositionInFlatTree(anchor, pos.computeOffsetInContainerNode());
|
| DCHECK(!anchor->isSlotOrActiveInsertionPoint());
|
| @@ -541,7 +541,11 @@ PositionInFlatTree toPositionInFlatTree(const Position& pos)
|
| return PositionInFlatTree(anchor, PositionAnchorType::AfterChildren);
|
| }
|
|
|
| - return PositionInFlatTree(pos.anchorNode(), pos.anchorType());
|
| + if (anchor->isShadowRoot())
|
| + return PositionInFlatTree(anchor->shadowHost(), pos.anchorType());
|
| + // TODO(yosin): Once we have a test case for SLOT or active insertion point,
|
| + // this function should handle it.
|
| + return PositionInFlatTree(anchor, pos.anchorType());
|
| }
|
|
|
| Position toPositionInDOMTree(const Position& position)
|
|
|