When a first letter is styled through the :first-letter, it is not selectable.
Created attachment 5209 [details] Testcase
This is a known issue that selections can not include generated text, which I assume the first letter is in this instance. The reason being that selections in WebCore are represented by DOMRange objects, and thus can not include anonymous render tree content. It's possible there is already a dup in bugzilla, there are also dups in Radar.
I'm pretty sure anything styled with first:letter isn't generated content: http://www.w3.org/TR/css3-content/ Generated content is stuff like "content: footnote;" and even list numbers: "li { display: list-item; list-style: decimal; }" But stuff that is written into the HTML and then styled with CSS isn't generated content.
*** Bug 16875 has been marked as a duplicate of this bug. ***
<rdar://problem/5688237>
Created attachment 147471 [details] Demonstrate more details I have begun trying to understand this issue some and have discovered several additional details: * If the selection begins with a :first-letter styled element the styled letter is not highlighted as selected (but is copied to the clipboard, more below). * However any following :first-letter styled elements are highlighted as selected. * If the selection does not begin with a :first-letter styled element all selected contents are highlighted. * The clipboard, once the selection is copied, includes the entire selection (rather than simply what is highlighted). * But the length of the selection, when testing the extentOffset property of the selection object, does not match what I'd expect. The attachment demonstrates each of the points above (except demonstrating pasting the copied selection).
I intend to start looking into fixing this bug next week so any pointers to relevant parts of WebCore for someone new to WebKit would be appreciated.
*** Bug 128705 has been marked as a duplicate of this bug. ***
Demo of issue: http://jsfiddle.net/P3TLx/6/
any work happening about all the contenteditable/first-letter issues?