Bug 63368 - RenderTextFragment should have regular children instead of magical first-letter child
Summary: RenderTextFragment should have regular children instead of magical first-lett...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 58911
  Show dependency treegraph
Reported: 2011-06-24 17:31 PDT by Ryosuke Niwa
Modified: 2013-05-08 06:53 PDT (History)
11 users (show)

See Also:

WIP patch. (6.83 KB, patch)
2012-06-14 00:59 PDT, Antaryami Pandia (apandia)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2011-06-24 17:31:59 PDT
There are numerous bugs and security vulnerabilities due to first-letter / RenderTextFragment being so exotic to the rest of render objects.  We should make RenderTextFragment act like the rest of rendering objects.  Namely, it should own regular children instead of holding a special pointer for first-letter.

This will fix almost all crashes and bugs related to first-letter in WebCore/editing.
Comment 1 Levi Weintraub 2011-06-24 17:54:47 PDT
Yesssss! This was the conclusion I drew in my own frustration dealing with first-letter and editing. Seeing these problems continue to crop up really drives the issue home. I'm happy to work on this.
Comment 2 Abhishek Arya 2011-06-24 20:22:25 PDT
Thanks a lot Levi and Ryosuke.
Comment 3 Ryosuke Niwa 2011-06-25 16:21:47 PDT
There are 2 possible approaches:
1. Keep RenderTextFragment inherit from RenderText.  In this approach, RenderTextFragment will act like RenderText and we can work-around most of issues in editing by adding a method to return the entire text instead "everything but first letter".

The problem with this approach is that renderes of inline text boxes will still be that of internal RenderText unless we wrap renderer() as well.

2. Make RenderTextFragment a render inline.  In this approach, we'll reimplement first-letter and act like anonymous node that contains two RenderText.

There are a lot of uncertainlies and risks but the biggest problem is that Text DOM nodes's renderer() will no longer return RenderText.  It might complicate many logics in editing and accessibility in addition to rendering, hit testing, and caret rendering, etc...
Comment 4 Levi Weintraub 2011-06-27 11:15:45 PDT
I talked with Ryosuke about this a bit. In my opinion, the first approach is viable and worthy of a proof of concept to make sure it's not out of the scope we think it is. I worry option 2 would be too invasive, kind of like getting the current first-letter implementation to work properly :)
Comment 5 Antaryami Pandia (apandia) 2012-06-14 00:59:45 PDT
Created attachment 147509 [details]
WIP patch.

Basic WIP patch.