[Webkit-unassigned] [Bug 21840] execCommand insertImage inserts image into wrong place

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 1 09:55:33 PST 2010


--- Comment #17 from Enrica Casucci <enrica at apple.com>  2010-02-01 09:55:31 PST ---
(In reply to comment #16)
> (In reply to comment #15)
> > I think that a simpler and cleaner approach would be to modify
> > DeleteSelectionCommand to add a placeholder in a case like this.
> > Creating a placeholder when you are deleting is easier than trying to find the
> > correct position after you deleted.
> > It has the benefit of minimizing the code changes without introducing a new way
> > of finding the position, while still keeping the benefit of eliminating all the
> > spans.
> That was my first attempt at fixing the bug :)
> The problem was that adding a placeholder changes the behavior of
> DeleteSelection.  It changes how mergeParagraphs works and it changes the logic
> about whether to insert a break or not at the end of a document.  This causes
> lots of other layout tests to fail.
> This lead me to the current approaches on this bug: keep track of the position
> by not modifying the DOM.  The first patch on this bug does that, but doesn't
> handle the isCaret() case so it doesn't fix bug 23993.  This could be fixed,
> but it ends up being more complicated because it has to handle cases where the
> insertion position is deleted by DeleteSelection (because, e.g., dom nodes are
> copied or paragraphs are merged).  It turns out that it is simpler to just
> compute the position after the all the DOM modifications have ended.

I'm not suggesting that you leave a placeholder all the time. 
If you limit the scope of the change to DeleteSelection to only cases where the
lack of a placeholder leads to ambiguity about where to insert the new content,
you should be fine.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list