Audit usages of unicode case-changing methods.

This commit is contained in:
Corey Farwell 2017-07-26 22:58:19 +00:00
parent 58fd2956b3
commit 23e5bfaf27
6 changed files with 30 additions and 28 deletions

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::activation::Activatable;
use std::ascii::AsciiExt;
use dom::bindings::codegen::Bindings::DOMTokenListBinding::DOMTokenListMethods;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLAreaElementBinding::HTMLAreaElementMethods;
@ -240,13 +241,13 @@ impl HTMLAreaElement {
pub fn get_shape_from_coords(&self) -> Option<Area> {
let elem = self.upcast::<Element>();
let shape = elem.get_string_attribute(&"shape".into());
let shp: Shape = match shape.to_lowercase().as_ref() {
"circle" => Shape::Circle,
"circ" => Shape::Circle,
"rectangle" => Shape::Rectangle,
"rect" => Shape::Rectangle,
"polygon" => Shape::Rectangle,
"poly" => Shape::Polygon,
let shp: Shape = match &shape {
s if s.eq_ignore_ascii_case("circle") => Shape::Circle,
s if s.eq_ignore_ascii_case("circ") => Shape::Circle,
s if s.eq_ignore_ascii_case("rectangle") => Shape::Rectangle,
s if s.eq_ignore_ascii_case("rect") => Shape::Rectangle,
s if s.eq_ignore_ascii_case("polygon") => Shape::Rectangle,
s if s.eq_ignore_ascii_case("poly") => Shape::Polygon,
_ => return None,
};
if elem.has_attribute(&"coords".into()) {