Last Comment Bug 674558 - Implement the HTML5 selectionDirection property for text controls (input and textarea)
: Implement the HTML5 selectionDirection property for text controls (input and ...
Status: RESOLVED FIXED
: dev-doc-complete, html5
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla8
Assigned To: :Ehsan Akhgari (busy, don't ask for review please)
:
Mentors:
http://www.whatwg.org/specs/web-apps/...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-27 09:03 PDT by :Ehsan Akhgari (busy, don't ask for review please)
Modified: 2011-09-07 09:23 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (v1) (33.37 KB, patch)
2011-07-27 22:53 PDT, :Ehsan Akhgari (busy, don't ask for review please)
no flags Details | Diff | Review
Patch (v2) (34.18 KB, patch)
2011-07-28 08:46 PDT, :Ehsan Akhgari (busy, don't ask for review please)
bzbarsky: review+
Details | Diff | Review
Patch (v3) (34.63 KB, patch)
2011-07-28 09:33 PDT, :Ehsan Akhgari (busy, don't ask for review please)
no flags Details | Diff | Review

Description :Ehsan Akhgari (busy, don't ask for review please) 2011-07-27 09:03:35 PDT
This is a new property for text controls which specifies the direction of the selection for text inputs and textareas.
Comment 1 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-27 22:53:38 PDT
Created attachment 549027 [details] [diff] [review]
Patch (v1)
Comment 2 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-28 08:46:13 PDT
Created attachment 549127 [details] [diff] [review]
Patch (v2)

Fixed a bug, and also added a couple of more tests.
Comment 3 :Ms2ger 2011-07-28 09:01:51 PDT
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 4 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-07-28 09:08:23 PDT
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.
Comment 5 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-28 09:08:50 PDT
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.
Comment 6 :Ehsan Akhgari (busy, don't ask for review please) 2011-07-28 09:33:09 PDT
Created attachment 549144 [details] [diff] [review]
Patch (v3)

Review comments addressed.
Comment 7 Mounir Lamouri (:mounir) 2011-07-28 15:04:45 PDT
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.
Comment 8 Marco Bonardo [::mak] 2011-07-29 03:07:58 PDT
http://hg.mozilla.org/mozilla-central/rev/e0c9fca2f500
Comment 10 :Ehsan Akhgari (busy, don't ask for review please) 2011-09-07 09:23:23 PDT
(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?

Note You need to log in before you can comment on or make changes to this bug.