From d951dee6401f7ff201ccadf0d322aba45275ff42 Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Wed, 7 Jun 2017 22:53:50 -0600 Subject: Add HTMLConstructor attributes where needed --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 1 + 1 file changed, 1 insertion(+) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index f92e662c354..8f93a83cbd6 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // https://html.spec.whatwg.org/multipage/#htmltextareaelement +[HTMLConstructor] interface HTMLTextAreaElement : HTMLElement { // attribute DOMString autocomplete; // attribute boolean autofocus; -- cgit v1.2.3 From 2460997ee18917bda1cdb68e46b7fd5520c3ade7 Mon Sep 17 00:00:00 2001 From: Connor Brewster Date: Mon, 10 Jul 2017 14:47:03 -0600 Subject: Add CEReactions where needed --- .../script/dom/webidls/HTMLTextAreaElement.webidl | 55 +++++++++++++--------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 8f93a83cbd6..2e2e1288559 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -5,44 +5,57 @@ // https://html.spec.whatwg.org/multipage/#htmltextareaelement [HTMLConstructor] interface HTMLTextAreaElement : HTMLElement { - // attribute DOMString autocomplete; - // attribute boolean autofocus; - [SetterThrows] - attribute unsigned long cols; - // attribute DOMString dirName; + // [CEReactions] + // attribute DOMString autocomplete; + // [CEReactions] + // attribute boolean autofocus; + [CEReactions, SetterThrows] + attribute unsigned long cols; + // [CEReactions] + // attribute DOMString dirName; + [CEReactions] attribute boolean disabled; readonly attribute HTMLFormElement? form; - // attribute DOMString inputMode; - // attribute long maxLength; - // attribute long minLength; + // [CEReactions] + // attribute DOMString inputMode; + // [CEReactions] + // attribute long maxLength; + // [CEReactions] + // attribute long minLength; attribute DOMString name; + [CEReactions] attribute DOMString placeholder; + [CEReactions] attribute boolean readOnly; + [CEReactions] attribute boolean required; - [SetterThrows] + [CEReactions, SetterThrows] attribute unsigned long rows; + [CEReactions] attribute DOMString wrap; readonly attribute DOMString type; + [CEReactions] attribute DOMString defaultValue; - [TreatNullAs=EmptyString] attribute DOMString value; - //readonly attribute unsigned long textLength; + [CEReactions,TreatNullAs=EmptyString] + attribute DOMString value; + // readonly attribute unsigned long textLength; - //readonly attribute boolean willValidate; - //readonly attribute ValidityState validity; - //readonly attribute DOMString validationMessage; - //boolean checkValidity(); - //boolean reportValidity(); - //void setCustomValidity(DOMString error); + // readonly attribute boolean willValidate; + // readonly attribute ValidityState validity; + // readonly attribute DOMString validationMessage; + // boolean checkValidity(); + // boolean reportValidity(); + // void setCustomValidity(DOMString error); readonly attribute NodeList labels; - //void select(); + // void select(); attribute unsigned long selectionStart; attribute unsigned long selectionEnd; attribute DOMString selectionDirection; - //void setRangeText(DOMString replacement); - //void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - // optional SelectionMode selectionMode = "preserve"); + // void setRangeText(DOMString replacement); + // void setRangeText(DOMString replacement, unsigned long start, unsigned long end, + // optional SelectionMode selectionMode = "preserve"); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); }; -- cgit v1.2.3 From 71a013dd5018294f507c7047ca0d4fd700b555f1 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sat, 2 Dec 2017 10:53:50 +0100 Subject: Handle cases where selection API doesn't apply The selection API only applies to certain types: https://html.spec.whatwg.org/multipage/#do-not-apply This commit ensures that we handle that correctly. Some notes: 1. TextControl::set_dom_selection_direction now calls set_selection_range(), which means that setting selectionDirection will now fire a selection event, as it should per the spec. 2. There is a test for the firing of the select event in tests/wpt/web-platform-tests/html/semantics/forms/textfieldselection/select-event.html, however the test did not run due to this syntax error: (pid:26017) "ERROR:script::dom::bindings::error: Error at http://web-platform.test:8000/html/semantics/forms/textfieldselection/select-event.html:50:11 missing = in const declaration" This happens due to the us of the "for (const foo of ...)" construct. Per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of this should actually work, so it's somewhat unsatisfying to have to change the test. 4. If an 's type is unset, it defaults to a text, and the selection API applies. Also, if an 's type is set to an invalid value, it defaults to a text too. I've expanded the tests to account for this second case. --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 2e2e1288559..f0e8a0be118 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -51,11 +51,15 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute NodeList labels; // void select(); - attribute unsigned long selectionStart; - attribute unsigned long selectionEnd; - attribute DOMString selectionDirection; + [SetterThrows] + attribute unsigned long? selectionStart; + [SetterThrows] + attribute unsigned long? selectionEnd; + [SetterThrows] + attribute DOMString? selectionDirection; // void setRangeText(DOMString replacement); // void setRangeText(DOMString replacement, unsigned long start, unsigned long end, // optional SelectionMode selectionMode = "preserve"); - void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); + [Throws] + void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); }; -- cgit v1.2.3 From 0148e9705b9e6dad41dd1895313c57f2acca3c56 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 7 Dec 2017 13:58:24 +0100 Subject: Support the select() method on input/textarea Issue #19171 --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index f0e8a0be118..c02cc5730a4 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -50,7 +50,7 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute NodeList labels; - // void select(); + void select(); [SetterThrows] attribute unsigned long? selectionStart; [SetterThrows] -- cgit v1.2.3 From ce7bae8834c0e89c57072ec1ddfa43efa5fe6f4e Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Mon, 11 Dec 2017 15:57:18 +0100 Subject: Implement setRangeText API Spec: https://html.spec.whatwg.org/multipage/#dom-textarea/input-setrangetext In order to do this, we need to define the SelectionMode enum in WebIDL: https://html.spec.whatwg.org/multipage/#selectionmode Since the enum is used by HTMLTextAreaElement and HTMLInputElement, it doesn't seem to make sense to define it in the WebIDL file for one or other of those. However, we also can't create a stand-alone SelectionMode.webidl file, because the current binding-generation code won't generate a "pub mod SelectionMode;" line in mod.rs unless SelectionMode.webidl contains either an interface or a namespace. (This logic happens in components/script/dom/bindings/codegen/Configuration.py:35, in the Configuration.__init__ method.) I thought about changing the binding-generation code, but that seems difficult. So I settled for placing the enum inside HTMLFormElement.webidl, as that seems like a "neutral" location. We could equally settle for putting it under HTMLTextAreaElement or HTMLInputElement, it probably doesn't really matter. The setRangeText algorithm set the "dirty value flag" on the input/textarea. I made some clean-ups related to this: 1. HTMLTextAreaElement called its dirty value flag "value_changed"; I changed this to "value_dirty" to be consistent with the spec. 2. HTMLInputElement had a "value_changed" field and also a "value_dirty" field, which were each used in slightly different places (and sometimes in both places). I consolidated these into a single "value_dirty" field, which was necessary in order to make some of the tests pass. TextControl::set_dom_range_text replaces part of the existing textinput content with the replacement string (steps 9-10 of the algorithm). My implementation changes the textinput's selection and then replaces the selection. A downside of this approach is that we lose the original selection state from before the call to setRangeText. Therefore, we have to save the state into the original_selection_state variable so that we can later pass it into TextControl::set_selection_range. This allows TextControl::set_selection_range to correctly decide whether or not to fire the select event. An alternative approach would be to implement a method on TextInput which allows a subtring of the content to be mutated, without touching the current selection state. However, any such method would potentially put the TextInput into an inconsistent state where the edit_point and/or selection_origin is a TextPoint which doesn't exist in the content. It would be up to the caller to subsequently make sure that the TextInput gets put back into a valid state (which would actually happen, when TextControl::set_selection_range is called). I think TextInput's public API should not make it possible to put it into an invalid state, as that would be a potential source of bugs. That's why I didn't take this approach. (TextInput's public API does currently make it possible to create an invalid state, but I'd like to submit a follow-up patch to lock this down.) --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index c02cc5730a4..3ff20242bfe 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -57,9 +57,11 @@ interface HTMLTextAreaElement : HTMLElement { attribute unsigned long? selectionEnd; [SetterThrows] attribute DOMString? selectionDirection; - // void setRangeText(DOMString replacement); - // void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - // optional SelectionMode selectionMode = "preserve"); + [Throws] + void setRangeText(DOMString replacement); + [Throws] + void setRangeText(DOMString replacement, unsigned long start, unsigned long end, + optional SelectionMode selectionMode = "preserve"); [Throws] void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); }; -- cgit v1.2.3 From 0907940db85f49541b1caa7581027ea0c02413aa Mon Sep 17 00:00:00 2001 From: tigercosmos Date: Thu, 14 Jun 2018 10:52:06 -0700 Subject: add TextLength --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 3ff20242bfe..f8f52c82b92 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -39,7 +39,7 @@ interface HTMLTextAreaElement : HTMLElement { attribute DOMString defaultValue; [CEReactions,TreatNullAs=EmptyString] attribute DOMString value; - // readonly attribute unsigned long textLength; + readonly attribute unsigned long textLength; // readonly attribute boolean willValidate; // readonly attribute ValidityState validity; -- cgit v1.2.3 From bdb6706f19167890aef895e5aa04bccc9de3695f Mon Sep 17 00:00:00 2001 From: tigercosmos Date: Sun, 17 Jun 2018 06:33:22 -0700 Subject: textarea minLength/maxLength --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index f8f52c82b92..3839be24f5e 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -18,10 +18,10 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute HTMLFormElement? form; // [CEReactions] // attribute DOMString inputMode; - // [CEReactions] - // attribute long maxLength; - // [CEReactions] - // attribute long minLength; + [CEReactions, SetterThrows] + attribute long maxLength; + [CEReactions, SetterThrows] + attribute long minLength; attribute DOMString name; [CEReactions] attribute DOMString placeholder; -- cgit v1.2.3 From 6d3ff9f742d7c79ff5997cf6b06d194565cffb6d Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 13 Aug 2018 11:16:46 -0400 Subject: Remove unnecessary CEReactions. This incorporates a spec update in https://github.com/whatwg/html/pull/3901. --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 3839be24f5e..46c88f6cbac 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -37,7 +37,7 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute DOMString type; [CEReactions] attribute DOMString defaultValue; - [CEReactions,TreatNullAs=EmptyString] + [TreatNullAs=EmptyString] attribute DOMString value; readonly attribute unsigned long textLength; -- cgit v1.2.3 From 6b0c111126f94174274b5fd8c9a1c6d3b378f738 Mon Sep 17 00:00:00 2001 From: Jan Andre Ikenmeyer Date: Mon, 19 Nov 2018 14:46:57 +0100 Subject: Update MPL license to https (part 2) --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 46c88f6cbac..24051f9f194 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -1,6 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://html.spec.whatwg.org/multipage/#htmltextareaelement [HTMLConstructor] -- cgit v1.2.3 From 7b48df53a142507f6f11b9645b605be816db5ab1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 2 Mar 2019 11:48:31 +0530 Subject: Update WebIDL.py to 4166cae81546 https://hg.mozilla.org/integration/autoland/rev/4166cae81546f54accae807413f806d20bf30920 Pulls in changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1359269 --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 24051f9f194..396c994e5ea 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -37,8 +37,7 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute DOMString type; [CEReactions] attribute DOMString defaultValue; - [TreatNullAs=EmptyString] - attribute DOMString value; + attribute [TreatNullAs=EmptyString] DOMString value; readonly attribute unsigned long textLength; // readonly attribute boolean willValidate; -- cgit v1.2.3 From 2660f359254e7543b7c91d14728b44ac01e438e5 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 2 Oct 2019 18:21:34 +0900 Subject: Remove [PrimaryGlobal] --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 396c994e5ea..88c69ef19aa 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://html.spec.whatwg.org/multipage/#htmltextareaelement -[HTMLConstructor] +[Exposed=Window, HTMLConstructor] interface HTMLTextAreaElement : HTMLElement { // [CEReactions] // attribute DOMString autocomplete; -- cgit v1.2.3 From e271edad927c6cfb304e9df8719d7ed5fe0309f9 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 19 Oct 2019 20:26:20 +0900 Subject: Convert [HTMLConstructor] as constructor extension --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 88c69ef19aa..d14eacfd99d 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -3,8 +3,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // https://html.spec.whatwg.org/multipage/#htmltextareaelement -[Exposed=Window, HTMLConstructor] +[Exposed=Window] interface HTMLTextAreaElement : HTMLElement { + [HTMLConstructor] constructor(); + // [CEReactions] // attribute DOMString autocomplete; // [CEReactions] -- cgit v1.2.3 From f29e22f131291ed1bcd581cb9be6807c66c1534e Mon Sep 17 00:00:00 2001 From: Patrick Shaughnessy Date: Tue, 21 Jan 2020 11:06:31 -0500 Subject: Names should now be consistently atoms --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 1 + 1 file changed, 1 insertion(+) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index d14eacfd99d..99cf18e0c10 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -24,6 +24,7 @@ interface HTMLTextAreaElement : HTMLElement { attribute long maxLength; [CEReactions, SetterThrows] attribute long minLength; + [CEReactions] attribute DOMString name; [CEReactions] attribute DOMString placeholder; -- cgit v1.2.3 From 7d6d1c09cb4227cef3662d6e72a72fd634f3fc73 Mon Sep 17 00:00:00 2001 From: Dmitry Kolupaev Date: Sun, 16 Feb 2020 00:15:24 +0300 Subject: Rearrange directionality algorithm functions --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index 99cf18e0c10..b09200f1dc5 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -13,8 +13,8 @@ interface HTMLTextAreaElement : HTMLElement { // attribute boolean autofocus; [CEReactions, SetterThrows] attribute unsigned long cols; - // [CEReactions] - // attribute DOMString dirName; + [CEReactions] + attribute DOMString dirName; [CEReactions] attribute boolean disabled; readonly attribute HTMLFormElement? form; -- cgit v1.2.3 From 779552ee7ddbbde1055c7202e16b9a13c3961988 Mon Sep 17 00:00:00 2001 From: teapotd Date: Wed, 1 Apr 2020 11:08:02 +0200 Subject: Form constraints validation --- components/script/dom/webidls/HTMLTextAreaElement.webidl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'components/script/dom/webidls/HTMLTextAreaElement.webidl') diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl index b09200f1dc5..b726946bc48 100644 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ b/components/script/dom/webidls/HTMLTextAreaElement.webidl @@ -43,12 +43,12 @@ interface HTMLTextAreaElement : HTMLElement { attribute [TreatNullAs=EmptyString] DOMString value; readonly attribute unsigned long textLength; - // readonly attribute boolean willValidate; - // readonly attribute ValidityState validity; - // readonly attribute DOMString validationMessage; - // boolean checkValidity(); - // boolean reportValidity(); - // void setCustomValidity(DOMString error); + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + void setCustomValidity(DOMString error); readonly attribute NodeList labels; -- cgit v1.2.3