Skip to content

script: Replace usage of IntersectionObserverRootMargin with Stylo'sIntersectionObserverMargin#38519

Merged
mrobinson merged 5 commits into
servo:mainfrom
labros7107:issue-35907
Aug 9, 2025
Merged

script: Replace usage of IntersectionObserverRootMargin with Stylo'sIntersectionObserverMargin#38519
mrobinson merged 5 commits into
servo:mainfrom
labros7107:issue-35907

Conversation

@labros7107
Copy link
Copy Markdown
Contributor

@labros7107 labros7107 commented Aug 7, 2025

@stevennovaryo
Created wrapper for Stylo's IntersectionObserverMargin and cleaned up repeated code.
Testing: Code compiles and ./mach test-unit tests/unit/style/ doesn't have any errors. intersectionobserver.rs is able to utilize the struct.
Fixes: #35907


Signed-off-by: samir [email protected]

repeated code. Additionally moved resolve_percentages_with_basis() to
work with wrapper.
---------------------------
Signed-off-by: samir <[email protected]>
@labros7107 labros7107 requested a review from gterzian as a code owner August 7, 2025 12:19
@jdm jdm requested a review from stevennovaryo August 7, 2025 12:21
Copy link
Copy Markdown
Member

@stevennovaryo stevennovaryo left a comment

Choose a reason for hiding this comment

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

Looking good! Several suggestions to go.

Comment thread components/script/dom/intersectionobserverrootmargin.rs
Comment thread components/script/dom/intersectionobserverrootmargin.rs Outdated
Comment thread components/script/dom/intersectionobserverrootmargin.rs Outdated
Comment thread components/script/dom/intersectionobserverrootmargin.rs Outdated
Comment thread components/script/dom/intersectionobserverrootmargin.rs Outdated
}

// TODO(stevennovaryo): move this to the wrapper later
impl IntersectionObserverRootMargin {
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.

Is this the only utility function? If so maybe we can remove the wrapper entirely and just inline this code.

Copy link
Copy Markdown
Member

@stevennovaryo stevennovaryo Aug 8, 2025

Choose a reason for hiding this comment

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

Yes it is. Are you referring to something like this? #38519 (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.

Yes. Sounds good.

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.

I have implemented the changes by referencing Stylo's implementation of IntersectionObserverMargin where applicable and moved resolve_percentages_with_basis under IntersectionObserver. Removed the intersectionobserverrootmargin.rs and changes mod.rs to not reference it.

@mrobinson mrobinson changed the title Stylo IntersectionObserverMargin wrapper script: Make IntersectionObserverRootMargin a wrapper around stylo::IntersectionObserverMargin Aug 8, 2025
labros7107 and others added 3 commits August 9, 2025 23:05
call it directly instead of using a local clone of the struct. All
references to the local clone of the struct has now been moved to the
upstream implementation. Additionally, custom functions added to the
local clone has been reimplemented directly within
intersectionobserver.rs

Signed-off-by: samir <[email protected]>
IntersectionObserverMargin struct. As Stylo's implementation is now
visible, it is no longer required. Changed mod.rs file to not reference
deleted file.
Signed-off-by: samir <[email protected]>
@labros7107 labros7107 requested a review from mrobinson August 9, 2025 15:03
@mrobinson mrobinson changed the title script: Make IntersectionObserverRootMargin a wrapper around stylo::IntersectionObserverMargin script: Replace usage of IntersectionObserverRootMargin with Stylo'sIntersectionObserverMargin Aug 9, 2025
@mrobinson mrobinson enabled auto-merge August 9, 2025 16:57
@mrobinson
Copy link
Copy Markdown
Member

Nice cleanup!

@mrobinson mrobinson added this pull request to the merge queue Aug 9, 2025
Merged via the queue into servo:main with commit 7b057be Aug 9, 2025
21 of 22 checks passed
@labros7107 labros7107 deleted the issue-35907 branch August 10, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tidy up IntersectionObserverRootMargin

3 participants