Auto merge of #29748 - Loirooriol:sync, r=mrobinson

Backport several style changes from Gecko

<!-- 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
- [ ] These changes fix #___ (GitHub issue number if applicable)

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

<!-- 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. -->
This commit is contained in:
bors-servo 2023-05-19 22:49:36 +02:00 committed by GitHub
commit 2426a38a4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 2063 additions and 1553 deletions

View file

@ -354,9 +354,9 @@ where
attr_val.map_or("".to_string(), |s| s.to_string()),
));
},
ContentItem::Url(image_url) => {
ContentItem::Image(image) => {
if let Some(replaced_content) =
ReplacedContent::from_image_url(element, context, image_url)
ReplacedContent::from_image(element, context, image)
{
vec.push(PseudoElementContentItem::Replaced(replaced_content));
}

View file

@ -21,6 +21,7 @@ use std::fmt;
use std::sync::{Arc, Mutex};
use style::properties::ComputedValues;
use style::servo::url::ComputedUrl;
use style::values::computed::image::Image as ComputedImage;
use style::values::computed::{Length, LengthOrAuto};
use style::values::CSSFloat;
use style::Zero;
@ -184,6 +185,17 @@ impl ReplacedContent {
None
}
pub fn from_image<'dom>(
element: impl NodeExt<'dom>,
context: &LayoutContext,
image: &ComputedImage,
) -> Option<Self> {
match image {
ComputedImage::Url(image_url) => Self::from_image_url(element, context, image_url),
_ => None, // TODO
}
}
fn flow_relative_intrinsic_size(&self, style: &ComputedValues) -> Vec2<Option<Length>> {
let intrinsic_size = PhysicalSize::new(self.intrinsic.width, self.intrinsic.height);
Vec2::from_physical_size(&intrinsic_size, style.writing_mode)