Skip to content

script: Implement margin dimension attributes for <img> - #48605

Merged
TimvdLippe merged 1 commit into
servo:mainfrom
TimvdLippe:img-margin-dimensions
Oct 6, 2026
Merged

TimvdLippe merged 1 commit into
servo:mainfrom
TimvdLippe:img-margin-dimensions

Conversation

@TimvdLippe

Copy link
Copy Markdown
Contributor

Part of #48604

Testing: new WPT test passes

@TimvdLippe
TimvdLippe requested a review from gterzian as a code owner October 3, 2026 15:08
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 3, 2026

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with a few small things to fix before landing.

Comment on lines +1471 to +1475
let margin_right_left = if let Some(this) = self.downcast::<HTMLImageElement>() {
this.get_margin_right_left()
} else {
LengthOrPercentageOrAuto::Auto
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if you map this into an Option<LengthPercentage> with a helper you could make this a bit shorter and avoid so much repetition below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately Stylo doesn't export LengthPercentage as an from_length_percentage. Therefore, it wasn't possible for me to get that and I need to use from_dimension instead.

The structure here is the same as for width and height. I will tackle these as a whole in a follow-up to make them all four consistent with each other.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 5, 2026
@TimvdLippe
TimvdLippe force-pushed the img-margin-dimensions branch from f3512d6 to 8666d80 Compare October 6, 2026 08:28
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Oct 6, 2026
@TimvdLippe
TimvdLippe force-pushed the img-margin-dimensions branch from 8666d80 to 169eb5a Compare October 6, 2026 08:36
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Oct 6, 2026
@TimvdLippe
TimvdLippe enabled auto-merge October 6, 2026 08:36
@TimvdLippe
TimvdLippe added this pull request to the merge queue Oct 6, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 6, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 6, 2026
Part of servo#48604

Testing: new WPT test passes

Signed-off-by: Tim van der Lippe <[email protected]>
@TimvdLippe
TimvdLippe force-pushed the img-margin-dimensions branch from 169eb5a to aee6d51 Compare October 6, 2026 17:45
@servo-highfive servo-highfive removed the S-tests-failed The changes caused existing tests to fail. label Oct 6, 2026
@TimvdLippe
TimvdLippe enabled auto-merge October 6, 2026 17:45
@TimvdLippe
TimvdLippe added this pull request to the merge queue Oct 6, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 6, 2026
Merged via the queue into servo:main with commit 858163a Oct 6, 2026
33 checks passed
@TimvdLippe
TimvdLippe deleted the img-margin-dimensions branch October 6, 2026 18:36
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 6, 2026
hhhwsqhhh pushed a commit to hhhwsqhhh/servo that referenced this pull request Oct 12, 2026
Part of servo#48604

Testing: new WPT test passes

Signed-off-by: Tim van der Lippe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants