Open Bug 853790 Opened 13 years ago Updated 5 years ago

Editor should not deal with insignificant text nodes

Categories

(Core :: DOM: Editor, defect, P5)

defect

Tracking

()

People

(Reporter: glazou, Unassigned)

Details

(Keywords: regression, testcase)

Attachments

(2 files, 2 obsolete files)

This is another regression making the markup created by the editor invalid: the editor now applies changes to some insignificant text nodes like CRs between two elements. This was reported to me by a BlueGriffon user and I narrowed the issue to the attached test case. Open test case and click on the link.
Showstopper bug for BlueGriffon 1.7...
Investigated a bit and found the guilty code. In his patches for bug 612128, Ehsan introduced nsHTMLEditor::IsEditable that did not exist previously and that method does not check if text nodes are significant text nodes or not. So insignificant text nodes end up in the list of nodes to be styled by nsHTMLEditor::SetInlineProperty...
Attached patch fix (obsolete) — — Splinter Review
Attachment #728250 - Flags: review?(ehsan)
Comment on attachment 728250 [details] [diff] [review] fix Review of attachment 728250 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the comment below. Can you also convert this testcase into a mochitest and add it to the patch as well? ::: editor/libeditor/html/nsHTMLEditor.cpp @@ +5432,5 @@ > } > + // We might be dealing with a text node for example, which we consider > + // to be editable if it's a significant text node > + if (IsTextNode(aNode)) { > + nsCOMPtr<nsIContent> content = do_QueryInterface(aNode); aNode is already an nsIContent*. Please get rid of the QI here.
Attachment #728250 - Flags: review?(ehsan) → review+
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #4) > aNode is already an nsIContent*. Please get rid of the QI here. How to be fooled by a variable's name when you're in a hurry. Sure, will do. Will write the mochitest too.
Attached patch fix + mochitest (obsolete) — — Splinter Review
in answer to ehsan's comments.
Attachment #728327 - Flags: review?(ehsan)
Attached patch fix + mochitest — — Splinter Review
better error message in mochitest
Attachment #728250 - Attachment is obsolete: true
Attachment #728327 - Attachment is obsolete: true
Attachment #728327 - Flags: review?(ehsan)
Attachment #728328 - Flags: review?(ehsan)
Attachment #728328 - Flags: review?(ehsan) → review+

Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: major → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: