diff options
Diffstat (limited to 'Source/WebCore/editing/FrameSelection.cpp')
-rw-r--r-- | Source/WebCore/editing/FrameSelection.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp index fc7286eba..de2d65d7e 100644 --- a/Source/WebCore/editing/FrameSelection.cpp +++ b/Source/WebCore/editing/FrameSelection.cpp @@ -425,10 +425,17 @@ static void updatePositionAfterAdoptingTextReplacement(Position& position, Chara position.moveToOffset(positionOffset - oldLength + newLength); } +static inline bool nodeIsDetachedFromDocument(Node* node) +{ + ASSERT(node); + Node* highest = highestAncestor(node); + return highest->nodeType() == Node::DOCUMENT_FRAGMENT_NODE && !highest->isShadowRoot(); +} + void FrameSelection::textWillBeReplaced(CharacterData* node, unsigned offset, unsigned oldLength, unsigned newLength) { // The fragment check is a performance optimization. See http://trac.webkit.org/changeset/30062. - if (isNone() || !node || highestAncestor(node)->nodeType() == Node::DOCUMENT_FRAGMENT_NODE) + if (isNone() || !node || nodeIsDetachedFromDocument(node)) return; Position base = m_selection.base(); |