Auto merge of #18411 - servo:rename-preshint-method, r=emilio

Rename VirtualMethods::attribute_is_mapped

<!-- 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/18411)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-07 15:56:01 -05:00 committed by GitHub
commit e9336b39a6
4 changed files with 7 additions and 7 deletions

View file

@ -2500,7 +2500,7 @@ impl Document {
entry.hint.insert(RESTYLE_STYLE_ATTRIBUTE);
}
if vtable_for(el.upcast()).attribute_is_mapped(attr) {
if vtable_for(el.upcast()).attribute_affects_presentational_hints(attr) {
entry.hint.insert(RESTYLE_SELF);
}

View file

@ -2303,14 +2303,14 @@ impl VirtualMethods for Element {
Some(self.upcast::<Node>() as &VirtualMethods)
}
fn attribute_is_mapped(&self, attr: &Attr) -> bool {
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
// FIXME: This should be more fine-grained, not all elements care about these.
if attr.local_name() == &local_name!("width") ||
attr.local_name() == &local_name!("height") {
return true;
}
self.super_type().unwrap().attribute_is_mapped(attr)
self.super_type().unwrap().attribute_affects_presentational_hints(attr)
}
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {

View file

@ -71,13 +71,13 @@ impl VirtualMethods for HTMLFontElement {
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn attribute_is_mapped(&self, attr: &Attr) -> bool {
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
if attr.local_name() == &local_name!("color") {
return true;
}
// FIXME: Should also return true for `size` and `face` changes!
self.super_type().unwrap().attribute_is_mapped(attr)
self.super_type().unwrap().attribute_affects_presentational_hints(attr)
}
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {

View file

@ -72,9 +72,9 @@ pub trait VirtualMethods {
/// Returns `true` if given attribute `attr` affects style of the
/// given element.
fn attribute_is_mapped(&self, attr: &Attr) -> bool {
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
match self.super_type() {
Some(s) => s.attribute_is_mapped(attr),
Some(s) => s.attribute_affects_presentational_hints(attr),
None => false
}
}