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