There's currently some inconsistency between how newlines selection
is painted in textareas vs contenteditable as you can see
in the attached example and image.
In textareas the newline has an extra whitespace selected,
so you know that you've selected the new line.
Also when yo
The primary use case for this is to be able to remove a bunch of empty lines
in a contenteditable element by selecting them.
Right now you cannot see how many you've selected in order to remove them,
however that's possible in a textarea.
I've been checking the code and actually the newlines are already adding
that extra whitespace for selection.
But the following condition in InlineFlowBoxPainter::Paint():
if (!paint_info.GetCullRect().IntersectsCullRect(overflow_rect))
return;
Is always true, so the painting code for the newline in InlineTextBoxPainter::Paint()
isn't called, thus the extra whitespace for selection isn't painted.
I've a experimental patch that modifies that method, so the VisualOverflowRect
of the newline is extended to include the extra whitespace.
This cause that the condition above isn't always true for newlines
and then the extra whitespace for selection is actually painted.
You can check it in the following CL:
https://chromium-review.googlesource.com/c/chromium/src/+/793036
|
Deleted:
selection-newlines-textarea-vs-contenteditable.html
595 bytes
|
|
selection-newlines-textarea-vs-contenteditable.html
595 bytes
View
Download
|
|
Deleted:
selection-newlines-textarea-vs-contenteditable.png
16.0 KB
|
|
selection-newlines-textarea-vs-contenteditable.png
16.0 KB
View
Download
|
|
Comment 1 by r...@igalia.com
, Dec 4 2017Status: Started (was: Untriaged)
1.7 KB
1.7 KB View Download
28.4 KB
28.4 KB View Download