Closed Bug 333063 Opened 19 years ago Closed 19 years ago

Fix the relationship between nsHTMLEditor::InsertHTMLWithContext and nsHTMLEditor::CreateDOMFragmentFromPaste

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: mrbkap, Assigned: mrbkap)

References

Details

(Whiteboard: [patch])

Attachments

(1 file)

Currently, the path to paste an HTML fragment in the editor goes through a little maze of functions. Two of those functions are InsertHTMLWithContext and CreateDOMFragmentFromPaste. These functions are currently in a weird incestuous relationship where one CreateDOMFragmentFromPaste does parsing and passes "hints" back to InsertHTMLWithContext, basically meaning that we end up calculating the same things twice. I want to clean up the relationship between the two functions so that we only calculate things once. This is a spinoff of bug 228920. Note that I don't want to nuke CreateDOMFragmentFromPaste altogether, since InsertHTMLWithContext is a large enough function as-is.
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha
Attached patch Pass 1Splinter Review
I tried to keep the behavior the same between the old and new code. I'm not really happy with the nsCOMPtr usage, suggestions are welcome.
Attachment #219573 - Flags: review?(neil)
Blocks: 333229
Comment on attachment 219573 [details] [diff] [review] Pass 1 >+ *outStartNode = contextLeaf; >+ *outStartOffset = 0; >+ >+ *outEndNode = *outStartNode; Chained assignment? >+ *outStartNode = tmp; ->swap? >+ GetLengthOfDOMNode(*outEndNode, (PRUint32&)*outEndOffset); > } > else > { >+ GetLengthOfDOMNode(*outEndNode, (PRUint32&)*outEndOffset); > } I suppose any decent compiler will optimise this, but it looks silly.
Attachment #219573 - Flags: review?(neil) → review+
Attachment #219573 - Flags: superreview?(jst)
Comment on attachment 219573 [details] [diff] [review] Pass 1 sr=jst
Attachment #219573 - Flags: superreview?(jst) → superreview+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 335484
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: