Open Bug 378745 Opened 17 years ago Updated 11 months ago

Enabling designMode makes images surrounded by text appear selected

Categories

(Core :: DOM: Editor, defect)

x86
All
defect

Tracking

()

People

(Reporter: mfenniak-moz, Unassigned)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)

When designMode is enabled on an HTML document, some images appear selected automatically.  On Windows, they turn slightly blue.  The images are not actually selected, but just appear that way.  It only occurs on images that are surrounded by non-whitespace on both sides.

A test case will be attached.

Reproducible: Always

Steps to Reproduce:
1. Open test case (to be attached).

Actual Results:  
The first two images on the page appear selected -- they have text surrounding the images.  The second two images on the page are not selected -- the first has a space before the image, and the second has a space after the image.

Expected Results:  
No images should appear selected in the test case.
Attached file test case
Attached patch proposed patchSplinter Review
Tracked this bug down to the inline spell checker.  In the test case, the spell checker would combine the text from both sides of the image ("abc" and "def"), decide that the word "abcdef" is spelled incorrectly, and add the entire range (including the image) to the shell check selection (line 1355 of mozInlineSpellChecker.cpp).  This also explains why the bug does not appear when whitespace is on either side of the image, since the spell checker will not treat the text as a single incorrectly spelled word.

The proposed patch fixes this problem by making an image element, even an inline image, a "break element".  After this patch, the spell checker works on "abc" and "def", but not the combined text.
Component: Editor → Spelling checker
Comment on attachment 262775 [details] [diff] [review]
proposed patch

Looks good.
Attachment #262775 - Flags: review+
Assignee: nobody → aoakof
Status: UNCONFIRMED → NEW
Ever confirmed: true
Shouldn't this check for more elements? Applet and object come to mind.
Blocks: 424615
QA Contact: editor → spelling-checker

Hi Olli, this merits probably a re-triage.

Assignee: mfenniak-moz → nobody
Flags: needinfo?(bugs)
Severity: normal → S3
Component: Spelling checker → DOM: Editor
Flags: needinfo?(smaug)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: