New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 645665 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Caret stays still in contenteditable but next is still entered normally

Project Member Reported by einbinder@chromium.org, Sep 9 2016

Issue description

Version:55.0.2856.0
OS: Linux

What steps will reproduce the problem?
(1) Open https://jsfiddle.net/61t170sy/
(2) Type something in the prompt
(3) note that the cursor doesn't move as you type more letters

Biscet: https://chromium.googlesource.com/chromium/src/+log/2c3af0c370b6671d8cd548ca09c6e66a998ba7d3..3c74f1cb2742e9b050fbc830f1ac0e06163c2370

Suspecting: https://chromium.googlesource.com/chromium/src/+/5153d9b53989b32068b7759aa0253a1e5662492a
 
Labels: -Pri-1 Pri-2
Components: Blink>Paint>Invalidation
I am planning to look at this shortly, thanks for patience.
Labels: OS-All
Test case concat'd from fiddle (and removing 'white-space: pre-wrap' which doesn't seem necessary) attached. Note the caret is only brokenly-absent when positioned at rightmost edge of inputted text.
caret.html
473 bytes View Download
When the caret is positioned at the end of the editor, hasEditableStyle(node) is false for both the node and parent node here:

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/editing/CaretBase.cpp?q=caretbase.cpp&sq=package:chromium&dr&l=167

(1) With text as "a" entered in the editable div, when caret is at end of input:

  node = #text "autocomplete hint text"
  parent node = SPAN id="after"

and (2) when it's somewhere before the end:

  node = #text "a"
  parent node = DIV id="editor"

Rough DOM tree below:

			DIV id="editor" (editable) (focused)
				#text "a"
				SPAN id="after"
*					#text "autocomplete hint text"
			#text "\n"

So, indeed, in (1) neither the node or parent node are marked as editable when caret is at end of input. Changing #after style from:

  -webkit-user-modify: read-only;

to:

  -webkit-user-modify: read-write-plaintext-only;

produces a properly blinking caret (but allows editing the "autocomplete hint text", which is undesirable for intended user facing functionality).

There's some discrepancy between editing logic that properly allows inputting text, and caret shouldRepaintCaret() logic checking hasEditableStyle(). I'll look at what editing is checking, perhaps we just need to follow that more closely.

Or we may need to just walk up layout tree and just return true for shouldRepaintCaret() if there is any ancestor marked editable.
Editing logic looks like it is using EditingUtilities::isEditablePosition() which uses position.parentAnchoredEquivalent().anchorNode() and checks hasEditableStyle() on that node, which is '#text "a"' even when we are at end of input.

Perhaps we can save off the position we get in CaretBase::updateCaretRect() and pass to EditingUtilities::isEditablePosition() which has some other special-case logic we should be using around, for example, tables.
Project Member

Comment 7 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d

commit c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d
Author: wkorman <wkorman@chromium.org>
Date: Wed Oct 12 18:25:30 2016

Use anchor node, rather than current selected node, to check editability.

BUG= 645665 

Review-Url: https://codereview.chromium.org/2401363003
Cr-Commit-Position: refs/heads/master@{#424790}

[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/editing/input/caret-read-only-after-editable.html
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-read-only-after-editable-expected.png
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/linux/editing/input/caret-read-only-after-editable-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/4776765-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/selection-after-delete-expected.txt
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-read-only-after-editable-expected.png
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-read-only-after-editable-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/4776765-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/selection-after-delete-expected.txt
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-read-only-after-editable-expected.png
[add] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/win/editing/input/caret-read-only-after-editable-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/4776765-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/selection-after-delete-expected.txt
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/Source/core/editing/FrameCaret.cpp
[modify] https://crrev.com/c0d0bd4e6f7e38c0208b78b2df9750ba7b0ceb0d/third_party/WebKit/Source/core/editing/FrameCaret.h

Status: Fixed (was: Assigned)
Thanks!

Sign in to add a comment