aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
Commit message (Collapse)AuthorAgeFilesLines
* Implement HTMLImageElement decode (#31269)Taym Haddadi2024-06-131-1/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement HTMLImageElement decode Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix Decode doc link Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Temp * Decode HTML Image Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix doc link Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Move image decode to process_image_response_for_environment_change Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update some wpt test result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Handle multiple image decode promises Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove unnecessary promise calls Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update more wpt test result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Undo body-size-cross-origin.https.html.ini changes Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Reject decode when src and srcset are missing Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Revert "Reject decode when src and srcset are missing" This reverts commit 1b57ab978f9fc24facafc8af97ee8851d5142533. * Drain promises vec and run update_the_image_data when element is created Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * resolve decode promise in abort_request when request is CompletelyAvailable Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update wpt test Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Move storing promise in decode task Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove the resolve logic from decode task Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Revert "Remove the resolve logic from decode task" This reverts commit eee6096d50dbe46a22a5bbfd7f15c03988ed2f4b. * reject or reject current promise before storing it Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Add comment to explain why resolve promise when state is CompletelyAvailable Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* clippy fixes regarding clone_from (#32482)Peter Mikola2024-06-121-1/+3
|
* script: Have `Document` own `Layout` (#32316)Martin Robinson2024-05-201-2/+4
| | | | | | Have `Document` own `Layout`. This makes it impossible to have a `Document` without `Layout`, which was true, but now the compiler checks it. In addition, `Layout` is now released when the `Document` is, avoiding leaking the entire `Layout`.
* compositor: Move WebRender-ish messages and types to `webrender_traits` (#32315)Mukilan Thiyagarajan2024-05-201-3/+3
| | | | | | | | | | | | | | | | | | | | * Move WebRender related types to `webrender_traits` This refactor moves several WebRender related types from `compositing_traits`, `script_traits` and `net_traits` crates to the `webrender_traits` crate. This change also moves the `Image` type and associated function out of `net_traits` and into the `pixels` crate. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Move `script_traits::WebrenderIpcSender` to `webrender_traits::WebRenderScriptApi` --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* Address issues uncovered by rust-1.78 beta (#32130)Martin Robinson2024-04-221-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes changes to allow Servo to compile with the 1.78 version of Rust: - Dead code is removd (Rust seems to have gotten better at detecting it). - The `FlowRef` `DerefMut` is updated according to @SimonSapin's advice [^1]. - The `imports.rs` now explicitly silences warnings about unused imports. [^1]: https://github.com/servo/servo/issues/6503#issuecomment-2066088179 <!-- 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 do not require tests because they should not change behavior. <!-- 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. -->
* layout: Add a `FontMetricsProvider` for resolving font-relative units (#31966)Martin Robinson2024-04-041-7/+8
| | | | | | | | | | | | | | | | | | | The only font relative unit that Servo knows how to resolve currently is `rem` (relative to the root font size). This is because Stylo cannot do any font queries. This adds a mechanism to allow this, exposing the ability to properly render `ex` units in Servo. This change only allows resolving some font size relative units thoug, as Servo doesn't collect all the FontMetrics it needs to resolve them all. This capability will be added in followup changes. Some new tests fail: - ex-unit-001.html: This test fails because Servo does not yet have support for setting the weight using @font-face rules on web fonts. - ex-unit-004.html: This test fails because Servo does not yet have support for setting the Unicode range of a web font using @font-face rules. - first-available-font-001.html: This test fails because the above two feature are missing.
* changed `match` to 'matches!' (#31850)Aarya Khandelwal2024-03-251-4/+1
|
* Fixed the .clone() warnings. (#31819)Aarya Khandelwal2024-03-221-1/+1
|
* Clippy: Fixed warnings in htmlimageelement.rs (#31800)Aarya Khandelwal2024-03-211-17/+17
| | | | | * Fixed warnings in htmlimageelement.rs * making changes for test-tidy to run without errors.
* Clippy: Fixed clippy warnings in components/script/dom (#31801)Aarya Khandelwal2024-03-211-7/+7
| | | | | | | | | * fixed clippy warnings in htmlformelement.rs * Fixed clippy warnings * Fixed warnings related to matches! * made changes to compile "test-tidy" successfully
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-5/+2
|
* style: Remove dependency on servo_url (#31358)Martin Robinson2024-02-161-5/+6
| | | | | In order for stylo to be a separate crate, it needs to depend on less things from Servo. This change makes it so that stylo no longer depends on servo_url.
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-4/+5
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove script_plugins * Use crown instead of script_plugins * crown_is_not_used * Use crown in command base * bootstrap crown * tidy happy * disable sccache * Bring crown in tree * Install crown from tree * fix windows ci * fix warning * fix mac libscript_plugins.dylib is not available anymore * Update components/script/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update for nightly-2023-03-18 Mostly just based off https://github.com/servo/servo/pull/30630 * Always install crown it's slow only when there is new version * Run crown test with `mach test-unit` * Small fixups; better trace_in_no_trace tests * Better doc * crown in config.toml * Fix tidy for real * no sccache on rustc_wrapper * document rustc overrides * fixup of compiletest * Make a few minor comment adjustments * Fix a typo in python/servo/platform/base.py Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> * Proper test types * Ignore tidy on crown/tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Further changes required by ServoOriol Brufau2023-11-241-0/+2
|
* Use Foo_Binding instead of FooBinding for namespace modules (#30447)Samson2023-09-301-3/+3
| | | | | * Update Codegen.py to emit Foo_Binding instead of FooBinding * s/FooBinding/Foo_Binding/g
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-46/+48
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-1/+1
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `no_trace` option to JSTraceable derive * NoTrace wrapper * Port some types to no_trace schematics * Fixing my unsafe mistakes (not tracing traceables) * Add docs & safety guards for no_trace Safety guards (trait shenanigans) guarantees safety usage of `no_trace` * Port canvas_traits to no_trace * Port servo_media to no_trace * Port net_traits to no_trace * Port style to no_trace * Port webgpu to no_trace * Port script_traits to no_trace * Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace * unrooted_must_root lint in seperate file * Add trace_in_no_trace_lint as script_plugin * Composable types in must_not_have_traceable * Introduced HashMapTracedValues wrapper * `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>` * Port rest of servo's types to no_trace * Port html5ever, euclid, mime and http to no_trace * Port remaining externals to no_trace * Port webxr and Arc<Mutex<_>> * Fix spelling in notrace doc
* Support arbitrary protos when wrapping DOM objects with constructors.Josh Matthews2023-05-281-1/+6
|
* Enter realms more consistently during the script event loop.Josh Matthews2023-05-201-0/+9
|
* Make url for "client" referrer mandatoryMatthias Deiml2020-06-171-2/+4
|
* Don't send a load event when a loaded image is actually the placeholderBastien Orivel2020-05-081-3/+11
| | | | | | | | | | | | The image cache returns an `ImageCacheResult::ImageAvailable `the second time you try getting the placeholder. This means that in some cases, the loading of an image would fail, then the same image would get fetched from the cache, the placeholder would be loaded from that but would be seen as a normal image, firing a load event. This made the tests in `fetch/cross-origin-resource-policy/image-loads.html` fail depending on their order.
* Auto merge of #26450 - ↵bors-servo2020-05-071-2/+40
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PeterZhizhin:add_referrerpolicy_to_list_of_relevant_mutations, r=jdm Add referrerpolicy to list of relevant mutations <!-- Please describe your changes on the following line: --> `img.referrerPolicy` change now mutates the image. Not all `referrerPolicy` attribute changes result in an image update event. Only valid changes are reflected. All referrerpolicy tests inside `relevant-mutations.html` WPT test now pass. --- <!-- 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 #26388 <!-- Either: --> - [x] These have tests: ``` ./mach test-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html ```
| * Added referrerpolicy as relevant mutation for imgPeterZhizhin2020-05-071-2/+40
| | | | | | | | | | | | | | | | This fixes #26388. referrerPolicy is now calls onload for image mutations. Not all referrerPolicy attribute changes result in an image update event. Only valid changes are reflected. Referrerpolicy tests now pass.
* | Use a restyle for animation ticksMartin Robinson2020-05-051-4/+2
|/ | | | | | | | | | | | | | This change corrects synchronization issues with animations, by reworking the animation processing model to do a quick restyle and incremental layout when ticking animations. While this change adds overhead to animation ticks, the idea is that this will be the fallback when synchronous behavior is required to fulfill specification requirements. In the optimistic case, many animations could be updated and applied off-the-main-thread and then resynchronized when style information is queried by script. Fixes #13865.
* Refactor ImageCache::find_image_or_metadata API.Julien Tregoat2020-04-171-85/+67
|
* Introduce <LayoutDom<HTMLImageElement>>::current_requestAnthony Ramine2020-04-011-32/+19
| | | | | This safe helper contains the only source of unsafety from the actual image layout helpers methods, making them completely safe.
* Introduce <LayoutDom<Element>>::attrs()Anthony Ramine2020-03-311-16/+10
| | | | | | This safe method is the basic block to access element attributes from layout. We reuse it in the other attr-related layout methods to remove a pretty big source of rampant unsafe code between script and layout.
* Merge RawLayoutElementHelpers into LayoutElementHelpersAnthony Ramine2020-03-311-3/+3
|
* Make LayoutHTMLImageElementHelpers methods take selfAnthony Ramine2020-03-291-16/+12
|
* Give a lifetime parameter to LayoutDomAnthony Ramine2020-03-281-1/+1
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-2/+0
|
* Handle nonexistent images in CanvasRenderingContext2D.createPattern()pylbrecht2020-03-131-7/+4
|
* Names should now be consistently atomsPatrick Shaughnessy2020-02-131-3/+2
|
* Add image usability checks to drawImage()pylbrecht2020-02-031-1/+21
|
* Remove unnecessary LocalName::from(constant) callsPatrick Shaughnessy2020-01-281-1/+1
|
* Auto merge of #25515 - pshaughn:checkpoints, r=jdmbors-servo2020-01-251-10/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add microtask checkpoints to script elements and custom elements Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file. --- <!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514 <!-- Either: --> - [X] There are tests for these changes <!-- 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. -->
| * Add microtask checkpoints on </script> and CE constructPatrick Shaughnessy2020-01-151-10/+4
| |
* | Auto merge of #25431 - warren-fisher:create-html-element, r=jdmbors-servo2020-01-211-4/+13
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | use create_html_element for HTMLAudioElement and HTMLImageElement <!-- Please describe your changes on the following line: --> Updated the Image and Audio constructors to use `create_html_element` via the Element::create method. This was done to meet these specifications of "Let (audio/image) be the result of **creating an element** given document, audio, and the HTML namespace." for [dom-image](https://html.spec.whatwg.org/multipage/embedded-content.html#dom-image) and [dom-audio](https://html.spec.whatwg.org/multipage/media.html#dom-audio) Not sure what _is_ is according to the [create-element guidelines](https://dom.spec.whatwg.org/#concept-create-element) so I left it as None copying from #25393. Also copied the ElementCreator and CustomElementCreationMode from #25393 as I do not know what they do. --- <!-- 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 #25421 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because it is a small swap out of the way used to generate these HTML elements. The pre-existing tests should be sufficient. <!-- 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. -->
| * | use create_html_element for HTMLAudioElement and HTMLImageElementWarren Fisher2020-01-041-4/+13
| | |
* | | Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-2/+3
| |/ |/|
* | Add accountable-refcell as optional build time featureKunal Mohan2020-01-081-2/+2
|/
* Use `#![register_tool]` instead of `#![register_attr]`Simon Sapin2019-11-151-1/+1
| | | | CC https://github.com/rust-lang/rust/issues/66079
* Correct inverted logic for available image checks.Josh Matthews2019-11-061-4/+1
|
* Add useful debug output for HTTP response and image cache.Josh Matthews2019-10-041-0/+1
|
* Support CORS attributes for image elements.Josh Matthews2019-10-041-5/+33
|
* Double key image cache by requesting origin, and store CORS status with ↵Josh Matthews2019-10-041-1/+8
| | | | cached images.
* Prefetch img and scripts during parsingAlan Jeffrey2019-09-101-3/+18
|