Skip to content

Split layout wrappers into style+layout and layout-only functionality - #9051

Merged
bors-servo merged 1 commit into
servo:masterfrom
bholley:split_style_and_layout_wrappers
Dec 30, 2015
Merged

bors-servo merged 1 commit into
servo:masterfrom
bholley:split_style_and_layout_wrappers

Conversation

@bholley

@bholley bholley commented Dec 22, 2015

Copy link
Copy Markdown
Contributor

This is a step towards removing the dependency of stylo on layout/.

This PR depends on #9004.

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 22, 2015
@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify layout code, but no reftests are modified. Please consider adding a reftest!

@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from 92d4fb6 to 04b65a6 Compare December 22, 2015 23:40
@bholley

bholley commented Dec 22, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 04b65a6 with merge a94e1df...

bors-servo pushed a commit that referenced this pull request Dec 22, 2015
Split layout wrappers into style+layout and layout-only functionality

This is a step towards removing the dependency of stylo on layout/.

This PR depends on #9004.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9051)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - gonk

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Dec 22, 2015
@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from 04b65a6 to 9866985 Compare December 23, 2015 00:15
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Dec 23, 2015
@bholley

bholley commented Dec 23, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 9866985 with merge dc924f7...

bors-servo pushed a commit that referenced this pull request Dec 23, 2015
Split layout wrappers into style+layout and layout-only functionality

This is a step towards removing the dependency of stylo on layout/.

This PR depends on #9004.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9051)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-dev-ref-unit

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Dec 23, 2015
@frewsxcv

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Dec 23, 2015
@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from 9866985 to f139860 Compare December 24, 2015 21:52
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Dec 24, 2015
@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from f139860 to 75c93eb Compare December 24, 2015 21:54
@bholley

bholley commented Dec 24, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 75c93eb with merge 0f875c1...

bors-servo pushed a commit that referenced this pull request Dec 24, 2015
Split layout wrappers into style+layout and layout-only functionality

This is a step towards removing the dependency of stylo on layout/.

This PR depends on #9004.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9051)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-dev-ref-unit

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Dec 24, 2015
@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from 75c93eb to 88c8453 Compare December 24, 2015 22:37
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Dec 24, 2015
@bholley

bholley commented Dec 24, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 88c8453 with merge 94c8165...

@SimonSapin

Copy link
Copy Markdown
Member

Reviewed 16 of 24 files at r1.
Review status: 16 of 24 files reviewed at latest revision, 1 unresolved discussion.


components/style/data.rs, line 38 [r1] (raw file):
I feel that this doesn’t belong here, but I’m guessing that not having it here makes things difficult in other places so don’t worry about it.


Comments from the review on Reviewable.io

@bholley

bholley commented Dec 28, 2015

Copy link
Copy Markdown
Contributor Author

components/style/data.rs, line 38 [r1] (raw file):
Yeah, this is needed for parallel DOM traversal. When I hoist parallel.rs into style/, I can move it into that file, which probably makes more sense.


Comments from the review on Reviewable.io

@larsbergstrom

Copy link
Copy Markdown
Contributor

I've spent a bunch of time staring at the layout & script portions of this code, and to my eye they preserve the previous behaviors (including clearing out the Option properly on dispose, panicing at appropriate places if a value is expected but the Option is empty, only calling transmute as needed, etc.). Not quite confident enough to r+ it yet, though, and would appreciate if @pcwalton or @SimonSapin could check to make sure that they like the structure of the refactoring in terms of which methods ended up where, to make sure it's in line with the design.

I'm very happy with the mechanics, though - they appear to have been preserved across the refactoring, so far as I can tell!

@Manishearth

Copy link
Copy Markdown
Member

Overall LGTM, but I'd also like to wait for review from Simon or Patrick.

@bholley

bholley commented Dec 29, 2015

Copy link
Copy Markdown
Contributor Author

Switching r? @SimonSapin, who will probably be able to review this sooner that @pcwalton.

@SimonSapin

Copy link
Copy Markdown
Member

Looks good overall.


Reviewed 8 of 24 files at r1.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


components/layout/wrapper.rs, line 178 [r1] (raw file):
Nit: please use as rather than transmute when possible. (I’m kinda scared of unqualified transmute + type inference + code changing over time.)


components/script/dom/node.rs, line 921 [r1] (raw file):
Nit: could this pair of methods be a single method that returns Option? It’s more idiomatic to leave it to callers to call .unwrap() or .is_some() or not.


components/style/dom.rs, line 32 [r1] (raw file):
Nit: while you’re touching this, please change uintptr_t to usize. They’re the same, except the latter doesn’t need to be imported.


components/style/dom.rs, line 44 [r1] (raw file):
(Re IRC discussion: no need to change anything here, but I haven’t seen the TFoo naming convention anywhere else and I don’t think it’s useful, other than as a not-so-good way to work around name conflicts.)


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 Dec 29, 2015
@bholley

bholley commented Dec 29, 2015

Copy link
Copy Markdown
Contributor Author

components/style/dom.rs, line 44 [r1] (raw file):
I'm certainly open to other suggestions. Per IRC discussion, I think it's pretty confusing to have selectors::tree::Element, style::Element, and script::dom::Element, where the former two are traits and the latter is a struct.


Comments from the review on Reviewable.io

@Manishearth

Copy link
Copy Markdown
Member

Review status: all files reviewed at latest revision, 4 unresolved discussions.


components/style/dom.rs, line 44 [r1] (raw file):
One solution is to always call these as style::Element and never import directly Another is AbstractElement (hello, Java, old friend). TElement is fine by me really, the other solutions don't seem too great.


Comments from the review on Reviewable.io

This patch does a number of things, unfortunately all at once:
* Hoists a large subset of the layout wrapper functionality into the style system.
* Merges TElementAttributes into the newly-created TElement.
* Reorganizes LayoutData by style vs layout, and removes LayoutDataShared.
* Simplifies the API for borrowing style/layout data.

There's still more to do to make the style system usable standalone, but
this is a good start.
@bholley

bholley commented Dec 29, 2015

Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 3 unresolved discussions.


components/script/dom/node.rs, line 921 [r1] (raw file):
I can change it, sure. I went with this convention on the layout side because almost all of the cases just .unwrap(), and I found that unnecessarily cluttered and confusing. But that leaves us with the has_data and the maybe_* variants. So I guess just .unwrap()-ing everywhere is in fact the most idiomatic.


Comments from the review on Reviewable.io

@bholley
bholley force-pushed the split_style_and_layout_wrappers branch from 48a8411 to 47059d2 Compare December 29, 2015 19:51
@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 Dec 29, 2015
@bholley

bholley commented Dec 29, 2015

Copy link
Copy Markdown
Contributor Author

r? @SimonSapin

@SimonSapin

Copy link
Copy Markdown
Member

@bors-servo r+


Reviewed 10 of 14 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 47059d2 has been approved by SimonSapin

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 47059d2 with merge 0f5c614...

@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Dec 30, 2015
bors-servo pushed a commit that referenced this pull request Dec 30, 2015
…nSapin

Split layout wrappers into style+layout and layout-only functionality

This is a step towards removing the dependency of stylo on layout/.

This PR depends on #9004.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9051)
<!-- Reviewable:end -->
@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 30, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 47059d2 into servo:master Dec 30, 2015
@bholley
bholley deleted the split_style_and_layout_wrappers branch October 30, 2016 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants