Commit graph

48 commits

Author SHA1 Message Date
Martin Robinson
0e616e0c5d
api: Flatten and simplify Servo preferences (#34966)
Flatten and simplify Servo's preferences code. In addition, have both
preferences and options passed in as arguments to `Servo::new()` and
make sure not to use the globally set preferences in `servoshell` (as
much as possible now).

Instead of a complex procedural macro to generate preferences, just
expose a very simple derive macro that adds string based getters and
setters.

- All command-line parsing is moved to servoshell.
- There is no longer the concept of a missing preference.
- Preferences no longer have to be part of the resources bundle because
  they now have reasonable default values.
- servoshell specific preferences are no longer part of the preferences
  exposed by the Servo API.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 13:54:06 +00:00
shanehandley
8c1a72f130
Update webidl and implement setter for the files property of a file input (#31934)
The files attribute was previously readonly, but was later updated to allow mutation via input.files = ...

see https://github.com/whatwg/html/issues/2861
2024-04-01 09:12:07 +00:00
bors-servo
d5b910ee86
Auto merge of #29384 - sagudev:idl, r=jdm
Update WebIDL.py

Update WebIDL.py to latest version from mozilla-central.
There were two major changes:
- [Rename legacy extended attributes in webidls](55dac83d9a) [bug 1631581](https://bugzilla.mozilla.org/show_bug.cgi?id=1631581)
- [removal of ReadableStream from WebIDL](https://phabricator.services.mozilla.com/D143074), which was solved with porting reverted removal patch (2801cc82b0)

WebIDL.Parser now has `use_builtin_readable_streams` field by default set to `true` (to use SM readable stream implementation), which could help with #29088.

My try build: 4216638911

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2023-03-22 02:23:01 +01:00
2shiori17
247a4778ee Make HTMLInputElement.list an HTMLDataListElement
Signed-off-by: 2shiori17 <98276492+2shiori17@users.noreply.github.com>
2023-03-02 19:22:28 +09:00
sagudev
55dac83d9a Rename legacy extended attributes in webidls
https://github.com/whatwg/webidl/pull/870
2023-02-19 14:05:45 +01:00
Kagami Sascha Rosylight
52ea5204a2 Convert Web IDL void to undefined
Fixes #27660
2022-01-05 03:39:33 +01:00
teapotd
779552ee7d Form constraints validation 2020-04-02 10:16:46 +02:00
Patrick Shaughnessy
87e86c81b9 stepUp, stepDown, valueAsNumber, valueAsDate, and list work and have tests 2020-01-10 20:09:51 -05:00
Patrick Shaughnessy
036e8dabe2 Labels are a live list in tree order 2020-01-06 10:39:36 -05:00
Kagami Sascha Rosylight
e271edad92 Convert [HTMLConstructor] as constructor extension 2019-10-19 20:55:45 +09:00
Kagami Sascha Rosylight
2660f35925 Remove [PrimaryGlobal] 2019-10-03 14:25:23 +09:00
Manish Goregaokar
7b48df53a1 Update WebIDL.py to 4166cae81546
4166cae815

Pulls in changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1359269
2019-03-04 14:03:31 +05:30
Dan Robertson
c46508e497
Update src/href attributes to be a USVString
The following IDLs have the src/href attributes typed as a DOMString
while in the spec the attribute has been updated to be a USVString:

 - HTMLIFrameElement
 - HTMLImageElement
 - HTMLInputElement
 - HTMLLinkElement
 - HTMLMediaElement
 - HTMLScriptElement
2018-12-17 15:28:42 +00:00
Jan Andre Ikenmeyer
6b0c111126
Update MPL license to https (part 2) 2018-11-19 14:46:57 +01:00
Jon Leighton
ce7bae8834 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.)
2018-01-26 20:12:33 +01:00
Jon Leighton
0148e9705b Support the select() method on input/textarea
Issue #19171
2018-01-26 19:50:45 +01:00
Jon Leighton
71a013dd50 Handle cases where selection API doesn't apply
The selection API only applies to certain <input> 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 <input>'s type is unset, it defaults to a text, and the
   selection API applies. Also, if an <input>'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.
2017-12-08 21:07:05 +01:00
Connor Brewster
2460997ee1 Add CEReactions where needed 2017-07-18 12:22:20 -06:00
Connor Brewster
d951dee640 Add HTMLConstructor attributes where needed 2017-06-15 21:16:57 -06:00
Taryn Hill
2cb5adf6c6 Implement minlength for text inputs 2016-09-21 07:54:39 -05:00
Maciej Skrzypkowski
9fa6d5083c Partial fix for #12415: expose interfaces of some HTML Elements 2016-07-28 14:38:47 +02:00
Ms2ger
ed743bb50c Explicitly expose everything everywhere. 2016-07-12 13:06:48 +02:00
Zhen Zhang
5e051c08f6 Add ability to WPT-test file uploads and fetches, fixes #12322 2016-07-09 15:31:00 +08:00
Zhen Zhang
6ca531fb8f Fix file-type input element 2016-06-30 14:18:11 +08:00
edunham
7ae63b1213 Remove modelines everywhere but tests/wpt 2016-04-20 10:49:09 -07:00
Arnaud Marant
9b8f183cba Issue #10491 add HTMLInputElement attributes that reflect content identically
it uses a new version of string-cache https://github.com/servo/string-cache/pull/148
2016-04-12 00:15:57 +02:00
Saurav Sachidanand
a3d77790a6 Implement input.setSelectionRange 2016-03-10 19:54:21 +05:30
Greg Guthe
e6c31e305d Get input value IDL attribute matching spec
Refs: https://github.com/servo/servo/issues/9455
2016-02-25 18:59:34 -05:00
Keith Yeung
3395e54585 Implement basic framework for static and interactive validation on forms 2015-12-15 16:34:42 -08:00
Sam Gibson
9668500e97 Makes setting negative values to maxLength throw an IndexSize exception 2015-12-03 14:00:59 +11:00
Sam Gibson
d26c555e2a Adds support for input element's maxlength attr
servo/servo#7320
servo/servo#7004
2015-12-03 14:00:51 +11:00
Corey Farwell
9df375195e Implement 'labels' attribute on 'labelable elements' 2015-11-01 09:50:14 -05:00
Corey Farwell
9b68d715de Explicitly place '/' before fragment for multipage spec links
This prevents us from 301 redirecting, which could cause the fragment to
get lost
2015-10-10 12:07:10 -04:00
Corey Farwell
85f2b6fc5b Replace usage of old-style WHATWG spec links 2015-10-10 11:55:09 -04:00
Manish Goregaokar
b677f0f4ae Add form getter for input/button elements; update test expectations 2015-09-24 11:58:24 +05:30
Corey Farwell
9415c92a5c Clean up whitespace, long lines for WebIDLs 2015-07-26 22:12:10 +07:00
Anthony Ramine
fedad2af1f Improve support of limited unsigned long attributes 2015-05-06 20:18:08 +02:00
Corey Farwell
5eaa922045 Update WHATWG links to use HTTPS
Extracted this out of #5649

This commit was created with the following commands:

```
find . -iname "*.webidl" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```

```
find . -iname "*.rs" -type f -print0 | xargs -0 sed -i '' 's/http:\(.*\)whatwg.org/https:\1whatwg.org/g'
```
2015-04-13 21:34:27 -07:00
Mikko Vanhatalo
29387f6c4c Implemented HTMLInputElement placeholder attribute
+ modified HTMLInputElement.webidl to include placeholder
+ modified placeholder test expectations
2015-04-04 14:44:32 +03:00
Matthew Rasmus
38e4d86b14 Implements DefaultChecked and resets of checkboxes 2014-12-16 11:34:04 -08:00
Matthew Rasmus
f932a6947a Implements HTMLInputElement.defaultValue
...and changes SetValue to update the input text instead of the content
attr.

Also includes a comment summarizing everything I currently know with
respect to an input elements checkedness vs its IDL attributes vs its
content attributes.
2014-12-16 11:06:56 -08:00
Manish Goregaokar
14a6e54371 Move InputCheckbox to Activatable 2014-12-05 18:32:13 -08:00
Manish Goregaokar
7d51a543d8 Implement form control mutability, rename FormOwner -> FormControl 2014-12-05 18:32:11 -08:00
Rohan Prinja
05134e6d1f Add form submission via input element 2014-10-14 21:24:36 +05:30
Manish Goregaokar
76219df816 Address review comments 2014-10-11 16:10:02 +05:30
Manish Goregaokar
8a2c746e61 Add type IDL attr for submittable elements 2014-10-11 09:48:15 +05:30
Josh Matthews
f70bb68503 Implement simple layout for text, button, radio, and checkbox inputs. Implement simple interaction for checkboxes and radio buttons. 2014-10-01 15:35:42 -04:00
Jack Moffitt
c6ab60dbfc Cargoify servo 2014-09-08 20:21:42 -06:00
Renamed from src/components/script/dom/webidls/HTMLInputElement.webidl (Browse further)