RESOLVED FIXED108633
No caret on empty contenteditable element with negative text-indent
https://bugs.webkit.org/show_bug.cgi?id=108633
Summary No caret on empty contenteditable element with negative text-indent
Jake Archibald
Reported 2013-02-01 06:57:42 PST
Click on the green box, the caret may flash once in the correct place, but doesn't appear after that. Once you start typing, the text appears, as does the caret. Firefox & Opera show a caret, although in the wrong place.
Attachments
Patch (5.62 KB, patch)
2013-02-18 14:16 PST, Robert Hogan
no flags
Patch (5.49 KB, patch)
2013-02-19 11:47 PST, Robert Hogan
no flags
Alexey Proskuryakov
Comment 1 2013-02-01 10:47:19 PST
See also: bug 20242, bug 58975, bug 108053. We probably have a few duplicates between these, and other bugs that I didn't find now.
Radar WebKit Bug Importer
Comment 2 2013-02-01 10:51:41 PST
Robert Hogan
Comment 3 2013-02-18 14:16:15 PST
WebKit Review Bot
Comment 4 2013-02-18 14:19:02 PST
Attachment 188942 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.png', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.txt', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/rendering/RenderBlock.cpp']" exit_code: 1 LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.png:0: Have to enable auto props in the subversion config file (/home/alancutter/.subversion/config "enable-auto-props = yes"). Have to set the svn:mime-type in the subversion config file (/home/alancutter/.subversion/config "*.png = svn:mime-type=image/png"). [image/png] [5] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 5 2013-02-18 14:57:57 PST
Comment on attachment 188942 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188942&action=review > Source/WebCore/rendering/RenderBlock.cpp:1685 > + bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled(); > + if (textIndentOffset() < 0 && (caretBrowsing || (node() && node()->rendererIsEditable()))) { Why do we want to check node()->rendererIsEditable() when caret browsing is disabled? rendererIsEditable() is a very expensive function, I'd rather not call it here.
Robert Hogan
Comment 6 2013-02-19 11:26:07 PST
(In reply to comment #5) > (From update of attachment 188942 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=188942&action=review > > > Source/WebCore/rendering/RenderBlock.cpp:1685 > > + bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled(); > > + if (textIndentOffset() < 0 && (caretBrowsing || (node() && node()->rendererIsEditable()))) { > > Why do we want to check node()->rendererIsEditable() when caret browsing is disabled? rendererIsEditable() is a very expensive function, I'd rather not call it here. rendererIsEditable() only gets expensive if you need to climb the tree looking for a HTML element. I don't think that will happen very often here, especially where a negative text indent has been defined. Does that sound reasonable? It might be cheaper overall to just add the overflow for any element that has the text indent rather than ones that will want to display a caret at some point. But I don't think rendererIsEditable() ever gets expensive here. I need to remove the multiple calls to textIndentOffset().
Robert Hogan
Comment 7 2013-02-19 11:47:23 PST
WebKit Review Bot
Comment 8 2013-02-19 11:51:01 PST
Attachment 189126 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.png', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.txt', u'LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent.html', u'Source/WebCore/ChangeLog', u'Source/WebCore/rendering/RenderBlock.cpp']" exit_code: 1 LayoutTests/fast/repaint/paint-caret-in-div-with-negative-indent-expected.png:0: Have to enable auto props in the subversion config file (/home/alancutter/.subversion/config "enable-auto-props = yes"). Have to set the svn:mime-type in the subversion config file (/home/alancutter/.subversion/config "*.png = svn:mime-type=image/png"). [image/png] [5] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 9 2013-02-20 11:52:45 PST
Comment on attachment 189126 [details] Patch Clearing flags on attachment: 189126 Committed r143483: <http://trac.webkit.org/changeset/143483>
WebKit Review Bot
Comment 10 2013-02-20 11:52:49 PST
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 11 2013-09-10 17:58:00 PDT
This caused a bad repaint regression, when authors combine negative text-indent with overflow:hidden (which is what we recommend they do): bug 121137.
Alexey Proskuryakov
Comment 12 2013-09-11 13:05:40 PDT
This bug still appears fixed after rollout (maybe <http://trac.webkit.org/changeset/143313> also took care of the same?) Please comment and possibly open a new bug if the next nightly doesn't quite work for you in this regard.
Note You need to log in before you can comment on or make changes to this bug.