REGRESSION(r266075): WebContent process crashes at TextManipulationController::getPath
https://bugs.webkit.org/show_bug.cgi?id=216846

Reviewed by Wenson Hsieh.

Source/WebCore:

TextIterator does not visit node that has no renderer, so if node has become hidden, TextManipulationController
will not find content node in paragraph range during replacement.

API Test: TextManipulation.CompleteTextManipulationParagraphBecomesHidden

* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::replace):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@267439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/TextManipulationController.cpp b/Source/WebCore/editing/TextManipulationController.cpp
index 9baf230..ed44596 100644
--- a/Source/WebCore/editing/TextManipulationController.cpp
+++ b/Source/WebCore/editing/TextManipulationController.cpp
@@ -828,6 +828,9 @@
         }
     }
 
+    if (!firstContentNode)
+        return ManipulationFailureType::ContentChanged;
+
     while (lastChildOfCommonAncestorInRange && lastChildOfCommonAncestorInRange->parentNode() != commonAncestor)
         lastChildOfCommonAncestorInRange = lastChildOfCommonAncestorInRange->parentNode();