Bug 87195 - REGRESSION(r92695, r112399): insertHTML doesn't respect current selection range and inserts HTML to incorrect position
Summary: REGRESSION(r92695, r112399): insertHTML doesn't respect current selection ran...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2012-05-22 18:41 PDT by jaroslav.benc
Modified: 2012-05-24 17:29 PDT (History)
8 users (show)

See Also:


Attachments
Text case - copy/paste text in the editable area as described in the example (632 bytes, text/html)
2012-05-22 18:42 PDT, jaroslav.benc
no flags Details
Fixes the bug (4.47 KB, patch)
2012-05-24 16:28 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jaroslav.benc 2012-05-22 18:41:48 PDT
Copy / paste text as described in the attached example

Note that this breaks web-based editors using insertHTML to paste text from clipboard (safe paste)

We have observed it on the DEV channel for some time, now it's in the BETA channel but not in the STABLE. 

Observed in Chrome 20 (BETA) and reported here - https://code.google.com/p/chromium/issues/detail?id=129283
Comment 1 jaroslav.benc 2012-05-22 18:42:49 PDT
Created attachment 143431 [details]
Text case - copy/paste text in the editable area as described in the example
Comment 2 Alexey Proskuryakov 2012-05-23 15:42:16 PDT
Could you please mentioned which editors are broken, and describe what goes wrong in those?

The results in the test case are quite dramatic, is this what happens on actual sites too?
Comment 3 Alexey Proskuryakov 2012-05-23 15:51:03 PDT
I have a fairly long range: <http://trac.webkit.org/log/trunk/?rev=112406&stop_rev=112382>

Perhaps <http://trac.webkit.org/changeset/112389> "Selectively retrieve text content around a given position" or <http://trac.webkit.org/changeset/112399> "An extra line break is inserted when pasting into a font element"?
Comment 4 Alexey Proskuryakov 2012-05-23 15:51:22 PDT
<rdar://problem/11519707>
Comment 5 Alexey Proskuryakov 2012-05-23 15:53:22 PDT
There latter seems more likely, of course.
Comment 6 Ryosuke Niwa 2012-05-23 16:03:11 PDT
It's likely http://trac.webkit.org/changeset/112399.
Comment 7 Yi Shen 2012-05-24 06:42:49 PDT
I will look at it.
(In reply to comment #6)
> It's likely http://trac.webkit.org/changeset/112399.
Comment 8 Ryosuke Niwa 2012-05-24 15:36:28 PDT
This regression came from the combination of r92695 and r112399. It's a very sneaky bug.
Comment 9 Ryosuke Niwa 2012-05-24 16:28:07 PDT
Created attachment 143918 [details]
Fixes the bug
Comment 10 Ryosuke Niwa 2012-05-24 16:40:00 PDT
That was quick. Thanks!
Comment 11 Yi Shen 2012-05-24 17:28:05 PDT
Thanks for fixing it. Sorry I didn't get a chance to work on it during the day, and was about to look at it with my son tonight, then I saw your fix :-) Thanks again!
(In reply to comment #10)
> That was quick. Thanks!
Comment 12 WebKit Review Bot 2012-05-24 17:29:10 PDT
Comment on attachment 143918 [details]
Fixes the bug

Clearing flags on attachment: 143918

Committed r118449: <http://trac.webkit.org/changeset/118449>
Comment 13 WebKit Review Bot 2012-05-24 17:29:15 PDT
All reviewed patches have been landed.  Closing bug.