Opened 16 years ago
Closed 12 years ago
#3475 closed Bug (fixed)
[FF] Multirange broken when command used several times
Reported by: | Tobiasz Cudnik | Owned by: | Garry Yao |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | SVN (CKEditor) - OLD |
Keywords: | Firefox Confirmed | Cc: |
Description (last modified by )
Multirange broken when command used several times.
Reproduction steps:
- Use bold on 2 separate chunks of text.
- Select part of 1st and part of 2nd chunk.
<strong>^fo^o </strong>bar<strong> f^oo^2</strong>
- Click "bold" button several times.
Depending on first selection range start, there are 2 possible misbehaviors:
- Second selection will jump from proper selection to rest of previously bolded text (of 2nd chunk).
- Second (or both) selections will disappear after second or third use of bold command, but still they will make some DOM modifications.
35sec screencast presenting this issue: http://pub.meta20.net/fck-multirange.ogg
Env: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.9) Gecko/2009042219 Iceweasel/3.0.9 (Debian-3.0.9-1)
Attachments (8)
Change History (37)
comment:1 Changed 16 years ago by
Description: | modified (diff) |
---|
comment:2 follow-up: 4 Changed 16 years ago by
Keywords: | Confirmed added |
---|---|
Milestone: | → CKEditor 3.0 |
comment:3 Changed 16 years ago by
Owner: | set to Garry Yao |
---|---|
Status: | new → assigned |
This's related to #3361.
Changed 16 years ago by
Attachment: | 3475.patch added |
---|
comment:4 Changed 16 years ago by
Keywords: | Review? added |
---|
Replying to fredck:
I think it's a problem with the order the ranges are being handled.
I confess it's would be a practical way to 'step off' the problem, since it's only happened on browser which support multiple ranges, we could temporarily use this fix, exactly like what we deal with the insertElement function on multi-ranges.
While a more sufficient fix would be pooling all the activated ranges and update them manually, it would be very cost.
comment:5 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
At this point, all bookmarks created in the code executed by applyToRange and removeFromRange should not happen. It also means that other parts of the code using those functions need to consider this, and create bookmarks before calling these functions.
Changed 16 years ago by
Attachment: | 3475_2.patch added |
---|
comment:6 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:7 follow-up: 8 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
Trying the same thing with the following initial selection instead:
^fo^o <strong>bar</strong> f^oo^2
It works before the patch, but it's broken after it.
comment:8 Changed 16 years ago by
Changed 16 years ago by
Attachment: | 3475_3.patch added |
---|
comment:9 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
I have no problem with both TCs after the patch.
comment:10 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
There're still some trick cases where the patch fails.
e.g.
- Open replacebyclass.html in Firefox.
- Select as follows:
<p> This is so^me <strong>sa^mple te^xt</strong>. Yo^u are using <a href="http://www.fckeditor.net/">CKEditor</a>.</p>
- Press "Bold" twice.
- The selection is wrong.
Pressing Italics twice would give the correct result here - apparently we need to account for the tag merging logic in the style plugin.
comment:11 Changed 16 years ago by
Nice catch Martin, now our theory of 'processing ranges in reverse order' doesn't any more fit this case, so I'm proposing a new way to resist dirty ranges.
Changed 16 years ago by
Attachment: | 3475_4.patch added |
---|
comment:12 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:13 Changed 16 years ago by
Keywords: | Review- added; Review? removed |
---|
Part of this patch is being fixed at #3256, so I would wait for that one to get committed first, and them propose a new patch here.
Changed 16 years ago by
Attachment: | 3475_5.patch added |
---|
comment:14 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:15 Changed 16 years ago by
Updates contain in this patch:
- Introducing a selection iterator to batch process multiple ranges to make sure during processing, each range doesn't mangle the following ones.
- Fixing a regression logic error of #3256 when creating bookmarks, check the TC test_createBookmarks_3475 in selection.html.
comment:16 Changed 16 years ago by
Keywords: | RC Review- added; Review? removed |
---|
After a peer review with Fred, the following updates should be considered:
- Introduce a dedicated class for represent range list, which encapsulate necessary range manipulation (e.g. bookmark creation) operation and also implementing the iterator interface;
- Bookmark creation logic regard dirty range update could be further simplified into a inline template function.
Changed 16 years ago by
Attachment: | 3475_6.patch added |
---|
comment:17 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:18 Changed 16 years ago by
Keywords: | RC removed |
---|
comment:19 Changed 16 years ago by
rangelist class is in a module pattern, while the encapsulation is perfect, but it's performance con is reveal by the attached deduced TC test-class-creation.html, where it's amazingly to see that in v8 with some inline caching VM level optimization, the difference is even as huge as 10x.
Based on the PF testing result, considering the fact that the rangelist is one of the frequently constructed object out there, I would revert it to a plain old prototype based form with the new patch with other changes remained.
Changed 16 years ago by
Attachment: | 3475_7.patch added |
---|
comment:20 Changed 16 years ago by
Milestone: | CKEditor 3.0 → CKEditor 3.1 |
---|
comment:21 Changed 16 years ago by
Owner: | Garry Yao deleted |
---|---|
Status: | assigned → new |
comment:22 Changed 15 years ago by
Owner: | set to Garry Yao |
---|---|
Status: | new → assigned |
comment:23 Changed 15 years ago by
Milestone: | CKEditor 3.1 → CKEditor 3.2 |
---|
Better to have this patch updated to the latest trunk.
comment:24 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
comment:25 Changed 15 years ago by
Milestone: | CKEditor 3.2 → CKEditor 3.3 |
---|
comment:26 Changed 15 years ago by
Milestone: | CKEditor 3.3 → CKEditor 3.4 |
---|
comment:27 Changed 15 years ago by
This's becoming more of a refactoring task than a bug fixing, if we decide to have it in this milestone, we need to do it in ASAP manner.
comment:28 Changed 15 years ago by
Milestone: | CKEditor 3.4 |
---|
comment:29 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | review_failed → closed |
Fixed. And what's more Mozilla is planning to drop multi-range selections support.
I think it's a problem with the order the ranges are being handled. If we are first changing the first range, it may happen that the offset values for the second range will not anymore be valid, due to text nodes being broken, insertion of elements, etc. If that's true, we need to invert the order of processing them, from last to first.
It's just an intuition though, still to be checked.