Commit graph

3697 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
c3786437a3 script: Fix mouseover/mouseout dispatching. 2016-03-02 20:01:41 +01:00
Emilio Cobos Álvarez
b1f0581637 script: Fix MouseOver handling
Now we only query for the topmost node, and apply the hover state to all
of the parent elements.

This fixes things like #9705, where the hover state was applied only to
the children.

This also makes us more conformant with other browsers in the case of
taking in account margins and paddings.

For example, prior to this PR, when your mouse was over the inner
element, in the bottom part, `hover` styles didn't apply to the parent.

```html
<style>
div {
  padding: 10px;
  margin: 10px;
  height: 15px;
  background: blue;
}

div:hover {
  background: red;
}
</style>

<div>
  <div></div>
</div>
```

Fixes #9705
2016-03-02 20:01:41 +01:00
bors-servo
9ceda7de50 Auto merge of #9837 - nox:deterministic-raf, r=mbrubeck
Use a BTreeMap for Document::animation_frame_list (fixes #9834)

The callbacks must stay ordered.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9837)
<!-- Reviewable:end -->
2016-03-02 21:24:38 +05:30
Anthony Ramine
1d87f61350 Use a BTreeMap for Document::animation_frame_list (fixes #9834)
The callbacks must stay ordered.
2016-03-02 16:53:06 +01:00
Ulf Nilsson
8c07a1a3af Use piston_image instead of stb_image for decoding JPEGs
Bump image to 0.7
2016-03-02 09:13:49 +01:00
bors-servo
f895f87197 Auto merge of #9823 - gmalecha:canvas-rendering-context-2d-update-idl, r=jdm
updating the CanvasRenderingContext2D to match the spec

- fixes #9443

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9823)
<!-- Reviewable:end -->
2016-03-02 04:32:26 +05:30
Gregory Malecha
2c6636129d updating the CanvasRenderingContext2D to match the spec
- fixes #9443
2016-03-01 08:13:50 -08:00
Ms2ger
549f2669f0 Stop generating a parser.out file in the source. 2016-03-01 15:02:50 +01:00
bors-servo
00628704ca Auto merge of #9763 - Tangresh:i9725, r=nox
Implement value for DOMTokenList

Fixes #9725

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9763)
<!-- Reviewable:end -->
2016-03-01 08:34:21 +05:30
bors-servo
4bcdbe6d56 Auto merge of #8932 - rilut:add-elementfrompoint, r=nox
Implement Document#elementFromPoint

Related to #8666. I haven't implemented elementsFromPoint, because from my past discussion with jdm, [it's not good yet](dbfa25214b (commitcomment-14668959)) to implement elementsFromPoint because it may cause GC hazards.

By the way, I also have to include the test for this, right? I've found this [1]. So, is all I have to do is just to put this into `tests/wpt/web-platform-tests/cssom-view/elementFromPoint.html`?

[1] http://test.csswg.org/suites/cssom-view-1_dev/nightly-unstable/html/elementFromPosition.htm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8932)
<!-- Reviewable:end -->
2016-03-01 03:01:50 +05:30
Rizky Luthfianto
76678bbdae Implement Document#elementFromPoint 2016-03-01 02:23:07 +07:00
Dominik Menzi
b29b2d6d73 Implement value for DOMTokenList 2016-02-29 16:07:03 +01:00
bors-servo
7d4276b393 Auto merge of #9787 - nox:event-invoke, r=Ms2ger
Refactor dispatch_event according to the spec (fixes #9178)

Two new functions invoke and invoke_inner are introduced and some invariants documented.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9787)
<!-- Reviewable:end -->
2016-02-29 20:13:11 +05:30
Anthony Ramine
587963c6e3 Refactor dispatch_event according to the spec (fixes #9178)
Two new functions invoke and inner_invoke are introduced and some
invariants documented.
2016-02-29 10:42:09 +01:00
Anthony Ramine
4d2587d6c3 Rename various bindings in event dispatching 2016-02-29 10:42:06 +01:00
Anthony Ramine
fc2cf31d5a Return a Vec from EventTarget::get_listeners_for 2016-02-29 10:42:02 +01:00
Anthony Ramine
590316a468 Merge EventTarget::{get_listeners, get_listeners_for} 2016-02-29 10:41:57 +01:00
bors-servo
dfdeabf57d Auto merge of #9799 - nox:range-extractcontents, r=KiChjang
Fix step 14.2 of Range::ExtractContents

We need the last inclusive ancestor of start node that is not an inclusive ancestor
of end node, not the first that is an inclusive ancestor of it.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9799)
<!-- Reviewable:end -->
2016-02-29 05:11:28 +05:30
Anthony Ramine
c0d79062b5 Fix step 14.2 of Range::ExtractContents
We need the last inclusive ancestor of start node that is not an inclusive ancestor
of end node, not the first that is an inclusive ancestor of it.
2016-02-29 00:19:18 +01:00
bors-servo
b3964a8958 Auto merge of #9797 - nox:range-insertnode, r=KiChjang
Fix step 1 of Range::InsertNode

The method needs to throw when trying to insert start node into range.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9797)
<!-- Reviewable:end -->
2016-02-29 04:18:06 +05:30
Anthony Ramine
c713734b48 Fix step 1 of Range::InsertNode
The method needs to throw when trying to insert start node into range.
2016-02-28 22:54:08 +01:00
Emilio Cobos Álvarez
3e36739e38 script: Fix remaining bugs from Range.deleteContents 2016-02-28 19:27:42 +01:00
bors-servo
be6940db59 Auto merge of #9793 - nox:range-deletecontents, r=ecoal95
Fix step 6 of Range::DeleteContents

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9793)
<!-- Reviewable:end -->
2016-02-28 20:21:51 +05:30
Anthony Ramine
0ac931a43e Fix step 6 of Range::DeleteContents 2016-02-28 04:57:10 +01:00
bors-servo
5b8041147d Auto merge of #9784 - servo:jdm-patch-1, r=Ms2ger
Fix some errors in the DOM documentation.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9784)
<!-- Reviewable:end -->
2016-02-28 01:42:47 +05:30
bors-servo
d5ce8f308f Auto merge of #9734 - nox:finish-event-dispatch, r=Ms2ger
Fix the "get the parent" loop when dispatching event (fixes #6733)

The DOM specification says:

> A document's get the parent algorithm, given an event, returns null
> if event's type attribute value is "load" or document does not have
> a browsing context, and the document's associated Window object
> otherwise.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9734)
<!-- Reviewable:end -->
2016-02-27 23:03:25 +05:30
Anthony Ramine
e70b520c1f Fix the "get the parent" loop when dispatching event (fixes #6733)
The DOM specification says:

A document's get the parent algorithm, given an event, returns null
if event's type attribute value is "load" or document does not have
a browsing context, and the document's associated Window object
otherwise.
2016-02-27 17:41:22 +01:00
bors-servo
4a7d234510 Auto merge of #9768 - jdm:add_disallowed_prefixes, r=jdm
disallow restricted XMLHttpRequest header prefixes

Rebased from #9376.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9768)
<!-- Reviewable:end -->
2016-02-27 22:09:46 +05:30
Josh Matthews
bec25a1759 Fix some errors in the DOM documentation. 2016-02-27 11:22:26 -05:00
bors-servo
6c65e154f4 Auto merge of #9774 - nox:remove-attribute-node, r=nox
Implement removeAttributeNode

Supersedes #8727

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9774)
<!-- Reviewable:end -->
2016-02-27 15:23:06 +05:30
bors-servo
8bdffa25f9 Auto merge of #9755 - jdm:handlerreturn, r=jdm
use return value of invoking event handlers to cancel the event

Rebased from #8707. Fixes #8490. We can modify the code and test as necessary whenever we make a decision about https://github.com/whatwg/html/issues/423 in the future.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9755)
<!-- Reviewable:end -->
2016-02-27 07:10:50 +05:30
bors-servo
0d7a2eee2d Auto merge of #9514 - g-k:html-input-value, r=KiChjang
HTML input value

Ready for review.

Fixes #9455.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9514)
<!-- Reviewable:end -->
2016-02-27 04:36:46 +05:30
Nick Fitzgerald
d28c9a1588 Implement removeAttributeNode
This commit implement removeAttributeNode, as described here:
https://dom.spec.whatwg.org/#dom-element-removeattributenode

See also #8724 and #8068.
2016-02-26 21:18:24 +01:00
Anthony Ramine
b8ae5897f1 Implement Element.getAttributeNames 2016-02-26 19:15:11 +01:00
Chandler Abraham
7c3a8d3f5b swap w3c spec link for whatwg, removed user-agent from disallowed headers 2016-02-26 11:04:34 -05:00
Chandler Abraham
c375ad5e95 disallow restricted XMLHttpRequest header prefixes 2016-02-26 11:04:33 -05:00
João Oliveira
b60d668908 use return value of invoking event handlers to cancel the event 2016-02-26 10:17:57 -05:00
bors-servo
26b40afe23 Auto merge of #9757 - jdm:websocket-errors-rebase, r=jdm
Trigger WebSocket error event

Trigger a WebSocket error after receiving an invalid message from the server. Rebased from #8868. Fixes #7861.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9757)
<!-- Reviewable:end -->
2016-02-26 14:14:06 +05:30
Sam Gibson
4f736e6f7c Trigger WebSocket error event
Trigger a WebSocket error after receiving an invalid message from the server
2016-02-26 09:43:12 +01:00
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
Eli Friedman
7b671d13a0 Use presentation hints correctly for the dimensions of <img>.
Mostly straightforward; includes some extra fixes to make `<canvas>`
work the same way as `<img>` for reflow.
2016-02-25 14:04:06 -05:00
Anthony Ramine
2ed1a4ab3b Do not generate RegisterBindings::Register anymore 2016-02-25 15:56:54 +01:00
Anthony Ramine
1559f5a39f Lazily define interface objects on globals (fixes #6419) 2016-02-25 15:56:47 +01:00
Anthony Ramine
ca979e115b Cache legacy callback interface objects in proto_or_icache_array
We need them to be cached to not instantiate them multiple times with
lazy initialisation.
2016-02-25 15:15:44 +01:00
Anthony Ramine
2c4d5da866 Lazily-define standard ECMAScript classes 2016-02-25 15:15:44 +01:00
bors-servo
42f1712846 Auto merge of #9740 - paulrouget:mozbrowserconnected, r=jdm
Support Browser API event mozbrowserconnected

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

This new event is not yet documented. If this lands, I will add documentation to MDN.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9740)
<!-- Reviewable:end -->
2016-02-25 15:56:24 +05:30
bors-servo
b3b6f09206 Auto merge of #9742 - nox:atom-from-string, r=ecoal95
Make use of From<String> for Atom

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9742)
<!-- Reviewable:end -->
2016-02-25 08:39:44 +05:30
bors-servo
e5f3c5b6d1 Auto merge of #9708 - danlrobertson:i8623, r=KiChjang
Implement GetElementRect webdriver command: #8623

Implement the webdriver Get Element Rect command. Originally I wrote out the algorithm for [Step 7](https://w3c.github.io/webdriver/webdriver-spec.html#dfn-calculate-the-absolute-position) and then I found `GetBoundingClientRect`, and i thought it was probably best to use it instead.

As always, feedback is very welcomed!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9708)
<!-- Reviewable:end -->
2016-02-25 05:49:03 +05:30
bors-servo
09e987b559 Auto merge of #9661 - jdm:devtools-inspector-get-layout, r=pcwalton
Completed implementation of devtools' `getLayout`.

Rebase of #7267. Fixes #3598.

This avoids all of the sketchy issues of trying to read the style data for margins from the script thread. I replaced it with a layout query that fetches the margin style properties for a given element.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9661)
<!-- Reviewable:end -->
2016-02-25 00:22:43 +05:30
benshu
0785d91ae4 Completed implementation of devtools' getLayout. 2016-02-24 13:51:47 -05:00