[Webkit-unassigned] [Bug 26937] Copying and pasting into a contenteditable area can create <div>s surrounded by <span>s

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 1 23:46:57 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=26937





--- Comment #10 from Ryosuke Niwa <rniwa at webkit.org>  2010-02-01 23:46:53 PST ---
(In reply to comment #9)
> I looked into this, but it's a bit tricky because the point where generate the
> computedStyle is after we've generated the markup as a string.  I guess we
> could convert into a document fragment so we could add these styles, but that
> seems slow.

Right, I thought of several different approaches but all of them turned out to
be bad because it affects so many other places and causes a lot of problems for
us. And we definitely don't want to convert back to a document fragment for the
reason you mentioned.

> We could also handle this on the paste side.  In
> ReplaceSelectionCommand::handleStyleSpan, we could take the style span
> attributes and move them to the child nodes like you suggest doing during the
> copy.  This would result in less styles copied and ideally in the example you'd
> get:
> <div style="text-decoration: none;"> <div style="font-weight: bold;"><div
> >one</div><div style="font-weight: normal>two</div></div>

This was one of the suggestions I got as well but...

> I think the main downside to this approach is that you still have the invalid
> markup in your clipboard.

This is a quite serious problem as users may use other Web browsers and word
processors while using WebKit. We probably want more input from other
reviewers/committers because if we fix this problem by introducing new code on
the paste side, it might have a profound impact on how we implement other
editing code later.

-- 
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