Closed Bug 751785 Opened 12 years ago Closed 12 years ago

Make Selection.toString() API use DOMString instead of wstring

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: MatsPalmgren_bugz, Assigned: jhk)

Details

(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])

Attachments

(1 file, 1 obsolete file)

Make Selection.toString() API use DOMString instead of wchar,
per bug 748961 comment 11.
Whiteboard: [good first bug][mentor=Ms2ger][lang=c++]
Need to change the declarations in

http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelection.idl#165
http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionPrivate.idl#88

to use "DOMString" instead of "wstring", and the implementations in

http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsSelection.cpp#1313

The PRUnichar** arguments should become nsAString& in nsTypedSelection::ToString and nsTypedSelection::ToStringWithFormat.
Summary: Make Selection.toString() API use DOMString instead of wchar → Make Selection.toString() API use DOMString instead of wstring
I'm looking at this bug as an introduction to the mozilla bug tracker and other things, but the PRUnichar** arguments are pointers to that type if im right, so changing them to nsAString& does what? Is that a type?
nsAString& is a writable abstract string type; see <https://developer.mozilla.org/En/Mozilla_internal_string_guide> for more information about it.
Attached patch Patch(v1) (obsolete) — Splinter Review
Attachment #631322 - Flags: feedback?(Ms2ger)
Comment on attachment 631322 [details] [diff] [review]
Patch(v1)

Review of attachment 631322 [details] [diff] [review]:
-----------------------------------------------------------------

This looks great; just a few comments. Can you fix those and ask :smaug to review?

::: content/base/public/nsISelection.idl
@@ +134,5 @@
>  
>      /**
>       * Returns the whole selection into a plain text string.
>       */
> +    DOMString toString();

Update the uuid.

::: layout/generic/nsSelection.cpp
@@ +1094,5 @@
>    // null if the Selection has been disconnected (the shell is Destroyed).
>    nsCOMPtr<nsIPresShell> shell =
>      mFrameSelection ? mFrameSelection->GetShell() : nsnull;
>    if (!shell) {
> +    aReturn = ToNewUnicode(EmptyString());

This should just be 'aReturn.Truncate();' now.

@@ +1145,1 @@
>    return rv;

And these four lines can be 'return encoder->EncodeToString(aReturn);'
Attachment #631322 - Flags: feedback?(Ms2ger) → feedback+
Attached patch Patch(v2)Splinter Review
Attachment #631322 - Attachment is obsolete: true
Attachment #631333 - Flags: review?(bugs)
Attachment #631333 - Flags: review?(bugs) → review+
Assignee: nobody → jigneshhk1992
Keywords: checkin-needed
Flags: in-testsuite-
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/34117bad5665
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Ms2ger pushed a follow-up to comm-central fix bustage there as well.
https://hg.mozilla.org/comm-central/rev/1608d7734acb
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: