Skip to content
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

Completed implementation of devtools' `getLayout`. (#3598) #7267

Closed

Conversation

@benschulz
Copy link
Contributor

benschulz commented Aug 18, 2015

First PR; be gentle. ;)
Fixes #3598.

Notes

  • I'm using serde_json for serialization, I will file a separate PR for converting the rest of devtools.
  • As suggested I'm accessing the shared layout data from the directly from the script task.
    • Should the corresponding field be renamed ( _shared_datashared_data )? I couldn't find any naming conventions, but I assume the underscore means "don't access".
    • Should any other documentation be updated?

Review on Reviewable

@highfive
Copy link

highfive commented Aug 18, 2015

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

@highfive
Copy link

highfive commented Aug 18, 2015

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 18, 2015

r? @pcwalton for the querying bits

@Manishearth
Copy link
Member

Manishearth commented Aug 18, 2015

The _ was probably used to circumvent an unused-variable lint or something.

@bors-servo
Copy link
Contributor

bors-servo commented Aug 20, 2015

The latest upstream changes (presumably #7265) made this pull request unmergeable. Please resolve the merge conflicts.

@benschulz benschulz force-pushed the benschulz:devtools-inspector-get-layout branch from 571829d to 50ce147 Aug 20, 2015
@bors-servo
Copy link
Contributor

bors-servo commented Aug 27, 2015

The latest upstream changes (presumably #7401) made this pull request unmergeable. Please resolve the merge conflicts.

@benschulz benschulz force-pushed the benschulz:devtools-inspector-get-layout branch from 50ce147 to df0fec9 Aug 27, 2015
@jdm jdm removed the S-needs-rebase label Aug 30, 2015
@pcwalton
Copy link
Contributor

pcwalton commented Sep 1, 2015

The layout/style bits look good to me.

@jdm
Copy link
Member

jdm commented Sep 1, 2015

@pcwalton Is there any danger from reading the style data directly in the script task, rather than querying layout for it?

@bors-servo
Copy link
Contributor

bors-servo commented Sep 1, 2015

The latest upstream changes (presumably #7488) made this pull request unmergeable. Please resolve the merge conflicts.

@benschulz benschulz force-pushed the benschulz:devtools-inspector-get-layout branch from df0fec9 to b86508a Sep 1, 2015
@bors-servo
Copy link
Contributor

bors-servo commented Sep 2, 2015

The latest upstream changes (presumably #7509) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm
Copy link
Member

jdm commented Sep 2, 2015

edit: (wrong issue for this comment)

@jdm
Copy link
Member

jdm commented Sep 2, 2015

I'll poke pcwalton to get an answer out of him, but these changes look pretty great to me!
-S-awaiting-review +S-needs-code-changes


Reviewed 7 of 7 files at r1, 6 of 6 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


components/script/devtools.rs, line 141 [r1] (raw file):
We can use &Node here instead.


components/script/dom/node.rs, line 63 [r1] (raw file):
This shouldn't be necessary.


components/script/dom/node.rs, line 1073 [r1] (raw file):
Just use query(*style) instead of calling deref above.


Comments from the review on Reviewable.io

@jdm
Copy link
Member

jdm commented Sep 3, 2015

-S-awaiting-review


Reviewed 2 of 2 files at r6.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from the review on Reviewable.io

@jdm jdm removed the S-awaiting-review label Sep 3, 2015
@pcwalton
Copy link
Contributor

pcwalton commented Sep 3, 2015

@jdm If there are off-main-thread CSS transitions running, they could be concurrently modifying style. So I think you need to handle the synchronization somehow. Since styles are atomically copy-on-write, you can satisfy this by simply cloning the style object.

@jdm jdm removed the S-awaiting-answer label Sep 3, 2015
@jdm
Copy link
Member

jdm commented Sep 3, 2015

@benschulz Instead of using borrow, could we create a style_for_script API that clones the style value under the hood and returns it?

@benschulz
Copy link
Contributor Author

benschulz commented Sep 4, 2015

Done.

Can I ask, how this addresses the problem? I've only just found out about Arc::make_unique and am unfamiliar with its exact mechanics. Isn't it based on the assumption that if the reference count is one then there's only one (mut) reference to the Arc? And if so, don't we break that assumption via TrustedNodeAddresses? I.e. couldn't the concurrent transition have checked that the reference count is one and then proceed to modify the ComputedValues in-place while the script task increments the ref count and reads those values?

@pcwalton
Copy link
Contributor

pcwalton commented Sep 25, 2015

@benschulz Yes, you're right that that's a potential race. Perhaps while there are TrustedNodeAddresses about we should take out a reference representing them? @jdm, what do you think?

@frewsxcv
Copy link
Member

frewsxcv commented Nov 15, 2015

@jdm It looks like this is waiting on an answer from you?

@jdm jdm assigned jdm and unassigned pcwalton Nov 20, 2015
@jdm
Copy link
Member

jdm commented Nov 20, 2015

Taking this so I stop forgetting about it.

@jdm
Copy link
Member

jdm commented Feb 16, 2016

Rebased in #9661.

@jdm jdm closed this Feb 16, 2016
bors-servo added a commit that referenced this pull request Feb 24, 2016
Completed implementation of devtools' `getLayout`.

Rebase of #7267. Fixes #3598.

This avoids all of the sketchy issues of trying to read the style data for margins from the script thread. I replaced it with a layout query that fetches the margin style properties for a given element.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9661)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.