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

incremental restyle: Hoist more stuff to Element #13951

Merged
merged 1 commit into from Oct 28, 2016

Conversation

@bholley
Copy link
Contributor

bholley commented Oct 28, 2016

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.


This change is Reviewable

@highfive
Copy link

highfive commented Oct 28, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script_layout_interface/wrapper_traits.rs, components/script/layout_wrapper.rs
  • @fitzgen: components/script_layout_interface/wrapper_traits.rs, components/script/layout_wrapper.rs
  • @emilio: components/layout/fragment.rs, components/layout/traversal.rs, components/layout/construct.rs, components/layout/query.rs, components/layout/wrapper.rs
@highfive
Copy link

highfive commented Oct 28, 2016

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify layout and script code, but no tests are modified. Please consider adding a test!
@bholley
Copy link
Contributor Author

bholley commented Oct 28, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

Trying commit 9094b8c with merge 144440e...

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist more stuff to Element

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.

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

bors-servo commented Oct 28, 2016

@bholley
Copy link
Contributor Author

bholley commented Oct 28, 2016

The next patch is 99% done but I may not finish it tonight. r? @emilio on this one.

@highfive highfive assigned emilio and unassigned cbrewster Oct 28, 2016
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
@emilio
emilio approved these changes Oct 28, 2016
Copy link
Member

emilio left a comment

r=me

fn debug_id(self) -> usize;

/// Returns an iterator over this node's children.
fn children(&self) -> LayoutIterator<Self::ChildrenIterator>;

/// If this is an element, accesses the element data. Fails if this is not an element node.
/// Returns a ThreadSafeLayoutElement this is an element, None otherwise.

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

"if this is an element".

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Fixed.


/// Returns true if this node contributes content. This is used in the implementation of
/// `empty_cells` per CSS 2.1 § 17.6.1.1.
fn is_content(&self) -> bool {

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

Now this can be written just as self.get_pseudo_element_type() == PseudoElementType::Normal, or self.type_id().is_some().

Not a big deal, but maybe worth doing.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Fixed.

}
}

fn selected_style(&self) -> Arc<ServoComputedValues> {

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

I think having the context parameter here was sort of intended for consistency, but it's fine too.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Yeah I was kinda on the fence about it, but decided to opt for removal, since we can always add it back if we need it.

@@ -757,46 +779,48 @@ impl<'ln> ServoThreadSafeLayoutNode<'ln> {
}
}

// NB: The implementation here is a bit tricky because elements implementing
// pseudos are supposed to return false for is_element().

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

Yeah, I'd like this to change. In every other browser a pseudo-element is represented as an Element. Of course, not in the scope of this PR.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Well, other browser elements put NAC in the DOM, which Servo explicitly avoids doing. But yeah, we might be able to make the intra-layout abstraction cleaner. Agreed on out of scope.

/// The pseudo-element type, with (optionally),
/// an specified display value to override the stylesheet.
/// The pseudo-element type, with (optionally)
/// a specified display value to override the stylesheet.

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

arrg, Bobby the dictionary strikes again to correct my typos! :P

Thanks for doing this.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

:-)

let layout_node = match *pseudo {
Some(PseudoElement::Before) => layout_node.get_before_pseudo(),
Some(PseudoElement::After) => layout_node.get_after_pseudo(),
let layout_el = requested_node.to_threadsafe().as_element().unwrap();

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

Probably worth making this function take an Element directly. Can be a followup if it's too much pain.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Turns out to be kinda hard to do because LayoutElement doesn't exist until #13956, and the opaque representations are all Node-y. We can do it later.

self.pseudo == PseudoElementType::Normal
}

fn is_text_node(&self) -> bool {

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

Probably we should panic here (or similar) given we're doing a totally unnecessary check.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

I think we can actually just remove this trait impl entirely.

false
}

fn needs_layout(&self) -> bool { true }

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

Same here.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

Yep.

}

fn needs_layout(&self) -> bool {
self.pseudo != PseudoElementType::Normal ||
self.node.is_element() || self.node.is_text_node()
self.node.is_text_node() || self.node.is_element()

This comment has been minimized.

Copy link
@emilio

emilio Oct 28, 2016

Member

We shouldn't be creating ThreadSafeLayoutNodes for other kind of nodes now right? So this function can pretty much go away I think.

This comment has been minimized.

Copy link
@bholley

bholley Oct 28, 2016

Author Contributor

We still can. The iterator returned by children() operates on nodes of type Self, and then filters them using needs_layout before returning them. So if there's a comment node, we'll still create a ServoThreadSafeLayoutNode for it, just not return it to the traversal code.

So I think we need this.

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
@bholley bholley force-pushed the bholley:more_element branch from 9094b8c to 46e2918 Oct 28, 2016
@bholley
Copy link
Contributor Author

bholley commented Oct 28, 2016

@bors-servo r=emilio p=1

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

📌 Commit 46e2918 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

Testing commit 46e2918 with merge 04ca7cd...

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist more stuff to Element

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.

<!-- 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/13951)
<!-- Reviewable:end -->
@larsbergstrom
Copy link
Contributor

larsbergstrom commented Oct 28, 2016

@bors-servo force clean retry

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

Testing commit 46e2918 with merge f61f380...

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist more stuff to Element

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.

<!-- 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/13951)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

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

bors-servo commented Oct 28, 2016

💔 Test failed - arm64

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

💔 Test failed - linux-rel-wpt

@bholley
Copy link
Contributor Author

bholley commented Oct 28, 2016

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

Testing commit 46e2918 with merge 355935e...

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist more stuff to Element

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.

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

bors-servo commented Oct 28, 2016

💔 Test failed - linux-rel-wpt

@larsbergstrom
Copy link
Contributor

larsbergstrom commented Oct 28, 2016

@bors-servo retry

  • infra
@bors-servo
Copy link
Contributor

bors-servo commented Oct 28, 2016

Testing commit 46e2918 with merge e7b5891...

bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist more stuff to Element

The patch here hoists pseudo-element handling onto ThreadSafeLayoutElement. I have another patch which hoists stuff from TNode to TElement, but want to make sure this patch passes try first.

<!-- 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/13951)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

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

bors-servo commented Oct 28, 2016

@bors-servo bors-servo merged commit 46e2918 into servo:master Oct 28, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 28, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 29, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 29, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 29, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this pull request Oct 29, 2016
incremental restyle: Hoist most styling functionality from TNode to TElement

This is a continuation of the work in #13951. I'm separating it out into a separate PR since the aforementioned patch has a green try run and this one doesn't yet.

<!-- 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/13956)
<!-- Reviewable:end -->
@bholley bholley deleted the bholley:more_element branch Oct 30, 2016
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

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