Invalidate the previous caret even if the parent text node is removed.

When the last character is removed from an input, the caret node is detached,
which is the anonymous #text node. However, FrameSelection still refer to
the previous caret node to invalidate the previous caret.

Before deleting the last character "a" >
	INPUT	0x3be145763a50 (focused)
		#shadow-root	0x3be145763b50
			DIV	0x3be145763c20 ID="inner-editor" (editable)
*				#text	0x3be145763f58 "a"

After deleting the last character "a" >
	INPUT	0x3be145763a50 (focused)
		#shadow-root	0x3be145763b50
*			DIV	0x3be145763c20 ID="inner-editor" (editable)

Currently, Blink doesn't invalidate the previous caret if the caret is detached
from DOM. This CL invalidates the caret region when the caret is detached.

TEST=webkit_unit_tests FrameSelectionTest.InvalidatePreviousCaretAfterRemovingLastCharacter
ManualTests/caret-paint-after-last-text-is-removed.html with --enable-partial-raster
BUG=528922

Review URL: https://codereview.chromium.org/1654123002

Cr-Commit-Position: refs/heads/master@{#377696}
4 files changed