WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
50481
Caret is incorrectly painted if the final position follows non-editable content.
https://bugs.webkit.org/show_bug.cgi?id=50481
Summary
Caret is incorrectly painted if the final position follows non-editable content.
Levi Weintraub
Reported
2010-12-03 13:40:27 PST
When the selection is a caret at the final position of an editable div immediately following non-editable content, the caret is painted at the right edge (or left edge in RTL) of the div instead of after the non-editable content. Consider this DOM: DIV contenteditable=true SPAN contenteditable=false text "Foo" Because the positions [SPAN, 1] or [text, 3] are not candidates, we end up with [DIV, 1], which is painted incorrectly despite being equivalent.
Attachments
Test case
(433 bytes, text/html)
2010-12-03 13:41 PST
,
Levi Weintraub
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Levi Weintraub
Comment 1
2010-12-03 13:41:48 PST
Created
attachment 75537
[details]
Test case
Levi Weintraub
Comment 2
2011-01-06 15:13:08 PST
The bug actually appears to be in Position::getInlineBoxAndOffset. The check here:
http://trac.webkit.org/browser/trunk/WebCore/dom/Position.cpp?annotate=blame&rev=72777#L1038
which is intended to prevent infinite recursion also has the side effect of not actually checking the upstream position when *this is the downstream position. Changing the line to if (equivalent == *this || (canHaveChildrenForEditing(equivalent.node()) && equivalent.node()->renderer()->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(equivalent.node()->renderer()))) solves the problem but isn't pretty.
Ahmad Saleem
Comment 3
2022-11-01 14:24:43 PDT
I am able to reproduce this bug in Safari 16.1 using attached test case and placing caret after "Foo" will show Caret at end of content editable like it is RTL, while Firefox Nightly 108 does not show any caret at all. Chrome do show caret at right position. Changing status to "New". Thanks!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug