mirror of
https://github.com/servo/servo.git
synced 2025-07-25 16:20:36 +01:00
auto merge of #5343 : frewsxcv/servo/script-dom-window, r=jdm
This commit is contained in:
commit
1432b630d2
1 changed files with 26 additions and 28 deletions
|
@ -270,11 +270,9 @@ pub fn base64_atob(atob: DOMString) -> Fallible<DOMString> {
|
||||||
// U+002B PLUS SIGN (+)
|
// U+002B PLUS SIGN (+)
|
||||||
// U+002F SOLIDUS (/)
|
// U+002F SOLIDUS (/)
|
||||||
// Alphanumeric ASCII characters"
|
// Alphanumeric ASCII characters"
|
||||||
if input.chars()
|
if input.chars().any(|c| c != '+' && c != '/' && !c.is_alphanumeric()) {
|
||||||
.find(|&c| !(c == '+' || c == '/' || c.is_alphanumeric()))
|
return Err(InvalidCharacter)
|
||||||
.is_some() {
|
}
|
||||||
return Err(InvalidCharacter)
|
|
||||||
}
|
|
||||||
|
|
||||||
match input.from_base64() {
|
match input.from_base64() {
|
||||||
Ok(data) => Ok(data.iter().map(|&b| b as char).collect::<String>()),
|
Ok(data) => Ok(data.iter().map(|&b| b as char).collect::<String>()),
|
||||||
|
@ -631,7 +629,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
||||||
fn load_url(self, href: DOMString) {
|
fn load_url(self, href: DOMString) {
|
||||||
let base_url = self.get_url();
|
let base_url = self.get_url();
|
||||||
debug!("current page url is {}", base_url);
|
debug!("current page url is {}", base_url);
|
||||||
let url = UrlParser::new().base_url(&base_url).parse(href.as_slice());
|
let url = UrlParser::new().base_url(&base_url).parse(&href);
|
||||||
// FIXME: handle URL parse errors more gracefully.
|
// FIXME: handle URL parse errors more gracefully.
|
||||||
let url = url.unwrap();
|
let url = url.unwrap();
|
||||||
match url.fragment {
|
match url.fragment {
|
||||||
|
@ -842,30 +840,30 @@ fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool{
|
||||||
|
|
||||||
fn debug_reflow_events(goal: &ReflowGoal, query_type: &ReflowQueryType, reason: &ReflowReason) {
|
fn debug_reflow_events(goal: &ReflowGoal, query_type: &ReflowQueryType, reason: &ReflowReason) {
|
||||||
let mut debug_msg = String::from_str("****");
|
let mut debug_msg = String::from_str("****");
|
||||||
match *goal {
|
debug_msg.push_str(match *goal {
|
||||||
ReflowGoal::ForDisplay => debug_msg.push_str("\tForDisplay"),
|
ReflowGoal::ForDisplay => "\tForDisplay",
|
||||||
ReflowGoal::ForScriptQuery => debug_msg.push_str("\tForScriptQuery"),
|
ReflowGoal::ForScriptQuery => "\tForScriptQuery",
|
||||||
}
|
});
|
||||||
|
|
||||||
match *query_type {
|
debug_msg.push_str(match *query_type {
|
||||||
ReflowQueryType::NoQuery => debug_msg.push_str("\tNoQuery"),
|
ReflowQueryType::NoQuery => "\tNoQuery",
|
||||||
ReflowQueryType::ContentBoxQuery(_n) => debug_msg.push_str("\tContentBoxQuery"),
|
ReflowQueryType::ContentBoxQuery(_n) => "\tContentBoxQuery",
|
||||||
ReflowQueryType::ContentBoxesQuery(_n) => debug_msg.push_str("\tContentBoxesQuery"),
|
ReflowQueryType::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
|
||||||
}
|
});
|
||||||
|
|
||||||
match *reason {
|
debug_msg.push_str(match *reason {
|
||||||
ReflowReason::CachedPageNeededReflow => debug_msg.push_str("\tCachedPageNeededReflow"),
|
ReflowReason::CachedPageNeededReflow => "\tCachedPageNeededReflow",
|
||||||
ReflowReason::FirstLoad => debug_msg.push_str("\tFirstLoad"),
|
ReflowReason::FirstLoad => "\tFirstLoad",
|
||||||
ReflowReason::KeyEvent => debug_msg.push_str("\tKeyEvent"),
|
ReflowReason::KeyEvent => "\tKeyEvent",
|
||||||
ReflowReason::MouseEvent => debug_msg.push_str("\tMouseEvent"),
|
ReflowReason::MouseEvent => "\tMouseEvent",
|
||||||
ReflowReason::Query => debug_msg.push_str("\tQuery"),
|
ReflowReason::Query => "\tQuery",
|
||||||
ReflowReason::ReceivedReflowEvent => debug_msg.push_str("\tReceivedReflowEvent"),
|
ReflowReason::ReceivedReflowEvent => "\tReceivedReflowEvent",
|
||||||
ReflowReason::Timer => debug_msg.push_str("\tTimer"),
|
ReflowReason::Timer => "\tTimer",
|
||||||
ReflowReason::Viewport => debug_msg.push_str("\tViewport"),
|
ReflowReason::Viewport => "\tViewport",
|
||||||
ReflowReason::WindowResize => debug_msg.push_str("\tWindowResize"),
|
ReflowReason::WindowResize => "\tWindowResize",
|
||||||
ReflowReason::DOMContentLoaded => debug_msg.push_str("\tDOMContentLoaded"),
|
ReflowReason::DOMContentLoaded => "\tDOMContentLoaded",
|
||||||
ReflowReason::DocumentLoaded => debug_msg.push_str("\tDocumentLoaded"),
|
ReflowReason::DocumentLoaded => "\tDocumentLoaded",
|
||||||
}
|
});
|
||||||
|
|
||||||
println!("{}", debug_msg);
|
println!("{}", debug_msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue