Commit graph

91 commits

Author SHA1 Message Date
Gecko Backout
11c64178d8 Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00
Simon Sapin
b6bfdc982d Upgrade to rustc 1.22.0-nightly (c6884b12d 2017-09-30)
A new `AddAssign` impl in the standard library made inference ambiguous.
2017-10-01 14:54:59 +02:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
est31
28b854d724 Bring back clipboard support 2017-06-01 16:37:29 +02:00
Behnam Esfahbod
4df0ad2bc5 [script/textinput] Fix warning: unreachable pattern
The `cfg` attribute in use resulted in two match arms for two cases on
`macos`. Since both arms had a main functionality in common, I merged
them and conditions the extra `macos` part.

```
warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:696:13
    |
696 |             (None, Key::Home) => {
    |             ^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default

warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:700:13
    |
700 |             (None, Key::End) => {
    |             ^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default
```
2017-05-24 01:42:10 -05:00
bors-servo
e45546edf0 Auto merge of #15822 - charlesvdv:unicode-panic, r=emilio
Correct unicode handling for text input

<!-- Please describe your changes on the following line: -->
Allow proprer handling of unicode sequence in text input.

---
<!-- 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
- [x] These changes fix #15819

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15822)
<!-- Reviewable:end -->
2017-04-16 15:08:59 -05:00
Clement Miao
ea3c840983 new keyboard shortcuts inside text input 2017-04-07 01:05:13 -07:00
Charles Vandevoorde
26e6c09776 Correct unicode handling for text input 2017-03-05 13:58:33 +01:00
Jean-Marie Comets
319153640c Return KeyReaction::Nothing for a Tab event
Hitting the tab key in an html text input shouldn't submit the form, and
for any text input, the tab key should have a particular action
associated, not the default action. This cleans up #12701.
2016-11-12 15:49:00 +01:00
Taryn Hill
2cb5adf6c6 Implement minlength for text inputs 2016-09-21 07:54:39 -05:00
Connor Brewster
8e5d5a45ef Take selection direction into account when setting selection 2016-07-06 16:14:32 -06:00
Josh Matthews
6496d73210 Make textinput handle actual key values. Don't restrict character values to a single byte. 2016-07-06 00:10:24 -04:00
Josh Matthews
04ce86c08c Associate logical and physical keypresses together to support non-QWERTY keyboards. 2016-07-05 18:06:42 -04:00
Alan Jeffrey
7ed8408f12 Added checks that selection is valid, and fix set_selection_range. 2016-06-29 07:24:19 -05:00
Anthony Ramine
ff899dc703 Implement :placeholder-shown (fixes #10561) 2016-06-03 14:45:14 +02:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Matt Brubeck
c4872d9544 Replace range::Range with std::ops::Range in script 2016-04-28 14:54:07 -07:00
Alberto Corona
5e863f2eb8
Implement HTMLTextArea.setSelectionRange 2016-04-17 17:27:26 +02:00
Matt Brubeck
deca979967 TextInput::max_length should be in code units, not bytes 2016-04-02 07:33:53 -07:00
Matt Brubeck
29fb3f1150 Find the correct column index in adjust_vertical 2016-04-01 14:00:50 -07:00
Matt Brubeck
e17ed2e6b0 Add/correct documentation comments in textinput 2016-04-01 14:00:49 -07:00
Matt Brubeck
d7e6f8b0f1 Use correct byte indices in replace_selection 2016-04-01 13:54:02 -07:00
bors-servo
db95de6e58 Auto merge of #10182 - mbrubeck:delete_char, r=jdm
Fix delete_char when selection range is empty

An empty selection range should be treated the same as no selection.  Fixes browserhtml/browserhtml#930.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10182)
<!-- Reviewable:end -->
2016-03-28 20:43:11 +05:30
Matt Brubeck
db2c1841cb Fix delete_char when selection range is empty
An empty selection range should be treated the same as no selection.
Fixes browserhtml/browserhtml#930.
2016-03-25 08:39:53 -07:00
Matt Brubeck
6171000875 Highlight selected text in input fields
Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
2016-03-24 18:33:26 -07:00
Saurav Sachidanand
0b593759df Resets selection in textinput when its content is changed.
Adds a wpt test as well.
2016-03-16 22:20:22 +05:30
Saurav Sachidanand
a3d77790a6 Implement input.setSelectionRange 2016-03-10 19:54:21 +05:30
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Tetsuharu OHZEKI
e8c12c1c6d Fix warnings: Use Vec.extend_from_slice instead of Vec.push_all 2015-12-10 16:49:29 -05: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
Alan Jeffrey
5db67b5981 Added in-place mutation to DOMString.
The methods which are currently implemented are the ones on String that are currently being used:
string.push_str(...), string.clear() and string.extend(...). We may want to revisit this API.
2015-11-12 17:53:01 -06:00
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
Ms2ger
e6aa976462 Use DOMString::new() somewhat consistently. 2015-11-04 12:09:10 +01:00
Florian Merz
80e8a674e2 display input caret for textarea. fixes #7758 2015-10-21 22:38:23 +02:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Patrick Walton
34d9a6091b script: Ask layout to redraw the selection whenever the user moves the
caret in an input element.
2015-09-17 13:31:11 +02:00
Brandon Fairchild
d61a6e2161 Fix reported test-tidy errors
This fixes lines that were reported to have missing
space after a comma.
2015-09-01 16:30:42 -04:00
erneyja
17663315dd make test-tidy check that = have space after them 2015-09-01 07:18:19 -04:00
Simon Sapin
95a252a650 Refactor script::textinput to count UTF-8 bytes rather than code points. 2015-08-28 11:57:40 +02:00
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Manish Goregaokar
ac1b7a3896 Cleanup textinput, timers 2015-08-18 18:37:12 +05:30
Bogdan Cuza
45145108da Measure heap memory usage for more types. Fixes #6951 2015-08-13 21:44:41 +03:00
Jack Moffitt
dae1a398a4 Use local slice_chars
StrExt::slice_chars is deprecated and will be removed in Rust. This
lifts the implementation from Rust libstd and puts it in util::str.

This fixes a bunch of deprecation warnings in Servo.
2015-07-31 12:23:13 -06:00
Avi Weinstock
9ba18850dd Update rust-clipboard to the version with working set_contents. 2015-07-29 12:19:39 -04:00