mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Refactor Error enum usage to consistently be qualified
This commit is contained in:
parent
94816bb3b4
commit
ba86131cd5
19 changed files with 139 additions and 161 deletions
|
@ -6,8 +6,7 @@ use canvas_traits::{CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle,
|
|||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::CanvasGradientBinding;
|
||||
use dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
|
||||
use dom::bindings::error::Error::{IndexSize, Syntax};
|
||||
use dom::bindings::error::ErrorResult;
|
||||
use dom::bindings::error::{Error, ErrorResult};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::num::Finite;
|
||||
|
@ -47,12 +46,12 @@ impl CanvasGradientMethods for CanvasGradient {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-canvasgradient-addcolorstop
|
||||
fn AddColorStop(&self, offset: Finite<f64>, color: String) -> ErrorResult {
|
||||
if *offset < 0f64 || *offset > 1f64 {
|
||||
return Err(IndexSize);
|
||||
return Err(Error::IndexSize);
|
||||
}
|
||||
|
||||
let color = match parse_color(&color) {
|
||||
Ok(color) => color,
|
||||
_ => return Err(Syntax)
|
||||
_ => return Err(Error::Syntax)
|
||||
};
|
||||
|
||||
self.stops.borrow_mut().push(CanvasGradientStop {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue