Skip to content

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

Closed
benschulz wants to merge 7 commits into
servo:masterfrom
benschulz:devtools-inspector-get-layout
Closed

benschulz wants to merge 7 commits into
servo:masterfrom
benschulz:devtools-inspector-get-layout

Conversation

@benschulz

Copy link
Copy Markdown
Contributor

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_data → shared_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 highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 18, 2015
@highfive

Copy link
Copy Markdown

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
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@Ms2ger

Ms2ger commented Aug 18, 2015

Copy link
Copy Markdown
Contributor

r? @pcwalton for the querying bits

@Manishearth

Copy link
Copy Markdown
Member

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

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 20, 2015
@benschulz
benschulz force-pushed the devtools-inspector-get-layout branch from 571829d to 50ce147 Compare August 20, 2015 15:24
@Manishearth Manishearth removed the S-needs-rebase There are merge conflict errors. label Aug 20, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 27, 2015
@benschulz
benschulz force-pushed the devtools-inspector-get-layout branch from 50ce147 to df0fec9 Compare August 27, 2015 20:53
@jdm jdm removed the S-needs-rebase There are merge conflict errors. label Aug 30, 2015
@pcwalton

pcwalton commented Sep 1, 2015

Copy link
Copy Markdown
Contributor

The layout/style bits look good to me.

@jdm

jdm commented Sep 1, 2015

Copy link
Copy Markdown
Member

@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
Copy Markdown
Contributor

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

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 1, 2015
@benschulz
benschulz force-pushed the devtools-inspector-get-layout branch from df0fec9 to b86508a Compare September 1, 2015 14:34
@jdm jdm added the S-awaiting-answer Someone asked a question that requires an answer. label Sep 1, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 2, 2015
@highfive highfive added the S-needs-rebase There are merge conflict errors. label Sep 2, 2015
@jdm

jdm commented Sep 2, 2015

Copy link
Copy Markdown
Member

edit: (wrong issue for this comment)

@jdm

jdm commented Sep 2, 2015

Copy link
Copy Markdown
Member

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 jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 2, 2015
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Sep 3, 2015
@jdm

jdm commented Sep 3, 2015

Copy link
Copy Markdown
Member

-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 There is new code that needs to be reviewed. label Sep 3, 2015
@pcwalton

pcwalton commented Sep 3, 2015

Copy link
Copy Markdown
Contributor

@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 Someone asked a question that requires an answer. label Sep 3, 2015
@jdm

jdm commented Sep 3, 2015

Copy link
Copy Markdown
Member

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

@jdm jdm added the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Sep 3, 2015
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Sep 4, 2015
@benschulz

Copy link
Copy Markdown
Contributor Author

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?

@jdm jdm added the S-awaiting-answer Someone asked a question that requires an answer. label Sep 4, 2015
@pcwalton

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

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

@jdm jdm assigned jdm and unassigned pcwalton Nov 20, 2015
@jdm

jdm commented Nov 20, 2015

Copy link
Copy Markdown
Member

Taking this so I stop forgetting about it.

@jdm

jdm commented Feb 16, 2016

Copy link
Copy Markdown
Member

Rebased in #9661.

@jdm jdm closed this Feb 16, 2016
bors-servo pushed 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

Labels

S-awaiting-answer Someone asked a question that requires an answer. S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants