Commit graph

7052 commits

Author SHA1 Message Date
Nupur Baghel
a1fd6c39a2 Added extra bool in Window object to know about its Mutation Observers 2018-02-16 21:52:29 +05:30
bors-servo
b1d3d6f632
Auto merge of #19975 - paulrouget:killbhtml, r=mbrubeck,emilio
Kill browserhtml

Fixes https://github.com/servo/servo/issues/19971

<!-- 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/19975)
<!-- Reviewable:end -->
2018-02-13 04:54:47 -05:00
bors-servo
9e64008e75
Auto merge of #19754 - ferjm:innertext, r=mbrubeck
Implement element.innerText getter

<!-- 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/19754)
<!-- Reviewable:end -->
2018-02-13 03:41:48 -05:00
Paul Rouget
da349ee8a9 remove mozbrowser code 2018-02-13 09:40:06 +01:00
Fernando Jiménez Moreno
2a4535f43e Implement element.innerText getter 2018-02-13 09:12:00 +01:00
bors-servo
62e1fc7899
Auto merge of #19963 - paavininanda:Issue#19958, r=<try>
Correct default SelectionStart and SelectionEnd

<!-- Please describe your changes on the following line: -->

---
<!-- 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] Added unit tests and wpt for these changes
- [x] These changes fix #19958

<!-- 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. -->

<!-- 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/19963)
<!-- Reviewable:end -->
2018-02-12 11:56:27 -05:00
Paul Rouget
e7c754fb64 remove forcetouch support 2018-02-11 08:02:39 +01:00
paavininanda
b2c1f89b93 Correct default Selectionstart and SelectionEnd 2018-02-10 17:46:29 +05:30
Emilio Cobos Álvarez
f1516d228f
style: Rename StylesheetSet to DocumentStylesheetSet.
MozReview-Commit-ID: 5Xl1eRLu1VF
2018-02-09 13:27:30 +01:00
bors-servo
7e501f50f7
Auto merge of #19972 - paavininanda:Issue16483, r=jdm
replaced content_type from DOCString to Mime

Replaced content_type from DomString to Mime

---
<!-- 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 #16483 (https://github.com/servo/servo/issues/16483).

<!-- Either: -->
- [x] These changes do not require tests because they make changes to already existing files

<!-- 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. -->

<!-- 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/19972)
<!-- Reviewable:end -->
2018-02-09 05:02:19 -05:00
Nupur Baghel
d02422408e Updated content_type of Document and XMLDocument from DOCString to Mime 2018-02-09 09:32:56 +05:30
bors-servo
5d209a70ab
Auto merge of #19970 - janczer:change_debug_assertions, r=emilio
Change debug assertions to specific ones

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #19962 (github issue number if applicable).

<!-- 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. -->

<!-- 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/19970)
<!-- Reviewable:end -->
2018-02-07 06:20:36 -05:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00
bors-servo
36eb711d3b
Auto merge of #19946 - paavininanda:Issue18613, r=jdm
Change Offset_to_text_point function and add unit tests

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #18613.

<!-- Either: -->
- [x] Added unit tests and web platform tests

<!-- 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. -->

<!-- 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/19946)
<!-- Reviewable:end -->
2018-02-06 15:11:54 -05:00
paavininanda
7b58fb5fdd Changed offset_to_text_point function and added unit tests for the same 2018-02-07 01:18:50 +05:30
Martin Robinson
99eb457fc7 Update WebRender
This allows servo to use the ExternalScrollId API from WebRender fixing
some issues related to duplicate scroll root ids.

Fixes #17176.
Fixes #19287.
Fixes #19648.
2018-02-06 15:10:35 +01:00
CJ Ku
174f5f7128 Implement scale property styling 2018-01-31 22:12:34 +00:00
CJ Ku
de3e8c9a8b Implement translate property styling 2018-01-31 22:12:33 +00:00
CJ Ku
62c0c6feee Implement rotate property styling 2018-01-31 22:12:26 +00:00
bors-servo
ff54a58694 Auto merge of #19909 - jonleighton:refactor-textcontrol, r=jdm
Refactor implementation of TextControl

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

https://github.com/servo/servo/pull/19544#discussion_r156167044

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? @jdm and @KiChjang

<!-- 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/19909)
<!-- Reviewable:end -->
2018-01-31 09:46:48 -06:00
Connor Brewster
198ea8f767 Implement initial part of history.state 2018-01-30 14:12:37 -06:00
Jon Leighton
0461681818 Refactor implementation of TextControl
The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

https://github.com/servo/servo/pull/19544#discussion_r156167044

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.
2018-01-30 20:11:08 +01:00
Rakhi Sharma
d47ce855ce Implement HTMLPictureElement interface. 2018-01-29 20:27:54 -05:00
bors-servo
82922c97dc Auto merge of #19878 - emilio:slotted-slot, r=nox
selectors: Never match ::slotted on <slot>s.

This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.

<!-- 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/19878)
<!-- Reviewable:end -->
2018-01-29 11:45:11 -06:00
CYBAI
37802dfd19 script: Move style as Element method 2018-01-28 23:47:39 +08:00
bors-servo
2a46067587 Auto merge of #19881 - jonleighton:issue-19811, r=emilio
Add layout RPC query for getting an element's style

This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes #19811.

r? @emilio

<!-- 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/19881)
<!-- Reviewable:end -->
2018-01-28 05:52:56 -06:00
Jon Leighton
fe583fc5d0 Add layout RPC query for getting an element's style
This enables us to implement Element::has_css_layout_box() in a more
direct way, and also enables us to remove some of the existing more
specific queries.

Fixes #19811.
2018-01-28 10:59:45 +01:00
Emilio Cobos Álvarez
61e60a87e5
selectors: Never match ::slotted on <slot>s.
This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.
2018-01-27 17:57:17 +01:00
bors-servo
c2dfece49f Auto merge of #19544 - jonleighton:issue-19171-5, r=nox
Text selection API conformance

This is my next batch of changes for issue #19171. All the tests in tests/wpt/metadata/html/semantics/forms/textfieldselection/ are now passing (and also some tests outside of there).

I've made detailed notes about the changes in each commit message.

r? @KiChjang

<!-- 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/19544)
<!-- Reviewable:end -->
2018-01-26 13:58:01 -06:00
Jon Leighton
a8b64aca2a Steps 7-9 of the input type change algorithm
Spec: https://html.spec.whatwg.org/multipage/input.html#input-type-change

In short, this resets the selection to the start of the field when the
type has changed from one which doesn't support the selection API to one
that does.

I couldn't see an existing WPT test covering this.
2018-01-26 20:12:38 +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
e34f7c58c9 Don't fire select event when selection hasn't changed 2018-01-26 19:50:53 +01:00
Jon Leighton
648bfbeb02 Fix clearing the selection when value is changed
The implementation of adjust_horizontal_to_limit() is written with UI in
mind. As such, when there's a selection and we "adjust horizontal", the
selection will be cleared and the cursor will and up at the start/end of
the previous selection. This is what happens when you have a selection
and you press an arrow key on your keyboard, but it isn't the behaviour
we want when programmatically changing the value.

Instead, we need to first clear the selection, and then move the cursor
to the end. (We also need to reset the selection direction when clearing
the selection.)
2018-01-26 19:50:52 +01:00
Jon Leighton
02883a6f54 Fix selection{Start,End} when selectionDirection is "backward"
Per the spec, selectionStart and selectionEnd should return the same
values regardless of the selectionDirection. (That is, selectionStart is
always less than or equal to selectionEnd; the direction then implies
which of selectionStart or selectionEnd is the cursor position.)

There was no explicit WPT test for this, so I added one.

This bug was initially quite hard to wrap my head around, and I think
part of the problem is the code in TextInput. Therefore, in the process
of fixing it I have refactored the implementation of TextInput:

* Rename selection_begin to selection_origin. This value doesn't
  necessarily correspond directly to the selectionStart DOM value - in
  the case of a backward selection, it corresponds to selectionEnd.
  I feel that "origin" doesn't imply a specific ordering as strongly as
  "begin" (or "start" for that matter) does.

* In various other cases where "begin" is used as a synonym for "start",
  just use "start" for consistency.

* Implement selection_start() and selection_end() methods (and their
  _offset() variants) which directly correspond to their DOM
  equivalents.

* Rename other related methods to make them less wordy and more
  consistent / intention-revealing.

* Add assertions to assert_ok_selection() to ensure that our assumptions
  about the ordering of selection_origin and edit_point are met. This
  then revealed a bug in adjust_selection_for_horizontal_change() where
  the value of selection_direction was not maintained correctly (causing
  a unit test failure when the new assertion failed).
2018-01-26 19:50:50 +01:00
Jon Leighton
0148e9705b Support the select() method on input/textarea
Issue #19171
2018-01-26 19:50:45 +01:00
Anthony Ramine
31a14082eb Make JSTraceable for DomRefCell<T> panic if cell is mutably borrowed (see #19871) 2018-01-26 10:12:40 +01:00
bors-servo
c9ba16f9fb Auto merge of #19868 - CYBAI:specific-assertion, r=emilio
Use specific assertions

Similar to #19865
r? jdm

Note: Should I squash all the commits into one commit?

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it should not break anything

<!-- 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/19868)
<!-- Reviewable:end -->
2018-01-25 18:06:33 -06:00
CYBAI
5104d2947f Use specific negative assertion for DOM XMLHttpRequest 2018-01-26 02:23:49 +08:00
CYBAI
2a17230623 Use specific negative assertion for DOM Window Proxy 2018-01-26 02:23:39 +08:00
CYBAI
f372bc0f40 Use specific negative assertion for DOM HTMLCollection 2018-01-26 02:11:02 +08:00
CYBAI
1ba2b67b00 Use specific negative assertion for DOM globalscope 2018-01-26 02:08:11 +08:00
CYBAI
5475059df7 Use specific negative assertion for DOM document 2018-01-26 02:07:47 +08:00
CYBAI
1f9ce9e5d7 Use specific negative assertion for DOM bindings utils 2018-01-26 02:07:27 +08:00
CYBAI
40e40e0f8b Use specific assertion for DOM XMLHttpRequest 2018-01-26 01:18:58 +08:00
CYBAI
15a1faff03 Use specific assertion for DOM webgl shader 2018-01-26 01:18:58 +08:00
CYBAI
9a358014f9 Use specific assertion for DOM servoparser 2018-01-26 01:18:57 +08:00
CYBAI
0e6f446a61 Use specific assertion for DOM servoparser async_html 2018-01-26 01:18:56 +08:00
CYBAI
5486335708 Use specific assertion for DOM create 2018-01-26 01:18:56 +08:00
CYBAI
9ee27d62ae Use specific assertion for DOM binding refcounted 2018-01-26 01:18:55 +08:00
CYBAI
1c31370a08 Use specific assertion for DOM binding interface 2018-01-26 01:18:55 +08:00