Commit graph

284 commits

Author SHA1 Message Date
bors-servo
ebc61bb2c3 Auto merge of #16407 - jdm:style_panic, r=emilio
Allow loading multiple stylesheets for the same link element.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16399
- [x] There are tests for these changes

<!-- 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/16407)
<!-- Reviewable:end -->
2017-04-13 11:29:58 -05:00
Josh Matthews
3c3311b16a Allow loading multiple stylesheets for the same link element. 2017-04-13 16:02:17 +10:00
J. Ryan Stinnett
1a31b87c22 Pass ParserContext down to lengths
To make it possible to check the rule type when parsing lengths, we need to pass
the `ParserContext` down through many layers to the place where length units are
parsed.

This change leaves it unused, so it's only to prepare for the next change.

MozReview-Commit-ID: 70YwtcCxnWw
2017-04-12 16:40:48 +08:00
Simon Sapin
1e38013783 Refactor StylesheetLoader so impls do not need to acquire a shared lock.
This fixes a deadlock:
https://github.com/servo/servo/pull/16014#issuecomment-287527067
2017-03-19 22:30:39 +01:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Emilio Cobos Álvarez
31ecc9b692
script: Don't avoid all the mutation notification methods when the style attribute changes.
Styling was correct because of the explicit dirtiness, but still not fun.

Some things, like dynamic updates to with things like [style~="color"] ~ foo
selectors, were pretty broken, because we didn't take snapshots of those
attributes.
2017-01-30 19:24:42 +01:00
bors-servo
f3c102d2fe Auto merge of #14930 - zaynetro:remove-stylesheets, r=emilio
Implement support for removing stylesheets from their document

<!-- Please describe your changes on the following line: -->
This pull request implements removing styles from the document when

* `<link>` element with associated styles is removed
* `<style>` element is removed

Additionally, it tests that when `<style>` element is changed. Styles are being reapplied correctly.

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

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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/14930)
<!-- Reviewable:end -->
2017-01-24 09:40:07 -08:00
SwagColoredKitteh
bb2826e41f fix issue #15101 and make sure out-of-order stylesheet loads work correctly for the same element 2017-01-24 15:52:01 +01:00
Roman Zaynetdinov
b3ce08f1b5 Remove styles when link node is removed from document 2017-01-22 08:52:52 +02:00
Nazım Can Altınova
fd950a7309 Support origins in CSSOM stylesheets 2017-01-20 22:00:49 +03:00
mrnayak
3d9e44a8c4 Handle crossorigin in link and refactor crossorigin handling
Implemented Step three and handled step four of obtain the resource part
of 4.2.4 The link element.
Link to spec : https://html.spec.whatwg.org/multipage/semantics.html#concept-link-obtain

Refactored crossOrigin handling in HTMLScriptElement, HTMLImageElement
2017-01-13 23:35:00 +05:30
bors-servo
eb72c0ec7b Auto merge of #14963 - jdm:script_current_line, r=asajeffrey
Report meaningful line numbers for inline script errors

Rebased from #14661.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12744 and partially #9604
- [X] There are tests for these changes

<!-- 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/14963)
<!-- Reviewable:end -->
2017-01-11 18:11:52 -08:00
karenher
db2082bc6e Store parser's current line when script elements are created.
Use the newly stored line as the starting line number when
evaluating JS. This ensures that inline scripts will report
errors with meaningful line numbers.
2017-01-11 21:11:00 -05:00
charlesvdv
19e31d5c50 Handle properly alternate stylesheet 2017-01-10 15:38:38 +01:00
mrnayak
a3026499f4 Implement Subresource Integrity
Implemented response validation part of
https://w3c.github.io/webappsec-subresource-integrity/.
Implemented step eighteen of the main fetch. If a request has integrity
metadata, then following steps are performed
*Wait for response body
*If the response does not have a termination reason and response does not
match request’s integrity metadata, set response to a
network error.# Please enter the commit message for your changes. Lines starting
2017-01-08 08:52:18 +05:30
Ms2ger
1bc0862214 Remove and allow some dead code. 2016-12-22 16:06:22 +01:00
Emilio Cobos Álvarez
b9901fbd89
script: Abstract HTMLLinkElement and StyleElement into StylesheetOwner. 2016-12-16 17:59:45 +01:00
Emilio Cobos Álvarez
072db0279a
script: Clarify htmllinkelement's comment about pending_loads. 2016-12-16 16:57:21 +01:00
Emilio Cobos Álvarez
7582a2d59d
script: Move the stylesheet loading code from htmllinkelement to stylesheet_loader. Make it track subresource loads properly. 2016-12-16 16:57:20 +01:00
Emilio Cobos Álvarez
21bf91c386
script: Add infrastructure to track subresource loads in <link> and <style> elements. 2016-12-16 16:57:20 +01:00
Anthony Ramine
1327ebd52f Remove HeapGCValue
It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
2016-12-12 10:47:54 -10:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Anthony Ramine
620a67ff14 Mark JSTraceable and its method as unsafe 2016-12-06 13:15:06 -10:00
Cameron McCormack
64ff6dc103 Implement StyleSheet.disabled. 2016-11-25 11:27:51 +08:00
Manish Goregaokar
972e9ac0fb Add support for LinkStyle's sheet getter on <style> and <link> 2016-11-23 09:30:33 -08:00
bors-servo
30867001d1 Auto merge of #14232 - servo:moar-locks, r=upsuper
CSSOM: Make Stylesheet fields have their own synchronization

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

r? @upsuper

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

<!-- 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/14232)
<!-- Reviewable:end -->
2016-11-21 19:33:57 -06:00
Simon Sapin
236c575c50 Replace Stylesheet::set_media with a constructor argument 2016-11-18 17:12:44 +01:00
Pu Xingyu
91f3d4f474 Remove redundant url clones
They are now redundant since now document.url() returns a struct rather
than a reference.
2016-11-18 12:39:22 +08:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Manish Goregaokar
177d6fa4ee Support basic immutable CSSOM 2016-11-15 06:56:18 -08:00
Keith Yeung
72cb856e31 Properly implement TaskSource for NetworkingTaskSource 2016-11-11 14:50:42 -08:00
Xidorn Quan
5dfcb07f6a Allow empty media query list
And make empty list the default value of MediaList.

This commit also removes Option wrapper of Stylesheet.media because
a stylesheet should always have an associated media query list.
2016-11-10 17:42:16 +11:00
Xidorn Quan
2733ec3bdc Rename media_queries::MediaQueryList to MediaList 2016-11-08 13:09:31 +11:00
bors-servo
73c9847ef8 Auto merge of #14036 - frewsxcv:event, r=nox
A couple improvements to `EventTarget` event firing.

<!-- 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/14036)
<!-- Reviewable:end -->
2016-11-04 06:43:56 -05:00
Ms2ger
277c6d0154 Move ReferrerPolicy to net_traits. 2016-11-04 10:43:37 +01:00
Corey Farwell
f447040ea9 Migrate EventTarget event firing functions to use Atoms.
This allows us to utilize more `atom` macros.
2016-11-03 17:04:30 -04:00
Corey Farwell
c3b279a4c3 Remove "fire a simple event" concept, refactor event firing API.
"fire a simple event" concept was removed in
https://github.com/whatwg/html/pull/1933.
2016-11-03 15:01:07 -04:00
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Anthony Ramine
0b3ab875f4 Remove intrinsic Root::r() 2016-10-11 19:44:32 +02:00
Anthony Ramine
d8e92bb271 Rename Reflectable::global_scope to global 2016-10-06 21:36:41 +02:00
Anthony Ramine
ae6af5172b Introduce Reflectable::global_scope 2016-10-06 21:35:38 +02:00
Anthony Ramine
27f100b1d4 Introduce GlobalScope::pipeline_id 2016-10-06 20:59:13 +02:00
Anthony Ramine
f789e73fd2 Introduce GlobalScope::constellation_chan 2016-10-06 20:59:12 +02:00
bors-servo
710bd7e1dc Auto merge of #13575 - servo:fetch-link, r=jdm
Use the fetch stack for stylesheets.

Fixes #13462.

<!-- 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/13575)
<!-- Reviewable:end -->
2016-10-04 18:12:18 -05:00
Ms2ger
2980903bfb Use the fetch stack for stylesheets.
Fixes #13462.
2016-10-04 17:12:56 +02:00
Simon Sapin
aeb3efda1f Make script build without impl<T: HeapSizeOf> HeapSizeOf for Arc<T>.
The removal of this impl is not included in this commit.
CC https://github.com/servo/heapsize/issues/37#issuecomment-249861171
2016-10-04 13:45:58 +02:00
Ms2ger
e2f5ce4893 Ignore stylesheet links with an empty href. 2016-09-30 11:23:45 +02:00
Ms2ger
ebbf9fd4d5 Deindent the main part of handle_stylesheet_url. 2016-09-30 10:58:45 +02:00
Ms2ger
d207919a02 Pass the correct attribute to handle_stylesheet_url. 2016-09-27 17:46:36 +02:00
Nikhil Shagrithaya
9d378ceb74 use .set_tokenlist_attribute to set rel content attribute in SetRel
Removed .ini files expecting crashes
2016-09-23 17:36:59 +00:00