Closed Bug 674558 Opened 13 years ago Closed 13 years ago

Implement the HTML5 selectionDirection property for text controls (input and textarea)

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

()

Details

(Keywords: dev-doc-complete, html5)

Attachments

(1 file, 2 obsolete files)

This is a new property for text controls which specifies the direction of the selection for text inputs and textareas.
Assignee: nobody → ehsan
Keywords: dev-doc-needed
Attached patch Patch (v1) (obsolete) — Splinter Review
Attachment #549027 - Flags: review?(bzbarsky)
Attached patch Patch (v2) (obsolete) — Splinter Review
Fixed a bug, and also added a couple of more tests.
Attachment #549027 - Attachment is obsolete: true
Attachment #549027 - Flags: review?(bzbarsky)
Attachment #549127 - Flags: review?(bzbarsky)
Comment on attachment 549127 [details] [diff] [review]
Patch (v2)

>--- a/content/html/content/src/nsHTMLInputElement.cpp
>+++ b/content/html/content/src/nsHTMLInputElement.cpp
>+      if (aDirection == NS_LITERAL_STRING("backward")) {

>--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
>+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
>+      if (aDirection == NS_LITERAL_STRING("backward")) {

That's I signature you don't see often. How about EqualsListeral?

>--- a/toolkit/components/satchel/nsFormFillController.cpp
>+++ b/toolkit/components/satchel/nsFormFillController.cpp
>-    mFocusedInput->SetSelectionRange(aStartIndex, aEndIndex);
>+    mFocusedInput->SetSelectionRange(aStartIndex, aEndIndex, NS_LITERAL_STRING(""));

EmptyString()?
Comment on attachment 549127 [details] [diff] [review]
Patch (v2)

>+++ b/content/base/public/nsISelectionPrivate.idl
>+     * (The return value is an nsDirection, and should be casted back to one

s/casted/cast/

That said, I think something like this would work cleaner:

  native nsDirection(nsDirection);

up front in the IDL and then

  [noscript, notxpcom] nsDirection getSelectionDirection();
  [noscript, notxpcom] void setSelectionDirection(nsDirection aDirection);

for the actual declaration.  That will give your C++ the function signature:

  nsDirection GetSelectionDirection();

I believe.

r=me with that.
Attachment #549127 - Flags: review?(bzbarsky) → review+
I filed http://www.w3.org/Bugs/Public/show_bug.cgi?id=13411 to fix the wording of the selectionEnd setting part in the spec.
Attached patch Patch (v3)Splinter Review
Review comments addressed.
Attachment #549127 - Attachment is obsolete: true
Comment on attachment 549144 [details] [diff] [review]
Patch (v3)

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

::: js/src/xpconnect/src/dom_quickstubs.qsconf
@@ +257,5 @@
>      'nsIDOMHTMLInputElement.files',
>      'nsIDOMHTMLInputElement.textLength',
>      'nsIDOMHTMLInputElement.selectionStart',
>      'nsIDOMHTMLInputElement.selectionEnd',
> +    'nsIDOMHTMLInputElement.selectionDirection',

Can't we have nsIDOMHTMLInputElement.*

@@ +317,5 @@
>      'nsIDOMHTMLTextAreaElement.select',
>      'nsIDOMHTMLTextAreaElement.setSelectionRange',
>      'nsIDOMHTMLTextAreaElement.selectionStart',
>      'nsIDOMHTMLTextAreaElement.selectionEnd',
> +    'nsIDOMHTMLTextAreaElement.selectionDirection',

Same for nsIDOMHTMLTextAreaElement.
OS: Mac OS X → All
Hardware: x86 → All
http://hg.mozilla.org/mozilla-central/rev/e0c9fca2f500
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
(In reply to Mounir Lamouri (:volkmar) from comment #7)
> Comment on attachment 549144 [details] [diff] [review]
> Patch (v3)
> 
> Review of attachment 549144 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/xpconnect/src/dom_quickstubs.qsconf
> @@ +257,5 @@
> >      'nsIDOMHTMLInputElement.files',
> >      'nsIDOMHTMLInputElement.textLength',
> >      'nsIDOMHTMLInputElement.selectionStart',
> >      'nsIDOMHTMLInputElement.selectionEnd',
> > +    'nsIDOMHTMLInputElement.selectionDirection',
> 
> Can't we have nsIDOMHTMLInputElement.*
> 
> @@ +317,5 @@
> >      'nsIDOMHTMLTextAreaElement.select',
> >      'nsIDOMHTMLTextAreaElement.setSelectionRange',
> >      'nsIDOMHTMLTextAreaElement.selectionStart',
> >      'nsIDOMHTMLTextAreaElement.selectionEnd',
> > +    'nsIDOMHTMLTextAreaElement.selectionDirection',
> 
> Same for nsIDOMHTMLTextAreaElement.

I don't see why we can't.  Would you mind filing a bug for that?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: