mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Change while loop in HTMLImageElement::handle_event to for loop
Remove trailing whitespace
This commit is contained in:
parent
e7efdfc655
commit
97e7c6be29
1 changed files with 9 additions and 8 deletions
|
@ -658,7 +658,7 @@ impl VirtualMethods for HTMLImageElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_event(&self, event: &Event) {
|
fn handle_event(&self, event: &Event) {
|
||||||
if (event.type_() == atom!("click")) {
|
if event.type_() == atom!("click") {
|
||||||
let area_elements = self.areas();
|
let area_elements = self.areas();
|
||||||
let elements = if let Some(x) = area_elements {
|
let elements = if let Some(x) = area_elements {
|
||||||
x
|
x
|
||||||
|
@ -673,23 +673,24 @@ impl VirtualMethods for HTMLImageElement {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let point = Point2D::new(mouse_event.ClientX().to_f32().unwrap(), mouse_event.ClientY().to_f32().unwrap());
|
let point = Point2D::new(mouse_event.ClientX().to_f32().unwrap(),
|
||||||
|
mouse_event.ClientY().to_f32().unwrap());
|
||||||
|
|
||||||
// Walk HTMLAreaElements
|
// Walk HTMLAreaElements
|
||||||
let mut index = 0;
|
for element in elements {
|
||||||
while index < elements.len() {
|
let shape = element.get_shape_from_coords();
|
||||||
let shape = elements[index].get_shape_from_coords();
|
|
||||||
let p = Point2D::new(self.upcast::<Element>().GetBoundingClientRect().X() as f32,
|
let p = Point2D::new(self.upcast::<Element>().GetBoundingClientRect().X() as f32,
|
||||||
self.upcast::<Element>().GetBoundingClientRect().Y() as f32);
|
self.upcast::<Element>().GetBoundingClientRect().Y() as f32);
|
||||||
|
|
||||||
let shp = if let Some(x) = shape {
|
let shp = if let Some(x) = shape {
|
||||||
x.absolute_coords(p)
|
x.absolute_coords(p)
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
};
|
};
|
||||||
if shp.hit_test(point) {
|
if shp.hit_test(point) {
|
||||||
elements[index].activation_behavior(event, self.upcast());
|
element.activation_behavior(event, self.upcast());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
index += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue