mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Auto merge of #22385 - servo:rustup, r=SimonSapin
Upgrade to rustc 1.33.0-nightly (fb86d604b 2018-12-27) <!-- 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/22385) <!-- Reviewable:end -->
This commit is contained in:
commit
8de1b8d3f4
217 changed files with 1218 additions and 1366 deletions
|
@ -461,10 +461,8 @@ impl BluetoothManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.retain(|s| {
|
services.retain(|s| {
|
||||||
!uuid_is_blocklisted(&s.get_uuid().unwrap_or(String::new()), Blocklist::All) && self
|
!uuid_is_blocklisted(&s.get_uuid().unwrap_or(String::new()), Blocklist::All) &&
|
||||||
.allowed_services
|
self.allowed_services.get(device_id).map_or(false, |uuids| {
|
||||||
.get(device_id)
|
|
||||||
.map_or(false, |uuids| {
|
|
||||||
uuids.contains(&s.get_uuid().unwrap_or(String::new()))
|
uuids.contains(&s.get_uuid().unwrap_or(String::new()))
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -554,9 +552,9 @@ impl BluetoothManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn characteristic_is_cached(&self, characteristic_id: &str) -> bool {
|
fn characteristic_is_cached(&self, characteristic_id: &str) -> bool {
|
||||||
self.cached_characteristics.contains_key(characteristic_id) && self
|
self.cached_characteristics.contains_key(characteristic_id) &&
|
||||||
.characteristic_to_service
|
self.characteristic_to_service
|
||||||
.contains_key(characteristic_id)
|
.contains_key(characteristic_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Descriptor
|
// Descriptor
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::canvas_data::*;
|
||||||
use azure::azure_hl::AntialiasMode;
|
use azure::azure_hl::AntialiasMode;
|
||||||
use canvas_traits::canvas::*;
|
use canvas_traits::canvas::*;
|
||||||
use crate::canvas_data::*;
|
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::gl_context::GLContextFactory;
|
||||||
|
use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
|
||||||
use canvas_traits::webgl::webgl_channel;
|
use canvas_traits::webgl::webgl_channel;
|
||||||
use canvas_traits::webgl::DOMToTextureCommand;
|
use canvas_traits::webgl::DOMToTextureCommand;
|
||||||
use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver};
|
use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver};
|
||||||
use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
|
use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
|
||||||
use crate::gl_context::GLContextFactory;
|
|
||||||
use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
|
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
|
|
|
@ -1425,10 +1425,10 @@ impl WebGLImpl {
|
||||||
(depth, gl::DEPTH_BUFFER_BIT),
|
(depth, gl::DEPTH_BUFFER_BIT),
|
||||||
(stencil, gl::STENCIL_BUFFER_BIT),
|
(stencil, gl::STENCIL_BUFFER_BIT),
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.fold(0, |bits, &(enabled, bit)| {
|
.fold(0, |bits, &(enabled, bit)| {
|
||||||
bits | if enabled { bit } else { 0 }
|
bits | if enabled { bit } else { 0 }
|
||||||
});
|
});
|
||||||
|
|
||||||
if state.scissor_test_enabled {
|
if state.scissor_test_enabled {
|
||||||
gl.disable(gl::SCISSOR_TEST);
|
gl.disable(gl::SCISSOR_TEST);
|
||||||
|
|
|
@ -975,15 +975,17 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let do_not_use_native_titlebar = opt_match.opt_present("b") || !PREFS
|
let do_not_use_native_titlebar = opt_match.opt_present("b") ||
|
||||||
.get("shell.native-titlebar.enabled")
|
!PREFS
|
||||||
.as_boolean()
|
.get("shell.native-titlebar.enabled")
|
||||||
.unwrap();
|
.as_boolean()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa && PREFS
|
let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa &&
|
||||||
.get("gfx.subpixel-text-antialiasing.enabled")
|
PREFS
|
||||||
.as_boolean()
|
.get("gfx.subpixel-text-antialiasing.enabled")
|
||||||
.unwrap();
|
.as_boolean()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
let is_printing_version = opt_match.opt_present("v") || opt_match.opt_present("version");
|
||||||
|
|
||||||
|
|
|
@ -89,17 +89,6 @@
|
||||||
//!
|
//!
|
||||||
//! See https://github.com/servo/servo/issues/14704
|
//! See https://github.com/servo/servo/issues/14704
|
||||||
|
|
||||||
use background_hang_monitor::HangMonitorRegister;
|
|
||||||
use backtrace::Backtrace;
|
|
||||||
use bluetooth_traits::BluetoothRequest;
|
|
||||||
use canvas::canvas_paint_thread::CanvasPaintThread;
|
|
||||||
use canvas::webgl_thread::WebGLThreads;
|
|
||||||
use canvas_traits::canvas::CanvasId;
|
|
||||||
use canvas_traits::canvas::CanvasMsg;
|
|
||||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
|
||||||
use compositing::compositor_thread::CompositorProxy;
|
|
||||||
use compositing::compositor_thread::Msg as ToCompositorMsg;
|
|
||||||
use compositing::SendableFrameTree;
|
|
||||||
use crate::browsingcontext::NewBrowsingContextInfo;
|
use crate::browsingcontext::NewBrowsingContextInfo;
|
||||||
use crate::browsingcontext::{
|
use crate::browsingcontext::{
|
||||||
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator,
|
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator,
|
||||||
|
@ -111,6 +100,17 @@ use crate::session_history::{
|
||||||
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
|
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
|
||||||
};
|
};
|
||||||
use crate::timer_scheduler::TimerScheduler;
|
use crate::timer_scheduler::TimerScheduler;
|
||||||
|
use background_hang_monitor::HangMonitorRegister;
|
||||||
|
use backtrace::Backtrace;
|
||||||
|
use bluetooth_traits::BluetoothRequest;
|
||||||
|
use canvas::canvas_paint_thread::CanvasPaintThread;
|
||||||
|
use canvas::webgl_thread::WebGLThreads;
|
||||||
|
use canvas_traits::canvas::CanvasId;
|
||||||
|
use canvas_traits::canvas::CanvasMsg;
|
||||||
|
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||||
|
use compositing::compositor_thread::CompositorProxy;
|
||||||
|
use compositing::compositor_thread::Msg as ToCompositorMsg;
|
||||||
|
use compositing::SendableFrameTree;
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
||||||
use embedder_traits::{EmbedderMsg, EmbedderProxy};
|
use embedder_traits::{EmbedderMsg, EmbedderProxy};
|
||||||
|
@ -1090,7 +1090,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Attempted to navigate {} after closure.",
|
"Attempted to navigate {} after closure.",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
@ -1103,7 +1103,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"AllowNavigationReqsponse for unknow request: {:?}",
|
"AllowNavigationReqsponse for unknow request: {:?}",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -1119,7 +1119,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"LoadUrl for unknow browsing context: {:?}",
|
"LoadUrl for unknow browsing context: {:?}",
|
||||||
top_level_browsing_context_id
|
top_level_browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// Since this is a top-level load, initiated by the embedder, go straight to load_url,
|
// Since this is a top-level load, initiated by the embedder, go straight to load_url,
|
||||||
|
@ -1857,7 +1857,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Subframe {} loaded in closed browsing context {}.",
|
"Subframe {} loaded in closed browsing context {}.",
|
||||||
pipeline_id, browsing_context_id,
|
pipeline_id, browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let parent_pipeline_id = match parent_pipeline_id {
|
let parent_pipeline_id = match parent_pipeline_id {
|
||||||
|
@ -1878,7 +1878,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Parent {} browsing context loaded after closure.",
|
"Parent {} browsing context loaded after closure.",
|
||||||
parent_pipeline_id
|
parent_pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
@ -1937,7 +1937,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Script loaded url in iframe {} in closed parent pipeline {}.",
|
"Script loaded url in iframe {} in closed parent pipeline {}.",
|
||||||
browsing_context_id, parent_pipeline_id,
|
browsing_context_id, parent_pipeline_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let is_parent_private = match self.browsing_contexts.get(&parent_browsing_context_id) {
|
let is_parent_private = match self.browsing_contexts.get(&parent_browsing_context_id) {
|
||||||
|
@ -1946,7 +1946,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Script loaded url in iframe {} in closed parent browsing context {}.",
|
"Script loaded url in iframe {} in closed parent browsing context {}.",
|
||||||
browsing_context_id, parent_browsing_context_id,
|
browsing_context_id, parent_browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
is_parent_private
|
is_parent_private
|
||||||
|
@ -1959,7 +1959,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Script loaded url in iframe with closed browsing context {}.",
|
"Script loaded url in iframe with closed browsing context {}.",
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let replace = if replace {
|
let replace = if replace {
|
||||||
|
@ -2022,7 +2022,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"New iframe {} loaded in closed parent browsing context {}.",
|
"New iframe {} loaded in closed parent browsing context {}.",
|
||||||
browsing_context_id, parent_browsing_context_id,
|
browsing_context_id, parent_browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let is_private = is_private || is_parent_private;
|
let is_private = is_private || is_parent_private;
|
||||||
|
@ -2079,7 +2079,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Auxiliary loaded url in closed iframe {}.",
|
"Auxiliary loaded url in closed iframe {}.",
|
||||||
opener_pipeline_id
|
opener_pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let (is_opener_private, is_opener_visible) =
|
let (is_opener_private, is_opener_visible) =
|
||||||
|
@ -2089,7 +2089,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"New auxiliary {} loaded in closed opener browsing context {}.",
|
"New auxiliary {} loaded in closed opener browsing context {}.",
|
||||||
new_browsing_context_id, opener_browsing_context_id,
|
new_browsing_context_id, opener_browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let pipeline = Pipeline::new(
|
let pipeline = Pipeline::new(
|
||||||
|
@ -2157,7 +2157,7 @@ where
|
||||||
match self.pipelines.get(&pipeline_id) {
|
match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
return warn!("Pipeline {:?} got script tick after closure.", pipeline_id)
|
return warn!("Pipeline {:?} got script tick after closure.", pipeline_id);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2166,7 +2166,7 @@ where
|
||||||
match self.pipelines.get(&pipeline_id) {
|
match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.layout_chan.send(msg),
|
Some(pipeline) => pipeline.layout_chan.send(msg),
|
||||||
None => {
|
None => {
|
||||||
return warn!("Pipeline {:?} got layout tick after closure.", pipeline_id)
|
return warn!("Pipeline {:?} got layout tick after closure.", pipeline_id);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2191,7 +2191,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {:?} tried to schedule a navigation while one is already pending.",
|
"Pipeline {:?} tried to schedule a navigation while one is already pending.",
|
||||||
source_id
|
source_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Entry::Vacant(entry) => {
|
Entry::Vacant(entry) => {
|
||||||
let _ = entry.insert((load_data.clone(), replace));
|
let _ = entry.insert((load_data.clone(), replace));
|
||||||
|
@ -2419,7 +2419,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {} navigated to fragment after closure",
|
"Pipeline {} navigated to fragment after closure",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2668,7 +2668,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {} child traversed after closure",
|
"Pipeline {} child traversed after closure",
|
||||||
parent_pipeline_id
|
parent_pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
};
|
};
|
||||||
|
@ -2689,7 +2689,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {} history state updated after closure",
|
"Pipeline {} history state updated after closure",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(pipeline) => {
|
Some(pipeline) => {
|
||||||
let msg = ConstellationControlMsg::UpdateHistoryState(
|
let msg = ConstellationControlMsg::UpdateHistoryState(
|
||||||
|
@ -2743,7 +2743,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Push history state {} for closed pipeline {}",
|
"Push history state {} for closed pipeline {}",
|
||||||
history_state_id, pipeline_id
|
history_state_id, pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2775,7 +2775,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Replace history state {} for closed pipeline {}",
|
"Replace history state {} for closed pipeline {}",
|
||||||
history_state_id, pipeline_id
|
history_state_id, pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2799,14 +2799,14 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Got key event for nonexistent browsing context {}.",
|
"Got key event for nonexistent browsing context {}.",
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
return debug!("Pipeline {:?} got key event after closure.", pipeline_id)
|
return debug!("Pipeline {:?} got key event after closure.", pipeline_id);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
@ -2828,7 +2828,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browsing context {} got reload event after closure.",
|
"Browsing context {} got reload event after closure.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::Reload(pipeline_id);
|
let msg = ConstellationControlMsg::Reload(pipeline_id);
|
||||||
|
@ -2852,7 +2852,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"PostMessage to closed browsing_context {}.",
|
"PostMessage to closed browsing_context {}.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(browsing_context) => browsing_context.pipeline_id,
|
Some(browsing_context) => browsing_context.pipeline_id,
|
||||||
};
|
};
|
||||||
|
@ -2920,7 +2920,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browser {} for focus msg does not exist",
|
"Browser {} for focus msg does not exist",
|
||||||
top_level_browsing_context_id
|
top_level_browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2935,7 +2935,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browsing context {:?} focus parent after closure.",
|
"Browsing context {:?} focus parent after closure.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let parent_pipeline_id = match parent_pipeline_id {
|
let parent_pipeline_id = match parent_pipeline_id {
|
||||||
|
@ -2944,7 +2944,7 @@ where
|
||||||
return debug!(
|
return debug!(
|
||||||
"Browsing context {:?} focus has no parent.",
|
"Browsing context {:?} focus has no parent.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2983,7 +2983,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"No browsing context associated with pipeline {:?}",
|
"No browsing context associated with pipeline {:?}",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3019,7 +3019,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Visibility change for closed browsing context {:?}.",
|
"Visibility change for closed browsing context {:?}.",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3092,7 +3092,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browsing context {} Refresh after closure.",
|
"Browsing context {} Refresh after closure.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let load_data = match self.pipelines.get(&pipeline_id) {
|
let load_data = match self.pipelines.get(&pipeline_id) {
|
||||||
|
@ -3108,7 +3108,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browsing context {} ScriptCommand after closure.",
|
"Browsing context {} ScriptCommand after closure.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let control_msg = ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, cmd);
|
let control_msg = ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, cmd);
|
||||||
|
@ -3127,7 +3127,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Browsing context {} SendKeys after closure.",
|
"Browsing context {} SendKeys after closure.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let event_loop = match self.pipelines.get(&pipeline_id) {
|
let event_loop = match self.pipelines.get(&pipeline_id) {
|
||||||
|
@ -3169,7 +3169,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Session history does not exist for {}",
|
"Session history does not exist for {}",
|
||||||
top_level_browsing_context_id
|
top_level_browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3179,7 +3179,7 @@ where
|
||||||
None => {
|
None => {
|
||||||
return warn!(
|
return warn!(
|
||||||
"notify_history_changed error after top-level browsing context closed."
|
"notify_history_changed error after top-level browsing context closed."
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3189,7 +3189,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {} refresh after closure.",
|
"Pipeline {} refresh after closure.",
|
||||||
browsing_context.pipeline_id
|
browsing_context.pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3289,7 +3289,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Webdriver load for closed browsing context {}.",
|
"Webdriver load for closed browsing context {}.",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if let Some(new_pipeline_id) = self.load_url(
|
if let Some(new_pipeline_id) = self.load_url(
|
||||||
|
@ -3342,7 +3342,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"No NewBrowsingContextInfo for browsing context {}",
|
"No NewBrowsingContextInfo for browsing context {}",
|
||||||
change.browsing_context_id,
|
change.browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.new_browsing_context(
|
self.new_browsing_context(
|
||||||
|
@ -3424,7 +3424,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {} removed history states after closure",
|
"Pipeline {} removed history states after closure",
|
||||||
pipeline_id
|
pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
};
|
};
|
||||||
|
@ -3465,9 +3465,9 @@ where
|
||||||
.and_then(|browser_id| self.browsers.get(&browser_id))
|
.and_then(|browser_id| self.browsers.get(&browser_id))
|
||||||
.map(|browser| browser.focused_browsing_context_id);
|
.map(|browser| browser.focused_browsing_context_id);
|
||||||
focused_browsing_context_id.map_or(false, |focus_ctx_id| {
|
focused_browsing_context_id.map_or(false, |focus_ctx_id| {
|
||||||
focus_ctx_id == browsing_context_id || self
|
focus_ctx_id == browsing_context_id ||
|
||||||
.fully_active_descendant_browsing_contexts_iter(browsing_context_id)
|
self.fully_active_descendant_browsing_contexts_iter(browsing_context_id)
|
||||||
.any(|nested_ctx| nested_ctx.id == focus_ctx_id)
|
.any(|nested_ctx| nested_ctx.id == focus_ctx_id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3557,7 +3557,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Activated document {} after browsing context {} closure.",
|
"Activated document {} after browsing context {} closure.",
|
||||||
change.new_pipeline_id, change.browsing_context_id,
|
change.new_pipeline_id, change.browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -3866,7 +3866,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline {:?} child closed after parent.",
|
"Pipeline {:?} child closed after parent.",
|
||||||
parent_pipeline_id
|
parent_pipeline_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(parent_pipeline) => parent_pipeline.remove_child(browsing_context_id),
|
Some(parent_pipeline) => parent_pipeline.remove_child(browsing_context_id),
|
||||||
};
|
};
|
||||||
|
@ -3925,7 +3925,7 @@ where
|
||||||
return warn!(
|
return warn!(
|
||||||
"Discarding pipeline {} after browser {} closure",
|
"Discarding pipeline {} after browser {} closure",
|
||||||
pipeline_id, top_level_browsing_context_id,
|
pipeline_id, top_level_browsing_context_id,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.close_pipeline(
|
self.close_pipeline(
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::event_loop::EventLoop;
|
||||||
use bluetooth_traits::BluetoothRequest;
|
use bluetooth_traits::BluetoothRequest;
|
||||||
use canvas_traits::webgl::WebGLPipeline;
|
use canvas_traits::webgl::WebGLPipeline;
|
||||||
use compositing::compositor_thread::Msg as CompositorMsg;
|
use compositing::compositor_thread::Msg as CompositorMsg;
|
||||||
use compositing::CompositionPipeline;
|
use compositing::CompositionPipeline;
|
||||||
use compositing::CompositorProxy;
|
use compositing::CompositorProxy;
|
||||||
use crate::event_loop::EventLoop;
|
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
||||||
use euclid::{TypedScale, TypedSize2D};
|
use euclid::{TypedScale, TypedSize2D};
|
||||||
|
@ -434,7 +434,7 @@ impl Pipeline {
|
||||||
return warn!(
|
return warn!(
|
||||||
"Pipeline remove child already removed ({:?}).",
|
"Pipeline remove child already removed ({:?}).",
|
||||||
browsing_context_id
|
browsing_context_id
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(index) => self.children.remove(index),
|
Some(index) => self.children.remove(index),
|
||||||
};
|
};
|
||||||
|
@ -564,11 +564,7 @@ impl UnprivilegedPipelineContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(target_os = "android", target_arch = "arm", target_arch = "aarch64"))]
|
||||||
target_os = "android",
|
|
||||||
target_arch = "arm",
|
|
||||||
target_arch = "aarch64"
|
|
||||||
))]
|
|
||||||
pub fn spawn_multiprocess(self) -> Result<(), Error> {
|
pub fn spawn_multiprocess(self) -> Result<(), Error> {
|
||||||
use ipc_channel::ipc::IpcOneShotServer;
|
use ipc_channel::ipc::IpcOneShotServer;
|
||||||
// Note that this function can panic, due to process creation,
|
// Note that this function can panic, due to process creation,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font_context::{FontContext, FontSource};
|
use crate::font_context::{FontContext, FontSource};
|
||||||
use crate::font_template::FontTemplateDescriptor;
|
use crate::font_template::FontTemplateDescriptor;
|
||||||
use crate::platform::font::{FontHandle, FontTable};
|
use crate::platform::font::{FontHandle, FontTable};
|
||||||
|
@ -12,6 +11,7 @@ use crate::platform::font_template::FontTemplateData;
|
||||||
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
|
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
|
||||||
use crate::text::shaping::ShaperMethods;
|
use crate::text::shaping::ShaperMethods;
|
||||||
use crate::text::Shaper;
|
use crate::text::Shaper;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
use euclid::{Point2D, Rect, Size2D};
|
||||||
use ordered_float::NotNan;
|
use ordered_float::NotNan;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope};
|
use crate::font::{FontFamilyDescriptor, FontFamilyName, FontSearchScope};
|
||||||
use crate::font_context::FontSource;
|
use crate::font_context::FontSource;
|
||||||
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
|
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
|
||||||
|
@ -12,6 +11,7 @@ use crate::platform::font_list::for_each_variation;
|
||||||
use crate::platform::font_list::system_default_family;
|
use crate::platform::font_list::system_default_family;
|
||||||
use crate::platform::font_list::SANS_SERIF_FONT_FAMILY;
|
use crate::platform::font_list::SANS_SERIF_FONT_FAMILY;
|
||||||
use crate::platform::font_template::FontTemplateData;
|
use crate::platform::font_template::FontTemplateData;
|
||||||
|
use app_units::Au;
|
||||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||||
use net_traits::request::{Destination, RequestInit};
|
use net_traits::request::{Destination, RequestInit};
|
||||||
use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
|
use net_traits::{fetch_async, CoreResourceThread, FetchResponseMsg};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{
|
use crate::font::{
|
||||||
Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef,
|
Font, FontDescriptor, FontFamilyDescriptor, FontGroup, FontHandleMethods, FontRef,
|
||||||
};
|
};
|
||||||
|
@ -10,6 +9,7 @@ use crate::font_cache_thread::FontTemplateInfo;
|
||||||
use crate::font_template::FontTemplateDescriptor;
|
use crate::font_template::FontTemplateDescriptor;
|
||||||
use crate::platform::font::FontHandle;
|
use crate::platform::font::FontHandle;
|
||||||
pub use crate::platform::font_context::FontContextHandle;
|
pub use crate::platform::font_context::FontContextHandle;
|
||||||
|
use app_units::Au;
|
||||||
use fnv::FnvHasher;
|
use fnv::FnvHasher;
|
||||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use super::c_str_to_string;
|
use super::c_str_to_string;
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
||||||
use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN};
|
use crate::font::{FontTableTag, FractionalPixel, GPOS, GSUB, KERN};
|
||||||
use crate::platform::font_context::FontContextHandle;
|
use crate::platform::font_context::FontContextHandle;
|
||||||
use crate::platform::font_template::FontTemplateData;
|
use crate::platform::font_template::FontTemplateData;
|
||||||
use crate::text::glyph::GlyphId;
|
use crate::text::glyph::GlyphId;
|
||||||
use crate::text::util::fixed_to_float;
|
use crate::text::util::fixed_to_float;
|
||||||
|
use app_units::Au;
|
||||||
use freetype::freetype::FT_Sfnt_Tag;
|
use freetype::freetype::FT_Sfnt_Tag;
|
||||||
use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face};
|
use freetype::freetype::{FT_Done_Face, FT_New_Face, FT_New_Memory_Face};
|
||||||
use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec};
|
use freetype::freetype::{FT_F26Dot6, FT_Face, FT_FaceRec};
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::font::{
|
||||||
|
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel,
|
||||||
|
};
|
||||||
|
use crate::font::{GPOS, GSUB, KERN};
|
||||||
|
use crate::platform::font_template::FontTemplateData;
|
||||||
|
use crate::platform::macos::font_context::FontContextHandle;
|
||||||
|
use crate::text::glyph::GlyphId;
|
||||||
/// Implementation of Quartz (CoreGraphics) fonts.
|
/// Implementation of Quartz (CoreGraphics) fonts.
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use byteorder::{BigEndian, ByteOrder};
|
use byteorder::{BigEndian, ByteOrder};
|
||||||
|
@ -13,13 +20,6 @@ use core_graphics::geometry::CGRect;
|
||||||
use core_text::font::CTFont;
|
use core_text::font::CTFont;
|
||||||
use core_text::font_descriptor::kCTFontDefaultOrientation;
|
use core_text::font_descriptor::kCTFontDefaultOrientation;
|
||||||
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
|
use core_text::font_descriptor::{SymbolicTraitAccessors, TraitAccessors};
|
||||||
use crate::font::{
|
|
||||||
FontHandleMethods, FontMetrics, FontTableMethods, FontTableTag, FractionalPixel,
|
|
||||||
};
|
|
||||||
use crate::font::{GPOS, GSUB, KERN};
|
|
||||||
use crate::platform::font_template::FontTemplateData;
|
|
||||||
use crate::platform::macos::font_context::FontContextHandle;
|
|
||||||
use crate::text::glyph::GlyphId;
|
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
// information for an approach that we'll likely need to take when the
|
// information for an approach that we'll likely need to take when the
|
||||||
// renderer moves to a sandboxed process.
|
// renderer moves to a sandboxed process.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
use crate::font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
||||||
use crate::font::{FontTableTag, FractionalPixel};
|
use crate::font::{FontTableTag, FractionalPixel};
|
||||||
use crate::platform::font_template::FontTemplateData;
|
use crate::platform::font_template::FontTemplateData;
|
||||||
use crate::platform::windows::font_context::FontContextHandle;
|
use crate::platform::windows::font_context::FontContextHandle;
|
||||||
use crate::platform::windows::font_list::font_from_atom;
|
use crate::platform::windows::font_list::font_from_atom;
|
||||||
use crate::text::glyph::GlyphId;
|
use crate::text::glyph::GlyphId;
|
||||||
|
use app_units::Au;
|
||||||
use dwrote::{Font, FontFace, FontFile};
|
use dwrote::{Font, FontFace, FontFile};
|
||||||
use dwrote::{FontStretch, FontStyle};
|
use dwrote::{FontStretch, FontStyle};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
|
@ -25,8 +25,8 @@ fn test_font_template_descriptor() {
|
||||||
"dejavu-fonts-ttf-2.37",
|
"dejavu-fonts-ttf-2.37",
|
||||||
"ttf",
|
"ttf",
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.collect();
|
.collect();
|
||||||
path.push(format!("{}.ttf", filename));
|
path.push(format!("{}.ttf", filename));
|
||||||
|
|
||||||
let file = File::open(path).unwrap();
|
let file = File::open(path).unwrap();
|
||||||
|
|
|
@ -806,11 +806,12 @@ impl<'a> Iterator for GlyphIterator<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No glyph range. Look at next byte.
|
// No glyph range. Look at next byte.
|
||||||
self.byte_index = self.byte_index + if self.store.is_rtl {
|
self.byte_index = self.byte_index +
|
||||||
ByteIndex(-1)
|
if self.store.is_rtl {
|
||||||
} else {
|
ByteIndex(-1)
|
||||||
ByteIndex(1)
|
} else {
|
||||||
};
|
ByteIndex(1)
|
||||||
|
};
|
||||||
let i = self.byte_index;
|
let i = self.byte_index;
|
||||||
if !self.byte_range.contains(i) {
|
if !self.byte_range.contains(i) {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
#![allow(unsafe_code)]
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
|
use crate::font::{Font, FontTableMethods, FontTableTag, ShapingFlags, ShapingOptions, KERN};
|
||||||
use crate::platform::font::FontTable;
|
use crate::platform::font::FontTable;
|
||||||
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
|
use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore};
|
||||||
use crate::text::shaping::ShaperMethods;
|
use crate::text::shaping::ShaperMethods;
|
||||||
use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
|
use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
|
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
|
||||||
// shapers. For now, however, HarfBuzz is a hard dependency.
|
// shapers. For now, however, HarfBuzz is a hard dependency.
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags};
|
use crate::font::{Font, FontHandleMethods, FontMetrics, ShapingFlags};
|
||||||
use crate::font::{RunMetrics, ShapingOptions};
|
use crate::font::{RunMetrics, ShapingOptions};
|
||||||
use crate::platform::font_template::FontTemplateData;
|
use crate::platform::font_template::FontTemplateData;
|
||||||
use crate::text::glyph::{ByteIndex, GlyphStore};
|
use crate::text::glyph::{ByteIndex, GlyphStore};
|
||||||
|
use app_units::Au;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::{max, Ordering};
|
use std::cmp::{max, Ordering};
|
||||||
|
@ -293,9 +293,10 @@ impl<'a> TextRun {
|
||||||
// TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text
|
// TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text
|
||||||
self.natural_word_slices_in_range(range)
|
self.natural_word_slices_in_range(range)
|
||||||
.fold(Au(0), |advance, slice| {
|
.fold(Au(0), |advance, slice| {
|
||||||
advance + slice
|
advance +
|
||||||
.glyphs
|
slice
|
||||||
.advance_for_byte_range(&slice.range, self.extra_word_spacing)
|
.glyphs
|
||||||
|
.advance_for_byte_range(&slice.range, self.extra_word_spacing)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,16 +78,17 @@ pub fn update_animation_state<E>(
|
||||||
for (key, running_animations) in running_animations.iter_mut() {
|
for (key, running_animations) in running_animations.iter_mut() {
|
||||||
let mut animations_still_running = vec![];
|
let mut animations_still_running = vec![];
|
||||||
for mut running_animation in running_animations.drain(..) {
|
for mut running_animation in running_animations.drain(..) {
|
||||||
let still_running = !running_animation.is_expired() && match running_animation {
|
let still_running = !running_animation.is_expired() &&
|
||||||
Animation::Transition(_, started_at, ref frame) => {
|
match running_animation {
|
||||||
now < started_at + frame.duration
|
Animation::Transition(_, started_at, ref frame) => {
|
||||||
},
|
now < started_at + frame.duration
|
||||||
Animation::Keyframes(_, _, _, ref mut state) => {
|
},
|
||||||
// This animation is still running, or we need to keep
|
Animation::Keyframes(_, _, _, ref mut state) => {
|
||||||
// iterating.
|
// This animation is still running, or we need to keep
|
||||||
now < state.started_at + state.duration || state.tick()
|
// iterating.
|
||||||
},
|
now < state.started_at + state.duration || state.tick()
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"update_animation_state({:?}): {:?}",
|
"update_animation_state({:?}): {:?}",
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
//!
|
//!
|
||||||
//! http://dev.w3.org/csswg/css-sizing/
|
//! http://dev.w3.org/csswg/css-sizing/
|
||||||
|
|
||||||
use app_units::{Au, MAX_AU};
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::items::DisplayListSection;
|
use crate::display_list::items::DisplayListSection;
|
||||||
use crate::display_list::StackingContextCollectionState;
|
use crate::display_list::StackingContextCollectionState;
|
||||||
|
@ -49,6 +48,7 @@ use crate::model::{
|
||||||
};
|
};
|
||||||
use crate::sequential;
|
use crate::sequential;
|
||||||
use crate::traversal::PreorderFlowTraversal;
|
use crate::traversal::PreorderFlowTraversal;
|
||||||
|
use app_units::{Au, MAX_AU};
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
|
@ -809,11 +809,10 @@ impl BlockFlow {
|
||||||
viewport_size: &Size2D<Au>,
|
viewport_size: &Size2D<Au>,
|
||||||
descendant: OpaqueFlow,
|
descendant: OpaqueFlow,
|
||||||
) -> LogicalSize<Au> {
|
) -> LogicalSize<Au> {
|
||||||
debug_assert!(
|
debug_assert!(self
|
||||||
self.base
|
.base
|
||||||
.flags
|
.flags
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
|
||||||
);
|
|
||||||
if self.is_fixed() || self.is_root() {
|
if self.is_fixed() || self.is_root() {
|
||||||
// Initial containing block is the CB for the root
|
// Initial containing block is the CB for the root
|
||||||
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
|
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
|
||||||
|
@ -1176,10 +1175,11 @@ impl BlockFlow {
|
||||||
let mut block_size = cur_b - block_start_offset;
|
let mut block_size = cur_b - block_start_offset;
|
||||||
let is_root = self.is_root();
|
let is_root = self.is_root();
|
||||||
|
|
||||||
if is_root || self.formatting_context_type() != FormattingContextType::None || self
|
if is_root ||
|
||||||
.base
|
self.formatting_context_type() != FormattingContextType::None ||
|
||||||
.flags
|
self.base
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
.flags
|
||||||
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||||
{
|
{
|
||||||
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
|
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
|
||||||
// way to handle this is to just treat it as clearance.
|
// way to handle this is to just treat it as clearance.
|
||||||
|
@ -1953,14 +1953,12 @@ impl BlockFlow {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
(Float::Left, _) => {
|
(Float::Left, _) => {
|
||||||
left_float_width_accumulator = left_float_width_accumulator + child_base
|
left_float_width_accumulator = left_float_width_accumulator +
|
||||||
.intrinsic_inline_sizes
|
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||||
.preferred_inline_size;
|
|
||||||
},
|
},
|
||||||
(Float::Right, _) => {
|
(Float::Right, _) => {
|
||||||
right_float_width_accumulator = right_float_width_accumulator + child_base
|
right_float_width_accumulator = right_float_width_accumulator +
|
||||||
.intrinsic_inline_sizes
|
child_base.intrinsic_inline_sizes.preferred_inline_size;
|
||||||
.preferred_inline_size;
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,17 +763,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
node: &ConcreteThreadSafeLayoutNode,
|
node: &ConcreteThreadSafeLayoutNode,
|
||||||
) -> ConstructionResult {
|
) -> ConstructionResult {
|
||||||
let mut fragments = IntermediateInlineFragments::new();
|
let mut fragments = IntermediateInlineFragments::new();
|
||||||
let node_is_input_or_text_area =
|
let node_is_input_or_text_area = node.type_id() ==
|
||||||
node.type_id() == Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
|
Some(LayoutNodeType::Element(LayoutElementType::HTMLInputElement)) ||
|
||||||
node.type_id() == Some(LayoutNodeType::Element(
|
node.type_id() ==
|
||||||
|
Some(LayoutNodeType::Element(
|
||||||
LayoutElementType::HTMLTextAreaElement,
|
LayoutElementType::HTMLTextAreaElement,
|
||||||
));
|
));
|
||||||
if node.get_pseudo_element_type().is_replaced_content() || node_is_input_or_text_area {
|
if node.get_pseudo_element_type().is_replaced_content() || node_is_input_or_text_area {
|
||||||
// A TextArea's text contents are displayed through the input text
|
// A TextArea's text contents are displayed through the input text
|
||||||
// box, so don't construct them.
|
// box, so don't construct them.
|
||||||
if node.type_id() == Some(LayoutNodeType::Element(
|
if node.type_id() ==
|
||||||
LayoutElementType::HTMLTextAreaElement,
|
Some(LayoutNodeType::Element(
|
||||||
)) {
|
LayoutElementType::HTMLTextAreaElement,
|
||||||
|
))
|
||||||
|
{
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
self.set_flow_construction_result(&kid, ConstructionResult::None)
|
self.set_flow_construction_result(&kid, ConstructionResult::None)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use atomic_refcell::AtomicRefCell;
|
|
||||||
use crate::construct::ConstructionResult;
|
use crate::construct::ConstructionResult;
|
||||||
|
use atomic_refcell::AtomicRefCell;
|
||||||
use script_layout_interface::StyleData;
|
use script_layout_interface::StyleData;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
// FIXME(rust-lang/rust#26264): Remove GenericBackgroundSize.
|
// FIXME(rust-lang/rust#26264): Remove GenericBackgroundSize.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::display_list::border;
|
use crate::display_list::border;
|
||||||
use crate::model::MaybeAuto;
|
use crate::model::MaybeAuto;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
use style::computed_values::background_attachment::single_value::T as BackgroundAttachment;
|
use style::computed_values::background_attachment::single_value::T as BackgroundAttachment;
|
||||||
use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
use style::computed_values::background_clip::single_value::T as BackgroundClip;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// FIXME(rust-lang/rust#26264): Remove GenericBorderImageSideWidth.
|
// FIXME(rust-lang/rust#26264): Remove GenericBorderImageSideWidth.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::display_list::ToLayout;
|
use crate::display_list::ToLayout;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Rect, SideOffsets2D, Size2D};
|
use euclid::{Rect, SideOffsets2D, Size2D};
|
||||||
use style::computed_values::border_image_outset::T as BorderImageOutset;
|
use style::computed_values::border_image_outset::T as BorderImageOutset;
|
||||||
use style::properties::style_structs::Border;
|
use style::properties::style_structs::Border;
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
|
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
|
||||||
//! paint.
|
//! paint.
|
||||||
|
|
||||||
use app_units::{Au, AU_PER_PX};
|
|
||||||
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
|
||||||
use crate::block::BlockFlow;
|
use crate::block::BlockFlow;
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::background::{self, get_cyclic};
|
use crate::display_list::background::{self, get_cyclic};
|
||||||
|
@ -33,6 +31,8 @@ use crate::inline::{InlineFlow, InlineFragmentNodeFlags};
|
||||||
use crate::list_item::ListItemFlow;
|
use crate::list_item::ListItemFlow;
|
||||||
use crate::model::MaybeAuto;
|
use crate::model::MaybeAuto;
|
||||||
use crate::table_cell::CollapsedBordersForCell;
|
use crate::table_cell::CollapsedBordersForCell;
|
||||||
|
use app_units::{Au, AU_PER_PX};
|
||||||
|
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
||||||
use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedRect, TypedSize2D, Vector2D};
|
use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedRect, TypedSize2D, Vector2D};
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use gfx::text::glyph::ByteIndex;
|
use gfx::text::glyph::ByteIndex;
|
||||||
|
@ -2172,13 +2172,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// FIXME(pcwalton): Get the real container size.
|
// FIXME(pcwalton): Get the real container size.
|
||||||
let container_size = Size2D::zero();
|
let container_size = Size2D::zero();
|
||||||
let metrics = &text_fragment.run.font_metrics;
|
let metrics = &text_fragment.run.font_metrics;
|
||||||
let baseline_origin = stacking_relative_content_box.origin + LogicalPoint::new(
|
let baseline_origin = stacking_relative_content_box.origin +
|
||||||
self.style.writing_mode,
|
LogicalPoint::new(self.style.writing_mode, Au(0), metrics.ascent)
|
||||||
Au(0),
|
.to_physical(self.style.writing_mode, container_size)
|
||||||
metrics.ascent,
|
.to_vector();
|
||||||
)
|
|
||||||
.to_physical(self.style.writing_mode, container_size)
|
|
||||||
.to_vector();
|
|
||||||
|
|
||||||
// Base item for all text/shadows
|
// Base item for all text/shadows
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
|
// FIXME(rust-lang/rust#26264): Remove GenericEndingShape and GenericGradientItem.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::display_list::ToLayout;
|
use crate::display_list::ToLayout;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Size2D, Vector2D};
|
use euclid::{Point2D, Size2D, Vector2D};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::image::{EndingShape, LineDirection};
|
use style::values::computed::image::{EndingShape, LineDirection};
|
||||||
|
|
|
@ -513,29 +513,28 @@ impl ClippingRegion {
|
||||||
/// This is a quick, not a precise, test; it can yield false positives.
|
/// This is a quick, not a precise, test; it can yield false positives.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn might_intersect_point(&self, point: &LayoutPoint) -> bool {
|
pub fn might_intersect_point(&self, point: &LayoutPoint) -> bool {
|
||||||
self.main.contains(point) && self
|
self.main.contains(point) &&
|
||||||
.complex
|
self.complex
|
||||||
.iter()
|
.iter()
|
||||||
.all(|complex| complex.rect.contains(point))
|
.all(|complex| complex.rect.contains(point))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this clipping region might intersect the given rectangle and false
|
/// Returns true if this clipping region might intersect the given rectangle and false
|
||||||
/// otherwise. This is a quick, not a precise, test; it can yield false positives.
|
/// otherwise. This is a quick, not a precise, test; it can yield false positives.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn might_intersect_rect(&self, rect: &LayoutRect) -> bool {
|
pub fn might_intersect_rect(&self, rect: &LayoutRect) -> bool {
|
||||||
self.main.intersects(rect) && self
|
self.main.intersects(rect) &&
|
||||||
.complex
|
self.complex
|
||||||
.iter()
|
.iter()
|
||||||
.all(|complex| complex.rect.intersects(rect))
|
.all(|complex| complex.rect.intersects(rect))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this clipping region completely surrounds the given rect.
|
/// Returns true if this clipping region completely surrounds the given rect.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn does_not_clip_rect(&self, rect: &LayoutRect) -> bool {
|
pub fn does_not_clip_rect(&self, rect: &LayoutRect) -> bool {
|
||||||
self.main.contains(&rect.origin) && self.main.contains(&rect.bottom_right()) && self
|
self.main.contains(&rect.origin) &&
|
||||||
.complex
|
self.main.contains(&rect.bottom_right()) &&
|
||||||
.iter()
|
self.complex.iter().all(|complex| {
|
||||||
.all(|complex| {
|
|
||||||
complex.rect.contains(&rect.origin) && complex.rect.contains(&rect.bottom_right())
|
complex.rect.contains(&rect.origin) && complex.rect.contains(&rect.bottom_right())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! Layout for elements with a CSS `display` property of `flex`.
|
//! Layout for elements with a CSS `display` property of `flex`.
|
||||||
|
|
||||||
use app_units::{Au, MAX_AU};
|
|
||||||
use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag};
|
use crate::block::{AbsoluteAssignBSizesTraversal, BlockFlow, MarginsMayCollapseFlag};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::StackingContextCollectionState;
|
use crate::display_list::StackingContextCollectionState;
|
||||||
|
@ -16,6 +15,7 @@ use crate::layout_debug;
|
||||||
use crate::model::{AdjoiningMargins, CollapsibleMargins};
|
use crate::model::{AdjoiningMargins, CollapsibleMargins};
|
||||||
use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
|
use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint};
|
||||||
use crate::traversal::PreorderFlowTraversal;
|
use crate::traversal::PreorderFlowTraversal;
|
||||||
|
use app_units::{Au, MAX_AU};
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
@ -846,13 +846,14 @@ impl FlexFlow {
|
||||||
// as if it has a fixed cross size, all child blocks should resolve against it.
|
// as if it has a fixed cross size, all child blocks should resolve against it.
|
||||||
// block.assign_block_size(layout_context);
|
// block.assign_block_size(layout_context);
|
||||||
}
|
}
|
||||||
block.base.position.start.b = margin_block_start + if !self.cross_reverse {
|
block.base.position.start.b = margin_block_start +
|
||||||
cur_b
|
if !self.cross_reverse {
|
||||||
} else {
|
cur_b
|
||||||
self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
|
} else {
|
||||||
cur_b -
|
self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -
|
||||||
line.cross_size
|
cur_b -
|
||||||
};
|
line.cross_size
|
||||||
|
};
|
||||||
// TODO(stshine): support baseline alignment.
|
// TODO(stshine): support baseline alignment.
|
||||||
if free_space != Au(0) {
|
if free_space != Au(0) {
|
||||||
let flex_cross = match self_align {
|
let flex_cross = match self_align {
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::{Au, MAX_AU};
|
|
||||||
use crate::block::FormattingContextType;
|
use crate::block::FormattingContextType;
|
||||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||||
use crate::persistent_list::PersistentList;
|
use crate::persistent_list::PersistentList;
|
||||||
|
use app_units::{Au, MAX_AU};
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style::computed_values::float::T as StyleFloat;
|
use style::computed_values::float::T as StyleFloat;
|
||||||
|
@ -353,7 +353,7 @@ impl Floats {
|
||||||
info.ceiling,
|
info.ceiling,
|
||||||
info.max_inline_size,
|
info.max_inline_size,
|
||||||
MAX_AU,
|
MAX_AU,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
FloatKind::Right => {
|
FloatKind::Right => {
|
||||||
return LogicalRect::new(
|
return LogicalRect::new(
|
||||||
|
@ -362,7 +362,7 @@ impl Floats {
|
||||||
info.ceiling,
|
info.ceiling,
|
||||||
info.max_inline_size,
|
info.max_inline_size,
|
||||||
MAX_AU,
|
MAX_AU,
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ impl Floats {
|
||||||
info.max_inline_size,
|
info.max_inline_size,
|
||||||
MAX_AU,
|
MAX_AU,
|
||||||
),
|
),
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
Some(rect) => {
|
Some(rect) => {
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
//! line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
|
//! line breaks and mapping to CSS boxes, for the purpose of handling `getClientRects()` and
|
||||||
//! similar methods.
|
//! similar methods.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{BlockFlow, FormattingContextType};
|
use crate::block::{BlockFlow, FormattingContextType};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::items::ClippingAndScrolling;
|
use crate::display_list::items::ClippingAndScrolling;
|
||||||
|
@ -46,6 +45,7 @@ use crate::table_colgroup::TableColGroupFlow;
|
||||||
use crate::table_row::TableRowFlow;
|
use crate::table_row::TableRowFlow;
|
||||||
use crate::table_rowgroup::TableRowGroupFlow;
|
use crate::table_rowgroup::TableRowGroupFlow;
|
||||||
use crate::table_wrapper::TableWrapperFlow;
|
use crate::table_wrapper::TableWrapperFlow;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use gfx_traits::StackingContextId;
|
use gfx_traits::StackingContextId;
|
||||||
|
@ -342,14 +342,14 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
||||||
overflow.scroll.size.height = border_box.size.height;
|
overflow.scroll.size.height = border_box.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.as_block().fragment.establishes_stacking_context() || self
|
if !self.as_block().fragment.establishes_stacking_context() ||
|
||||||
.as_block()
|
self.as_block()
|
||||||
.fragment
|
.fragment
|
||||||
.style
|
.style
|
||||||
.get_box()
|
.get_box()
|
||||||
.transform
|
.transform
|
||||||
.0
|
.0
|
||||||
.is_empty()
|
.is_empty()
|
||||||
{
|
{
|
||||||
overflow.translate(&position.origin.to_vector());
|
overflow.translate(&position.origin.to_vector());
|
||||||
return overflow;
|
return overflow;
|
||||||
|
@ -466,10 +466,10 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contains_positioned_fragments(&self) -> bool {
|
fn contains_positioned_fragments(&self) -> bool {
|
||||||
self.contains_relatively_positioned_fragments() || self
|
self.contains_relatively_positioned_fragments() ||
|
||||||
.base()
|
self.base()
|
||||||
.flags
|
.flags
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contains_relatively_positioned_fragments(&self) -> bool {
|
fn contains_relatively_positioned_fragments(&self) -> bool {
|
||||||
|
@ -1406,10 +1406,10 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
|
||||||
return Some(kid.base().position.start.b + baseline_offset);
|
return Some(kid.base().position.start.b + baseline_offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if kid.is_block_like() && !kid
|
if kid.is_block_like() &&
|
||||||
.base()
|
!kid.base()
|
||||||
.flags
|
.flags
|
||||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||||
{
|
{
|
||||||
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
|
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
|
||||||
return Some(kid.base().position.start.b + baseline_offset);
|
return Some(kid.base().position.start.b + baseline_offset);
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
//! The `Fragment` type, which represents the leaves of the layout tree.
|
//! The `Fragment` type, which represents the leaves of the layout tree.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
|
||||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||||
use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR};
|
use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR};
|
||||||
use crate::display_list::ToLayout;
|
use crate::display_list::ToLayout;
|
||||||
|
@ -22,6 +20,8 @@ use crate::text;
|
||||||
use crate::text::TextRunScanner;
|
use crate::text::TextRunScanner;
|
||||||
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
|
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
|
||||||
use crate::ServoArc;
|
use crate::ServoArc;
|
||||||
|
use app_units::Au;
|
||||||
|
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||||
use gfx::text::glyph::ByteIndex;
|
use gfx::text::glyph::ByteIndex;
|
||||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||||
|
@ -849,10 +849,10 @@ impl Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_node(&self, node_address: OpaqueNode) -> bool {
|
pub fn contains_node(&self, node_address: OpaqueNode) -> bool {
|
||||||
node_address == self.node || self
|
node_address == self.node ||
|
||||||
.inline_context
|
self.inline_context
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(false, |ctx| ctx.contains_node(node_address))
|
.map_or(false, |ctx| ctx.contains_node(node_address))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a style to the inline context for this fragment. If the inline context doesn't exist
|
/// Adds a style to the inline context for this fragment. If the inline context doesn't exist
|
||||||
|
@ -1939,9 +1939,9 @@ impl Fragment {
|
||||||
// The advance is more than the remaining inline-size, so split here. First, check to
|
// The advance is more than the remaining inline-size, so split here. First, check to
|
||||||
// see if we're going to overflow the line. If so, perform a best-effort split.
|
// see if we're going to overflow the line. If so, perform a best-effort split.
|
||||||
let mut remaining_range = slice.text_run_range();
|
let mut remaining_range = slice.text_run_range();
|
||||||
let split_is_empty = inline_start_range.is_empty() && !(self
|
let split_is_empty = inline_start_range.is_empty() &&
|
||||||
.requires_line_break_afterward_if_wrapping_on_newlines() &&
|
!(self.requires_line_break_afterward_if_wrapping_on_newlines() &&
|
||||||
!self.white_space().allow_wrap());
|
!self.white_space().allow_wrap());
|
||||||
if split_is_empty {
|
if split_is_empty {
|
||||||
// We're going to overflow the line.
|
// We're going to overflow the line.
|
||||||
overflowing = true;
|
overflowing = true;
|
||||||
|
@ -2416,9 +2416,9 @@ impl Fragment {
|
||||||
minimum_line_metrics.space_above_baseline
|
minimum_line_metrics.space_above_baseline
|
||||||
},
|
},
|
||||||
VerticalAlign::TextBottom => {
|
VerticalAlign::TextBottom => {
|
||||||
offset = minimum_line_metrics.space_below_baseline - self
|
offset = minimum_line_metrics.space_below_baseline -
|
||||||
.content_inline_metrics(layout_context)
|
self.content_inline_metrics(layout_context)
|
||||||
.space_below_baseline
|
.space_below_baseline
|
||||||
},
|
},
|
||||||
VerticalAlign::Top => {
|
VerticalAlign::Top => {
|
||||||
if let Some(actual_line_metrics) = actual_line_metrics {
|
if let Some(actual_line_metrics) = actual_line_metrics {
|
||||||
|
|
|
@ -62,17 +62,18 @@ impl<'a> LayoutDamageComputation for &'a mut dyn Flow {
|
||||||
.damage_for_parent(child_is_absolutely_positioned),
|
.damage_for_parent(child_is_absolutely_positioned),
|
||||||
);
|
);
|
||||||
|
|
||||||
has_counter_affecting_children =
|
has_counter_affecting_children = has_counter_affecting_children ||
|
||||||
has_counter_affecting_children || kid.base().flags.intersects(
|
kid.base().flags.intersects(
|
||||||
FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN,
|
FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let self_base = self.mut_base();
|
let self_base = self.mut_base();
|
||||||
if self_base.flags.float_kind() != Float::None && self_base
|
if self_base.flags.float_kind() != Float::None &&
|
||||||
.restyle_damage
|
self_base
|
||||||
.intersects(ServoRestyleDamage::REFLOW)
|
.restyle_damage
|
||||||
|
.intersects(ServoRestyleDamage::REFLOW)
|
||||||
{
|
{
|
||||||
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
|
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::{Au, MIN_AU};
|
|
||||||
use crate::block::AbsoluteAssignBSizesTraversal;
|
use crate::block::AbsoluteAssignBSizesTraversal;
|
||||||
use crate::context::{LayoutContext, LayoutFontContext};
|
use crate::context::{LayoutContext, LayoutFontContext};
|
||||||
use crate::display_list::items::OpaqueNode;
|
use crate::display_list::items::OpaqueNode;
|
||||||
|
@ -20,6 +19,7 @@ use crate::model::IntrinsicISizesContribution;
|
||||||
use crate::text;
|
use crate::text;
|
||||||
use crate::traversal::PreorderFlowTraversal;
|
use crate::traversal::PreorderFlowTraversal;
|
||||||
use crate::ServoArc;
|
use crate::ServoArc;
|
||||||
|
use app_units::{Au, MIN_AU};
|
||||||
use euclid::{Point2D, Size2D};
|
use euclid::{Point2D, Size2D};
|
||||||
use gfx::font::FontMetrics;
|
use gfx::font::FontMetrics;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
|
@ -1363,9 +1363,9 @@ impl InlineFlow {
|
||||||
fragment_index: FragmentIndex,
|
fragment_index: FragmentIndex,
|
||||||
) -> Range<FragmentIndex> {
|
) -> Range<FragmentIndex> {
|
||||||
let mut start_index = fragment_index;
|
let mut start_index = fragment_index;
|
||||||
while start_index > FragmentIndex(0) && self.fragments.fragments
|
while start_index > FragmentIndex(0) &&
|
||||||
[(start_index - FragmentIndex(1)).get() as usize]
|
self.fragments.fragments[(start_index - FragmentIndex(1)).get() as usize]
|
||||||
.is_positioned()
|
.is_positioned()
|
||||||
{
|
{
|
||||||
start_index = start_index - FragmentIndex(1)
|
start_index = start_index - FragmentIndex(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
|
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
|
||||||
//! block and an extra inline fragment for the marker.
|
//! block and an extra inline fragment for the marker.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::BlockFlow;
|
use crate::block::BlockFlow;
|
||||||
use crate::context::{with_thread_local_font_context, LayoutContext};
|
use crate::context::{with_thread_local_font_context, LayoutContext};
|
||||||
use crate::display_list::StackingContextCollectionState;
|
use crate::display_list::StackingContextCollectionState;
|
||||||
|
@ -18,6 +17,7 @@ use crate::fragment::{
|
||||||
};
|
};
|
||||||
use crate::generated_content;
|
use crate::generated_content;
|
||||||
use crate::inline::InlineFlow;
|
use crate::inline::InlineFlow;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use style::computed_values::list_style_type::T as ListStyleType;
|
use style::computed_values::list_style_type::T as ListStyleType;
|
||||||
use style::computed_values::position::T as Position;
|
use style::computed_values::position::T as Position;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
//! Borders, padding, and margins.
|
//! Borders, padding, and margins.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::fragment::Fragment;
|
use crate::fragment::Fragment;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::SideOffsets2D;
|
use euclid::SideOffsets2D;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -133,8 +133,8 @@ impl MarginCollapseInfo {
|
||||||
) -> (CollapsibleMargins, Au) {
|
) -> (CollapsibleMargins, Au) {
|
||||||
let state = match self.state {
|
let state = match self.state {
|
||||||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||||
may_collapse_through =
|
may_collapse_through = may_collapse_through &&
|
||||||
may_collapse_through && match fragment.style().content_block_size() {
|
match fragment.style().content_block_size() {
|
||||||
LengthOrPercentageOrAuto::Auto => true,
|
LengthOrPercentageOrAuto::Auto => true,
|
||||||
LengthOrPercentageOrAuto::Length(l) => l.px() == 0.,
|
LengthOrPercentageOrAuto::Length(l) => l.px() == 0.,
|
||||||
LengthOrPercentageOrAuto::Percentage(v) => {
|
LengthOrPercentageOrAuto::Percentage(v) => {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
|
//! CSS Multi-column layout http://dev.w3.org/csswg/css-multicol/
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::BlockFlow;
|
use crate::block::BlockFlow;
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||||
|
@ -12,6 +11,7 @@ use crate::floats::FloatKind;
|
||||||
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
|
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
|
||||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use crate::ServoArc;
|
use crate::ServoArc;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Vector2D};
|
use euclid::{Point2D, Vector2D};
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! Utilities for querying the layout, as needed by the layout thread.
|
//! Utilities for querying the layout, as needed by the layout thread.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::construct::ConstructionResult;
|
use crate::construct::ConstructionResult;
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap};
|
use crate::display_list::items::{DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||||
|
@ -15,6 +14,7 @@ use crate::inline::InlineFragmentNodeFlags;
|
||||||
use crate::opaque_node::OpaqueNodeMethods;
|
use crate::opaque_node::OpaqueNodeMethods;
|
||||||
use crate::sequential;
|
use crate::sequential;
|
||||||
use crate::wrapper::LayoutNodeLayoutData;
|
use crate::wrapper::LayoutNodeLayoutData;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
|
@ -777,7 +777,7 @@ where
|
||||||
// so this should be web-compatible.
|
// so this should be web-compatible.
|
||||||
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
||||||
PropertyId::Custom(ref name) => {
|
PropertyId::Custom(ref name) => {
|
||||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
|
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ where
|
||||||
// so this should be web-compatible.
|
// so this should be web-compatible.
|
||||||
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(),
|
||||||
PropertyId::Custom(ref name) => {
|
PropertyId::Custom(ref name) => {
|
||||||
return style.computed_value_to_string(PropertyDeclarationId::Custom(name))
|
return style.computed_value_to_string(PropertyDeclarationId::Custom(name));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! Implements sequential traversals over the DOM and flow trees.
|
//! Implements sequential traversals over the DOM and flow trees.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||||
use crate::floats::SpeculatedFloatPlacement;
|
use crate::floats::SpeculatedFloatPlacement;
|
||||||
|
@ -14,6 +13,7 @@ use crate::generated_content::ResolveGeneratedContent;
|
||||||
use crate::incremental::RelayoutMode;
|
use crate::incremental::RelayoutMode;
|
||||||
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||||
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Vector2D};
|
use euclid::{Point2D, Vector2D};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
|
@ -106,10 +106,11 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(
|
||||||
.stacking_relative_border_box(CoordinateSystem::Own);
|
.stacking_relative_border_box(CoordinateSystem::Own);
|
||||||
if let Some(matrix) = kid.as_block().fragment.transform_matrix(&relative_position) {
|
if let Some(matrix) = kid.as_block().fragment.transform_matrix(&relative_position) {
|
||||||
let transform_matrix = matrix.transform_point2d(&LayoutPoint::zero()).unwrap();
|
let transform_matrix = matrix.transform_point2d(&LayoutPoint::zero()).unwrap();
|
||||||
stacking_context_position = stacking_context_position + Vector2D::new(
|
stacking_context_position = stacking_context_position +
|
||||||
Au::from_f32_px(transform_matrix.x),
|
Vector2D::new(
|
||||||
Au::from_f32_px(transform_matrix.y),
|
Au::from_f32_px(transform_matrix.x),
|
||||||
)
|
Au::from_f32_px(transform_matrix.y),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doit(kid, level + 1, iterator, &stacking_context_position);
|
doit(kid, level + 1, iterator, &stacking_context_position);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
use crate::block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
||||||
use crate::block::{ISizeConstraintInput, ISizeConstraintSolution};
|
use crate::block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
|
@ -24,6 +23,7 @@ use crate::table_cell::TableCellFlow;
|
||||||
use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
||||||
use crate::table_row::{TableRowFlow, TableRowSizeData};
|
use crate::table_row::{TableRowFlow, TableRowSizeData};
|
||||||
use crate::table_wrapper::TableLayout;
|
use crate::table_wrapper::TableLayout;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::{cmp, fmt};
|
use std::{cmp, fmt};
|
||||||
|
@ -952,9 +952,8 @@ impl TableLikeFlow for BlockFlow {
|
||||||
row.mut_base().restyle_damage.remove(
|
row.mut_base().restyle_damage.remove(
|
||||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
|
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
|
||||||
);
|
);
|
||||||
current_block_offset =
|
current_block_offset = current_block_offset +
|
||||||
current_block_offset +
|
border_spacing_for_row(&self.fragment, row, block_direction_spacing);
|
||||||
border_spacing_for_row(&self.fragment, row, block_direction_spacing);
|
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,11 +989,12 @@ impl TableLikeFlow for BlockFlow {
|
||||||
current_block_offset = current_block_offset + delta;
|
current_block_offset = current_block_offset + delta;
|
||||||
|
|
||||||
// Take border, padding, and spacing into account.
|
// Take border, padding, and spacing into account.
|
||||||
let block_end_offset = self.fragment.border_padding.block_end + if has_rows {
|
let block_end_offset = self.fragment.border_padding.block_end +
|
||||||
block_direction_spacing
|
if has_rows {
|
||||||
} else {
|
block_direction_spacing
|
||||||
Au(0)
|
} else {
|
||||||
};
|
Au(0)
|
||||||
|
};
|
||||||
current_block_offset = current_block_offset + block_end_offset;
|
current_block_offset = current_block_offset + block_end_offset;
|
||||||
|
|
||||||
// Now that `current_block_offset` is at the block-end of the border box, compute the
|
// Now that `current_block_offset` is at the block-end of the border box, compute the
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::BlockFlow;
|
use crate::block::BlockFlow;
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||||
use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState};
|
use crate::display_list::{StackingContextCollectionFlags, StackingContextCollectionState};
|
||||||
use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
||||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
|
use crate::block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||||
|
@ -15,6 +14,7 @@ use crate::layout_debug;
|
||||||
use crate::model::MaybeAuto;
|
use crate::model::MaybeAuto;
|
||||||
use crate::table::InternalTable;
|
use crate::table::InternalTable;
|
||||||
use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
||||||
|
@ -106,12 +106,15 @@ impl TableCellFlow {
|
||||||
if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let start = kid_base.position.start.b - kid_base
|
let start = kid_base.position.start.b -
|
||||||
.collapsible_margins
|
kid_base
|
||||||
.block_start_margin_for_noncollapsible_context();
|
.collapsible_margins
|
||||||
let end = kid_base.position.start.b + kid_base.position.size.block + kid_base
|
.block_start_margin_for_noncollapsible_context();
|
||||||
.collapsible_margins
|
let end = kid_base.position.start.b +
|
||||||
.block_end_margin_for_noncollapsible_context();
|
kid_base.position.size.block +
|
||||||
|
kid_base
|
||||||
|
.collapsible_margins
|
||||||
|
.block_end_margin_for_noncollapsible_context();
|
||||||
match extents {
|
match extents {
|
||||||
Some((ref mut first_start, ref mut last_end)) => {
|
Some((ref mut first_start, ref mut last_end)) => {
|
||||||
if start < *first_start {
|
if start < *first_start {
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||||
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
||||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use crate::layout_debug;
|
use crate::layout_debug;
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style::logical_geometry::LogicalSize;
|
use style::logical_geometry::LogicalSize;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||||
|
@ -18,6 +17,7 @@ use crate::layout_debug;
|
||||||
use crate::model::MaybeAuto;
|
use crate::model::MaybeAuto;
|
||||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||||
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
|
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! CSS table formatting contexts.
|
//! CSS table formatting contexts.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
use crate::block::{BlockFlow, ISizeAndMarginsComputer};
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
use crate::display_list::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||||
|
@ -13,6 +12,7 @@ use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
||||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use crate::layout_debug;
|
use crate::layout_debug;
|
||||||
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
//!
|
//!
|
||||||
//! Hereafter this document is referred to as INTRINSIC.
|
//! Hereafter this document is referred to as INTRINSIC.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::block::{
|
use crate::block::{
|
||||||
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput,
|
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput,
|
||||||
};
|
};
|
||||||
|
@ -26,6 +25,7 @@ use crate::flow::{Flow, FlowClass, FlowFlags, ImmutableFlowUtils, OpaqueFlow};
|
||||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use crate::model::MaybeAuto;
|
use crate::model::MaybeAuto;
|
||||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||||
|
use app_units::Au;
|
||||||
use euclid::Point2D;
|
use euclid::Point2D;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
|
@ -795,18 +795,18 @@ impl ExcessInlineSizeDistributionInfo {
|
||||||
if !column_intrinsic_inline_size.constrained &&
|
if !column_intrinsic_inline_size.constrained &&
|
||||||
column_intrinsic_inline_size.percentage == 0.0
|
column_intrinsic_inline_size.percentage == 0.0
|
||||||
{
|
{
|
||||||
column_intrinsic_inline_size.preferred.to_f32_px() / self
|
column_intrinsic_inline_size.preferred.to_f32_px() /
|
||||||
.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
|
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
|
||||||
.to_f32_px()
|
.to_f32_px()
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
}
|
}
|
||||||
} else if self.count_of_nonconstrained_columns_with_no_percentage > 0 {
|
} else if self.count_of_nonconstrained_columns_with_no_percentage > 0 {
|
||||||
1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat)
|
1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat)
|
||||||
} else if self.preferred_inline_size_of_constrained_columns_with_no_percentage > Au(0) {
|
} else if self.preferred_inline_size_of_constrained_columns_with_no_percentage > Au(0) {
|
||||||
column_intrinsic_inline_size.preferred.to_f32_px() / self
|
column_intrinsic_inline_size.preferred.to_f32_px() /
|
||||||
.preferred_inline_size_of_constrained_columns_with_no_percentage
|
self.preferred_inline_size_of_constrained_columns_with_no_percentage
|
||||||
.to_f32_px()
|
.to_f32_px()
|
||||||
} else if self.total_percentage > 0.0 {
|
} else if self.total_percentage > 0.0 {
|
||||||
column_intrinsic_inline_size.percentage / self.total_percentage
|
column_intrinsic_inline_size.percentage / self.total_percentage
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
//! Text layout.
|
//! Text layout.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::context::LayoutFontContext;
|
use crate::context::LayoutFontContext;
|
||||||
use crate::fragment::{Fragment, ScannedTextFlags};
|
use crate::fragment::{Fragment, ScannedTextFlags};
|
||||||
use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
use crate::fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||||
use crate::inline::{InlineFragmentNodeFlags, InlineFragments};
|
use crate::inline::{InlineFragmentNodeFlags, InlineFragments};
|
||||||
use crate::linked_list::split_off_head;
|
use crate::linked_list::split_off_head;
|
||||||
|
use app_units::Au;
|
||||||
use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
||||||
use gfx::text::glyph::ByteIndex;
|
use gfx::text::glyph::ByteIndex;
|
||||||
use gfx::text::text_run::TextRun;
|
use gfx::text::text_run::TextRun;
|
||||||
|
@ -112,11 +112,11 @@ impl TextRunScanner {
|
||||||
// Create a clump.
|
// Create a clump.
|
||||||
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
||||||
self.clump.append(&mut split_off_head(&mut fragments));
|
self.clump.append(&mut split_off_head(&mut fragments));
|
||||||
while !fragments.is_empty() && self
|
while !fragments.is_empty() &&
|
||||||
.clump
|
self.clump
|
||||||
.back()
|
.back()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.can_merge_with_fragment(fragments.front().unwrap())
|
.can_merge_with_fragment(fragments.front().unwrap())
|
||||||
{
|
{
|
||||||
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
split_first_fragment_at_newline_if_necessary(&mut fragments);
|
||||||
self.clump.append(&mut split_off_head(&mut fragments));
|
self.clump.append(&mut split_off_head(&mut fragments));
|
||||||
|
|
|
@ -201,9 +201,10 @@ where
|
||||||
|
|
||||||
// Always reconstruct if incremental layout is turned off.
|
// Always reconstruct if incremental layout is turned off.
|
||||||
let nonincremental_layout = opts::get().nonincremental_layout;
|
let nonincremental_layout = opts::get().nonincremental_layout;
|
||||||
if nonincremental_layout || tnode.restyle_damage() != RestyleDamage::empty() || node
|
if nonincremental_layout ||
|
||||||
.as_element()
|
tnode.restyle_damage() != RestyleDamage::empty() ||
|
||||||
.map_or(false, |el| el.has_dirty_descendants())
|
node.as_element()
|
||||||
|
.map_or(false, |el| el.has_dirty_descendants())
|
||||||
{
|
{
|
||||||
let mut flow_constructor = FlowConstructor::new(context);
|
let mut flow_constructor = FlowConstructor::new(context);
|
||||||
if nonincremental_layout || !flow_constructor.repair_if_possible(&tnode) {
|
if nonincremental_layout || !flow_constructor.repair_if_possible(&tnode) {
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
#![allow(unsafe_code)]
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
use atomic_refcell::{AtomicRef, AtomicRefMut};
|
|
||||||
use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData};
|
use crate::data::{LayoutData, LayoutDataFlags, StyleAndLayoutData};
|
||||||
|
use atomic_refcell::{AtomicRef, AtomicRefMut};
|
||||||
use script_layout_interface::wrapper_traits::GetLayoutData;
|
use script_layout_interface::wrapper_traits::GetLayoutData;
|
||||||
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||||
use style::dom::{NodeInfo, TNode};
|
use style::dom::{NodeInfo, TNode};
|
||||||
|
|
|
@ -20,9 +20,9 @@ extern crate profile_traits;
|
||||||
|
|
||||||
mod dom_wrapper;
|
mod dom_wrapper;
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::dom_wrapper::drop_style_and_layout_data;
|
use crate::dom_wrapper::drop_style_and_layout_data;
|
||||||
use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
|
use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
|
||||||
|
use app_units::Au;
|
||||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||||
use embedder_traits::resources::{self, Resource};
|
use embedder_traits::resources::{self, Resource};
|
||||||
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
|
use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D};
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
cargo-features = ["rename-dependency"]
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "net"
|
name = "net"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -233,9 +233,10 @@ fn evict_one_cookie(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> bool {
|
||||||
fn get_oldest_accessed(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> Option<(usize, Tm)> {
|
fn get_oldest_accessed(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> Option<(usize, Tm)> {
|
||||||
let mut oldest_accessed: Option<(usize, Tm)> = None;
|
let mut oldest_accessed: Option<(usize, Tm)> = None;
|
||||||
for (i, c) in cookies.iter().enumerate() {
|
for (i, c) in cookies.iter().enumerate() {
|
||||||
if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) && oldest_accessed
|
if (c.cookie.secure().unwrap_or(false) == is_secure_cookie) &&
|
||||||
.as_ref()
|
oldest_accessed
|
||||||
.map_or(true, |a| c.last_access < a.1)
|
.as_ref()
|
||||||
|
.map_or(true, |a| c.last_access < a.1)
|
||||||
{
|
{
|
||||||
oldest_accessed = Some((i, c.last_access));
|
oldest_accessed = Some((i, c.last_access));
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,10 +253,10 @@ pub fn main_fetch(
|
||||||
Response::network_error(NetworkError::Internal("Non-http scheme".into()))
|
Response::network_error(NetworkError::Internal("Non-http scheme".into()))
|
||||||
} else if request.use_cors_preflight ||
|
} else if request.use_cors_preflight ||
|
||||||
(request.unsafe_request &&
|
(request.unsafe_request &&
|
||||||
(!is_cors_safelisted_method(&request.method) || request
|
(!is_cors_safelisted_method(&request.method) ||
|
||||||
.headers
|
request.headers.iter().any(|(name, value)| {
|
||||||
.iter()
|
!is_cors_safelisted_request_header(&name, &value)
|
||||||
.any(|(name, value)| !is_cors_safelisted_request_header(&name, &value))))
|
})))
|
||||||
{
|
{
|
||||||
// Substep 1.
|
// Substep 1.
|
||||||
request.response_tainting = ResponseTainting::CorsTainting;
|
request.response_tainting = ResponseTainting::CorsTainting;
|
||||||
|
@ -372,10 +372,12 @@ pub fn main_fetch(
|
||||||
// in the previous step.
|
// in the previous step.
|
||||||
let not_network_error = !response_is_network_error && !internal_response.is_network_error();
|
let not_network_error = !response_is_network_error && !internal_response.is_network_error();
|
||||||
if not_network_error &&
|
if not_network_error &&
|
||||||
(is_null_body_status(&internal_response.status) || match request.method {
|
(is_null_body_status(&internal_response.status) ||
|
||||||
Method::HEAD | Method::CONNECT => true,
|
match request.method {
|
||||||
_ => false,
|
Method::HEAD | Method::CONNECT => true,
|
||||||
}) {
|
_ => false,
|
||||||
|
})
|
||||||
|
{
|
||||||
// when Fetch is used only asynchronously, we will need to make sure
|
// when Fetch is used only asynchronously, we will need to make sure
|
||||||
// that nothing tries to write to the body at this point
|
// that nothing tries to write to the body at this point
|
||||||
let mut body = internal_response.body.lock().unwrap();
|
let mut body = internal_response.body.lock().unwrap();
|
||||||
|
@ -785,7 +787,8 @@ pub fn should_be_blocked_due_to_nosniff(
|
||||||
.get("x-content-type-options")
|
.get("x-content-type-options")
|
||||||
.map_or(true, |val| {
|
.map_or(true, |val| {
|
||||||
val.to_str().unwrap_or("").to_lowercase() != "nosniff"
|
val.to_str().unwrap_or("").to_lowercase() != "nosniff"
|
||||||
}) {
|
})
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,12 +853,13 @@ fn should_be_blocked_due_to_mime_type(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 2-3
|
// Step 2-3
|
||||||
destination.is_script_like() && match mime_type.type_() {
|
destination.is_script_like() &&
|
||||||
mime::AUDIO | mime::VIDEO | mime::IMAGE => true,
|
match mime_type.type_() {
|
||||||
mime::TEXT if mime_type.subtype() == mime::CSV => true,
|
mime::AUDIO | mime::VIDEO | mime::IMAGE => true,
|
||||||
// Step 4
|
mime::TEXT if mime_type.subtype() == mime::CSV => true,
|
||||||
_ => false,
|
// Step 4
|
||||||
}
|
_ => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://fetch.spec.whatwg.org/#block-bad-port>
|
/// <https://fetch.spec.whatwg.org/#block-bad-port>
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use brotli::Decompressor;
|
|
||||||
use bytes::Bytes;
|
|
||||||
use crate::connector::{create_http_client, Connector, WrappedBody, BUF_SIZE};
|
use crate::connector::{create_http_client, Connector, WrappedBody, BUF_SIZE};
|
||||||
use crate::cookie;
|
use crate::cookie;
|
||||||
use crate::cookie_storage::CookieStorage;
|
use crate::cookie_storage::CookieStorage;
|
||||||
|
@ -15,6 +13,8 @@ use crate::fetch::methods::{Data, DoneChannel, FetchContext, Target};
|
||||||
use crate::hsts::HstsList;
|
use crate::hsts::HstsList;
|
||||||
use crate::http_cache::HttpCache;
|
use crate::http_cache::HttpCache;
|
||||||
use crate::resource_thread::AuthCache;
|
use crate::resource_thread::AuthCache;
|
||||||
|
use brotli::Decompressor;
|
||||||
|
use bytes::Bytes;
|
||||||
use crossbeam_channel::{unbounded, Sender};
|
use crossbeam_channel::{unbounded, Sender};
|
||||||
use devtools_traits::{
|
use devtools_traits::{
|
||||||
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
||||||
|
@ -684,13 +684,13 @@ pub fn http_redirect_fetch(
|
||||||
Some(Err(err)) => {
|
Some(Err(err)) => {
|
||||||
return Response::network_error(NetworkError::Internal(
|
return Response::network_error(NetworkError::Internal(
|
||||||
"Location URL parse failure: ".to_owned() + &err,
|
"Location URL parse failure: ".to_owned() + &err,
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
// Step 4
|
// Step 4
|
||||||
Some(Ok(ref url)) if !matches!(url.scheme(), "http" | "https") => {
|
Some(Ok(ref url)) if !matches!(url.scheme(), "http" | "https") => {
|
||||||
return Response::network_error(NetworkError::Internal(
|
return Response::network_error(NetworkError::Internal(
|
||||||
"Location URL not an HTTP(S) scheme".into(),
|
"Location URL not an HTTP(S) scheme".into(),
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
Some(Ok(url)) => url,
|
Some(Ok(url)) => url,
|
||||||
};
|
};
|
||||||
|
@ -749,7 +749,8 @@ pub fn http_redirect_fetch(
|
||||||
((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) &&
|
((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) &&
|
||||||
request.method == Method::POST) ||
|
request.method == Method::POST) ||
|
||||||
(*code == StatusCode::SEE_OTHER && request.method != Method::HEAD)
|
(*code == StatusCode::SEE_OTHER && request.method != Method::HEAD)
|
||||||
}) {
|
})
|
||||||
|
{
|
||||||
request.method = Method::GET;
|
request.method = Method::GET;
|
||||||
request.body = None;
|
request.body = None;
|
||||||
}
|
}
|
||||||
|
@ -1069,10 +1070,11 @@ fn http_network_or_cache_fetch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Substep 4
|
// Substep 4
|
||||||
if revalidating_flag && forward_response
|
if revalidating_flag &&
|
||||||
.status
|
forward_response
|
||||||
.as_ref()
|
.status
|
||||||
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
|
.as_ref()
|
||||||
|
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
|
||||||
{
|
{
|
||||||
if let Ok(mut http_cache) = context.state.http_cache.write() {
|
if let Ok(mut http_cache) = context.state.http_cache.write() {
|
||||||
response = http_cache.refresh(&http_request, forward_response.clone(), done_chan);
|
response = http_cache.refresh(&http_request, forward_response.clone(), done_chan);
|
||||||
|
@ -1416,10 +1418,11 @@ fn cors_preflight_fetch(
|
||||||
let response = http_network_or_cache_fetch(&mut preflight, false, false, &mut None, context);
|
let response = http_network_or_cache_fetch(&mut preflight, false, false, &mut None, context);
|
||||||
|
|
||||||
// Step 6
|
// Step 6
|
||||||
if cors_check(&request, &response).is_ok() && response
|
if cors_check(&request, &response).is_ok() &&
|
||||||
.status
|
response
|
||||||
.as_ref()
|
.status
|
||||||
.map_or(false, |(status, _)| status.is_success())
|
.as_ref()
|
||||||
|
.map_or(false, |(status, _)| status.is_success())
|
||||||
{
|
{
|
||||||
// Substep 1, 2
|
// Substep 1, 2
|
||||||
let mut methods = if response
|
let mut methods = if response
|
||||||
|
@ -1432,7 +1435,7 @@ fn cors_preflight_fetch(
|
||||||
None => {
|
None => {
|
||||||
return Response::network_error(NetworkError::Internal(
|
return Response::network_error(NetworkError::Internal(
|
||||||
"CORS ACAM check failed".into(),
|
"CORS ACAM check failed".into(),
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1450,7 +1453,7 @@ fn cors_preflight_fetch(
|
||||||
None => {
|
None => {
|
||||||
return Response::network_error(NetworkError::Internal(
|
return Response::network_error(NetworkError::Internal(
|
||||||
"CORS ACAH check failed".into(),
|
"CORS ACAH check failed".into(),
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -404,9 +404,10 @@ impl Mp4Matcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mp4 = [0x6D, 0x70, 0x34];
|
let mp4 = [0x6D, 0x70, 0x34];
|
||||||
data[8..].starts_with(&mp4) || data[16..box_size]
|
data[8..].starts_with(&mp4) ||
|
||||||
.chunks(4)
|
data[16..box_size]
|
||||||
.any(|chunk| chunk.starts_with(&mp4))
|
.chunks(4)
|
||||||
|
.any(|chunk| chunk.starts_with(&mp4))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl MIMEChecker for Mp4Matcher {
|
impl MIMEChecker for Mp4Matcher {
|
||||||
|
|
|
@ -260,25 +260,19 @@ fn test_cors_preflight_fetch() {
|
||||||
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
||||||
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||||
{
|
{
|
||||||
assert!(
|
assert!(request
|
||||||
request
|
.headers()
|
||||||
.headers()
|
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
assert!(!request
|
||||||
);
|
.headers()
|
||||||
assert!(
|
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||||
!request
|
assert!(!request
|
||||||
.headers()
|
.headers()
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
.get(header::REFERER)
|
||||||
);
|
.unwrap()
|
||||||
assert!(
|
.to_str()
|
||||||
!request
|
.unwrap()
|
||||||
.headers()
|
.contains("a.html"));
|
||||||
.get(header::REFERER)
|
|
||||||
.unwrap()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.contains("a.html")
|
|
||||||
);
|
|
||||||
response
|
response
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||||
|
@ -324,16 +318,12 @@ fn test_cors_preflight_cache_fetch() {
|
||||||
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
||||||
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||||
{
|
{
|
||||||
assert!(
|
assert!(request
|
||||||
request
|
.headers()
|
||||||
.headers()
|
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
assert!(!request
|
||||||
);
|
.headers()
|
||||||
assert!(
|
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||||
!request
|
|
||||||
.headers()
|
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
|
||||||
);
|
|
||||||
response
|
response
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||||
|
@ -393,16 +383,12 @@ fn test_cors_preflight_fetch_network_error() {
|
||||||
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
let handler = move |request: HyperRequest<Body>, response: &mut HyperResponse<Body>| {
|
||||||
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
if request.method() == Method::OPTIONS && state.clone().fetch_add(1, Ordering::SeqCst) == 0
|
||||||
{
|
{
|
||||||
assert!(
|
assert!(request
|
||||||
request
|
.headers()
|
||||||
.headers()
|
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD));
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_METHOD)
|
assert!(!request
|
||||||
);
|
.headers()
|
||||||
assert!(
|
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
|
||||||
!request
|
|
||||||
.headers()
|
|
||||||
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS)
|
|
||||||
);
|
|
||||||
response
|
response
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||||
|
@ -461,11 +447,9 @@ fn test_fetch_response_is_basic_filtered() {
|
||||||
|
|
||||||
let headers = fetch_response.headers;
|
let headers = fetch_response.headers;
|
||||||
assert!(!headers.contains_key(header::SET_COOKIE));
|
assert!(!headers.contains_key(header::SET_COOKIE));
|
||||||
assert!(
|
assert!(headers
|
||||||
headers
|
.get(HeaderName::from_static("set-cookie2"))
|
||||||
.get(HeaderName::from_static("set-cookie2"))
|
.is_none());
|
||||||
.is_none()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -535,11 +519,9 @@ fn test_fetch_response_is_cors_filtered() {
|
||||||
|
|
||||||
assert!(!headers.contains_key(header::ACCESS_CONTROL_ALLOW_ORIGIN));
|
assert!(!headers.contains_key(header::ACCESS_CONTROL_ALLOW_ORIGIN));
|
||||||
assert!(!headers.contains_key(header::SET_COOKIE));
|
assert!(!headers.contains_key(header::SET_COOKIE));
|
||||||
assert!(
|
assert!(headers
|
||||||
headers
|
.get(HeaderName::from_static("set-cookie2"))
|
||||||
.get(HeaderName::from_static("set-cookie2"))
|
.is_none());
|
||||||
.is_none()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -102,14 +102,12 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() {
|
||||||
let mut entries_map = HashMap::new();
|
let mut entries_map = HashMap::new();
|
||||||
entries_map.insert(
|
entries_map.insert(
|
||||||
"mozilla.org".to_owned(),
|
"mozilla.org".to_owned(),
|
||||||
vec![
|
vec![HstsEntry::new(
|
||||||
HstsEntry::new(
|
"mozilla.org".to_owned(),
|
||||||
"mozilla.org".to_owned(),
|
IncludeSubdomains::NotIncluded,
|
||||||
IncludeSubdomains::NotIncluded,
|
Some(500000u64),
|
||||||
Some(500000u64),
|
)
|
||||||
)
|
.unwrap()],
|
||||||
.unwrap(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
let mut list = HstsList {
|
let mut list = HstsList {
|
||||||
entries_map: entries_map,
|
entries_map: entries_map,
|
||||||
|
@ -180,14 +178,12 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() {
|
||||||
let mut entries_map = HashMap::new();
|
let mut entries_map = HashMap::new();
|
||||||
entries_map.insert(
|
entries_map.insert(
|
||||||
"mozilla.org".to_owned(),
|
"mozilla.org".to_owned(),
|
||||||
vec![
|
vec![HstsEntry::new(
|
||||||
HstsEntry::new(
|
"mozilla.org".to_owned(),
|
||||||
"mozilla.org".to_owned(),
|
IncludeSubdomains::NotIncluded,
|
||||||
IncludeSubdomains::NotIncluded,
|
None,
|
||||||
None,
|
)
|
||||||
)
|
.unwrap()],
|
||||||
.unwrap(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
let mut list = HstsList {
|
let mut list = HstsList {
|
||||||
entries_map: entries_map,
|
entries_map: entries_map,
|
||||||
|
@ -286,14 +282,12 @@ fn test_hsts_list_with_exact_domain_entry_is_is_host_secure() {
|
||||||
let mut entries_map = HashMap::new();
|
let mut entries_map = HashMap::new();
|
||||||
entries_map.insert(
|
entries_map.insert(
|
||||||
"mozilla.org".to_owned(),
|
"mozilla.org".to_owned(),
|
||||||
vec![
|
vec![HstsEntry::new(
|
||||||
HstsEntry::new(
|
"mozilla.org".to_owned(),
|
||||||
"mozilla.org".to_owned(),
|
IncludeSubdomains::NotIncluded,
|
||||||
IncludeSubdomains::NotIncluded,
|
None,
|
||||||
None,
|
)
|
||||||
)
|
.unwrap()],
|
||||||
.unwrap(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let hsts_list = HstsList {
|
let hsts_list = HstsList {
|
||||||
|
@ -322,14 +316,12 @@ fn test_hsts_list_with_subdomain_when_include_subdomains_is_false_is_not_is_host
|
||||||
let mut entries_map = HashMap::new();
|
let mut entries_map = HashMap::new();
|
||||||
entries_map.insert(
|
entries_map.insert(
|
||||||
"mozilla.org".to_owned(),
|
"mozilla.org".to_owned(),
|
||||||
vec![
|
vec![HstsEntry::new(
|
||||||
HstsEntry::new(
|
"mozilla.org".to_owned(),
|
||||||
"mozilla.org".to_owned(),
|
IncludeSubdomains::NotIncluded,
|
||||||
IncludeSubdomains::NotIncluded,
|
None,
|
||||||
None,
|
)
|
||||||
)
|
.unwrap()],
|
||||||
.unwrap(),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
let hsts_list = HstsList {
|
let hsts_list = HstsList {
|
||||||
entries_map: entries_map,
|
entries_map: entries_map,
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cookie_rs::Cookie as CookiePair;
|
|
||||||
use crate::fetch;
|
use crate::fetch;
|
||||||
use crate::fetch_with_context;
|
use crate::fetch_with_context;
|
||||||
use crate::make_server;
|
use crate::make_server;
|
||||||
use crate::new_fetch_context;
|
use crate::new_fetch_context;
|
||||||
|
use cookie_rs::Cookie as CookiePair;
|
||||||
use crossbeam_channel::{unbounded, Receiver};
|
use crossbeam_channel::{unbounded, Receiver};
|
||||||
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
|
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
|
||||||
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
|
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
|
||||||
|
@ -144,15 +144,13 @@ fn test_check_default_headers_loaded_in_every_request() {
|
||||||
..RequestInit::default()
|
..RequestInit::default()
|
||||||
});
|
});
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Testing for method.POST
|
// Testing for method.POST
|
||||||
let mut post_headers = headers.clone();
|
let mut post_headers = headers.clone();
|
||||||
|
@ -174,15 +172,13 @@ fn test_check_default_headers_loaded_in_every_request() {
|
||||||
..RequestInit::default()
|
..RequestInit::default()
|
||||||
});
|
});
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
}
|
}
|
||||||
|
@ -208,15 +204,13 @@ fn test_load_when_request_is_not_get_or_head_and_there_is_no_body_content_length
|
||||||
..RequestInit::default()
|
..RequestInit::default()
|
||||||
});
|
});
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
}
|
}
|
||||||
|
@ -245,15 +239,13 @@ fn test_request_and_response_data_with_network_messages() {
|
||||||
});
|
});
|
||||||
let (devtools_chan, devtools_port) = unbounded();
|
let (devtools_chan, devtools_port) = unbounded();
|
||||||
let response = fetch(&mut request, Some(devtools_chan));
|
let response = fetch(&mut request, Some(devtools_chan));
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
|
@ -346,15 +338,13 @@ fn test_request_and_response_message_from_devtool_without_pipeline_id() {
|
||||||
});
|
});
|
||||||
let (devtools_chan, devtools_port) = unbounded();
|
let (devtools_chan, devtools_port) = unbounded();
|
||||||
let response = fetch(&mut request, Some(devtools_chan));
|
let response = fetch(&mut request, Some(devtools_chan));
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
|
@ -592,15 +582,13 @@ fn test_load_doesnt_add_host_to_sts_list_when_url_is_http_even_if_sts_headers_ar
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
context
|
context
|
||||||
.state
|
.state
|
||||||
|
@ -641,15 +629,13 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_cookie_for_domain(
|
assert_cookie_for_domain(
|
||||||
&context.state.cookie_jar,
|
&context.state.cookie_jar,
|
||||||
|
@ -696,15 +682,13 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -745,15 +729,13 @@ fn test_load_sends_cookie_if_nonhttp() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -785,15 +767,13 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_cookie_for_domain(
|
assert_cookie_for_domain(
|
||||||
&context.state.cookie_jar,
|
&context.state.cookie_jar,
|
||||||
|
@ -801,11 +781,9 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
|
||||||
Some("mozillaIs=theBest"),
|
Some("mozillaIs=theBest"),
|
||||||
);
|
);
|
||||||
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
|
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
|
||||||
assert!(
|
assert!(cookie_jar
|
||||||
cookie_jar
|
.cookies_for_url(&url, CookieSource::NonHTTP)
|
||||||
.cookies_for_url(&url, CookieSource::NonHTTP)
|
.is_none());
|
||||||
.is_none()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -837,15 +815,13 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_cookie_for_domain(&context.state.cookie_jar, url.as_str(), None);
|
assert_cookie_for_domain(&context.state.cookie_jar, url.as_str(), None);
|
||||||
}
|
}
|
||||||
|
@ -876,15 +852,13 @@ fn test_load_sets_content_length_to_length_of_request_body() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -918,15 +892,13 @@ fn test_load_uses_explicit_accept_from_headers_in_load_data() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -957,15 +929,13 @@ fn test_load_sets_default_accept_to_html_xhtml_xml_and_then_anything_else() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -999,15 +969,13 @@ fn test_load_uses_explicit_accept_encoding_from_load_data_headers() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1038,15 +1006,13 @@ fn test_load_sets_default_accept_encoding_to_gzip_and_deflate() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1374,15 +1340,13 @@ fn test_if_auth_creds_not_in_url_but_in_cache_it_sets_it() {
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
|
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1439,15 +1403,13 @@ fn test_origin_set() {
|
||||||
..RequestInit::default()
|
..RequestInit::default()
|
||||||
});
|
});
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let origin_url = ServoUrl::parse("http://example.com").unwrap();
|
let origin_url = ServoUrl::parse("http://example.com").unwrap();
|
||||||
origin =
|
origin =
|
||||||
|
@ -1464,15 +1426,13 @@ fn test_origin_set() {
|
||||||
|
|
||||||
*origin_header_clone.lock().unwrap() = Some(origin.clone());
|
*origin_header_clone.lock().unwrap() = Some(origin.clone());
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Test Origin header is not set on method Head
|
// Test Origin header is not set on method Head
|
||||||
let mut request = Request::from_init(RequestInit {
|
let mut request = Request::from_init(RequestInit {
|
||||||
|
@ -1485,15 +1445,13 @@ fn test_origin_set() {
|
||||||
|
|
||||||
*origin_header_clone.lock().unwrap() = None;
|
*origin_header_clone.lock().unwrap() = None;
|
||||||
let response = fetch(&mut request, None);
|
let response = fetch(&mut request, None);
|
||||||
assert!(
|
assert!(response
|
||||||
response
|
.internal_response
|
||||||
.internal_response
|
.unwrap()
|
||||||
.unwrap()
|
.status
|
||||||
.status
|
.unwrap()
|
||||||
.unwrap()
|
.0
|
||||||
.0
|
.is_success());
|
||||||
.is_success()
|
|
||||||
);
|
|
||||||
|
|
||||||
let _ = server.close();
|
let _ = server.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
cargo-features = ["rename-dependency"]
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "net_traits"
|
name = "net_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -17,11 +17,11 @@ extern crate serde;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
use cookie::Cookie;
|
|
||||||
use crate::filemanager_thread::FileManagerThreadMsg;
|
use crate::filemanager_thread::FileManagerThreadMsg;
|
||||||
use crate::request::{Request, RequestInit};
|
use crate::request::{Request, RequestInit};
|
||||||
use crate::response::{HttpsState, Response, ResponseInit};
|
use crate::response::{HttpsState, Response, ResponseInit};
|
||||||
use crate::storage_thread::StorageThreadMsg;
|
use crate::storage_thread::StorageThreadMsg;
|
||||||
|
use cookie::Cookie;
|
||||||
use headers_core::HeaderMapExt;
|
use headers_core::HeaderMapExt;
|
||||||
use headers_ext::{ContentType, ReferrerPolicy as ReferrerPolicyHeader};
|
use headers_ext::{ContentType, ReferrerPolicy as ReferrerPolicyHeader};
|
||||||
use http::{Error as HttpError, HeaderMap};
|
use http::{Error as HttpError, HeaderMap};
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl PubDomainRules {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
fn suffix_pair<'a>(&self, domain: &'a str) -> (&'a str, &'a str) {
|
fn suffix_pair<'a>(&self, domain: &'a str) -> (&'a str, &'a str) {
|
||||||
let domain = domain.trim_left_matches(".");
|
let domain = domain.trim_start_matches(".");
|
||||||
let mut suffix = domain;
|
let mut suffix = domain;
|
||||||
let mut prev_suffix = domain;
|
let mut prev_suffix = domain;
|
||||||
for (index, _) in domain.match_indices(".") {
|
for (index, _) in domain.match_indices(".") {
|
||||||
|
@ -96,7 +96,7 @@ impl PubDomainRules {
|
||||||
// Speeded-up version of
|
// Speeded-up version of
|
||||||
// domain != "" &&
|
// domain != "" &&
|
||||||
// self.public_suffix(domain) == domain.
|
// self.public_suffix(domain) == domain.
|
||||||
let domain = domain.trim_left_matches(".");
|
let domain = domain.trim_start_matches(".");
|
||||||
match domain.find(".") {
|
match domain.find(".") {
|
||||||
None => !domain.is_empty(),
|
None => !domain.is_empty(),
|
||||||
Some(index) => {
|
Some(index) => {
|
||||||
|
@ -109,7 +109,7 @@ impl PubDomainRules {
|
||||||
// Speeded-up version of
|
// Speeded-up version of
|
||||||
// self.public_suffix(domain) != domain &&
|
// self.public_suffix(domain) != domain &&
|
||||||
// self.registrable_suffix(domain) == domain.
|
// self.registrable_suffix(domain) == domain.
|
||||||
let domain = domain.trim_left_matches(".");
|
let domain = domain.trim_start_matches(".");
|
||||||
match domain.find(".") {
|
match domain.find(".") {
|
||||||
None => false,
|
None => false,
|
||||||
Some(index) => {
|
Some(index) => {
|
||||||
|
|
|
@ -69,7 +69,7 @@ where
|
||||||
digits[0] = (x % 10) as u8 + b'0';
|
digits[0] = (x % 10) as u8 + b'0';
|
||||||
|
|
||||||
let s = str::from_utf8(&digits[..]).unwrap();
|
let s = str::from_utf8(&digits[..]).unwrap();
|
||||||
fmt.write_str(s.trim_right_matches('0'))
|
fmt.write_str(s.trim_end_matches('0'))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
cargo-features = ["rename-dependency"]
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "profile"
|
name = "profile"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl ThreadId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local!{ static THREAD_ID: ThreadId = ThreadId::new() }
|
thread_local! { static THREAD_ID: ThreadId = ThreadId::new() }
|
||||||
|
|
||||||
/// A type for atomic storage of thread ids.
|
/// A type for atomic storage of thread ids.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
cargo-features = ["rename-dependency"]
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "script"
|
name = "script"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -47,14 +47,12 @@ pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<E
|
||||||
} else if rval.is_boolean() {
|
} else if rval.is_boolean() {
|
||||||
EvaluateJSReply::BooleanValue(rval.to_boolean())
|
EvaluateJSReply::BooleanValue(rval.to_boolean())
|
||||||
} else if rval.is_double() || rval.is_int32() {
|
} else if rval.is_double() || rval.is_int32() {
|
||||||
EvaluateJSReply::NumberValue(match FromJSValConvertible::from_jsval(
|
EvaluateJSReply::NumberValue(
|
||||||
cx,
|
match FromJSValConvertible::from_jsval(cx, rval.handle(), ()) {
|
||||||
rval.handle(),
|
Ok(ConversionResult::Success(v)) => v,
|
||||||
(),
|
_ => unreachable!(),
|
||||||
) {
|
},
|
||||||
Ok(ConversionResult::Success(v)) => v,
|
)
|
||||||
_ => unreachable!(),
|
|
||||||
})
|
|
||||||
} else if rval.is_string() {
|
} else if rval.is_string() {
|
||||||
EvaluateJSReply::StringValue(String::from(jsstring_to_str(cx, rval.to_string())))
|
EvaluateJSReply::StringValue(String::from(jsstring_to_str(cx, rval.to_string())))
|
||||||
} else if rval.is_null() {
|
} else if rval.is_null() {
|
||||||
|
@ -242,7 +240,7 @@ pub fn handle_modify_attribute(
|
||||||
return warn!(
|
return warn!(
|
||||||
"node id {} for pipeline id {} is not found",
|
"node id {} for pipeline id {} is not found",
|
||||||
&node_id, &pipeline
|
&node_id, &pipeline
|
||||||
)
|
);
|
||||||
},
|
},
|
||||||
Some(found_node) => found_node,
|
Some(found_node) => found_node,
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,9 +108,9 @@ impl AnalyserNode {
|
||||||
let this = this.clone();
|
let this = this.clone();
|
||||||
let _ = source.queue_with_canceller(
|
let _ = source.queue_with_canceller(
|
||||||
task!(append_analysis_block: move || {
|
task!(append_analysis_block: move || {
|
||||||
let this = this.root();
|
let this = this.root();
|
||||||
this.push_block(block.to().unwrap())
|
this.push_block(block.to().unwrap())
|
||||||
}),
|
}),
|
||||||
&canceller,
|
&canceller,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -134,20 +134,20 @@ impl AudioContextMethods for AudioContext {
|
||||||
let context = Trusted::new(self);
|
let context = Trusted::new(self);
|
||||||
let _ = task_source.queue(
|
let _ = task_source.queue(
|
||||||
task!(suspend_ok: move || {
|
task!(suspend_ok: move || {
|
||||||
let base_context = base_context.root();
|
let base_context = base_context.root();
|
||||||
let context = context.root();
|
let context = context.root();
|
||||||
let promise = trusted_promise.root();
|
let promise = trusted_promise.root();
|
||||||
promise.resolve_native(&());
|
promise.resolve_native(&());
|
||||||
if base_context.State() != AudioContextState::Suspended {
|
if base_context.State() != AudioContextState::Suspended {
|
||||||
base_context.set_state_attribute(AudioContextState::Suspended);
|
base_context.set_state_attribute(AudioContextState::Suspended);
|
||||||
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
|
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
|
||||||
window.task_manager().dom_manipulation_task_source().queue_simple_event(
|
window.task_manager().dom_manipulation_task_source().queue_simple_event(
|
||||||
context.upcast(),
|
context.upcast(),
|
||||||
atom!("statechange"),
|
atom!("statechange"),
|
||||||
&window
|
&window
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -156,9 +156,9 @@ impl AudioContextMethods for AudioContext {
|
||||||
// never fail, but we handle the case here for completion.
|
// never fail, but we handle the case here for completion.
|
||||||
let _ = task_source.queue(
|
let _ = task_source.queue(
|
||||||
task!(suspend_error: move || {
|
task!(suspend_error: move || {
|
||||||
let promise = trusted_promise.root();
|
let promise = trusted_promise.root();
|
||||||
promise.reject_error(Error::Type("Something went wrong".to_owned()));
|
promise.reject_error(Error::Type("Something went wrong".to_owned()));
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -196,20 +196,20 @@ impl AudioContextMethods for AudioContext {
|
||||||
let context = Trusted::new(self);
|
let context = Trusted::new(self);
|
||||||
let _ = task_source.queue(
|
let _ = task_source.queue(
|
||||||
task!(suspend_ok: move || {
|
task!(suspend_ok: move || {
|
||||||
let base_context = base_context.root();
|
let base_context = base_context.root();
|
||||||
let context = context.root();
|
let context = context.root();
|
||||||
let promise = trusted_promise.root();
|
let promise = trusted_promise.root();
|
||||||
promise.resolve_native(&());
|
promise.resolve_native(&());
|
||||||
if base_context.State() != AudioContextState::Closed {
|
if base_context.State() != AudioContextState::Closed {
|
||||||
base_context.set_state_attribute(AudioContextState::Closed);
|
base_context.set_state_attribute(AudioContextState::Closed);
|
||||||
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
|
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
|
||||||
window.task_manager().dom_manipulation_task_source().queue_simple_event(
|
window.task_manager().dom_manipulation_task_source().queue_simple_event(
|
||||||
context.upcast(),
|
context.upcast(),
|
||||||
atom!("statechange"),
|
atom!("statechange"),
|
||||||
&window
|
&window
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -218,9 +218,9 @@ impl AudioContextMethods for AudioContext {
|
||||||
// never fail, but we handle the case here for completion.
|
// never fail, but we handle the case here for completion.
|
||||||
let _ = task_source.queue(
|
let _ = task_source.queue(
|
||||||
task!(suspend_error: move || {
|
task!(suspend_error: move || {
|
||||||
let promise = trusted_promise.root();
|
let promise = trusted_promise.root();
|
||||||
promise.reject_error(Error::Type("Something went wrong".to_owned()));
|
promise.reject_error(Error::Type("Something went wrong".to_owned()));
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -244,8 +244,8 @@ impl BaseAudioContext {
|
||||||
)));
|
)));
|
||||||
let _ = task_source.queue(
|
let _ = task_source.queue(
|
||||||
task!(resume_error: move || {
|
task!(resume_error: move || {
|
||||||
this.root().fulfill_in_flight_resume_promises(|| {})
|
this.root().fulfill_in_flight_resume_promises(|| {})
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
//! Utilities to throw exceptions from Rust bindings.
|
//! Utilities to throw exceptions from Rust bindings.
|
||||||
|
|
||||||
#[cfg(feature = "js_backtrace")]
|
|
||||||
use backtrace::Backtrace;
|
|
||||||
#[cfg(feature = "js_backtrace")]
|
#[cfg(feature = "js_backtrace")]
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
||||||
|
@ -17,6 +15,8 @@ use crate::dom::bindings::conversions::{
|
||||||
use crate::dom::bindings::str::USVString;
|
use crate::dom::bindings::str::USVString;
|
||||||
use crate::dom::domexception::{DOMErrorName, DOMException};
|
use crate::dom::domexception::{DOMErrorName, DOMException};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
#[cfg(feature = "js_backtrace")]
|
||||||
|
use backtrace::Backtrace;
|
||||||
use js::error::{throw_range_error, throw_type_error};
|
use js::error::{throw_range_error, throw_type_error};
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
use js::jsapi::JS_ClearPendingException;
|
use js::jsapi::JS_ClearPendingException;
|
||||||
|
|
|
@ -105,7 +105,7 @@ where
|
||||||
None => {
|
None => {
|
||||||
return Err(Error::Type(
|
return Err(Error::Type(
|
||||||
"No custom element definition found for new.target".to_owned(),
|
"No custom element definition found for new.target".to_owned(),
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -734,10 +734,10 @@ fn parse_floating_point_number(input: &str) -> Result<f64, ()> {
|
||||||
match input.trim().parse::<f64>() {
|
match input.trim().parse::<f64>() {
|
||||||
Ok(val)
|
Ok(val)
|
||||||
if !(
|
if !(
|
||||||
// A valid number is the same as what rust considers to be valid,
|
// A valid number is the same as what rust considers to be valid,
|
||||||
// except for +1., NaN, and Infinity.
|
// except for +1., NaN, and Infinity.
|
||||||
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
|
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
|
||||||
) =>
|
) =>
|
||||||
{
|
{
|
||||||
// TODO(#19773): need consider `min`, `max`, `step`, when they are implemented
|
// TODO(#19773): need consider `min`, `max`, `step`, when they are implemented
|
||||||
Ok(val.round())
|
Ok(val.round())
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
//! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of
|
//! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of
|
||||||
//! `JSTraceable` to a datatype.
|
//! `JSTraceable` to a datatype.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use canvas_traits::canvas::{
|
|
||||||
CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
|
|
||||||
};
|
|
||||||
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
|
|
||||||
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
|
|
||||||
use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
|
|
||||||
use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
|
|
||||||
use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
|
|
||||||
use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
|
@ -50,6 +40,16 @@ use crate::dom::document::PendingRestyle;
|
||||||
use crate::dom::htmlimageelement::SourceSet;
|
use crate::dom::htmlimageelement::SourceSet;
|
||||||
use crate::dom::htmlmediaelement::MediaFrameRenderer;
|
use crate::dom::htmlmediaelement::MediaFrameRenderer;
|
||||||
use crate::task::TaskBox;
|
use crate::task::TaskBox;
|
||||||
|
use app_units::Au;
|
||||||
|
use canvas_traits::canvas::{
|
||||||
|
CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
|
||||||
|
};
|
||||||
|
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
|
||||||
|
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
|
||||||
|
use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
|
||||||
|
use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
|
||||||
|
use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
|
||||||
|
use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
|
||||||
use crossbeam_channel::{Receiver, Sender};
|
use crossbeam_channel::{Receiver, Sender};
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use devtools_traits::{CSSError, TimelineMarkerType, WorkerId};
|
use devtools_traits::{CSSError, TimelineMarkerType, WorkerId};
|
||||||
|
@ -769,8 +769,10 @@ struct RootedTraceableSet {
|
||||||
set: Vec<*const dyn JSTraceable>,
|
set: Vec<*const dyn JSTraceable>,
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local!(/// TLV Holds a set of JSTraceables that need to be rooted
|
thread_local!(
|
||||||
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new()););
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
||||||
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new());
|
||||||
|
);
|
||||||
|
|
||||||
impl RootedTraceableSet {
|
impl RootedTraceableSet {
|
||||||
fn new() -> RootedTraceableSet {
|
fn new() -> RootedTraceableSet {
|
||||||
|
|
|
@ -116,12 +116,16 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid_continuation(c: char) -> bool {
|
fn is_valid_continuation(c: char) -> bool {
|
||||||
is_valid_start(c) || match c {
|
is_valid_start(c) ||
|
||||||
'-' | '.' | '0'...'9' | '\u{B7}' | '\u{300}'...'\u{36F}' | '\u{203F}'...'\u{2040}' => {
|
match c {
|
||||||
true
|
'-' |
|
||||||
},
|
'.' |
|
||||||
_ => false,
|
'0'...'9' |
|
||||||
}
|
'\u{B7}' |
|
||||||
|
'\u{300}'...'\u{36F}' |
|
||||||
|
'\u{203F}'...'\u{2040}' => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut iter = name.chars();
|
let mut iter = name.chars();
|
||||||
|
|
|
@ -426,7 +426,7 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible<Bluetooth
|
||||||
let manufacturer_id = match u16::from_str(key.as_ref()) {
|
let manufacturer_id = match u16::from_str(key.as_ref()) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)))
|
return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
|
|
||||||
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
|
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
||||||
|
@ -23,6 +21,8 @@ use crate::dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
|
||||||
|
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use profile_traits::ipc;
|
use profile_traits::ipc;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{
|
use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{
|
||||||
self, BluetoothPermissionResultMethods,
|
self, BluetoothPermissionResultMethods,
|
||||||
|
@ -22,6 +21,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::permissionstatus::PermissionStatus;
|
use crate::dom::permissionstatus::PermissionStatus;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
|
|
||||||
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding;
|
||||||
|
@ -25,6 +23,8 @@ use crate::dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
|
||||||
|
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
|
|
||||||
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding;
|
||||||
|
@ -21,6 +19,8 @@ use crate::dom::bluetoothremotegattcharacteristic::{
|
||||||
};
|
};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
|
||||||
|
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
|
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||||
|
@ -15,6 +14,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
|
||||||
use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
|
use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use bluetooth_traits::{BluetoothResponse, GATTType};
|
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||||
|
@ -16,6 +15,7 @@ use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUI
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::promise::Promise;
|
use crate::dom::promise::Promise;
|
||||||
|
use bluetooth_traits::{BluetoothResponse, GATTType};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use canvas_traits::canvas::{
|
|
||||||
CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
|
|
||||||
};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding;
|
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
|
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
|
||||||
|
@ -14,6 +11,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use canvas_traits::canvas::{
|
||||||
|
CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
|
||||||
|
};
|
||||||
use cssparser::Color as CSSColor;
|
use cssparser::Color as CSSColor;
|
||||||
use cssparser::{Parser, ParserInput, RGBA};
|
use cssparser::{Parser, ParserInput, RGBA};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
|
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasPatternBinding;
|
use crate::dom::bindings::codegen::Bindings::CanvasPatternBinding;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
|
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
|
||||||
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
|
|
||||||
use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
|
|
||||||
use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding;
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
||||||
|
@ -29,6 +25,10 @@ use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement};
|
||||||
use crate::dom::imagedata::ImageData;
|
use crate::dom::imagedata::ImageData;
|
||||||
use crate::dom::node::{window_from_node, Node, NodeDamage};
|
use crate::dom::node::{window_from_node, Node, NodeDamage};
|
||||||
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
|
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
|
||||||
|
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
|
||||||
|
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
|
||||||
|
use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
|
||||||
|
use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
|
||||||
use cssparser::Color as CSSColor;
|
use cssparser::Color as CSSColor;
|
||||||
use cssparser::{Parser, ParserInput, RGBA};
|
use cssparser::{Parser, ParserInput, RGBA};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
|
@ -522,7 +522,7 @@ impl CustomElementDefinition {
|
||||||
Ok(ConversionResult::Failure(..)) => {
|
Ok(ConversionResult::Failure(..)) => {
|
||||||
return Err(Error::Type(
|
return Err(Error::Type(
|
||||||
"Constructor did not return a DOM node".to_owned(),
|
"Constructor did not return a DOM node".to_owned(),
|
||||||
))
|
));
|
||||||
},
|
},
|
||||||
_ => return Err(Error::JSFailed),
|
_ => return Err(Error::JSFailed),
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cookie::Cookie;
|
|
||||||
use crate::document_loader::{DocumentLoader, LoadType};
|
use crate::document_loader::{DocumentLoader, LoadType};
|
||||||
use crate::dom::activation::{synthetic_click_activation, ActivationSource};
|
use crate::dom::activation::{synthetic_click_activation, ActivationSource};
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
|
@ -104,6 +103,7 @@ use crate::script_thread::{MainThreadScriptMsg, ScriptThread};
|
||||||
use crate::task::TaskBox;
|
use crate::task::TaskBox;
|
||||||
use crate::task_source::{TaskSource, TaskSourceName};
|
use crate::task_source::{TaskSource, TaskSourceName};
|
||||||
use crate::timers::OneshotTimerCallback;
|
use crate::timers::OneshotTimerCallback;
|
||||||
|
use cookie::Cookie;
|
||||||
use devtools_traits::ScriptToDevtoolsControlMsg;
|
use devtools_traits::ScriptToDevtoolsControlMsg;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::EmbedderMsg;
|
||||||
|
@ -542,30 +542,30 @@ impl Document {
|
||||||
.dom_manipulation_task_source()
|
.dom_manipulation_task_source()
|
||||||
.queue(
|
.queue(
|
||||||
task!(fire_pageshow_event: move || {
|
task!(fire_pageshow_event: move || {
|
||||||
let document = document.root();
|
let document = document.root();
|
||||||
let window = document.window();
|
let window = document.window();
|
||||||
// Step 4.6.1
|
// Step 4.6.1
|
||||||
if document.page_showing.get() {
|
if document.page_showing.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Step 4.6.2
|
// Step 4.6.2
|
||||||
document.page_showing.set(true);
|
document.page_showing.set(true);
|
||||||
// Step 4.6.4
|
// Step 4.6.4
|
||||||
let event = PageTransitionEvent::new(
|
let event = PageTransitionEvent::new(
|
||||||
window,
|
window,
|
||||||
atom!("pageshow"),
|
atom!("pageshow"),
|
||||||
false, // bubbles
|
false, // bubbles
|
||||||
false, // cancelable
|
false, // cancelable
|
||||||
true, // persisted
|
true, // persisted
|
||||||
);
|
);
|
||||||
let event = event.upcast::<Event>();
|
let event = event.upcast::<Event>();
|
||||||
event.set_trusted(true);
|
event.set_trusted(true);
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
||||||
document.upcast(),
|
document.upcast(),
|
||||||
&event,
|
&event,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -615,11 +615,12 @@ impl Document {
|
||||||
// FIXME: This should check the dirty bit on the document,
|
// FIXME: This should check the dirty bit on the document,
|
||||||
// not the document element. Needs some layout changes to make
|
// not the document element. Needs some layout changes to make
|
||||||
// that workable.
|
// that workable.
|
||||||
self.stylesheets.borrow().has_changed() || self.GetDocumentElement().map_or(false, |root| {
|
self.stylesheets.borrow().has_changed() ||
|
||||||
root.upcast::<Node>().has_dirty_descendants() ||
|
self.GetDocumentElement().map_or(false, |root| {
|
||||||
!self.pending_restyles.borrow().is_empty() ||
|
root.upcast::<Node>().has_dirty_descendants() ||
|
||||||
self.needs_paint()
|
!self.pending_restyles.borrow().is_empty() ||
|
||||||
})
|
self.needs_paint()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the first `base` element in the DOM that has an `href` attribute.
|
/// Returns the first `base` element in the DOM that has an `href` attribute.
|
||||||
|
@ -1940,46 +1941,46 @@ impl Document {
|
||||||
.dom_manipulation_task_source()
|
.dom_manipulation_task_source()
|
||||||
.queue(
|
.queue(
|
||||||
task!(fire_load_event: move || {
|
task!(fire_load_event: move || {
|
||||||
let document = document.root();
|
let document = document.root();
|
||||||
let window = document.window();
|
let window = document.window();
|
||||||
if !window.is_alive() {
|
if !window.is_alive() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7.1.
|
// Step 7.1.
|
||||||
document.set_ready_state(DocumentReadyState::Complete);
|
document.set_ready_state(DocumentReadyState::Complete);
|
||||||
|
|
||||||
// Step 7.2.
|
// Step 7.2.
|
||||||
if document.browsing_context().is_none() {
|
if document.browsing_context().is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let event = Event::new(
|
let event = Event::new(
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
atom!("load"),
|
atom!("load"),
|
||||||
EventBubbles::DoesNotBubble,
|
EventBubbles::DoesNotBubble,
|
||||||
EventCancelable::NotCancelable,
|
EventCancelable::NotCancelable,
|
||||||
);
|
);
|
||||||
event.set_trusted(true);
|
event.set_trusted(true);
|
||||||
|
|
||||||
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
|
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
|
||||||
update_with_current_time_ms(&document.load_event_start);
|
update_with_current_time_ms(&document.load_event_start);
|
||||||
|
|
||||||
debug!("About to dispatch load for {:?}", document.url());
|
debug!("About to dispatch load for {:?}", document.url());
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
||||||
document.upcast(),
|
document.upcast(),
|
||||||
&event,
|
&event,
|
||||||
);
|
);
|
||||||
|
|
||||||
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
|
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
|
||||||
update_with_current_time_ms(&document.load_event_end);
|
update_with_current_time_ms(&document.load_event_end);
|
||||||
|
|
||||||
window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
|
window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
|
||||||
|
|
||||||
if let Some(fragment) = document.url().fragment() {
|
if let Some(fragment) = document.url().fragment() {
|
||||||
document.check_and_scroll_fragment(fragment);
|
document.check_and_scroll_fragment(fragment);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -1992,30 +1993,30 @@ impl Document {
|
||||||
.dom_manipulation_task_source()
|
.dom_manipulation_task_source()
|
||||||
.queue(
|
.queue(
|
||||||
task!(fire_pageshow_event: move || {
|
task!(fire_pageshow_event: move || {
|
||||||
let document = document.root();
|
let document = document.root();
|
||||||
let window = document.window();
|
let window = document.window();
|
||||||
if document.page_showing.get() || !window.is_alive() {
|
if document.page_showing.get() || !window.is_alive() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.page_showing.set(true);
|
document.page_showing.set(true);
|
||||||
|
|
||||||
let event = PageTransitionEvent::new(
|
let event = PageTransitionEvent::new(
|
||||||
window,
|
window,
|
||||||
atom!("pageshow"),
|
atom!("pageshow"),
|
||||||
false, // bubbles
|
false, // bubbles
|
||||||
false, // cancelable
|
false, // cancelable
|
||||||
false, // persisted
|
false, // persisted
|
||||||
);
|
);
|
||||||
let event = event.upcast::<Event>();
|
let event = event.upcast::<Event>();
|
||||||
event.set_trusted(true);
|
event.set_trusted(true);
|
||||||
|
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
|
||||||
document.upcast(),
|
document.upcast(),
|
||||||
&event,
|
&event,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -2040,12 +2041,12 @@ impl Document {
|
||||||
.dom_manipulation_task_source()
|
.dom_manipulation_task_source()
|
||||||
.queue(
|
.queue(
|
||||||
task!(completely_loaded: move || {
|
task!(completely_loaded: move || {
|
||||||
let document = document.root();
|
let document = document.root();
|
||||||
document.completely_loaded.set(true);
|
document.completely_loaded.set(true);
|
||||||
// Note: this will, among others, result in the "iframe-load-event-steps" being run.
|
// Note: this will, among others, result in the "iframe-load-event-steps" being run.
|
||||||
// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
|
// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
|
||||||
document.notify_constellation_load();
|
document.notify_constellation_load();
|
||||||
}),
|
}),
|
||||||
self.window.upcast(),
|
self.window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1532,11 +1532,9 @@ impl Element {
|
||||||
|
|
||||||
pub fn get_int_attribute(&self, local_name: &LocalName, default: i32) -> i32 {
|
pub fn get_int_attribute(&self, local_name: &LocalName, default: i32) -> i32 {
|
||||||
// TODO: Is this assert necessary?
|
// TODO: Is this assert necessary?
|
||||||
assert!(
|
assert!(local_name
|
||||||
local_name
|
.chars()
|
||||||
.chars()
|
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
|
||||||
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
|
|
||||||
);
|
|
||||||
let attribute = self.get_attribute(&ns!(), local_name);
|
let attribute = self.get_attribute(&ns!(), local_name);
|
||||||
|
|
||||||
match attribute {
|
match attribute {
|
||||||
|
@ -1557,11 +1555,9 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_uint_attribute(&self, local_name: &LocalName, default: u32) -> u32 {
|
pub fn get_uint_attribute(&self, local_name: &LocalName, default: u32) -> u32 {
|
||||||
assert!(
|
assert!(local_name
|
||||||
local_name
|
.chars()
|
||||||
.chars()
|
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
|
||||||
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
|
|
||||||
);
|
|
||||||
let attribute = self.get_attribute(&ns!(), local_name);
|
let attribute = self.get_attribute(&ns!(), local_name);
|
||||||
match attribute {
|
match attribute {
|
||||||
Some(ref attribute) => match *attribute.value() {
|
Some(ref attribute) => match *attribute.value() {
|
||||||
|
@ -2840,10 +2836,11 @@ impl<'a> SelectorsElement for DomRoot<Element> {
|
||||||
|
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
self.node.children().all(|node| {
|
self.node.children().all(|node| {
|
||||||
!node.is::<Element>() && match node.downcast::<Text>() {
|
!node.is::<Element>() &&
|
||||||
None => true,
|
match node.downcast::<Text>() {
|
||||||
Some(text) => text.upcast::<CharacterData>().data().is_empty(),
|
None => true,
|
||||||
}
|
Some(text) => text.upcast::<CharacterData>().data().is_empty(),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use base64;
|
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{
|
use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{
|
||||||
|
@ -25,6 +24,7 @@ use crate::dom::progressevent::ProgressEvent;
|
||||||
use crate::task::TaskCanceller;
|
use crate::task::TaskCanceller;
|
||||||
use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
|
use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
|
||||||
use crate::task_source::{TaskSource, TaskSourceName};
|
use crate::task_source::{TaskSource, TaskSourceName};
|
||||||
|
use base64;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use encoding_rs::{Encoding, UTF_8};
|
use encoding_rs::{Encoding, UTF_8};
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
|
|
|
@ -97,14 +97,12 @@ impl FileReaderSyncMethods for FileReaderSync {
|
||||||
|
|
||||||
// step 2
|
// step 2
|
||||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
||||||
assert!(
|
assert!(ArrayBuffer::create(
|
||||||
ArrayBuffer::create(
|
cx,
|
||||||
cx,
|
CreateWith::Slice(&blob_contents),
|
||||||
CreateWith::Slice(&blob_contents),
|
array_buffer.handle_mut()
|
||||||
array_buffer.handle_mut()
|
)
|
||||||
)
|
.is_ok());
|
||||||
.is_ok()
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(NonNull::new_unchecked(array_buffer.get()))
|
Ok(NonNull::new_unchecked(array_buffer.get()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,9 +367,10 @@ pub fn is_forbidden_header_name(name: &str) -> bool {
|
||||||
|
|
||||||
let disallowed_header_prefixes = ["sec-", "proxy-"];
|
let disallowed_header_prefixes = ["sec-", "proxy-"];
|
||||||
|
|
||||||
disallowed_headers.iter().any(|header| *header == name) || disallowed_header_prefixes
|
disallowed_headers.iter().any(|header| *header == name) ||
|
||||||
.iter()
|
disallowed_header_prefixes
|
||||||
.any(|prefix| name.starts_with(prefix))
|
.iter()
|
||||||
|
.any(|prefix| name.starts_with(prefix))
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is some unresolved confusion over the definition of a name and a value.
|
// There is some unresolved confusion over the definition of a name and a value.
|
||||||
|
|
|
@ -413,8 +413,8 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
Some(ref url)
|
Some(ref url)
|
||||||
if url.host().is_none() || url.cannot_be_a_base() || url.scheme() == "file" =>
|
if url.host().is_none() || url.cannot_be_a_base() || url.scheme() == "file" =>
|
||||||
{
|
{
|
||||||
return
|
return;
|
||||||
},
|
}
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
|
|
|
@ -61,9 +61,10 @@ impl HTMLBodyElement {
|
||||||
let self_node = self.upcast::<Node>();
|
let self_node = self.upcast::<Node>();
|
||||||
let root_elem = self.upcast::<Element>().root_element();
|
let root_elem = self.upcast::<Element>().root_element();
|
||||||
let root_node = root_elem.upcast::<Node>();
|
let root_node = root_elem.upcast::<Node>();
|
||||||
root_node.is_parent_of(self_node) && self_node
|
root_node.is_parent_of(self_node) &&
|
||||||
.preceding_siblings()
|
self_node
|
||||||
.all(|n| !n.is::<HTMLBodyElement>())
|
.preceding_siblings()
|
||||||
|
.all(|n| !n.is::<HTMLBodyElement>())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use base64;
|
|
||||||
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
|
|
||||||
use canvas_traits::webgl::WebGLVersion;
|
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
|
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
|
||||||
|
@ -31,6 +28,9 @@ use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
|
||||||
use crate::dom::webglrenderingcontext::{
|
use crate::dom::webglrenderingcontext::{
|
||||||
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
|
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
|
||||||
};
|
};
|
||||||
|
use base64;
|
||||||
|
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
|
||||||
|
use canvas_traits::webgl::WebGLVersion;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::{Rect, Size2D};
|
use euclid::{Rect, Size2D};
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
|
|
@ -628,20 +628,20 @@ impl VirtualMethods for HTMLIFrameElement {
|
||||||
|
|
||||||
let iframe = Trusted::new(self);
|
let iframe = Trusted::new(self);
|
||||||
document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || {
|
document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || {
|
||||||
let this = iframe.root();
|
let this = iframe.root();
|
||||||
// https://html.spec.whatwg.org/multipage/#the-iframe-element
|
// https://html.spec.whatwg.org/multipage/#the-iframe-element
|
||||||
// "When an iframe element is inserted into a document that has
|
// "When an iframe element is inserted into a document that has
|
||||||
// a browsing context, the user agent must create a new
|
// a browsing context, the user agent must create a new
|
||||||
// browsing context, set the element's nested browsing context
|
// browsing context, set the element's nested browsing context
|
||||||
// to the newly-created browsing context, and then process the
|
// to the newly-created browsing context, and then process the
|
||||||
// iframe attributes for the "first time"."
|
// iframe attributes for the "first time"."
|
||||||
if this.upcast::<Node>().is_in_doc_with_browsing_context() {
|
if this.upcast::<Node>().is_in_doc_with_browsing_context() {
|
||||||
debug!("iframe bound to browsing context.");
|
debug!("iframe bound to browsing context.");
|
||||||
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
|
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
|
||||||
this.create_nested_browsing_context();
|
this.create_nested_browsing_context();
|
||||||
this.process_the_iframe_attributes(ProcessingMode::FirstTime);
|
this.process_the_iframe_attributes(ProcessingMode::FirstTime);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unbind_from_tree(&self, context: &UnbindContext) {
|
fn unbind_from_tree(&self, context: &UnbindContext) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use app_units::{Au, AU_PER_PX};
|
|
||||||
use crate::document_loader::{LoadBlocker, LoadType};
|
use crate::document_loader::{LoadBlocker, LoadType};
|
||||||
use crate::dom::activation::Activatable;
|
use crate::dom::activation::Activatable;
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
|
@ -43,6 +42,7 @@ use crate::microtask::{Microtask, MicrotaskRunnable};
|
||||||
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
|
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
|
||||||
use crate::script_thread::ScriptThread;
|
use crate::script_thread::ScriptThread;
|
||||||
use crate::task_source::TaskSource;
|
use crate::task_source::TaskSource;
|
||||||
|
use app_units::{Au, AU_PER_PX};
|
||||||
use cssparser::{Parser, ParserInput};
|
use cssparser::{Parser, ParserInput};
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
@ -286,12 +286,12 @@ impl HTMLImageElement {
|
||||||
// FIXME(nox): Why are errors silenced here?
|
// FIXME(nox): Why are errors silenced here?
|
||||||
let _ = task_source.queue_with_canceller(
|
let _ = task_source.queue_with_canceller(
|
||||||
task!(process_image_response: move || {
|
task!(process_image_response: move || {
|
||||||
let element = element.root();
|
let element = element.root();
|
||||||
// Ignore any image response for a previous request that has been discarded.
|
// Ignore any image response for a previous request that has been discarded.
|
||||||
if generation == element.generation.get() {
|
if generation == element.generation.get() {
|
||||||
element.process_image_response(image);
|
element.process_image_response(image);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
&canceller,
|
&canceller,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use caseless::compatibility_caseless_match_str;
|
|
||||||
use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource};
|
use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource};
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
|
@ -47,6 +46,7 @@ use crate::textinput::KeyReaction::{
|
||||||
};
|
};
|
||||||
use crate::textinput::Lines::Single;
|
use crate::textinput::Lines::Single;
|
||||||
use crate::textinput::{Direction, SelectionDirection, TextInput};
|
use crate::textinput::{Direction, SelectionDirection, TextInput};
|
||||||
|
use caseless::compatibility_caseless_match_str;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::FilterPattern;
|
use embedder_traits::FilterPattern;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
@ -946,7 +946,7 @@ impl HTMLInputElement {
|
||||||
match self.input_type() {
|
match self.input_type() {
|
||||||
// Step 3.1: it's a button but it is not submitter.
|
// Step 3.1: it's a button but it is not submitter.
|
||||||
InputType::Submit | InputType::Button | InputType::Reset if !is_submitter => {
|
InputType::Submit | InputType::Button | InputType::Reset if !is_submitter => {
|
||||||
return vec![]
|
return vec![];
|
||||||
},
|
},
|
||||||
|
|
||||||
// Step 3.1: it's the "Checkbox" or "Radio Button" and whose checkedness is false.
|
// Step 3.1: it's the "Checkbox" or "Radio Button" and whose checkedness is false.
|
||||||
|
@ -1769,21 +1769,22 @@ impl Activatable for HTMLInputElement {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.filter_map(DomRoot::downcast::<HTMLInputElement>)
|
.filter_map(DomRoot::downcast::<HTMLInputElement>)
|
||||||
.filter(|input| {
|
.filter(|input| {
|
||||||
input.form_owner() == owner && match input.input_type() {
|
input.form_owner() == owner &&
|
||||||
InputType::Text |
|
match input.input_type() {
|
||||||
InputType::Search |
|
InputType::Text |
|
||||||
InputType::Url |
|
InputType::Search |
|
||||||
InputType::Tel |
|
InputType::Url |
|
||||||
InputType::Email |
|
InputType::Tel |
|
||||||
InputType::Password |
|
InputType::Email |
|
||||||
InputType::Date |
|
InputType::Password |
|
||||||
InputType::Month |
|
InputType::Date |
|
||||||
InputType::Week |
|
InputType::Month |
|
||||||
InputType::Time |
|
InputType::Week |
|
||||||
InputType::DatetimeLocal |
|
InputType::Time |
|
||||||
InputType::Number => true,
|
InputType::DatetimeLocal |
|
||||||
_ => false,
|
InputType::Number => true,
|
||||||
}
|
_ => false,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if inputs.skip(1).next().is_some() {
|
if inputs.skip(1).next().is_some() {
|
||||||
|
|
|
@ -367,15 +367,15 @@ impl HTMLMediaElement {
|
||||||
task_source
|
task_source
|
||||||
.queue(
|
.queue(
|
||||||
task!(resolve_pending_play_promises: move || {
|
task!(resolve_pending_play_promises: move || {
|
||||||
let this = this.root();
|
let this = this.root();
|
||||||
if generation_id != this.generation_id.get() {
|
if generation_id != this.generation_id.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fulfill_in_flight_play_promises(|| {
|
this.fulfill_in_flight_play_promises(|| {
|
||||||
this.play_media();
|
this.play_media();
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -820,8 +820,8 @@ impl HTMLMediaElement {
|
||||||
.media_element_task_source()
|
.media_element_task_source()
|
||||||
.queue(
|
.queue(
|
||||||
task!(set_media_delay_load_event_flag_to_false: move || {
|
task!(set_media_delay_load_event_flag_to_false: move || {
|
||||||
this.root().delay_load_event(false);
|
this.root().delay_load_event(false);
|
||||||
}),
|
}),
|
||||||
window.upcast(),
|
window.upcast(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -779,8 +779,8 @@ impl VirtualMethods for HTMLScriptElement {
|
||||||
if tree_in_doc && !self.parser_inserted.get() {
|
if tree_in_doc && !self.parser_inserted.get() {
|
||||||
let script = Trusted::new(self);
|
let script = Trusted::new(self);
|
||||||
document_from_node(self).add_delayed_task(task!(ScriptDelayedInitialize: move || {
|
document_from_node(self).add_delayed_task(task!(ScriptDelayedInitialize: move || {
|
||||||
script.root().prepare();
|
script.root().prepare();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,9 +822,9 @@ impl HTMLScriptElementMethods for HTMLScriptElement {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-script-async
|
// https://html.spec.whatwg.org/multipage/#dom-script-async
|
||||||
fn Async(&self) -> bool {
|
fn Async(&self) -> bool {
|
||||||
self.non_blocking.get() || self
|
self.non_blocking.get() ||
|
||||||
.upcast::<Element>()
|
self.upcast::<Element>()
|
||||||
.has_attribute(&local_name!("async"))
|
.has_attribute(&local_name!("async"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-script-async
|
// https://html.spec.whatwg.org/multipage/#dom-script-async
|
||||||
|
|
|
@ -44,10 +44,10 @@ struct TableRowFilter {
|
||||||
impl CollectionFilter for TableRowFilter {
|
impl CollectionFilter for TableRowFilter {
|
||||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||||
elem.is::<HTMLTableRowElement>() &&
|
elem.is::<HTMLTableRowElement>() &&
|
||||||
(root.is_parent_of(elem.upcast()) || self
|
(root.is_parent_of(elem.upcast()) ||
|
||||||
.sections
|
self.sections
|
||||||
.iter()
|
.iter()
|
||||||
.any(|ref section| section.is_parent_of(elem.upcast())))
|
.any(|ref section| section.is_parent_of(elem.upcast())))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,8 @@ impl HTMLTableElementMethods for HTMLTableElement {
|
||||||
.filter_map(DomRoot::downcast::<Element>)
|
.filter_map(DomRoot::downcast::<Element>)
|
||||||
.find(|n| {
|
.find(|n| {
|
||||||
n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")
|
n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")
|
||||||
}) {
|
})
|
||||||
|
{
|
||||||
last_tbody
|
last_tbody
|
||||||
.upcast::<Node>()
|
.upcast::<Node>()
|
||||||
.AppendChild(new_row.upcast::<Node>())
|
.AppendChild(new_row.upcast::<Node>())
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
|
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
|
||||||
|
|
||||||
use app_units::Au;
|
|
||||||
use crate::document_loader::DocumentLoader;
|
use crate::document_loader::DocumentLoader;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
|
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
|
||||||
|
@ -55,6 +54,7 @@ use crate::dom::text::Text;
|
||||||
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
|
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use crate::script_thread::ScriptThread;
|
use crate::script_thread::ScriptThread;
|
||||||
|
use app_units::Au;
|
||||||
use devtools_traits::NodeInfo;
|
use devtools_traits::NodeInfo;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||||
|
@ -1850,10 +1850,9 @@ impl Node {
|
||||||
// https://dom.spec.whatwg.org/#concept-node-remove
|
// https://dom.spec.whatwg.org/#concept-node-remove
|
||||||
fn remove(node: &Node, parent: &Node, suppress_observers: SuppressObserver) {
|
fn remove(node: &Node, parent: &Node, suppress_observers: SuppressObserver) {
|
||||||
parent.owner_doc().add_script_and_layout_blocker();
|
parent.owner_doc().add_script_and_layout_blocker();
|
||||||
assert!(
|
assert!(node
|
||||||
node.GetParentNode()
|
.GetParentNode()
|
||||||
.map_or(false, |node_parent| &*node_parent == parent)
|
.map_or(false, |node_parent| &*node_parent == parent));
|
||||||
);
|
|
||||||
let cached_index = {
|
let cached_index = {
|
||||||
if parent.ranges.is_empty() {
|
if parent.ranges.is_empty() {
|
||||||
None
|
None
|
||||||
|
@ -2242,10 +2241,10 @@ impl NodeMethods for Node {
|
||||||
// Step 4-5.
|
// Step 4-5.
|
||||||
match node.type_id() {
|
match node.type_id() {
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is::<Document>() => {
|
NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is::<Document>() => {
|
||||||
return Err(Error::HierarchyRequest)
|
return Err(Error::HierarchyRequest);
|
||||||
},
|
},
|
||||||
NodeTypeId::DocumentType if !self.is::<Document>() => {
|
NodeTypeId::DocumentType if !self.is::<Document>() => {
|
||||||
return Err(Error::HierarchyRequest)
|
return Err(Error::HierarchyRequest);
|
||||||
},
|
},
|
||||||
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
|
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -2462,14 +2461,14 @@ impl NodeMethods for Node {
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)
|
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)
|
||||||
if !is_equal_processinginstruction(this, node) =>
|
if !is_equal_processinginstruction(this, node) =>
|
||||||
{
|
{
|
||||||
return false
|
return false;
|
||||||
},
|
}
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text) |
|
NodeTypeId::CharacterData(CharacterDataTypeId::Text) |
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment)
|
NodeTypeId::CharacterData(CharacterDataTypeId::Comment)
|
||||||
if !is_equal_characterdata(this, node) =>
|
if !is_equal_characterdata(this, node) =>
|
||||||
{
|
{
|
||||||
return false
|
return false;
|
||||||
},
|
}
|
||||||
// Step 4.
|
// Step 4.
|
||||||
NodeTypeId::Element(..) if !is_equal_element_attrs(this, node) => return false,
|
NodeTypeId::Element(..) if !is_equal_element_attrs(this, node) => return false,
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use canvas_traits::canvas::CanvasImageData;
|
|
||||||
use canvas_traits::canvas::CanvasMsg;
|
|
||||||
use canvas_traits::canvas::FromLayoutMsg;
|
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
|
||||||
|
@ -25,6 +22,9 @@ use crate::dom::canvaspattern::CanvasPattern;
|
||||||
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
||||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||||
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
use crate::dom::workletglobalscope::WorkletGlobalScope;
|
||||||
|
use canvas_traits::canvas::CanvasImageData;
|
||||||
|
use canvas_traits::canvas::CanvasMsg;
|
||||||
|
use canvas_traits::canvas::FromLayoutMsg;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use euclid::TypedScale;
|
use euclid::TypedScale;
|
||||||
|
|
|
@ -72,9 +72,10 @@ impl PerformanceEntryList {
|
||||||
.entries
|
.entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|e| {
|
.filter(|e| {
|
||||||
name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
|
name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
|
||||||
.as_ref()
|
entry_type
|
||||||
.map_or(true, |type_| *e.entry_type() == *type_)
|
.as_ref()
|
||||||
|
.map_or(true, |type_| *e.entry_type() == *type_)
|
||||||
})
|
})
|
||||||
.map(|e| e.clone())
|
.map(|e| e.clone())
|
||||||
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
||||||
|
@ -92,9 +93,10 @@ impl PerformanceEntryList {
|
||||||
entry_type: Option<DOMString>,
|
entry_type: Option<DOMString>,
|
||||||
) {
|
) {
|
||||||
self.entries.retain(|e| {
|
self.entries.retain(|e| {
|
||||||
name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
|
name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
|
||||||
.as_ref()
|
entry_type
|
||||||
.map_or(true, |type_| *e.entry_type() == *type_)
|
.as_ref()
|
||||||
|
.map_or(true, |type_| *e.entry_type() == *type_)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue