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

stylo: Stop restyling display: none elements, remove the has_changed hack that made us use ReconstructFrame unconditionally. #12757

Merged
merged 12 commits into from Aug 11, 2016

Conversation

@emilio
Copy link
Member

emilio commented Aug 6, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors

r? @bholley


This change is Reviewable

@highfive
Copy link

highfive commented Aug 6, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/parallel.rs, components/style/sequential.rs, components/style/dom.rs, components/style/traversal.rs, components/style/matching.rs
  • @KiChjang: components/script_layout_interface/restyle_damage.rs
@highfive
Copy link

highfive commented Aug 6, 2016

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style and layout code, but no tests are modified. Please consider adding a test!
@emilio emilio force-pushed the emilio:stylo branch from a5b7ed9 to 1130e7a Aug 7, 2016
@emilio
Copy link
Member Author

emilio commented Aug 7, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Aug 7, 2016

Trying commit 1130e7a with merge bf43593...

bors-servo added a commit that referenced this pull request Aug 7, 2016
stylo: Stop restyling display: none elements, remove the has_changed hack that made us use ReconstructFrame unconditionally.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

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

r? @bholley

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

bors-servo commented Aug 7, 2016

💔 Test failed - mac-rel-css

@emilio emilio force-pushed the emilio:stylo branch from 1130e7a to 8b3a8fc Aug 7, 2016
@highfive highfive removed the S-tests-failed label Aug 7, 2016
@emilio
Copy link
Member Author

emilio commented Aug 7, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Aug 7, 2016

Trying commit 8b3a8fc with merge dbffad1...

bors-servo added a commit that referenced this pull request Aug 7, 2016
stylo: Stop restyling display: none elements, remove the has_changed hack that made us use ReconstructFrame unconditionally.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

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

r? @bholley

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

bors-servo commented Aug 7, 2016

💔 Test failed - linux-rel

@highfive
Copy link

highfive commented Aug 7, 2016

  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/browsing_context_name.html:
  └ PASS [expected FAIL] Retaining window.name on history traversal
@emilio
Copy link
Member Author

emilio commented Aug 8, 2016

That's a known intermittent (#12568), cool :)

@emilio emilio removed the S-tests-failed label Aug 8, 2016
/// performed.
///
/// If it's false, then process_postorder has no effect at all.
fn should_traverse_back_up(&self) -> bool { true }

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Call this has_postorder_traversal?

@@ -36,4 +36,7 @@ impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> {
}

fn process_postorder(&self, _: GeckoNode<'ln>) {}

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

unreacheable!() here.

@@ -149,6 +149,12 @@ pub trait DomTraversalContext<N: TNode> {
/// Process `node` on the way up, after its children have been processed.
fn process_postorder(&self, node: N);

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Add a comment indicating that this is only called if has_postorder_traversal returns true.

fn compute(source: Option<&nsStyleContext>,
new_style: &Arc<ComputedValues>) -> Self {
type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
let context = match source {
Some(ctx) => ctx as *const nsStyleContext as *mut nsStyleContext,
// If there's no style source (that is, no style context), there can

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

I'd say "if there's no preexisting computed values".

// If there's no style source (that is, no style context), there can
// be two reasons for it.
//
// The first one, is that this is not an incremental restyle (so we

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Nit: remove the comma.

//
// The second one is that this is an incremental restyle, but the
// node has display: none. In this case, the old computed values
// should still be present, and we should be able to compare the new

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Emphasize that they're stored on the node by servo, but we don't have a style context.

// can do nothing on it because the old and the new display values
// are none.
//
// This is done outside of this method in servo itself, so we

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Be more specific as to where.

use std::mem;
GeckoRestyleDamage(unsafe { mem::transmute(0u32) })
}

fn compute(source: Option<&nsStyleContext>,
new_style: &Arc<ComputedValues>) -> Self {

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Per discussion, let's make this take a Non-Option, and then the caller can make stronger assertions about the reason why the style context doesn't exist (i.e. either non-incremental restyle or the display::none case).

// the changes, and any change that we could miss would already have
// been caught by the parent's change. If for some reason I'm wrong on
// this, we'd have to compare computed values in Gecko too.
let existing_style =

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Please file a followup bug on bugzilla describing the stuff we talked about, and reference that bug here.

context.process_preorder(node);
let should_stop = match context.process_preorder(node) {
ForceTraversalStop::Force => true,
ForceTraversalStop::DontForce => false,

This comment has been minimized.

@bholley

bholley Aug 8, 2016

Contributor

Let's call these Let's call this RestyleResult::{StopTraversal,ContinueTraversal}?

context.pre_process_child_hook(node, kid);
if context.should_process(kid) {
doit::<N, C>(context, kid);
if !should_stop {

This comment has been minimized.

@pcwalton

pcwalton Aug 10, 2016

Contributor

Same as above: don't convert RestyleResult to a boolean.

@@ -201,6 +211,7 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
let mut bf = take_thread_local_bloom_filter(parent_opt, root, context.shared_context());

let nonincremental_layout = opts::get().nonincremental_layout;
let mut restyle_result = RestyleResult::Continue;
if nonincremental_layout || node.is_dirty() {

This comment has been minimized.

@pcwalton

pcwalton Aug 10, 2016

Contributor

nit: I wonder if this might be clearer as:

if !nonincremental_layout && !node.is_dirty() {
    return RestyleResult::Continue
}

Then you can remove a level of indentation below.

This comment has been minimized.

@emilio

emilio Aug 10, 2016

Author Member

Hmm... I can't see what you mean, you still need to insert the node in the bloom filter, complete animations, etc.

The rest of the comments are addressed or were on outdated commits and no longer apply I think.

This comment has been minimized.

@emilio

emilio Aug 10, 2016

Author Member

(Still needs an squash though)

@pcwalton
Copy link
Contributor

pcwalton commented Aug 11, 2016

r=me

emilio added 10 commits Aug 5, 2016
…play: none.
… nodes in the display: none case.
…andling to the caller.
@emilio emilio force-pushed the emilio:stylo branch from 3c9bfa3 to 9b8eac0 Aug 11, 2016
@emilio
Copy link
Member Author

emilio commented Aug 11, 2016

@bors-servo: r=bholley,pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2016

📌 Commit 9b8eac0 has been approved by bholley,pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2016

Testing commit 9b8eac0 with merge 1b24503...

bors-servo added a commit that referenced this pull request Aug 11, 2016
stylo: Stop restyling display: none elements, remove the has_changed hack that made us use ReconstructFrame unconditionally.

<!-- Please describe your changes on the following line: -->

---
<!-- 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

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

r? @bholley

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

bors-servo commented Aug 11, 2016

@bors-servo bors-servo merged commit 9b8eac0 into servo:master Aug 11, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@emilio emilio deleted the emilio:stylo branch Aug 11, 2016
@bors-servo bors-servo mentioned this pull request Aug 11, 2016
4 of 5 tasks complete
@bholley
Copy link
Contributor

bholley commented Aug 11, 2016

@emilio does the gecko-dev branch need to be updated in correspondence with this commit?

@emilio
Copy link
Member Author

emilio commented Aug 11, 2016

@bholley no, not necessarily

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

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