aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-17 15:34:47 -0600
committerGitHub <noreply@github.com>2016-11-17 15:34:47 -0600
commit22aebdf5d41a3509cd6515ccf5edcdf33715a76d (patch)
tree824af410d147404d0a6dc0908cec85cc71df5bfd /components/script/dom/document.rs
parentb3ad71353bf264770bf0b3a87b32d86928eb09d4 (diff)
parent913c874cb55fd0fdc9e8f3a4c34624cd015fac8a (diff)
downloadservo-22aebdf5d41a3509cd6515ccf5edcdf33715a76d.tar.gz
servo-22aebdf5d41a3509cd6515ccf5edcdf33715a76d.zip
Auto merge of #14246 - emilio:servo-url, r=SimonSapin
Urlmageddon <!-- Please describe your changes on the following line: --> Still needs a bunch of code in net to be converted in order to get more advantage of this for images and stuff, but meanwhile this should help quite a bit with #13778. Still wanted to get this in. r? @SimonSapin <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index d13d94f8099..ec71cf20085 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -108,6 +108,7 @@ use script_traits::{ScriptMsg as ConstellationMsg, TouchpadPressurePhase};
use script_traits::{TouchEventType, TouchId};
use script_traits::UntrustedNodeAddress;
use servo_atoms::Atom;
+use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::boxed::FnBox;
@@ -127,7 +128,6 @@ use style::selector_impl::{RestyleDamage, Snapshot};
use style::str::{split_html_space_chars, str_join};
use style::stylesheets::Stylesheet;
use time;
-use url::Url;
use url::percent_encoding::percent_decode;
use util::prefs::PREFS;
@@ -192,7 +192,7 @@ pub struct Document {
last_modified: Option<String>,
encoding: Cell<EncodingRef>,
is_html_document: bool,
- url: Url,
+ url: ServoUrl,
quirks_mode: Cell<QuirksMode>,
/// Caches for the getElement methods
id_map: DOMRefCell<HashMap<Atom, Vec<JS<Element>>>>,
@@ -398,12 +398,12 @@ impl Document {
}
// https://dom.spec.whatwg.org/#concept-document-url
- pub fn url(&self) -> &Url {
+ pub fn url(&self) -> &ServoUrl {
&self.url
}
// https://html.spec.whatwg.org/multipage/#fallback-base-url
- pub fn fallback_base_url(&self) -> Url {
+ pub fn fallback_base_url(&self) -> ServoUrl {
// Step 1: iframe srcdoc (#4767).
// Step 2: about:blank with a creator browsing context.
// Step 3.
@@ -411,7 +411,7 @@ impl Document {
}
// https://html.spec.whatwg.org/multipage/#document-base-url
- pub fn base_url(&self) -> Url {
+ pub fn base_url(&self) -> ServoUrl {
match self.base_element() {
// Step 1.
None => self.fallback_base_url(),
@@ -1762,7 +1762,7 @@ impl LayoutDocumentHelpers for LayoutJS<Document> {
}
/// https://url.spec.whatwg.org/#network-scheme
-fn url_has_network_scheme(url: &Url) -> bool {
+fn url_has_network_scheme(url: &ServoUrl) -> bool {
match url.scheme() {
"ftp" | "http" | "https" => true,
_ => false,
@@ -1772,7 +1772,7 @@ fn url_has_network_scheme(url: &Url) -> bool {
impl Document {
pub fn new_inherited(window: &Window,
browsing_context: Option<&BrowsingContext>,
- url: Option<Url>,
+ url: Option<ServoUrl>,
is_html_document: IsHTMLDocument,
content_type: Option<DOMString>,
last_modified: Option<String>,
@@ -1781,7 +1781,7 @@ impl Document {
referrer: Option<String>,
referrer_policy: Option<ReferrerPolicy>)
-> Document {
- let url = url.unwrap_or_else(|| Url::parse("about:blank").unwrap());
+ let url = url.unwrap_or_else(|| ServoUrl::parse("about:blank").unwrap());
let (ready_state, domcontentloaded_dispatched) = if source == DocumentSource::FromParser {
(DocumentReadyState::Loading, false)
@@ -1892,7 +1892,7 @@ impl Document {
pub fn new(window: &Window,
browsing_context: Option<&BrowsingContext>,
- url: Option<Url>,
+ url: Option<ServoUrl>,
doctype: IsHTMLDocument,
content_type: Option<DOMString>,
last_modified: Option<String>,