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

Add is_mathml_annotation_xml_integration_point method #186

Merged
merged 1 commit into from Jan 11, 2016

Conversation

@GuillaumeGomez
Copy link
Contributor

GuillaumeGomez commented Jan 4, 2016

r? @nox
#119

Review on Reviewable

for it in 0..attrs.len() {
match attrs[it].name {
qualname!(html, "encoding") => {
return new_node(Element(name, AnnotationXml(attrs[it].value.to_lowercase() == "text/html"), attrs));

This comment has been minimized.

@SimonSapin

SimonSapin Jan 5, 2016

Member

Use .eq_ignore_ascii_case("text/html") to save a memory allocation.

@@ -45,6 +45,7 @@ pub enum ElementEnum {
/// A template element and its template contents.
/// https://html.spec.whatwg.org/multipage/#template-contents
Template(Handle),
AnnotationXml(bool),

This comment has been minimized.

@SimonSapin

SimonSapin Jan 5, 2016

Member

What does it mean for an element to "be" this variant? Is it exclusive with other variants? What does the boolean mean? Consider using a struct-like variant in order to name the boolean. Please add a doc-comment with a link to the relevant section of spec.

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez Jan 5, 2016

Author Contributor

I didn't add comments yet, it was just supposed to be a first shot to get help. on some details before finishing it. I should have precised, my bad.


// Returns true if the adjusted current node is an HTML integration point
// and the token is a start tag
fn is_mathml_annotation_xml_integration_point(&self) -> bool;

This comment has been minimized.

@nox

nox Jan 5, 2016

Member

This should take a Self::Handle and that's the thing on which you check whether it is an integration point or not.

@@ -303,6 +312,13 @@ impl TreeSink for RcDom {
panic!("not a script element!");
}
}

fn is_mathml_annotation_xml_integration_point(&self) -> bool {
match (**self.document).borrow().node {

This comment has been minimized.

@nox

nox Jan 5, 2016

Member

The thing you need to check is the given Handle that needs to be passed to the method.

@GuillaumeGomez
Copy link
Contributor Author

GuillaumeGomez commented Jan 5, 2016

Ok, I updated the current code @nox.

fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {
match (**handle).borrow().node {
Element(_, AnnotationXml(ret), _) => ret,
_ => false,

This comment has been minimized.

@nox

nox Jan 6, 2016

Member

This should be unreachable.

}
_ => continue,
}
}

This comment has been minimized.

@nox

nox Jan 6, 2016

Member

This should be in the match expression defining info below, for qualname!(mathml, "annotation-xml") elements.

@GuillaumeGomez
Copy link
Contributor Author

GuillaumeGomez commented Jan 10, 2016

Anything else to add/update?

@@ -901,11 +901,15 @@ impl<Handle, Sink> TreeBuilderActions<Handle>

if let qualname!(mathml, "annotation-xml") = name {
if let TagToken(Tag { kind: StartTag, name: atom!("svg"), .. }) = *token {

This comment has been minimized.

@nox

nox Jan 10, 2016

Member

This condition should go away. It has nothing to do here.

This comment has been minimized.

@nox

nox Jan 11, 2016

Member

I was wrong about this.


// Returns true if the adjusted current node is an HTML integration point
// and the token is a start tag
fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {

This comment has been minimized.

@nox

nox Jan 10, 2016

Member

This should take Self::Handle, and you should clone handles when passing them.

@nox
Copy link
Member

nox commented Jan 11, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jan 11, 2016

📌 Commit 3de1587 has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Jan 11, 2016

Testing commit 3de1587 with merge c3dea24...

bors-servo added a commit that referenced this pull request Jan 11, 2016
Add is_mathml_annotation_xml_integration_point method

r? @nox

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/html5ever/186)
<!-- Reviewable:end -->
@nox nox self-assigned this Jan 11, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Jan 11, 2016

☀️ Test successful - travis

@bors-servo bors-servo merged commit 3de1587 into servo:master Jan 11, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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

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