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

Merge normal and important declarations in style rules #12943

Merged
merged 15 commits into from
Aug 21, 2016

Conversation

SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Aug 19, 2016

Have a single Vec instead of two. Fix #3426


  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/selector_matching.rs, components/style/properties/properties.mako.rs, components/style/matching.rs, components/style/Cargo.toml, components/style/lib.rs, components/style/properties/data.py, components/style/properties/shorthand/box.mako.rs, components/style/dom.rs, components/style/keyframes.rs, components/style/properties/longhand/box.mako.rs, components/style/animation.rs
  • @KiChjang: components/script/dom/cssstyledeclaration.rs, components/script/dom/element.rs, components/script_layout_interface/wrapper_traits.rs, components/script/layout_wrapper.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 19, 2016
@highfive
Copy link

warning Warning warning

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

@SimonSapin
Copy link
Member Author

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 2f500e9 with merge 95b3287...

bors-servo pushed a commit that referenced this pull request Aug 19, 2016
Merge normal and important declarations in style rules

Have a single Vec instead of two. Fix #3426

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #3426.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/12943)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

⛄ The build was interrupted to prioritize another pull request.

@bors-servo
Copy link
Contributor

⌛ Trying commit 2f500e9 with merge 0095764...

bors-servo pushed a commit that referenced this pull request Aug 19, 2016
Merge normal and important declarations in style rules

Have a single Vec instead of two. Fix #3426

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #3426.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/12943)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💥 Test timed out

declarations: declarations.normal,
})
}
pub declarations: Arc<Vec<(PropertyDeclaration, Importance)>>,
Copy link
Member

Choose a reason for hiding this comment

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

Important declarations in keyframes are ignored, so the previous implementation was correct. Please make this just a Vec<PropertyDeclaration>, and point to https://drafts.csswg.org/css-animations/#keyframes:

None of the properties interact with the cascade (so using !important on them is invalid and will cause the
property to be ignored).

Copy link
Member Author

Choose a reason for hiding this comment

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

style::animation::compute_style_for_animation_step crates a style::selector_matching::DeclarationBlock struct from this. That struct contains Arc<Vec<(PropertyDeclaration, Importance)>>. So having dummy Importance::Normal values in Keyframe enables doing this by cloning an Arc (incrementing a refcount) rather than creating a new Vec.

I’ve added a doc-comment saying this.

@emilio
Copy link
Member

emilio commented Aug 20, 2016

Arguably should have reviewed commit by commit to avoid leaving so much noise, but it's probably late for that.

The approach looks good to me. Probably @heycam may want to take a look at this too. I'm still confused by the deduplicate_property_declarations thing, but the rest makes sense to me.

@bors-servo: retry

@bors-servo
Copy link
Contributor

⌛ Trying commit 2f500e9 with merge 7ed02d2...

bors-servo pushed a commit that referenced this pull request Aug 20, 2016
Merge normal and important declarations in style rules

Have a single Vec instead of two. Fix #3426

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #3426.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/12943)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Aug 20, 2016
@highfive
Copy link

  ▶ FAIL [expected PASS] /css-style-attr-1_dev/html4/style-attr-cascade-002.htm
  └   → /css-style-attr-1_dev/html4/style-attr-cascade-002.htm bf25a67d9f07765e90c077aec3051e5effa9ed08
/css-style-attr-1_dev/html4/reference/ref-green.htm 5570f2b94aae1cac828af0c91bc632190eb0f0c1
Testing bf25a67d9f07765e90c077aec3051e5effa9ed08 == 5570f2b94aae1cac828af0c91bc632190eb0f0c1

  ▶ FAIL [expected PASS] /css-variables-1_dev/html/variable-reference-13.htm
  └   → /css-variables-1_dev/html/variable-reference-13.htm bf1aa2f1153c018c97c7fdd1ac77c71ff66e899d
/css-variables-1_dev/html/support/color-green-ref.htm 90de59877a1f34c922b370c162008e33df4c6f30
Testing bf1aa2f1153c018c97c7fdd1ac77c71ff66e899d == 90de59877a1f34c922b370c162008e33df4c6f30

  ▶ FAIL [expected PASS] /css21_dev/html4/style-attr-cascade-002.htm
  └   → /css21_dev/html4/style-attr-cascade-002.htm bf25a67d9f07765e90c077aec3051e5effa9ed08
/css21_dev/html4/reference/ref-green.htm 5570f2b94aae1cac828af0c91bc632190eb0f0c1
Testing bf25a67d9f07765e90c077aec3051e5effa9ed08 == 5570f2b94aae1cac828af0c91bc632190eb0f0c1

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Aug 20, 2016
@SimonSapin
Copy link
Member Author

SimonSapin commented Aug 20, 2016

I’ve pushed fixup! commits, separate for review but to be auto-squashed before merging.

These last three test failures were not intermittent. I could reliably reproduce them locally, and fixing the deduplication vs importance bug that you caught fixed them.

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 7b0a881 with merge e3c563c...

@emilio
Copy link
Member

emilio commented Aug 21, 2016

@bors-servo: r+

@bors-servo
Copy link
Contributor

📌 Commit 023a3b7 has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Aug 21, 2016
@highfive highfive assigned emilio and unassigned metajack Aug 21, 2016
@bors-servo
Copy link
Contributor

⌛ Testing commit 023a3b7 with merge 87fd6f1...

bors-servo pushed a commit that referenced this pull request Aug 21, 2016
Merge normal and important declarations in style rules

Have a single Vec instead of two. Fix #3426

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #3426.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/12943)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 21, 2016
@highfive
Copy link

  ▶ FAIL [expected PASS] /_mozilla/css/setpropertypriority.html
  └   → /_mozilla/css/setpropertypriority.html 1c40214a1a913cbd096a44b2d280fb3193fa09d0
/_mozilla/css/setpropertypriority_ref.html f565a85a358e1e10906e0a87eb234acff04e9bfb
Testing 1c40214a1a913cbd096a44b2d280fb3193fa09d0 == f565a85a358e1e10906e0a87eb234acff04e9bfb

let declarations = Arc::make_mut(&mut declarations.declarations);
for &mut (ref declaration, ref mut importance) in declarations {
if properties.iter().any(|p| declaration.name() == **p) {
*importance = new_importance
Copy link
Member

Choose a reason for hiding this comment

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

forgot to update the count in this one, that's why that test is failing, sorry for not catching it before.

… instead of the presence (`bool` flags) of each.

This allows removing `recalc_any` which iterated over the `Vec`.
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 21, 2016
@SimonSapin
Copy link
Member Author

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit f9150af has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 21, 2016
@bors-servo
Copy link
Contributor

⌛ Testing commit f9150af with merge f8b2be1...

bors-servo pushed a commit that referenced this pull request Aug 21, 2016
Merge normal and important declarations in style rules

Have a single Vec instead of two. Fix #3426

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #3426.

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/12943)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows-dev

@bors-servo bors-servo merged commit f9150af into master Aug 21, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 21, 2016
@SimonSapin SimonSapin deleted the merged-declaration-block branch August 21, 2016 09:40
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.

Make PropertyDeclarationBlock store a single vector of declarations
5 participants