The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in mozilla8

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

({dev-doc-complete, html5})

Trunk
mozilla8
dev-doc-complete, html5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

6 years ago
This is a new property for text controls which specifies the direction of the selection for text inputs and textareas.
(Assignee)

Updated

6 years ago
Assignee: nobody → ehsan
(Assignee)

Updated

6 years ago
Keywords: dev-doc-needed
(Assignee)

Comment 1

6 years ago
Created attachment 549027 [details] [diff] [review]
Patch (v1)
Attachment #549027 - Flags: review?(bzbarsky)
(Assignee)

Comment 2

6 years ago
Created attachment 549127 [details] [diff] [review]
Patch (v2)

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+
(Assignee)

Comment 5

6 years ago
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.
(Assignee)

Updated

6 years ago
(Assignee)

Comment 6

6 years ago
Created attachment 549144 [details] [diff] [review]
Patch (v3)

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
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Documentation updated:

https://developer.mozilla.org/en/HTML/Element/input
https://developer.mozilla.org/en/DOM/HTMLTextAreaElement
https://developer.mozilla.org/en/DOM/HTMLInputElement
https://developer.mozilla.org/en/DOM/Input.setSelectionRange
https://developer.mozilla.org/en/HTML/Element/textarea

And listed on Firefox 8 for developers.
Keywords: dev-doc-needed → dev-doc-complete
(Assignee)

Comment 10

6 years ago
(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.