| Index: Source/core/editing/ReplaceSelectionCommand.cpp
 | 
| diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp
 | 
| index 42fc520f9afce59ae8fa459c959f229b59952326..3bd6d94de71800399f5141c5e3cae6e8d8ad9095 100644
 | 
| --- a/Source/core/editing/ReplaceSelectionCommand.cpp
 | 
| +++ b/Source/core/editing/ReplaceSelectionCommand.cpp
 | 
| @@ -157,7 +157,11 @@ ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* f
 | 
|      if (!editableRoot)
 | 
|          return;
 | 
|  
 | 
| -    Node* shadowAncestorNode = editableRoot->deprecatedShadowAncestorNode();
 | 
| +    Node* shadowAncestorNode;
 | 
| +    if (editableRoot->isInShadowTree())
 | 
| +        shadowAncestorNode = editableRoot->shadowHost();
 | 
| +    else
 | 
| +        shadowAncestorNode = editableRoot.get();
 | 
|  
 | 
|      if (!editableRoot->getAttributeEventListener(EventTypeNames::webkitBeforeTextInserted) &&
 | 
|          // FIXME: Remove these checks once textareas and textfields actually register an event handler.
 | 
| 
 |