Rustfmt has changed its default style :/

This commit is contained in:
Simon Sapin 2018-12-14 08:31:30 +01:00
parent 82fc6d9f49
commit be69f9c3e6
207 changed files with 1200 additions and 1339 deletions

View file

@ -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,8 +552,8 @@ 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)
} }

View file

@ -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;

View file

@ -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;

View file

@ -975,12 +975,14 @@ 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") ||
!PREFS
.get("shell.native-titlebar.enabled") .get("shell.native-titlebar.enabled")
.as_boolean() .as_boolean()
.unwrap(); .unwrap();
let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa && PREFS let enable_subpixel_text_antialiasing = !debug_options.disable_subpixel_aa &&
PREFS
.get("gfx.subpixel-text-antialiasing.enabled") .get("gfx.subpixel-text-antialiasing.enabled")
.as_boolean() .as_boolean()
.unwrap(); .unwrap();

View file

@ -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,8 +3465,8 @@ 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(

View file

@ -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,

View file

@ -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;

View file

@ -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};

View file

@ -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;

View file

@ -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};

View file

@ -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;

View file

@ -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;

View file

@ -806,7 +806,8 @@ 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 +
if self.store.is_rtl {
ByteIndex(-1) ByteIndex(-1)
} else { } else {
ByteIndex(1) ByteIndex(1)

View file

@ -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.

View file

@ -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,7 +293,8 @@ 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 +
slice
.glyphs .glyphs
.advance_for_byte_range(&slice.range, self.extra_word_spacing) .advance_for_byte_range(&slice.range, self.extra_word_spacing)
}) })

View file

@ -78,7 +78,8 @@ 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() &&
match running_animation {
Animation::Transition(_, started_at, ref frame) => { Animation::Transition(_, started_at, ref frame) => {
now < started_at + frame.duration now < started_at + frame.duration
}, },

View file

@ -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,8 +1175,9 @@ 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 ||
self.base
.flags .flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) .contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
{ {
@ -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;
}, },
} }
} }

View file

@ -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() ==
Some(LayoutNodeType::Element(
LayoutElementType::HTMLTextAreaElement, 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)
} }

View file

@ -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)]

View file

@ -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;

View file

@ -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;

View file

@ -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,11 +2172,8 @@ 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),
metrics.ascent,
)
.to_physical(self.style.writing_mode, container_size) .to_physical(self.style.writing_mode, container_size)
.to_vector(); .to_vector();

View file

@ -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};

View file

@ -513,8 +513,8 @@ 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))
} }
@ -523,8 +523,8 @@ impl ClippingRegion {
/// 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))
} }
@ -532,10 +532,9 @@ impl ClippingRegion {
/// 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())
}) })
} }

View file

@ -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,7 +846,8 @@ 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 +
if !self.cross_reverse {
cur_b cur_b
} else { } else {
self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size - self.block_flow.fragment.border_padding.block_start * 2 + total_cross_size -

View file

@ -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!(

View file

@ -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,8 +342,8 @@ 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()
@ -466,8 +466,8 @@ 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)
} }
@ -1406,8 +1406,8 @@ 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)
{ {

View file

@ -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,8 +849,8 @@ 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))
} }
@ -1939,8 +1939,8 @@ 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.
@ -2416,8 +2416,8 @@ 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 => {

View file

@ -62,15 +62,16 @@ 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 &&
self_base
.restyle_damage .restyle_damage
.intersects(ServoRestyleDamage::REFLOW) .intersects(ServoRestyleDamage::REFLOW)
{ {

View file

@ -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,8 +1363,8 @@ 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)

View file

@ -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;

View file

@ -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) => {

View file

@ -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};

View file

@ -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));
}, },
}; };

View file

@ -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,7 +106,8 @@ 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 +
Vector2D::new(
Au::from_f32_px(transform_matrix.x), Au::from_f32_px(transform_matrix.x),
Au::from_f32_px(transform_matrix.y), Au::from_f32_px(transform_matrix.y),
) )

View file

@ -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,8 +952,7 @@ 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,7 +989,8 @@ 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 +
if has_rows {
block_direction_spacing block_direction_spacing
} else { } else {
Au(0) Au(0)

View file

@ -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;

View file

@ -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,10 +106,13 @@ 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 -
kid_base
.collapsible_margins .collapsible_margins
.block_start_margin_for_noncollapsible_context(); .block_start_margin_for_noncollapsible_context();
let end = kid_base.position.start.b + kid_base.position.size.block + kid_base let end = kid_base.position.start.b +
kid_base.position.size.block +
kid_base
.collapsible_margins .collapsible_margins
.block_end_margin_for_noncollapsible_context(); .block_end_margin_for_noncollapsible_context();
match extents { match extents {

View file

@ -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;

View file

@ -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};

View file

@ -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};

View file

@ -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,8 +795,8 @@ 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
@ -804,8 +804,8 @@ impl ExcessInlineSizeDistributionInfo {
} 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

View file

@ -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,8 +112,8 @@ 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())

View file

@ -201,8 +201,9 @@ 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() ||
node.as_element()
.map_or(false, |el| el.has_dirty_descendants()) .map_or(false, |el| el.has_dirty_descendants())
{ {
let mut flow_constructor = FlowConstructor::new(context); let mut flow_constructor = FlowConstructor::new(context);

View file

@ -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};

View file

@ -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};

View file

@ -233,7 +233,8 @@ 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) &&
oldest_accessed
.as_ref() .as_ref()
.map_or(true, |a| c.last_access < a.1) .map_or(true, |a| c.last_access < a.1)
{ {

View file

@ -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) ||
match request.method {
Method::HEAD | Method::CONNECT => true, Method::HEAD | Method::CONNECT => true,
_ => false, _ => 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,7 +853,8 @@ 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() &&
match mime_type.type_() {
mime::AUDIO | mime::VIDEO | mime::IMAGE => true, mime::AUDIO | mime::VIDEO | mime::IMAGE => true,
mime::TEXT if mime_type.subtype() == mime::CSV => true, mime::TEXT if mime_type.subtype() == mime::CSV => true,
// Step 4 // Step 4

View file

@ -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,7 +1070,8 @@ fn http_network_or_cache_fetch(
} }
} }
// Substep 4 // Substep 4
if revalidating_flag && forward_response if revalidating_flag &&
forward_response
.status .status
.as_ref() .as_ref()
.map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED) .map_or(false, |s| s.0 == StatusCode::NOT_MODIFIED)
@ -1416,7 +1418,8 @@ 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() &&
response
.status .status
.as_ref() .as_ref()
.map_or(false, |(status, _)| status.is_success()) .map_or(false, |(status, _)| status.is_success())
@ -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 {

View file

@ -404,7 +404,8 @@ 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) ||
data[16..box_size]
.chunks(4) .chunks(4)
.any(|chunk| chunk.starts_with(&mp4)) .any(|chunk| chunk.starts_with(&mp4))
} }

View file

@ -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
assert!(
!request
.headers() .headers()
.contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS) .contains_key(header::ACCESS_CONTROL_REQUEST_HEADERS));
); assert!(!request
assert!(
!request
.headers() .headers()
.get(header::REFERER) .get(header::REFERER)
.unwrap() .unwrap()
.to_str() .to_str()
.unwrap() .unwrap()
.contains("a.html") .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
assert!(
!request
.headers() .headers()
.contains_key(header::ACCESS_CONTROL_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
assert!(
!request
.headers() .headers()
.contains_key(header::ACCESS_CONTROL_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]

View file

@ -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,

View file

@ -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();
} }

View file

@ -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};

View file

@ -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, Ok(ConversionResult::Success(v)) => v,
_ => unreachable!(), _ => 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,
}; };

View file

@ -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;

View file

@ -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(),
)) ));
}, },
}; };

View file

@ -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 {

View file

@ -116,10 +116,14 @@ 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 '-' |
}, '.' |
'0'...'9' |
'\u{B7}' |
'\u{300}'...'\u{36F}' |
'\u{203F}'...'\u{2040}' => true,
_ => false, _ => false,
} }
} }

View file

@ -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)));
}, },
}; };

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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),
}; };

View file

@ -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;
@ -615,7 +615,8 @@ 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() ||
self.GetDocumentElement().map_or(false, |root| {
root.upcast::<Node>().has_dirty_descendants() || root.upcast::<Node>().has_dirty_descendants() ||
!self.pending_restyles.borrow().is_empty() || !self.pending_restyles.borrow().is_empty() ||
self.needs_paint() self.needs_paint()

View file

@ -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,7 +2836,8 @@ 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>() &&
match node.downcast::<Text>() {
None => true, None => true,
Some(text) => text.upcast::<CharacterData>().data().is_empty(), Some(text) => text.upcast::<CharacterData>().data().is_empty(),
} }

View file

@ -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;

View file

@ -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()))
} }

View file

@ -367,7 +367,8 @@ 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) ||
disallowed_header_prefixes
.iter() .iter()
.any(|prefix| name.starts_with(prefix)) .any(|prefix| name.starts_with(prefix))
} }

View file

@ -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) => {

View file

@ -61,7 +61,8 @@ 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) &&
self_node
.preceding_siblings() .preceding_siblings()
.all(|n| !n.is::<HTMLBodyElement>()) .all(|n| !n.is::<HTMLBodyElement>())
} }

View file

@ -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};

View file

@ -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;

View file

@ -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,7 +1769,8 @@ 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 &&
match input.input_type() {
InputType::Text | InputType::Text |
InputType::Search | InputType::Search |
InputType::Url | InputType::Url |

View file

@ -822,8 +822,8 @@ 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"))
} }

View file

@ -44,8 +44,8 @@ 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>())

View file

@ -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,
_ => (), _ => (),

View file

@ -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;

View file

@ -72,7 +72,8 @@ 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_) &&
entry_type
.as_ref() .as_ref()
.map_or(true, |type_| *e.entry_type() == *type_) .map_or(true, |type_| *e.entry_type() == *type_)
}) })
@ -92,7 +93,8 @@ 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_) &&
entry_type
.as_ref() .as_ref()
.map_or(true, |type_| *e.entry_type() == *type_) .map_or(true, |type_| *e.entry_type() == *type_)
}); });

View file

@ -76,7 +76,7 @@ impl PromiseRejectionEvent {
None => { None => {
return Err(Error::Type( return Err(Error::Type(
"required member promise is undefined.".to_string(), "required member promise is undefined.".to_string(),
)) ));
}, },
}; };
let bubbles = EventBubbles::from(init.parent.bubbles); let bubbles = EventBubbles::from(init.parent.bubbles);

View file

@ -758,7 +758,8 @@ impl RangeMethods for Range {
let new_offset = reference_node.r().map_or(parent.len(), |node| node.index()); let new_offset = reference_node.r().map_or(parent.len(), |node| node.index());
// Step 11 // Step 11
let new_offset = new_offset + if node.type_id() == NodeTypeId::DocumentFragment { let new_offset = new_offset +
if node.type_id() == NodeTypeId::DocumentFragment {
node.len() node.len()
} else { } else {
1 1
@ -874,7 +875,7 @@ impl RangeMethods for Range {
// Step 2. // Step 2.
match new_parent.type_id() { match new_parent.type_id() {
NodeTypeId::Document(_) | NodeTypeId::DocumentType | NodeTypeId::DocumentFragment => { NodeTypeId::Document(_) | NodeTypeId::DocumentType | NodeTypeId::DocumentFragment => {
return Err(Error::InvalidNodeType) return Err(Error::InvalidNodeType);
}, },
_ => (), _ => (),
} }

View file

@ -379,12 +379,12 @@ impl Request {
HttpMethod::GET => { HttpMethod::GET => {
return Err(Error::Type( return Err(Error::Type(
"Init's body is non-null, and request method is GET".to_string(), "Init's body is non-null, and request method is GET".to_string(),
)) ));
}, },
HttpMethod::HEAD => { HttpMethod::HEAD => {
return Err(Error::Type( return Err(Error::Type(
"Init's body is non-null, and request method is HEAD".to_string(), "Init's body is non-null, and request method is HEAD".to_string(),
)) ));
}, },
_ => {}, _ => {},
} }

View file

@ -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;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding; use crate::dom::bindings::codegen::Bindings::TestRunnerBinding;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods;
use crate::dom::bindings::error::{Error, ErrorResult}; use crate::dom::bindings::error::{Error, ErrorResult};
@ -10,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, 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 bluetooth_traits::BluetoothRequest;
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;

View file

@ -189,8 +189,8 @@ impl TreeWalkerMethods for TreeWalker {
// This can happen if the user set the current node to somewhere // This can happen if the user set the current node to somewhere
// outside of the tree rooted at the original root. // outside of the tree rooted at the original root.
{ {
return Ok(None) return Ok(None);
}, }
Some(n) => node = n, Some(n) => node = n,
} }
// "5. Filter node and if the return value is FILTER_ACCEPT, then // "5. Filter node and if the return value is FILTER_ACCEPT, then
@ -321,8 +321,8 @@ impl TreeWalker {
Some(ref parent) Some(ref parent)
if self.is_root_node(&parent) || self.is_current_node(&parent) => if self.is_root_node(&parent) || self.is_current_node(&parent) =>
{ {
return Ok(None) return Ok(None);
}, }
// "5. Otherwise, set node to parent." // "5. Otherwise, set node to parent."
Some(parent) => node = parent, Some(parent) => node = parent,
} }

View file

@ -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 canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceBinding::PerformanceMethods; use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceBinding::PerformanceMethods;
@ -33,6 +32,7 @@ use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::script_runtime::CommonScriptMsg; use crate::script_runtime::CommonScriptMsg;
use crate::script_runtime::ScriptThreadEventCategory::WebVREvent; use crate::script_runtime::ScriptThreadEventCategory::WebVREvent;
use crate::task_source::TaskSourceName; use crate::task_source::TaskSourceName;
use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crossbeam_channel::{unbounded, Sender}; use crossbeam_channel::{unbounded, Sender};
use dom_struct::dom_struct; use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;

View file

@ -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/. */
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
@ -31,6 +29,8 @@ use crate::dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat;
use crate::dom::webgltexture::WebGLTexture; use crate::dom::webgltexture::WebGLTexture;
use crate::dom::webgluniformlocation::WebGLUniformLocation; use crate::dom::webgluniformlocation::WebGLUniformLocation;
use crate::dom::window::Window; use crate::dom::window::Window;
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use euclid::Size2D; use euclid::Size2D;
use js::jsapi::{JSContext, JSObject}; use js::jsapi::{JSContext, JSObject};

View file

@ -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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysMethods; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,11 +3,11 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding; use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,12 +3,12 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding; use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat; use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,11 +3,11 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding; use crate::dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,12 +3,12 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,11 +3,11 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESElementIndexUintBinding; use crate::dom::bindings::codegen::Bindings::OESElementIndexUintBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -3,12 +3,12 @@
* 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::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions}; use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding; use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding;
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants; use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

View file

@ -5,11 +5,11 @@
use super::{ use super::{
constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions, constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
}; };
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESTextureFloatBinding; use crate::dom::bindings::codegen::Bindings::OESTextureFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct; use dom_struct::dom_struct;
#[dom_struct] #[dom_struct]

Some files were not shown because too many files have changed in this diff Show more