New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Partial ShadowDOM support #22743

Open
wants to merge 49 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@ferjm
Copy link
Member

ferjm commented Jan 22, 2019

This is just an early WIP, not to take it very seriously yet.

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes

This change is Reviewable

@highfive

This comment has been minimized.

Copy link

highfive commented Jan 22, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/document.rs, components/script/dom/shadowroot.rs, components/script/dom/macros.rs, components/script/dom/node.rs, components/script/dom/element.rs and 9 more
  • @KiChjang: components/script/dom/document.rs, components/script/dom/shadowroot.rs, components/script/dom/macros.rs, components/script/dom/node.rs, components/script/dom/element.rs and 9 more
@highfive

This comment has been minimized.

Copy link

highfive commented Jan 22, 2019

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
let x = *x as f32;
let y = *y as f32;
let point = &Point2D::new(x, y);
let viewport = self.window.window_size().initial_viewport;

This comment has been minimized.

@emilio

emilio Jan 24, 2019

Member

This needs to retarget nodes in shadow trees and such... Rather than having these implementations duplicated I would have them just in DocumentOrShadowRoot, which also avoids having to implement dummy ShadowRoot::GetBody & co.

Show resolved Hide resolved components/script/dom/htmlcollection.rs Outdated
@emilio

This comment has been minimized.

Copy link
Member

emilio commented Jan 24, 2019

Also, I'm pretty sure you need a flag to know when a node is connected, and replace a bunch of uses of IS_IN_DOCUMENT by that. Also you need to audit all the callers that propagate flags around the tree like the layout dirty flags and change them so they not only look at parent_node but at parent_node_crossing_shadow_root or something

@ferjm ferjm force-pushed the ferjm:shadowdom branch from f2857c7 to 950c2e3 Jan 24, 2019

@ferjm ferjm changed the title [WIP] Partial ShadowDOM support: ShadowRoot [WIP] Partial ShadowDOM support Jan 24, 2019

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Jan 25, 2019

Also, I'm pretty sure you need a flag to know when a node is connected, and replace a bunch of uses of IS_IN_DOCUMENT by that

I ended up setting the IS_IN_DOC flag if the node is connected, which I think is essentially the same thing and saves us from replacing some of the uses of IS_IN_DOC by IS_CONNECTED.

@emilio

This comment has been minimized.

Copy link
Member

emilio commented Jan 25, 2019

I'd rather not do that, there are some legit uses of IS_IN_DOC / is_in_doc that need to know whether you're on a document or not. Gecko used to do that and we had to rewrite it because there were too many bugs.

Show resolved Hide resolved components/script/dom/node.rs Outdated
Show resolved Hide resolved components/script/dom/node.rs Outdated
Show resolved Hide resolved components/script/dom/node.rs

@ferjm ferjm force-pushed the ferjm:shadowdom branch from 53a0414 to ec5eee9 Feb 1, 2019

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 13, 2019

The shadow tree is now rendered and styled. Shadow tree styles still affect the document though.

screenshot 2019-02-13 at 16 44 45

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 13, 2019

The last commit fixes the fact that shadow tree styles were applied to the document.

screenshot 2019-02-13 at 18 24 10

@ferjm ferjm force-pushed the ferjm:shadowdom branch from 0021c69 to e681af0 Feb 20, 2019

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 20, 2019

@bors-servo try=wpt

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Feb 20, 2019

⌛️ Trying commit e681af0 with merge 8301410...

bors-servo added a commit that referenced this pull request Feb 20, 2019

Auto merge of #22743 - ferjm:shadowdom, r=<try>
[WIP] Partial ShadowDOM support

This is just an early WIP, not to take it very seriously yet.

- [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)
- [ ] 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/22743)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Feb 20, 2019

💔 Test failed - linux-rel-wpt

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 20, 2019

@bors-servo try=wpt

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Feb 20, 2019

⌛️ Trying commit 30a1c79 with merge 7f99a9d...

bors-servo added a commit that referenced this pull request Feb 20, 2019

Auto merge of #22743 - ferjm:shadowdom, r=<try>
[WIP] Partial ShadowDOM support

This is just an early WIP, not to take it very seriously yet.

- [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)
- [ ] 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/22743)
<!-- Reviewable:end -->
@servo-wpt-sync

This comment has been minimized.

Copy link
Collaborator

servo-wpt-sync commented Feb 20, 2019

Error syncing changes upstream. Logs saved in error-snapshot-1550663780895.

@ferjm ferjm force-pushed the ferjm:shadowdom branch from 30a1c79 to c58018a Feb 20, 2019

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 20, 2019

@bors-servo try=wpt

bors-servo added a commit that referenced this pull request Feb 20, 2019

Auto merge of #22743 - ferjm:shadowdom, r=<try>
[WIP] Partial ShadowDOM support

This is just an early WIP, not to take it very seriously yet.

- [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)
- [ ] 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/22743)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Feb 20, 2019

⌛️ Trying commit c58018a with merge 34746cd...

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Feb 20, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
State: approved= try=True

@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 20, 2019

We still need to figure out the privileged JS stuff and preferably make styles work when imported from link elements (they currently work from style tags only), but I think this is enough to support the media UI #22720.

r? @emilio

@emilio
Copy link
Member

emilio left a comment

Very very superficial review for now, need to get to the meat of the changes :)

Show resolved Hide resolved components/layout_thread/dom_wrapper.rs Outdated
Show resolved Hide resolved components/layout_thread/dom_wrapper.rs Outdated
Show resolved Hide resolved components/layout_thread/dom_wrapper.rs Outdated
Show resolved Hide resolved components/layout_thread/dom_wrapper.rs
Show resolved Hide resolved components/layout_thread/dom_wrapper.rs Outdated
Show resolved Hide resolved components/script/dom/bindings/trace.rs Outdated
Show resolved Hide resolved components/script/dom/cssstyledeclaration.rs Outdated
Show resolved Hide resolved components/script/dom/cssstylerule.rs Outdated
Show resolved Hide resolved components/script/dom/cssstylesheet.rs Outdated
Show resolved Hide resolved components/script/dom/element.rs
@ferjm

This comment has been minimized.

Copy link
Member Author

ferjm commented Feb 22, 2019

r? @emilio
Thanks! I think I addressed all the review comments.

@ferjm ferjm requested a review from emilio Feb 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment