Auto merge of #16798 - bzbarsky:stylist-lazier-updates, r=emilio

Allow stylo to do lazier stylist rebuilds

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1361843 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because it's optimization, which should have no observable behavior difference.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16798)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-10 16:22:06 -05:00 committed by GitHub
commit c6c0252b19
4 changed files with 105 additions and 59 deletions

View file

@ -108,18 +108,26 @@ impl PerDocumentStyleDataImpl {
let author_style_disabled = self.stylesheets.author_style_disabled();
let mut stylesheets = Vec::<Arc<Stylesheet>>::new();
self.stylesheets.flush(&mut stylesheets);
stylist.update(stylesheets.as_slice(),
&StylesheetGuards::same(guard),
/* ua_sheets = */ None,
/* stylesheets_changed = */ true,
author_style_disabled,
&mut extra_data);
stylist.clear();
stylist.rebuild(stylesheets.as_slice(),
&StylesheetGuards::same(guard),
/* ua_sheets = */ None,
/* stylesheets_changed = */ true,
author_style_disabled,
&mut extra_data);
}
/// Get the default computed values for this document.
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
self.stylist.device.default_computed_values_arc()
}
/// Clear the stylist. This will be a no-op if the stylist is
/// already cleared; the stylist handles that.
pub fn clear_stylist(&mut self) {
let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
stylist.clear();
}
}
unsafe impl HasFFI for PerDocumentStyleData {

View file

@ -1628,16 +1628,16 @@ extern "C" {
extern "C" {
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_PrependStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_RemoveStyleSheet(set: RawServoStyleSetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_InsertStyleSheetBefore(set:
@ -1645,8 +1645,7 @@ extern "C" {
sheet:
RawServoStyleSheetBorrowed,
unique_id: u32,
before_unique_id: u32,
flush: bool);
before_unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_FlushStyleSheets(set: RawServoStyleSetBorrowed);