servo: Merge #18411 - Rename VirtualMethods::attribute_is_mapped (from servo:rename-preshint-method); r=emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: e9336b39a6c24037f8dce1bbc85f437af5f439d7

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : abbaa026055a724705a5cbdf2e082d7de4309843
This commit is contained in:
Anthony Ramine 2017-09-07 15:56:01 -05:00
Родитель c489cd113c
Коммит 4d2e9e52b8
4 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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
}
}