aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/devtools_traits/lib.rs2
-rw-r--r--components/gfx/display_list/mod.rs49
-rw-r--r--components/gfx/font.rs2
-rw-r--r--components/gfx/font_cache_thread.rs16
-rw-r--r--components/gfx/text/text_run.rs17
-rw-r--r--components/layout/block.rs131
-rw-r--r--components/layout/construct.rs50
-rw-r--r--components/layout/data.rs16
-rw-r--r--components/layout/display_list_builder.rs105
-rw-r--r--components/layout/flex.rs8
-rw-r--r--components/layout/flow.rs26
-rw-r--r--components/layout/fragment.rs8
-rw-r--r--components/layout/inline.rs27
-rw-r--r--components/layout/list_item.rs8
-rw-r--r--components/layout/multicol.rs15
-rw-r--r--components/layout/sequential.rs5
-rw-r--r--components/layout/table.rs8
-rw-r--r--components/layout/table_caption.rs8
-rw-r--r--components/layout/table_cell.rs8
-rw-r--r--components/layout/table_colgroup.rs8
-rw-r--r--components/layout/table_row.rs14
-rw-r--r--components/layout/table_rowgroup.rs8
-rw-r--r--components/layout/table_wrapper.rs16
-rw-r--r--components/layout/text.rs9
-rw-r--r--components/layout/wrapper.rs55
-rw-r--r--components/layout_thread/lib.rs6
-rw-r--r--components/net/cookie.rs2
-rw-r--r--components/net/fetch/methods.rs40
-rw-r--r--components/net/lib.rs1
-rw-r--r--components/net/pub_domains.rs73
-rw-r--r--components/net_traits/lib.rs80
-rw-r--r--components/net_traits/pub_domains.rs140
-rw-r--r--components/net_traits/request.rs5
-rw-r--r--components/profile_traits/Cargo.toml3
-rw-r--r--components/profile_traits/lib.rs2
-rw-r--r--components/profile_traits/time.rs101
-rw-r--r--components/script/body.rs164
-rw-r--r--components/script/document_loader.rs47
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py69
-rw-r--r--components/script/dom/bindings/codegen/parser/WebIDL.py304
-rw-r--r--components/script/dom/bindings/codegen/parser/bytestring.patch29
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_array.py18
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py13
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py29
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_attr.py166
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_bytestring.py41
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py9
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_method.py16
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py10
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_union.py3
-rw-r--r--components/script/dom/bindings/codegen/parser/union-typedef.patch22
-rwxr-xr-xcomponents/script/dom/bindings/codegen/parser/update.sh2
-rw-r--r--components/script/dom/bindings/global.rs87
-rw-r--r--components/script/dom/bindings/proxyhandler.rs2
-rw-r--r--components/script/dom/bluetooth.rs63
-rw-r--r--components/script/dom/bluetoothremotegattcharacteristic.rs89
-rw-r--r--components/script/dom/bluetoothremotegattdescriptor.rs53
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs95
-rw-r--r--components/script/dom/bluetoothremotegattservice.rs101
-rw-r--r--components/script/dom/bluetoothuuid.rs95
-rw-r--r--components/script/dom/browsingcontext.rs2
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs66
-rw-r--r--components/script/dom/document.rs18
-rw-r--r--components/script/dom/headers.rs4
-rw-r--r--components/script/dom/htmllinkelement.rs105
-rw-r--r--components/script/dom/htmlscriptelement.rs12
-rw-r--r--components/script/dom/request.rs116
-rw-r--r--components/script/dom/response.rs107
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs13
-rw-r--r--components/script/dom/webglprogram.rs70
-rw-r--r--components/script/dom/webglrenderingcontext.rs160
-rw-r--r--components/script/dom/webidls/Bluetooth.webidl4
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl16
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl6
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTServer.webidl12
-rw-r--r--components/script/dom/webidls/BluetoothRemoteGATTService.webidl19
-rw-r--r--components/script/dom/webidls/Body.webidl9
-rw-r--r--components/script/dom/webidls/EventSource.webidl3
-rw-r--r--components/script/dom/webidls/Fetch.webidl11
-rw-r--r--components/script/dom/webidls/Response.webidl3
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl6
-rw-r--r--components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl30
-rw-r--r--components/script/dom/window.rs77
-rw-r--r--components/script/dom/worker.rs2
-rw-r--r--components/script/dom/workerglobalscope.rs69
-rw-r--r--components/script/dom/xmlhttprequest.rs3
-rw-r--r--components/script/fetch.rs171
-rw-r--r--components/script/layout_wrapper.rs44
-rw-r--r--components/script/lib.rs2
-rw-r--r--components/script/script_thread.rs5
-rw-r--r--components/script/timers.rs7
-rw-r--r--components/script/webdriver_handlers.rs8
-rw-r--r--components/script_layout_interface/lib.rs10
-rw-r--r--components/script_layout_interface/wrapper_traits.rs65
-rw-r--r--components/script_traits/lib.rs2
-rw-r--r--components/servo/Cargo.lock56
-rw-r--r--components/servo/Cargo.toml1
-rw-r--r--components/style/Cargo.toml1
-rw-r--r--components/style/atomic_refcell.rs41
-rw-r--r--components/style/binding_tools/README.md24
-rwxr-xr-xcomponents/style/binding_tools/regen.py10
-rwxr-xr-xcomponents/style/binding_tools/regen.sh8
-rwxr-xr-xcomponents/style/binding_tools/regen_atoms.py110
-rwxr-xr-xcomponents/style/binding_tools/setup_bindgen.sh17
-rw-r--r--components/style/data.rs6
-rw-r--r--components/style/dom.rs24
-rw-r--r--components/style/gecko/selector_impl.rs2
-rw-r--r--components/style/gecko/wrapper.rs154
-rw-r--r--components/style/gecko_bindings/mod.rs13
-rw-r--r--components/style/gecko_bindings/structs_debug.rs1414
-rw-r--r--components/style/gecko_bindings/structs_release.rs1352
-rw-r--r--components/style/gecko_bindings/sugar/mod.rs2
-rw-r--r--components/style/gecko_bindings/sugar/ns_com_ptr.rs18
-rw-r--r--components/style/gecko_bindings/sugar/ns_t_array.rs1
-rw-r--r--components/style/gecko_bindings/sugar/style_complex_color.rs47
-rw-r--r--components/style/gecko_string_cache/atom_macro.rs47
-rw-r--r--components/style/gecko_string_cache/mod.rs2
-rw-r--r--components/style/lib.rs2
-rw-r--r--components/style/matching.rs20
-rw-r--r--components/style/parallel.rs4
-rw-r--r--components/style/properties/data.py9
-rw-r--r--components/style/properties/gecko.mako.rs144
-rw-r--r--components/style/properties/longhand/box.mako.rs2
-rw-r--r--components/style/properties/longhand/inherited_table.mako.rs2
-rw-r--r--components/style/properties/longhand/inherited_text.mako.rs5
-rw-r--r--components/style/properties/longhand/svg.mako.rs14
-rw-r--r--components/style/properties/longhand/text.mako.rs3
-rw-r--r--components/style/properties/properties.mako.rs1
-rw-r--r--components/style/properties/shorthand/background.mako.rs27
-rw-r--r--components/style/properties/shorthand/mask.mako.rs205
-rw-r--r--components/style/properties/shorthand/text.mako.rs3
-rw-r--r--components/util/lib.rs10
-rw-r--r--components/util/opts.rs19
133 files changed, 4289 insertions, 3387 deletions
diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs
index 4edf19d6f02..b7711821112 100644
--- a/components/devtools_traits/lib.rs
+++ b/components/devtools_traits/lib.rs
@@ -145,7 +145,7 @@ pub struct TimelineMarker {
pub end_stack: Option<Vec<()>>,
}
-#[derive(PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
+#[derive(PartialEq, Eq, Hash, Clone, Deserialize, Serialize, HeapSizeOf)]
pub enum TimelineMarkerType {
Reflow,
DOMEvent,
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index 27ed5d6ace5..1b7195fa201 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -618,7 +618,7 @@ pub struct StackingContext {
pub layer_info: Option<LayerInfo>,
/// Children of this StackingContext.
- children: Vec<Box<StackingContext>>,
+ pub children: Vec<Box<StackingContext>>,
}
impl StackingContext {
@@ -654,30 +654,9 @@ impl StackingContext {
}
}
- pub fn set_children(&mut self, children: Vec<Box<StackingContext>>) {
- debug_assert!(self.children.is_empty());
- // We need to take into account the possible transformations of the
- // child stacking contexts.
- for child in &children {
- self.update_overflow_for_new_child(&child);
- }
-
- self.children = children;
- }
-
- pub fn add_child(&mut self, child: Box<StackingContext>) {
- self.update_overflow_for_new_child(&child);
- self.children.push(child);
- }
-
- pub fn add_children(&mut self, children: Vec<Box<StackingContext>>) {
- if self.children.is_empty() {
- return self.set_children(children);
- }
-
- for child in children {
- self.add_child(child);
- }
+ pub fn add_child(&mut self, mut child: StackingContext) {
+ child.update_overflow_for_all_children();
+ self.children.push(Box::new(child));
}
pub fn child_at_mut(&mut self, index: usize) -> &mut StackingContext {
@@ -688,16 +667,18 @@ impl StackingContext {
&self.children
}
- fn update_overflow_for_new_child(&mut self, child: &StackingContext) {
- if self.context_type == StackingContextType::Real &&
- child.context_type == StackingContextType::Real &&
- !self.scrolls_overflow_area {
- // This child might be transformed, so we need to take into account
- // its transformed overflow rect too, but at the correct position.
- let overflow =
- child.overflow_rect_in_parent_space();
+ fn update_overflow_for_all_children(&mut self) {
+ for child in self.children.iter() {
+ if self.context_type == StackingContextType::Real &&
+ child.context_type == StackingContextType::Real &&
+ !self.scrolls_overflow_area {
+ // This child might be transformed, so we need to take into account
+ // its transformed overflow rect too, but at the correct position.
+ let overflow =
+ child.overflow_rect_in_parent_space();
- self.overflow = self.overflow.union(&overflow);
+ self.overflow = self.overflow.union(&overflow);
+ }
}
}
diff --git a/components/gfx/font.rs b/components/gfx/font.rs
index 7e1cf5236d5..c955c042eff 100644
--- a/components/gfx/font.rs
+++ b/components/gfx/font.rs
@@ -148,6 +148,8 @@ bitflags! {
const DISABLE_KERNING_SHAPING_FLAG = 0x04,
#[doc = "Text direction is right-to-left."]
const RTL_FLAG = 0x08,
+ #[doc = "Set if word-break is set to keep-all."]
+ const KEEP_ALL_FLAG = 0x10,
}
}
diff --git a/components/gfx/font_cache_thread.rs b/components/gfx/font_cache_thread.rs
index 26fcd6b98b7..c3fcf7dfc07 100644
--- a/components/gfx/font_cache_thread.rs
+++ b/components/gfx/font_cache_thread.rs
@@ -7,7 +7,7 @@ use fontsan;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use mime::{TopLevel, SubLevel};
-use net_traits::{AsyncResponseTarget, LoadContext, PendingAsyncLoad, CoreResourceThread, ResponseAction};
+use net_traits::{AsyncResponseTarget, LoadContext, CoreResourceThread, ResponseAction, load_async};
use platform::font_context::FontContextHandle;
use platform::font_list::SANS_SERIF_FONT_FAMILY;
use platform::font_list::for_each_available_family;
@@ -208,17 +208,17 @@ impl FontCache {
match src {
Source::Url(ref url_source) => {
let url = &url_source.url;
- let load = PendingAsyncLoad::new(LoadContext::Font,
- self.core_resource_thread.clone(),
- url.clone(),
- None,
- None,
- None);
let (data_sender, data_receiver) = ipc::channel().unwrap();
let data_target = AsyncResponseTarget {
sender: data_sender,
};
- load.load_async(data_target);
+ load_async(LoadContext::Font,
+ self.core_resource_thread.clone(),
+ url.clone(),
+ None,
+ None,
+ None,
+ data_target);
let channel_to_self = self.channel_to_self.clone();
let url = (*url).clone();
let bytes = Mutex::new(Vec::new());
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index a431a124239..7ab8f4a870f 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -3,8 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
-use font::{Font, FontHandleMethods, FontMetrics, IS_WHITESPACE_SHAPING_FLAG, RunMetrics};
-use font::ShapingOptions;
+use font::{Font, FontHandleMethods, FontMetrics, IS_WHITESPACE_SHAPING_FLAG, KEEP_ALL_FLAG};
+use font::{RunMetrics, ShapingOptions};
use platform::font_template::FontTemplateData;
use range::Range;
use std::cell::Cell;
@@ -206,11 +206,14 @@ impl<'a> TextRun {
// Split off any trailing whitespace into a separate glyph run.
let mut whitespace = slice.end..slice.end;
if let Some((i, _)) = word.char_indices().rev()
- .take_while(|&(_, c)| char_is_whitespace(c)).last() {
- whitespace.start = slice.start + i;
- slice.end = whitespace.start;
- }
-
+ .take_while(|&(_, c)| char_is_whitespace(c)).last() {
+ whitespace.start = slice.start + i;
+ slice.end = whitespace.start;
+ } else if idx != text.len() && options.flags.contains(KEEP_ALL_FLAG) {
+ // If there's no whitespace and word-break is set to
+ // keep-all, try increasing the slice.
+ continue;
+ }
if slice.len() > 0 {
glyphs.push(GlyphRun {
glyph_store: font.shape_text(&text[slice.clone()], options),
diff --git a/components/layout/block.rs b/components/layout/block.rs
index dc623d9871a..7de8f379560 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -44,7 +44,7 @@ use flow_ref::FlowRef;
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER, Overflow};
use fragment::SpecificFragmentInfo;
use gfx::display_list::{ClippingRegion, StackingContext};
-use gfx_traits::{LayerId, StackingContextId};
+use gfx_traits::LayerId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::{self, IntrinsicISizes, MarginCollapseInfo};
@@ -52,6 +52,7 @@ use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none};
use rustc_serialize::{Encodable, Encoder};
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
use script_layout_interface::restyle_damage::REPOSITION;
+use sequential;
use std::cmp::{max, min};
use std::fmt;
use std::sync::Arc;
@@ -62,6 +63,7 @@ use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMod
use style::properties::ServoComputedValues;
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
+use util::clamp;
use util::geometry::max_rect;
/// The number of screens of data we're allowed to generate display lists for in each direction.
@@ -781,6 +783,7 @@ impl BlockFlow {
self.base.debug_id());
let mut break_at = None;
+ let content_box = self.fragment.content_box();
if self.base.restyle_damage.contains(REFLOW) {
self.determine_if_layer_needed();
@@ -830,7 +833,8 @@ impl BlockFlow {
kid.place_float_if_applicable();
if !flow::base(kid).flags.is_float() {
kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
- thread_id);
+ thread_id,
+ content_box);
}
// Skip the collapsing and float processing for absolute flow kids and continue
@@ -881,7 +885,8 @@ impl BlockFlow {
// Lay the child out if this was an in-order traversal.
let need_to_process_child_floats =
kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
- thread_id);
+ thread_id,
+ content_box);
if !had_children_with_clearance &&
floats.is_present() &&
@@ -1062,7 +1067,9 @@ impl BlockFlow {
// necessary.
let thread_id = self.base.thread_id;
for kid in self.base.child_iter_mut() {
- kid.assign_block_size_for_inorder_child_if_necessary(layout_context, thread_id);
+ kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
+ thread_id,
+ content_box);
}
}
@@ -1457,32 +1464,102 @@ impl BlockFlow {
/// on the floats we could see at the time of inline-size assignment. The job of this function,
/// therefore, is not only to assign the final size but also to perform the layout again for
/// this block formatting context if our speculation was wrong.
- ///
- /// FIXME(pcwalton): This code is not incremental-reflow-safe (i.e. not idempotent).
- fn assign_inline_position_for_formatting_context(&mut self) {
+ fn assign_inline_position_for_formatting_context<'a>(&mut self,
+ layout_context: &'a LayoutContext<'a>,
+ content_box: LogicalRect<Au>) {
debug_assert!(self.formatting_context_type() != FormattingContextType::None);
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
return
}
- let info = PlacementInfo {
- size: self.fragment.border_box.size.convert(self.fragment.style.writing_mode,
- self.base.floats.writing_mode),
- ceiling: self.base.position.start.b,
- max_inline_size: MAX_AU,
- kind: FloatKind::Left,
- };
+ // We do this first to avoid recomputing our inline size when we propagate it.
+ self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- // Offset our position by whatever displacement is needed to not impact the floats.
- let rect = self.base.floats.place_between_floats(&info);
- self.base.position.start.i = self.base.position.start.i + rect.start.i;
+ // The code below would completely wreck the layout if run on a flex item, however:
+ // * Flex items are always the children of flex containers.
+ // * Flex containers only contain flex items.
+ // * Floats cannot intrude into flex containers.
+ // * Floats cannot escape flex items.
+ // * Flex items cannot also be floats.
+ // Therefore, a flex item cannot be impacted by a float.
+ // See also: https://www.w3.org/TR/css-flexbox-1/#flex-containers
+ if !self.base.might_have_floats_in() {
+ return
+ }
+
+ // If you remove the might_have_floats_in conditional, this will go off.
+ debug_assert!(!self.is_flex());
+
+ // Compute the available space for us, based on the actual floats.
+ let rect = self.base.floats.available_rect(
+ self.base.position.start.b,
+ self.fragment.border_box.size.block,
+ content_box.size.inline
+ );
+ let available_inline_size = if let Some(rect) = rect {
+ // Offset our position by whatever displacement is needed to not impact the floats.
+ // Also, account for margins sliding behind floats.
+ let inline_offset = if self.fragment.margin.inline_start < rect.start.i {
+ // Do not do anything for negative margins; those are handled separately.
+ rect.start.i - max(Au(0), self.fragment.margin.inline_start)
+ } else {
+ Au(0)
+ };
+ self.base.position.start.i = content_box.start.i + inline_offset;
+ // Handle the end margin sliding behind the float.
+ let end = content_box.size.inline - rect.start.i - rect.size.inline;
+ let inline_end_offset = if self.fragment.margin.inline_end < end {
+ end - max(Au(0), self.fragment.margin.inline_end)
+ } else {
+ Au(0)
+ };
+ content_box.size.inline - inline_offset - inline_end_offset
+ } else {
+ content_box.size.inline
+ } - self.fragment.margin.inline_start_end();
+ let max_inline_size = specified_or_none(
+ self.fragment.style().max_inline_size(),
+ self.base.block_container_inline_size
+ ).unwrap_or(MAX_AU);
+ let min_inline_size = specified(
+ self.fragment.style().min_inline_size(),
+ self.base.block_container_inline_size
+ );
+ let specified_inline_size = self.fragment.style().content_inline_size();
+ let container_size = self.base.block_container_inline_size;
+ let inline_size =
+ if let MaybeAuto::Specified(size) = MaybeAuto::from_style(specified_inline_size,
+ container_size) {
+ match self.fragment.style().get_position().box_sizing {
+ box_sizing::T::border_box => size,
+ box_sizing::T::content_box =>
+ size + self.fragment.border_padding.inline_start_end(),
+ }
+ } else {
+ clamp(min_inline_size, available_inline_size, max_inline_size)
+ };
+ self.base.position.size.inline = inline_size + self.fragment.margin.inline_start_end();
- // TODO(pcwalton): If the inline-size of this flow is different from the size we estimated
- // earlier, lay it out again.
+ // If float speculation failed, fixup our layout, and re-layout all the children.
+ if self.fragment.margin_box_inline_size() != self.base.position.size.inline {
+ debug!("assign_inline_position_for_formatting_context: float speculation failed");
+ // Fix-up our own layout.
+ // We can't just traverse_flow_tree_preorder ourself, because that would re-run
+ // float speculation, instead of acting on the actual results.
+ self.fragment.border_box.size.inline = inline_size;
+ // Assign final-final inline sizes on all our children.
+ self.assign_inline_sizes(&layout_context.shared.style_context);
+ // Re-run layout on our children.
+ for child in flow::mut_base(self).children.iter_mut() {
+ sequential::traverse_flow_tree_preorder(child, layout_context.shared);
+ }
+ // Assign our final-final block size.
+ self.assign_block_size(layout_context);
+ }
- self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
- self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
+ debug_assert_eq!(self.fragment.margin_box_inline_size(), self.base.position.size.inline);
}
fn is_inline_block(&self) -> bool {
@@ -1792,7 +1869,8 @@ impl Flow for BlockFlow {
fn assign_block_size_for_inorder_child_if_necessary<'a>(&mut self,
layout_context: &'a LayoutContext<'a>,
- parent_thread_id: u8)
+ parent_thread_id: u8,
+ content_box: LogicalRect<Au>)
-> bool {
if self.base.flags.is_float() {
return false
@@ -1800,7 +1878,7 @@ impl Flow for BlockFlow {
let is_formatting_context = self.formatting_context_type() != FormattingContextType::None;
if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && is_formatting_context {
- self.assign_inline_position_for_formatting_context();
+ self.assign_inline_position_for_formatting_context(layout_context, content_box);
}
if (self as &Flow).floats_might_flow_through() {
@@ -2172,11 +2250,8 @@ impl Flow for BlockFlow {
}
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.collect_stacking_contexts_for_block(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.collect_stacking_contexts_for_block(parent);
}
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index d5a788778f2..8a463ded66a 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -16,7 +16,7 @@
use app_units::Au;
use block::BlockFlow;
use context::LayoutContext;
-use data::{HAS_NEWLY_CONSTRUCTED_FLOW, PrivateLayoutData};
+use data::{HAS_NEWLY_CONSTRUCTED_FLOW, PersistentLayoutData};
use flex::FlexFlow;
use floats::FloatKind;
use flow::{self, AbsoluteDescendants, IS_ABSOLUTELY_POSITIONED, ImmutableFlowUtils};
@@ -218,8 +218,8 @@ impl InlineFragmentsAccumulator {
enclosing_node: Some(InlineFragmentNodeInfo {
address: node.opaque(),
pseudo: node.get_pseudo_element_type().strip(),
- style: node.style(style_context).clone(),
- selected_style: node.selected_style(style_context).clone(),
+ style: node.style(style_context),
+ selected_style: node.selected_style(style_context),
flags: InlineFragmentNodeFlags::empty(),
}),
bidi_control_chars: None,
@@ -355,12 +355,12 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let style_context = self.style_context();
if child.is_table_cell() {
- let mut style = child_node.style(style_context).clone();
+ let mut style = child_node.style(style_context);
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table_row);
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
PseudoElementType::Normal,
style,
- child_node.selected_style(style_context).clone(),
+ child_node.selected_style(style_context),
child_node.restyle_damage(),
SpecificFragmentInfo::TableRow);
let mut new_child: FlowRef = Arc::new(TableRowFlow::from_fragment(fragment));
@@ -369,12 +369,12 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
*child = new_child
}
if child.is_table_row() || child.is_table_rowgroup() {
- let mut style = child_node.style(style_context).clone();
+ let mut style = child_node.style(style_context);
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
let fragment = Fragment::from_opaque_node_and_style(child_node.opaque(),
PseudoElementType::Normal,
style,
- child_node.selected_style(style_context).clone(),
+ child_node.selected_style(style_context),
child_node.restyle_damage(),
SpecificFragmentInfo::Table);
let mut new_child: FlowRef = Arc::new(TableFlow::from_fragment(fragment));
@@ -383,13 +383,13 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
*child = new_child
}
if child.is_table() {
- let mut style = child_node.style(style_context).clone();
+ let mut style = child_node.style(style_context);
properties::modify_style_for_anonymous_table_object(&mut style, display::T::table);
let fragment =
Fragment::from_opaque_node_and_style(child_node.opaque(),
PseudoElementType::Normal,
style,
- child_node.selected_style(style_context).clone(),
+ child_node.selected_style(style_context),
child_node.restyle_damage(),
SpecificFragmentInfo::TableWrapper);
let mut new_child: FlowRef = Arc::new(TableWrapperFlow::from_fragment(fragment, None));
@@ -477,7 +477,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let (ascent, descent) =
inline_flow.compute_minimum_ascent_and_descent(&mut self.layout_context
.font_context(),
- &**node.style(self.style_context()));
+ &node.style(self.style_context()));
inline_flow.minimum_block_size_above_baseline = ascent;
inline_flow.minimum_depth_below_baseline = descent;
}
@@ -589,7 +589,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let fragment = Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_pseudo,
whitespace_style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
whitespace_damage,
fragment_info);
inline_fragment_accumulator.fragments.fragments.push_back(fragment);
@@ -692,7 +692,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
}
}
- let mut style = node.style(self.style_context()).clone();
+ let mut style = node.style(self.style_context());
if node_is_input_or_text_area {
style = self.style_context().stylist.
precomputed_values_for_pseudo(&PseudoElement::ServoInputText, Some(&style)).unwrap();
@@ -732,7 +732,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
node.opaque(),
node.get_pseudo_element_type().strip(),
style,
- selected_style.clone(),
+ selected_style,
node.restyle_damage(),
specific_fragment_info))
}
@@ -806,7 +806,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
-> ConstructionResult {
let mut opt_inline_block_splits: LinkedList<InlineBlockSplit> = LinkedList::new();
let mut fragment_accumulator = InlineFragmentsAccumulator::from_inline_node(node, self.style_context());
- fragment_accumulator.bidi_control_chars = bidi_control_chars(&*node.style(self.style_context()));
+ fragment_accumulator.bidi_control_chars = bidi_control_chars(&node.style(self.style_context()));
let mut abs_descendants = AbsoluteDescendants::new();
@@ -882,7 +882,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
Fragment::from_opaque_node_and_style(whitespace_node,
whitespace_pseudo,
whitespace_style,
- node.selected_style(self.style_context()).clone(),
+ node.selected_style(self.style_context()),
whitespace_damage,
fragment_info);
fragment_accumulator.fragments.fragments.push_back(fragment)
@@ -905,7 +905,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
node.get_pseudo_element_type().strip(),
modified_style,
- node.selected_style(self.style_context()).clone(),
+ node.selected_style(self.style_context()),
node.restyle_damage(),
info);
fragment_accumulator.fragments.fragments.push_back(fragment)
@@ -949,13 +949,13 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
node.opaque(),
node.get_pseudo_element_type().strip(),
- node.style(self.style_context()).clone(),
+ node.style(self.style_context()),
node.restyle_damage()))
}
// Modify the style as necessary. (See the comment in
// `properties::modify_style_for_replaced_content()`.)
- let mut style = node.style(self.style_context()).clone();
+ let mut style = node.style(self.style_context());
match node.get_pseudo_element_type() {
PseudoElementType::Before(_) |
PseudoElementType::After(_) => {}
@@ -993,14 +993,14 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
};
let style_context = self.style_context();
- let mut modified_style = (*node.style(self.style_context())).clone();
+ let mut modified_style = node.style(self.style_context());
properties::modify_style_for_outer_inline_block_fragment(&mut modified_style);
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
block_flow));
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
node.get_pseudo_element_type().strip(),
modified_style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
node.restyle_damage(),
fragment_info);
@@ -1030,12 +1030,12 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical(
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
let style_context = self.style_context();
- let mut style = node.style(style_context).clone();
+ let mut style = node.style(style_context);
properties::modify_style_for_inline_absolute_hypothetical_fragment(&mut style);
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
PseudoElementType::Normal,
style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
node.restyle_damage(),
fragment_info);
@@ -1412,7 +1412,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let mut set_has_newly_constructed_flow_flag = false;
let result = {
- let mut style = node.style(self.style_context()).clone();
+ let mut style = node.style(self.style_context());
let mut data = node.mutate_layout_data().unwrap();
let damage = data.restyle_damage;
@@ -1679,7 +1679,7 @@ trait NodeUtils {
/// Returns true if this node doesn't render its kids and false otherwise.
fn is_replaced_content(&self) -> bool;
- fn construction_result_mut(self, layout_data: &mut PrivateLayoutData) -> &mut ConstructionResult;
+ fn construction_result_mut(self, layout_data: &mut PersistentLayoutData) -> &mut ConstructionResult;
/// Sets the construction result of a flow.
fn set_flow_construction_result(self, result: ConstructionResult);
@@ -1708,7 +1708,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
}
}
- fn construction_result_mut(self, data: &mut PrivateLayoutData) -> &mut ConstructionResult {
+ fn construction_result_mut(self, data: &mut PersistentLayoutData) -> &mut ConstructionResult {
match self.get_pseudo_element_type() {
PseudoElementType::Before(_) => &mut data.before_flow_construction_result,
PseudoElementType::After (_) => &mut data.after_flow_construction_result,
diff --git a/components/layout/data.rs b/components/layout/data.rs
index 167b87e6f1a..69f8488e2e6 100644
--- a/components/layout/data.rs
+++ b/components/layout/data.rs
@@ -4,15 +4,15 @@
use construct::ConstructionResult;
use script_layout_interface::restyle_damage::RestyleDamage;
-use style::data::PrivateStyleData;
+use style::data::PersistentStyleData;
/// Data that layout associates with a node.
-pub struct PrivateLayoutData {
+pub struct PersistentLayoutData {
/// Data that the style system associates with a node. When the
/// style system is being used standalone, this is all that hangs
/// off the node. This must be first to permit the various
- /// transmuations between PrivateStyleData PrivateLayoutData.
- pub style_data: PrivateStyleData,
+ /// transmutations between PersistentStyleData and PersistentLayoutData.
+ pub style_data: PersistentStyleData,
/// Description of how to account for recent style changes.
pub restyle_damage: RestyleDamage,
@@ -34,11 +34,11 @@ pub struct PrivateLayoutData {
pub flags: LayoutDataFlags,
}
-impl PrivateLayoutData {
+impl PersistentLayoutData {
/// Creates new layout data.
- pub fn new() -> PrivateLayoutData {
- PrivateLayoutData {
- style_data: PrivateStyleData::new(),
+ pub fn new() -> PersistentLayoutData {
+ PersistentLayoutData {
+ style_data: PersistentStyleData::new(),
restyle_damage: RestyleDamage::empty(),
flow_construction_result: ConstructionResult::None,
before_flow_construction_result: ConstructionResult::None,
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 97d2c7c4b43..c62518a9977 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -292,7 +292,7 @@ pub trait FragmentDisplayListBuilding {
base_flow: &BaseFlow,
scroll_policy: ScrollPolicy,
mode: StackingContextCreationMode)
- -> Box<StackingContext>;
+ -> StackingContext;
}
fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> {
@@ -1369,7 +1369,7 @@ impl FragmentDisplayListBuilding for Fragment {
base_flow: &BaseFlow,
scroll_policy: ScrollPolicy,
mode: StackingContextCreationMode)
- -> Box<StackingContext> {
+ -> StackingContext {
let use_webrender = opts::get().use_webrender;
let border_box = match mode {
StackingContextCreationMode::InnerScrollWrapper => {
@@ -1510,18 +1510,18 @@ impl FragmentDisplayListBuilding for Fragment {
_ => StackingContextType::Real,
};
- Box::new(StackingContext::new(id,
- context_type,
- &border_box,
- &overflow,
- self.effective_z_index(),
- filters,
- self.style().get_effects().mix_blend_mode,
- transform,
- perspective,
- establishes_3d_context,
- scrolls_overflow_area,
- layer_info))
+ StackingContext::new(id,
+ context_type,
+ &border_box,
+ &overflow,
+ self.effective_z_index(),
+ filters,
+ self.style().get_effects().mix_blend_mode,
+ transform,
+ perspective,
+ establishes_3d_context,
+ scrolls_overflow_area,
+ layer_info)
}
fn adjust_clipping_region_for_children(&self,
@@ -1721,25 +1721,19 @@ impl FragmentDisplayListBuilding for Fragment {
}
pub trait BlockFlowDisplayListBuilding {
- fn collect_stacking_contexts_for_block(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId;
+ fn collect_stacking_contexts_for_block(&mut self, parent: &mut StackingContext);
fn build_display_list_for_block(&mut self,
state: &mut DisplayListBuildState,
border_painting_mode: BorderPaintingMode);
}
impl BlockFlowDisplayListBuilding for BlockFlow {
- fn collect_stacking_contexts_for_block(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
+ fn collect_stacking_contexts_for_block(&mut self, parent: &mut StackingContext) {
let block_stacking_context_type = self.block_stacking_context_type();
if block_stacking_context_type == BlockStackingContextType::NonstackingContext {
- self.base.stacking_context_id = parent_id;
- self.base.collect_stacking_contexts_for_children(parent_id, contexts);
- return parent_id;
+ self.base.stacking_context_id = parent.id;
+ self.base.collect_stacking_contexts_for_children(parent);
+ return;
}
let has_scrolling_overflow = self.has_scrolling_overflow();
@@ -1758,9 +1752,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
stacking_context_id
};
- let mut child_contexts = Vec::new();
- self.base.collect_stacking_contexts_for_children(inner_stacking_context_id,
- &mut child_contexts);
if block_stacking_context_type == BlockStackingContextType::PseudoStackingContext {
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
@@ -1771,25 +1762,25 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
StackingContextCreationMode::PseudoFloat
};
- let stacking_context_index = contexts.len();
- contexts.push(self.fragment.create_stacking_context(stacking_context_id,
- &self.base,
- ScrollPolicy::Scrollable,
- creation_mode));
-
- let mut floating = vec![];
- for child_context in child_contexts.into_iter() {
- if child_context.context_type == StackingContextType::PseudoFloat {
- // Floating.
- floating.push(child_context)
+ let mut new_context = self.fragment.create_stacking_context(stacking_context_id,
+ &self.base,
+ ScrollPolicy::Scrollable,
+ creation_mode);
+ self.base.collect_stacking_contexts_for_children(&mut new_context);
+ let new_children: Vec<Box<StackingContext>> = new_context.children.drain(..).collect();
+
+ let mut non_floating_children = Vec::new();
+ for child in new_children {
+ if child.context_type == StackingContextType::PseudoFloat {
+ new_context.children.push(child);
} else {
- // Positioned.
- contexts.push(child_context)
+ non_floating_children.push(child);
}
}
- contexts[stacking_context_index].set_children(floating);
- return stacking_context_id;
+ parent.add_child(new_context);
+ parent.children.append(&mut non_floating_children);
+ return;
}
let scroll_policy = if self.is_fixed() {
@@ -1804,7 +1795,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
&self.base,
scroll_policy,
StackingContextCreationMode::InnerScrollWrapper);
- inner_stacking_context.set_children(child_contexts);
+ self.base.collect_stacking_contexts_for_children(&mut inner_stacking_context);
let mut outer_stacking_context = self.fragment.create_stacking_context(
stacking_context_id,
@@ -1819,12 +1810,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
&self.base,
scroll_policy,
StackingContextCreationMode::Normal);
- stacking_context.set_children(child_contexts);
+ self.base.collect_stacking_contexts_for_children(&mut stacking_context);
stacking_context
};
- contexts.push(stacking_context);
- stacking_context_id
+ parent.add_child(stacking_context);
}
fn build_display_list_for_block(&mut self,
@@ -1871,10 +1861,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
}
pub trait InlineFlowDisplayListBuilding {
- fn collect_stacking_contexts_for_inline(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId;
+ fn collect_stacking_contexts_for_inline(&mut self, parent: &mut StackingContext);
fn build_display_list_for_inline_fragment_at_index(&mut self,
state: &mut DisplayListBuildState,
index: usize);
@@ -1882,36 +1869,32 @@ pub trait InlineFlowDisplayListBuilding {
}
impl InlineFlowDisplayListBuilding for InlineFlow {
- fn collect_stacking_contexts_for_inline(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.base.stacking_context_id = parent_id;
+ fn collect_stacking_contexts_for_inline(&mut self, parent: &mut StackingContext) {
+ self.base.stacking_context_id = parent.id;
for mut fragment in self.fragments.fragments.iter_mut() {
match fragment.specific {
SpecificFragmentInfo::InlineBlock(ref mut block_flow) => {
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
- block_flow.collect_stacking_contexts(parent_id, contexts);
+ block_flow.collect_stacking_contexts(parent);
}
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut block_flow) => {
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
- block_flow.collect_stacking_contexts(parent_id, contexts);
+ block_flow.collect_stacking_contexts(parent);
}
_ if fragment.establishes_stacking_context() => {
fragment.stacking_context_id =
StackingContextId::new_of_type(fragment.fragment_id(),
fragment.fragment_type());
- contexts.push(fragment.create_stacking_context(
+ parent.add_child(fragment.create_stacking_context(
fragment.stacking_context_id,
&self.base,
ScrollPolicy::Scrollable,
StackingContextCreationMode::Normal));
}
- _ => fragment.stacking_context_id = parent_id,
+ _ => fragment.stacking_context_id = parent.id,
}
}
- parent_id
}
fn build_display_list_for_inline_fragment_at_index(&mut self,
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 8ad36bf8d14..bce1e0f099f 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -18,7 +18,6 @@ use flow::{INLINE_POSITION_IS_STATIC, IS_ABSOLUTELY_POSITIONED};
use flow_ref::{self, FlowRef};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use layout_debug;
use model::{Direction, IntrinsicISizes, MaybeAuto, MinMaxConstraint};
use model::{specified, specified_or_none};
@@ -940,11 +939,8 @@ impl Flow for FlexFlow {
self.build_display_list_for_flex(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index c8703272fd6..f206e9fc5a8 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -224,10 +224,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
None
}
- fn collect_stacking_contexts(&mut self,
- _parent_id: StackingContextId,
- _: &mut Vec<Box<StackingContext>>)
- -> StackingContextId;
+ fn collect_stacking_contexts(&mut self, _parent: &mut StackingContext);
/// If this is a float, places it. The default implementation does nothing.
fn place_float_if_applicable<'a>(&mut self) {}
@@ -241,7 +238,8 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
/// it as laid out by its parent.
fn assign_block_size_for_inorder_child_if_necessary<'a>(&mut self,
layout_context: &'a LayoutContext<'a>,
- parent_thread_id: u8)
+ parent_thread_id: u8,
+ _content_box: LogicalRect<Au>)
-> bool {
let might_have_floats_in_or_out = base(self).might_have_floats_in() ||
base(self).might_have_floats_out();
@@ -1160,11 +1158,9 @@ impl BaseFlow {
return self as *const BaseFlow as usize;
}
- pub fn collect_stacking_contexts_for_children(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>) {
+ pub fn collect_stacking_contexts_for_children(&mut self, parent: &mut StackingContext) {
for kid in self.children.iter_mut() {
- kid.collect_stacking_contexts(parent_id, contexts);
+ kid.collect_stacking_contexts(parent);
}
}
@@ -1276,7 +1272,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
/// as it's harder to understand.
fn generate_missing_child_flow<N: ThreadSafeLayoutNode>(self, node: &N, ctx: &LayoutContext) -> FlowRef {
let style_context = ctx.style_context();
- let mut style = node.style(style_context).clone();
+ let mut style = node.style(style_context);
match self.class() {
FlowClass::Table | FlowClass::TableRowGroup => {
properties::modify_style_for_anonymous_table_object(
@@ -1286,7 +1282,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
node.opaque(),
PseudoElementType::Normal,
style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
node.restyle_damage(),
SpecificFragmentInfo::TableRow);
Arc::new(TableRowFlow::from_fragment(fragment))
@@ -1299,7 +1295,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
node.opaque(),
PseudoElementType::Normal,
style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
node.restyle_damage(),
SpecificFragmentInfo::TableCell);
let hide = node.style(style_context).get_inheritedtable().empty_cells == empty_cells::T::hide;
@@ -1313,7 +1309,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
Fragment::from_opaque_node_and_style(node.opaque(),
PseudoElementType::Normal,
style,
- node.selected_style(style_context).clone(),
+ node.selected_style(style_context),
node.restyle_damage(),
SpecificFragmentInfo::Generic);
Arc::new(BlockFlow::from_fragment(fragment, None))
@@ -1404,7 +1400,9 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
fn baseline_offset_of_last_line_box_in_flow(self) -> Option<Au> {
for kid in base(self).children.iter().rev() {
if kid.is_inline_flow() {
- return kid.as_inline().baseline_offset_of_last_line()
+ if let Some(baseline_offset) = kid.as_inline().baseline_offset_of_last_line() {
+ return Some(baseline_offset)
+ }
}
if kid.is_block_like() &&
kid.as_block().formatting_context_type() == FormattingContextType::None &&
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 5245e821711..9bd69518d98 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -856,7 +856,7 @@ impl Fragment {
/// Constructs a new `Fragment` instance.
pub fn new<N: ThreadSafeLayoutNode>(node: &N, specific: SpecificFragmentInfo, ctx: &LayoutContext) -> Fragment {
let style_context = ctx.style_context();
- let style = node.style(style_context).clone();
+ let style = node.style(style_context);
let writing_mode = style.writing_mode;
let mut restyle_damage = node.restyle_damage();
@@ -865,7 +865,7 @@ impl Fragment {
Fragment {
node: node.opaque(),
style: style,
- selected_style: node.selected_style(style_context).clone(),
+ selected_style: node.selected_style(style_context),
restyle_damage: restyle_damage,
border_box: LogicalRect::zero(writing_mode),
border_padding: LogicalMargin::zero(writing_mode),
@@ -1637,8 +1637,8 @@ impl Fragment {
}
match self.style().get_inheritedtext().word_break {
- word_break::T::normal => {
- // Break at normal word boundaries.
+ word_break::T::normal | word_break::T::keep_all => {
+ // Break at normal word boundaries. keep-all forbids soft wrap opportunities.
let natural_word_breaking_strategy =
text_fragment_info.run.natural_word_slices_in_range(&text_fragment_info.range);
self.calculate_split_position_using_breaking_strategy(
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index ec1d223cd36..fb47f647a34 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -20,7 +20,6 @@ use fragment::SpecificFragmentInfo;
use gfx::display_list::{OpaqueNode, StackingContext};
use gfx::font::FontMetrics;
use gfx::font_context::FontContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::IntrinsicISizesContribution;
@@ -1262,13 +1261,16 @@ impl InlineFlow {
}
pub fn baseline_offset_of_last_line(&self) -> Option<Au> {
- match self.lines.last() {
- None => None,
- Some(ref last_line) => {
- Some(last_line.bounds.start.b + last_line.bounds.size.block -
- last_line.inline_metrics.depth_below_baseline)
+ // Find the last line that doesn't consist entirely of hypothetical boxes.
+ for line in self.lines.iter().rev() {
+ if (line.range.begin().get()..line.range.end().get()).any(|index| {
+ !self.fragments.fragments[index as usize].is_hypothetical()
+ }) {
+ return Some(line.bounds.start.b + line.bounds.size.block -
+ line.inline_metrics.depth_below_baseline)
}
}
+ None
}
}
@@ -1451,7 +1453,6 @@ impl Flow for InlineFlow {
self.minimum_depth_below_baseline);
scanner.scan_for_lines(self, layout_context);
-
// Now, go through each line and lay out the fragments inside.
let line_count = self.lines.len();
for (line_index, line) in self.lines.iter_mut().enumerate() {
@@ -1481,7 +1482,10 @@ impl Flow for InlineFlow {
flow::base(kid).flags.is_float() {
continue
}
- kid.assign_block_size_for_inorder_child_if_necessary(layout_context, thread_id);
+ let content_box = flow::base(kid).position;
+ kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
+ thread_id,
+ content_box);
}
if self.contains_positioned_fragments() {
@@ -1658,11 +1662,8 @@ impl Flow for InlineFlow {
fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.collect_stacking_contexts_for_inline(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.collect_stacking_contexts_for_inline(parent);
}
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs
index 4616c22ae7a..9bcb38cd5ad 100644
--- a/components/layout/list_item.rs
+++ b/components/layout/list_item.rs
@@ -18,7 +18,6 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedC
use fragment::Overflow;
use generated_content;
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use inline::InlineMetrics;
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
use std::sync::Arc;
@@ -148,11 +147,8 @@ impl Flow for ListItemFlow {
self.build_display_list_for_list_item(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs
index e64479ffb11..b2283ad9015 100644
--- a/components/layout/multicol.rs
+++ b/components/layout/multicol.rs
@@ -17,7 +17,6 @@ use flow::{Flow, FlowClass, OpaqueFlow, mut_base, FragmentationContext};
use flow_ref::{self, FlowRef};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use std::cmp::{min, max};
use std::fmt;
@@ -186,11 +185,8 @@ impl Flow for MulticolFlow {
self.block_flow.build_display_list(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
@@ -271,11 +267,8 @@ impl Flow for MulticolColumnFlow {
self.block_flow.build_display_list(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs
index d59774c46d5..f2964976ed3 100644
--- a/components/layout/sequential.rs
+++ b/components/layout/sequential.rs
@@ -78,10 +78,7 @@ pub fn build_display_list_for_subtree(flow_root: &mut Flow,
root_stacking_context: &mut StackingContext,
shared_layout_context: &SharedLayoutContext)
-> Vec<DisplayItem> {
- let mut children = vec![];
- flow_root.collect_stacking_contexts(root_stacking_context.id,
- &mut children);
- root_stacking_context.add_children(children);
+ flow_root.collect_stacking_contexts(root_stacking_context);
let mut build_display_list = BuildDisplayList {
state: DisplayListBuildState::new(shared_layout_context,
flow::base(flow_root).stacking_context_id),
diff --git a/components/layout/table.rs b/components/layout/table.rs
index ebd2bb65e8a..ab7c5e9f12e 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -17,7 +17,6 @@ use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUt
use flow_list::MutFlowListIterator;
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
@@ -477,11 +476,8 @@ impl Flow for TableFlow {
self.block_flow.build_display_list_for_block(state, border_painting_mode);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs
index fc28b6c5833..13e92903582 100644
--- a/components/layout/table_caption.rs
+++ b/components/layout/table_caption.rs
@@ -14,7 +14,6 @@ use euclid::Point2D;
use flow::{Flow, FlowClass, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use std::fmt;
use std::sync::Arc;
@@ -83,11 +82,8 @@ impl Flow for TableCaptionFlow {
self.block_flow.build_display_list(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs
index 83c5fb522e3..a1f1eab101a 100644
--- a/components/layout/table_cell.rs
+++ b/components/layout/table_cell.rs
@@ -15,7 +15,6 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use flow::{self, Flow, FlowClass, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::MaybeAuto;
@@ -237,11 +236,8 @@ impl Flow for TableCellFlow {
self.block_flow.build_display_list_for_block(state, border_painting_mode)
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs
index fb8f0048c3c..795f24693b7 100644
--- a/components/layout/table_colgroup.rs
+++ b/components/layout/table_colgroup.rs
@@ -13,7 +13,6 @@ use euclid::Point2D;
use flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use layout_debug;
use std::cmp::max;
use std::fmt;
@@ -96,12 +95,7 @@ impl Flow for TableColGroupFlow {
// Table columns are invisible.
fn build_display_list(&mut self, _: &mut DisplayListBuildState) { }
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- _: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- parent_id
- }
+ fn collect_stacking_contexts(&mut self, _parent: &mut StackingContext) { }
fn repair_style(&mut self, _: &Arc<ServoComputedValues>) {}
diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs
index d40d7b1282e..17db349c41f 100644
--- a/components/layout/table_row.rs
+++ b/components/layout/table_row.rs
@@ -16,7 +16,6 @@ use flow::{self, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils,
use flow_list::MutFlowListIterator;
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use model::MaybeAuto;
@@ -112,11 +111,15 @@ impl TableRowFlow {
// all cells).
let mut max_block_size = Au(0);
let thread_id = self.block_flow.base.thread_id;
+ let content_box = self.block_flow.base.position
+ - self.block_flow.fragment.border_padding
+ - self.block_flow.fragment.margin;
for kid in self.block_flow.base.child_iter_mut() {
kid.place_float_if_applicable();
if !flow::base(kid).flags.is_float() {
kid.assign_block_size_for_inorder_child_if_necessary(layout_context,
- thread_id);
+ thread_id,
+ content_box);
}
{
@@ -455,11 +458,8 @@ impl Flow for TableRowFlow {
self.block_flow.build_display_list_for_block(state, border_painting_mode);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs
index bc48a44838b..0d5b6363783 100644
--- a/components/layout/table_rowgroup.rs
+++ b/components/layout/table_rowgroup.rs
@@ -14,7 +14,6 @@ use euclid::Point2D;
use flow::{Flow, FlowClass, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use layout_debug;
use rustc_serialize::{Encodable, Encoder};
@@ -212,11 +211,8 @@ impl Flow for TableRowGroupFlow {
self.block_flow.build_display_list(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index e07cee03084..ad5dcb776b3 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -23,7 +23,6 @@ use floats::FloatKind;
use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, OpaqueFlow};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use gfx::display_list::StackingContext;
-use gfx_traits::StackingContextId;
use gfx_traits::print_tree::PrintTree;
use model::MaybeAuto;
use std::cmp::{max, min};
@@ -32,7 +31,7 @@ use std::ops::Add;
use std::sync::Arc;
use style::computed_values::{border_collapse, table_layout};
use style::context::SharedStyleContext;
-use style::logical_geometry::LogicalSize;
+use style::logical_geometry::{LogicalRect, LogicalSize};
use style::properties::ServoComputedValues;
use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;
@@ -423,10 +422,12 @@ impl Flow for TableWrapperFlow {
fn assign_block_size_for_inorder_child_if_necessary<'a>(&mut self,
layout_context: &'a LayoutContext<'a>,
- parent_thread_id: u8)
+ parent_thread_id: u8,
+ content_box: LogicalRect<Au>)
-> bool {
self.block_flow.assign_block_size_for_inorder_child_if_necessary(layout_context,
- parent_thread_id)
+ parent_thread_id,
+ content_box)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {
@@ -445,11 +446,8 @@ impl Flow for TableWrapperFlow {
self.block_flow.build_display_list(state);
}
- fn collect_stacking_contexts(&mut self,
- parent_id: StackingContextId,
- contexts: &mut Vec<Box<StackingContext>>)
- -> StackingContextId {
- self.block_flow.collect_stacking_contexts(parent_id, contexts)
+ fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
+ self.block_flow.collect_stacking_contexts(parent);
}
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 18d2cbf3c08..237f339ea71 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -10,7 +10,7 @@ use app_units::Au;
use fragment::{Fragment, REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES, ScannedTextFlags};
use fragment::{SELECTED, ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG};
-use gfx::font::{RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions};
+use gfx::font::{KEEP_ALL_FLAG, RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions};
use gfx::font_context::FontContext;
use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::TextRun;
@@ -24,7 +24,7 @@ use std::collections::LinkedList;
use std::mem;
use std::sync::Arc;
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
-use style::computed_values::white_space;
+use style::computed_values::{word_break, white_space};
use style::logical_geometry::{LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::properties::style_structs;
@@ -151,6 +151,7 @@ impl TextRunScanner {
let letter_spacing;
let word_spacing;
let text_rendering;
+ let word_break;
{
let in_fragment = self.clump.front().unwrap();
let font_style = in_fragment.style().get_font_arc();
@@ -169,6 +170,7 @@ impl TextRunScanner {
.map(|lop| lop.to_hash_key())
.unwrap_or((Au(0), NotNaN::new(0.0).unwrap()));
text_rendering = inherited_text_style.text_rendering;
+ word_break = inherited_text_style.word_break;
}
// First, transform/compress text of all the nodes.
@@ -289,6 +291,9 @@ impl TextRunScanner {
flags.insert(IGNORE_LIGATURES_SHAPING_FLAG);
flags.insert(DISABLE_KERNING_SHAPING_FLAG)
}
+ if word_break == word_break::T::keep_all {
+ flags.insert(KEEP_ALL_FLAG);
+ }
let options = ShapingOptions {
letter_spacing: letter_spacing,
word_spacing: word_spacing,
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index bc90055387e..28d1196221b 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -31,33 +31,25 @@
#![allow(unsafe_code)]
use core::nonzero::NonZero;
-use data::{LayoutDataFlags, PrivateLayoutData};
-use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
+use data::{LayoutDataFlags, PersistentLayoutData};
+use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
+use style::atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use style::computed_values::content::{self, ContentItem};
-use style::refcell::{Ref, RefCell, RefMut};
-pub type NonOpaqueStyleAndLayoutData = *mut RefCell<PrivateLayoutData>;
+pub type NonOpaqueStyleAndLayoutData = *mut AtomicRefCell<PersistentLayoutData>;
pub trait LayoutNodeLayoutData {
- /// Similar to borrow_data*, but returns the full PrivateLayoutData rather
- /// than only the PrivateStyleData.
- unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
- fn borrow_layout_data(&self) -> Option<Ref<PrivateLayoutData>>;
- fn mutate_layout_data(&self) -> Option<RefMut<PrivateLayoutData>>;
+ /// Similar to borrow_data*, but returns the full PersistentLayoutData rather
+ /// than only the PersistentStyleData.
+ fn borrow_layout_data(&self) -> Option<AtomicRef<PersistentLayoutData>>;
+ fn mutate_layout_data(&self) -> Option<AtomicRefMut<PersistentLayoutData>>;
fn initialize_data(self);
fn flow_debug_id(self) -> usize;
}
impl<T: LayoutNode> LayoutNodeLayoutData for T {
- unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
- self.get_style_and_layout_data().map(|opaque| {
- let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
- &(*(*container).as_unsafe_cell().get()) as *const PrivateLayoutData
- })
- }
-
- fn borrow_layout_data(&self) -> Option<Ref<PrivateLayoutData>> {
+ fn borrow_layout_data(&self) -> Option<AtomicRef<PersistentLayoutData>> {
unsafe {
self.get_style_and_layout_data().map(|opaque| {
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
@@ -66,7 +58,7 @@ impl<T: LayoutNode> LayoutNodeLayoutData for T {
}
}
- fn mutate_layout_data(&self) -> Option<RefMut<PrivateLayoutData>> {
+ fn mutate_layout_data(&self) -> Option<AtomicRefMut<PersistentLayoutData>> {
unsafe {
self.get_style_and_layout_data().map(|opaque| {
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
@@ -76,11 +68,11 @@ impl<T: LayoutNode> LayoutNodeLayoutData for T {
}
fn initialize_data(self) {
- if unsafe { self.borrow_data_unchecked() }.is_none() {
+ if self.borrow_data().is_none() {
let ptr: NonOpaqueStyleAndLayoutData =
- Box::into_raw(box RefCell::new(PrivateLayoutData::new()));
+ Box::into_raw(box AtomicRefCell::new(PersistentLayoutData::new()));
let opaque = OpaqueStyleAndLayoutData {
- ptr: unsafe { NonZero::new(ptr as *mut RefCell<PartialStyleAndLayoutData>) }
+ ptr: unsafe { NonZero::new(ptr as *mut AtomicRefCell<PartialPersistentLayoutData>) }
};
self.init_style_and_layout_data(opaque);
}
@@ -94,19 +86,17 @@ impl<T: LayoutNode> LayoutNodeLayoutData for T {
pub trait ThreadSafeLayoutNodeHelpers {
fn flow_debug_id(self) -> usize;
- unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData>;
-
/// Borrows the layout data immutably. Fails on a conflicting borrow.
///
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
#[inline(always)]
- fn borrow_layout_data(&self) -> Option<Ref<PrivateLayoutData>>;
+ fn borrow_layout_data(&self) -> Option<AtomicRef<PersistentLayoutData>>;
/// Borrows the layout data mutably. Fails on a conflicting borrow.
///
/// TODO(pcwalton): Make this private. It will let us avoid borrow flag checks in some cases.
#[inline(always)]
- fn mutate_layout_data(&self) -> Option<RefMut<PrivateLayoutData>>;
+ fn mutate_layout_data(&self) -> Option<AtomicRefMut<PersistentLayoutData>>;
/// Returns the layout data flags for this node.
fn flags(self) -> LayoutDataFlags;
@@ -129,14 +119,7 @@ impl<T: ThreadSafeLayoutNode> ThreadSafeLayoutNodeHelpers for T {
self.borrow_layout_data().map_or(0, |d| d.flow_construction_result.debug_id())
}
- unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
- self.get_style_and_layout_data().map(|opaque| {
- let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
- &(*(*container).as_unsafe_cell().get()) as *const PrivateLayoutData
- })
- }
-
- fn borrow_layout_data(&self) -> Option<Ref<PrivateLayoutData>> {
+ fn borrow_layout_data(&self) -> Option<AtomicRef<PersistentLayoutData>> {
unsafe {
self.get_style_and_layout_data().map(|opaque| {
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
@@ -145,7 +128,7 @@ impl<T: ThreadSafeLayoutNode> ThreadSafeLayoutNodeHelpers for T {
}
}
- fn mutate_layout_data(&self) -> Option<RefMut<PrivateLayoutData>> {
+ fn mutate_layout_data(&self) -> Option<AtomicRefMut<PersistentLayoutData>> {
unsafe {
self.get_style_and_layout_data().map(|opaque| {
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
@@ -155,9 +138,7 @@ impl<T: ThreadSafeLayoutNode> ThreadSafeLayoutNodeHelpers for T {
}
fn flags(self) -> LayoutDataFlags {
- unsafe {
- (*self.borrow_layout_data_unchecked().unwrap()).flags
- }
+ self.borrow_layout_data().as_ref().unwrap().flags
}
fn insert_flags(self, new_flags: LayoutDataFlags) {
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 6e8b32a2687..4797b8814aa 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -86,7 +86,7 @@ use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
use profile_traits::time::{self, TimerMetadata, profile};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::layout_wrapper::{ServoLayoutDocument, ServoLayoutNode};
-use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
+use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
use script_layout_interface::message::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
use script_layout_interface::reporter::CSSErrorReporter;
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION};
@@ -104,6 +104,7 @@ use std::sync::{Arc, Mutex, MutexGuard, RwLock};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
use style::animation::Animation;
+use style::atomic_refcell::AtomicRefCell;
use style::computed_values::{filter, mix_blend_mode};
use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleContext};
use style::dom::{TDocument, TElement, TNode};
@@ -112,7 +113,6 @@ use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::parser::ParserContextExtraData;
-use style::refcell::RefCell;
use style::selector_matching::Stylist;
use style::stylesheets::{CSSRuleIteratorExt, Origin, Stylesheet, UserAgentStylesheets};
use style::thread_state;
@@ -1594,7 +1594,7 @@ impl LayoutThread {
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* thread
/// because the struct type is transmuted to a different type on the script side.
unsafe fn handle_reap_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData) {
- let ptr: *mut RefCell<PartialStyleAndLayoutData> = *data.ptr;
+ let ptr: *mut AtomicRefCell<PartialPersistentLayoutData> = *data.ptr;
let non_opaque: NonOpaqueStyleAndLayoutData = ptr as *mut _;
let _ = Box::from_raw(non_opaque);
}
diff --git a/components/net/cookie.rs b/components/net/cookie.rs
index 558d8e49a8c..28972d95806 100644
--- a/components/net/cookie.rs
+++ b/components/net/cookie.rs
@@ -7,7 +7,7 @@
use cookie_rs;
use net_traits::CookieSource;
-use pub_domains::is_pub_domain;
+use net_traits::pub_domains::is_pub_domain;
use std::borrow::ToOwned;
use std::net::{Ipv4Addr, Ipv6Addr};
use time::{Tm, now, at, Duration};
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs
index a97ee2e9985..52536472514 100644
--- a/components/net/fetch/methods.rs
+++ b/components/net/fetch/methods.rs
@@ -194,8 +194,8 @@ fn main_fetch(request: Rc<Request>, cache: &mut CORSCache, cors_flag: bool,
};
if (same_origin && !cors_flag ) ||
- (current_url.scheme() == "data" && request.same_origin_data.get()) ||
- (current_url.scheme() == "file" && request.same_origin_data.get()) ||
+ current_url.scheme() == "data" ||
+ current_url.scheme() == "file" ||
current_url.scheme() == "about" ||
request.mode == RequestMode::Navigate {
basic_fetch(request.clone(), cache, target, done_chan, context)
@@ -640,41 +640,35 @@ fn http_redirect_fetch(request: Rc<Request>,
// Step 1
assert_eq!(response.return_internal.get(), true);
- // Step 3
- // this step is done early, because querying if Location exists says
- // if it is None or Some, making it easy to seperate from the retrieval failure case
+ // Step 2
if !response.actual_response().headers.has::<Location>() {
return Rc::try_unwrap(response).ok().unwrap();
}
- // Step 2
+ // Step 3
let location = match response.actual_response().headers.get::<Location>() {
Some(&Location(ref location)) => location.clone(),
- // Step 4
_ => return Response::network_error()
};
-
- // Step 5
let response_url = response.actual_response().url.as_ref().unwrap();
let location_url = response_url.join(&*location);
-
- // Step 6
let location_url = match location_url {
Ok(url) => url,
_ => return Response::network_error()
};
- // Step 7
+ // Step 4
+ // TODO implement return network_error if not HTTP(S)
+
+ // Step 5
if request.redirect_count.get() >= 20 {
return Response::network_error();
}
- // Step 8
+ // Step 6
request.redirect_count.set(request.redirect_count.get() + 1);
- // Step 9
- request.same_origin_data.set(false);
-
+ // Step 7
let same_origin = if let Origin::Origin(ref origin) = *request.origin.borrow() {
*origin == request.current_url().origin()
} else {
@@ -682,22 +676,21 @@ fn http_redirect_fetch(request: Rc<Request>,
};
let has_credentials = has_credentials(&location_url);
- // Step 10
if request.mode == RequestMode::CORSMode && !same_origin && has_credentials {
return Response::network_error();
}
- // Step 11
+ // Step 8
if cors_flag && has_credentials {
return Response::network_error();
}
- // Step 12
+ // Step 9
if cors_flag && !same_origin {
*request.origin.borrow_mut() = Origin::Origin(UrlOrigin::new_opaque());
}
- // Step 13
+ // Step 10
let status_code = response.actual_response().status.unwrap();
if ((status_code == StatusCode::MovedPermanently || status_code == StatusCode::Found) &&
*request.method.borrow() == Method::Post) ||
@@ -706,10 +699,13 @@ fn http_redirect_fetch(request: Rc<Request>,
*request.body.borrow_mut() = None;
}
- // Step 14
+ // Step 11
request.url_list.borrow_mut().push(location_url);
- // Step 15
+ // Step 12
+ // TODO implement referrer policy
+
+ // Step 13
main_fetch(request, cache, cors_flag, true, target, done_chan, context)
}
diff --git a/components/net/lib.rs b/components/net/lib.rs
index 120dacb27d2..822c2105c6e 100644
--- a/components/net/lib.rs
+++ b/components/net/lib.rs
@@ -63,7 +63,6 @@ pub mod hsts;
pub mod http_loader;
pub mod image_cache_thread;
pub mod mime_classifier;
-pub mod pub_domains;
pub mod resource_thread;
pub mod storage_thread;
pub mod websocket_loader;
diff --git a/components/net/pub_domains.rs b/components/net/pub_domains.rs
deleted file mode 100644
index 6a9555d4bb1..00000000000
--- a/components/net/pub_domains.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! Implementation of public domain matching.
-//!
-//! The list is a file located on the `resources` folder and loaded once on first need.
-//!
-//! The list can be updated with `./mach update-pub-domains` from this source:
-//! https://publicsuffix.org/list/
-//!
-//! This implementation is not strictly following the specification of the list. Wildcards are not
-//! restricted to appear only in the leftmost position, but the current list has no such cases so
-//! we don't need to make the code more complex for it. The `mach` update command makes sure that
-//! those cases are not present.
-
-use std::collections::HashSet;
-use std::str::from_utf8;
-use std::sync::Arc;
-use util::resource_files::read_resource_file;
-
-lazy_static! {
- static ref PUB_DOMAINS: Arc<HashSet<String>> = load_pub_domains();
-}
-
-fn load_pub_domains() -> Arc<HashSet<String>> {
- let content = read_resource_file("public_domains.txt")
- .expect("Could not find public suffix list file");
- let domains = from_utf8(&content)
- .expect("Could not read suffix list file")
- .lines()
- .filter_map(|i| {
- let domain = i.trim();
- if domain == "" { return None };
- if domain.starts_with("//") { return None };
- Some(domain.to_owned())
- });
-
- Arc::new(domains.collect())
-}
-
-/// Match the given domain against a static list of known public domains
-pub fn is_pub_domain(domain: &str) -> bool {
- let domain = domain.trim_left_matches(".");
-
- // Start by looking for a plain match
- if PUB_DOMAINS.contains(&domain.to_string()) {
- return true
- }
-
- // Then look for a wildcard match
- // To make things simpler, just look for the same domain with its leftmost part replaced by a
- // wildcard.
- match domain.find(".") {
- None => {
- // This is a domain with only one part, so there is no need to search for wildcards or
- // exceptions
- return false
- }
- Some(position) => {
- let wildcard_domain = "*".to_string() + domain.split_at(position).1;
- if PUB_DOMAINS.contains(&wildcard_domain) {
- // We have a wildcard match, search for an eventual exception
- let exception_domain = "!".to_string() + domain;
- return ! PUB_DOMAINS.contains(&exception_domain)
- } else {
- // No wildcard match -> this is not a public domain
- return false
- }
- }
- }
-}
-
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs
index 2cbc198e0f7..7f4a3abd164 100644
--- a/components/net_traits/lib.rs
+++ b/components/net_traits/lib.rs
@@ -44,7 +44,6 @@ use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use request::{Request, RequestInit};
use response::{HttpsState, Response};
use std::io::Error as IOError;
-use std::thread;
use storage_thread::StorageThreadMsg;
use url::Url;
use websocket::header;
@@ -56,6 +55,7 @@ pub mod filemanager_thread;
pub mod hosts;
pub mod image_cache_thread;
pub mod net_error_list;
+pub mod pub_domains;
pub mod request;
pub mod response;
pub mod storage_thread;
@@ -466,35 +466,13 @@ pub enum CoreResourceMsg {
/// Initialized but unsent request. Encapsulates everything necessary to instruct
/// the resource thread to make a new request. The `load` method *must* be called before
/// destruction or the thread will panic.
-pub struct PendingAsyncLoad {
- core_resource_thread: CoreResourceThread,
- url: Url,
+struct LoadOriginData {
pipeline: Option<PipelineId>,
- guard: PendingLoadGuard,
- context: LoadContext,
referrer_policy: Option<ReferrerPolicy>,
referrer_url: Option<Url>
}
-struct PendingLoadGuard {
- loaded: bool,
-}
-
-impl PendingLoadGuard {
- fn neuter(&mut self) {
- self.loaded = true;
- }
-}
-
-impl Drop for PendingLoadGuard {
- fn drop(&mut self) {
- if !thread::panicking() {
- assert!(self.loaded)
- }
- }
-}
-
-impl LoadOrigin for PendingAsyncLoad {
+impl LoadOrigin for LoadOriginData {
fn referrer_url(&self) -> Option<Url> {
self.referrer_url.clone()
}
@@ -506,42 +484,22 @@ impl LoadOrigin for PendingAsyncLoad {
}
}
-impl PendingAsyncLoad {
- pub fn new(context: LoadContext,
- core_resource_thread: CoreResourceThread,
- url: Url,
- pipeline: Option<PipelineId>,
- referrer_policy: Option<ReferrerPolicy>,
- referrer_url: Option<Url>)
- -> PendingAsyncLoad {
- PendingAsyncLoad {
- core_resource_thread: core_resource_thread,
- url: url,
- pipeline: pipeline,
- guard: PendingLoadGuard { loaded: false, },
- context: context,
- referrer_policy: referrer_policy,
- referrer_url: referrer_url
- }
- }
-
- /// Initiate the network request associated with this pending load, using the provided target.
- pub fn load_async(mut self, listener: AsyncResponseTarget) {
- self.guard.neuter();
-
- let load_data = LoadData::new(self.context.clone(),
- self.url.clone(),
- &self);
- let consumer = LoadConsumer::Listener(listener);
- self.core_resource_thread.send(CoreResourceMsg::Load(load_data, consumer, None)).unwrap();
- }
-
- /// Initiate the fetch associated with this pending load.
- pub fn fetch_async(mut self, request: RequestInit, fetch_target: IpcSender<FetchResponseMsg>) {
- self.guard.neuter();
-
- self.core_resource_thread.send(CoreResourceMsg::Fetch(request, fetch_target)).unwrap();
- }
+/// Instruct the resource thread to make a new request.
+pub fn load_async(context: LoadContext,
+ core_resource_thread: CoreResourceThread,
+ url: Url,
+ pipeline: Option<PipelineId>,
+ referrer_policy: Option<ReferrerPolicy>,
+ referrer_url: Option<Url>,
+ listener: AsyncResponseTarget) {
+ let load = LoadOriginData {
+ pipeline: pipeline,
+ referrer_policy: referrer_policy,
+ referrer_url: referrer_url
+ };
+ let load_data = LoadData::new(context, url, &load);
+ let consumer = LoadConsumer::Listener(listener);
+ core_resource_thread.send(CoreResourceMsg::Load(load_data, consumer, None)).unwrap();
}
/// Message sent in response to `Load`. Contains metadata, and a port
diff --git a/components/net_traits/pub_domains.rs b/components/net_traits/pub_domains.rs
new file mode 100644
index 00000000000..f40815e100e
--- /dev/null
+++ b/components/net_traits/pub_domains.rs
@@ -0,0 +1,140 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//! Implementation of public domain matching.
+//!
+//! The list is a file located on the `resources` folder and loaded once on first need.
+//!
+//! The list can be updated with `./mach update-pub-domains` from this source:
+//! https://publicsuffix.org/list/
+//!
+//! This implementation is not strictly following the specification of the list. Wildcards are not
+//! restricted to appear only in the leftmost position, but the current list has no such cases so
+//! we don't need to make the code more complex for it. The `mach` update command makes sure that
+//! those cases are not present.
+
+use std::collections::HashSet;
+use std::iter::FromIterator;
+use std::str::from_utf8;
+use util::resource_files::read_resource_file;
+
+#[derive(Clone,Debug)]
+pub struct PubDomainRules {
+ rules: HashSet<String>,
+ wildcards: HashSet<String>,
+ exceptions: HashSet<String>,
+}
+
+lazy_static! {
+ static ref PUB_DOMAINS: PubDomainRules = load_pub_domains();
+}
+
+impl<'a> FromIterator<&'a str> for PubDomainRules {
+ fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=&'a str> {
+ let mut result = PubDomainRules::new();
+ for item in iter {
+ if item.starts_with("!") {
+ result.exceptions.insert(String::from(&item[1..]));
+ } else if item.starts_with("*.") {
+ result.wildcards.insert(String::from(&item[2..]));
+ } else {
+ result.rules.insert(String::from(item));
+ }
+ }
+ result
+ }
+}
+
+impl PubDomainRules {
+ pub fn new() -> PubDomainRules {
+ PubDomainRules {
+ rules: HashSet::new(),
+ wildcards: HashSet::new(),
+ exceptions: HashSet::new(),
+ }
+ }
+ pub fn parse(content: &str) -> PubDomainRules {
+ content.lines()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .filter(|s| !s.starts_with("//"))
+ .collect()
+ }
+ fn suffix_pair<'a>(&self, domain: &'a str) -> (&'a str, &'a str) {
+ let domain = domain.trim_left_matches(".");
+ let mut suffix = domain;
+ let mut prev_suffix = domain;
+ for (index, _) in domain.match_indices(".") {
+ let next_suffix = &domain[index + 1..];
+ if self.exceptions.contains(suffix) {
+ return (next_suffix, suffix);
+ } else if self.wildcards.contains(next_suffix) {
+ return (suffix, prev_suffix);
+ } else if self.rules.contains(suffix) {
+ return (suffix, prev_suffix);
+ } else {
+ prev_suffix = suffix;
+ suffix = next_suffix;
+ }
+ }
+ return (suffix, prev_suffix);
+ }
+ pub fn public_suffix<'a>(&self, domain: &'a str) -> &'a str {
+ let (public, _) = self.suffix_pair(domain);
+ public
+ }
+ pub fn registrable_suffix<'a>(&self, domain: &'a str) -> &'a str {
+ let (_, registrable) = self.suffix_pair(domain);
+ registrable
+ }
+ pub fn is_public_suffix(&self, domain: &str) -> bool {
+ // Speeded-up version of
+ // domain != "" &&
+ // self.public_suffix(domain) == domain.
+ let domain = domain.trim_left_matches(".");
+ match domain.find(".") {
+ None => !domain.is_empty(),
+ Some(index) => !self.exceptions.contains(domain) &&
+ self.wildcards.contains(&domain[index + 1..]) ||
+ self.rules.contains(domain),
+ }
+ }
+ pub fn is_registrable_suffix(&self, domain: &str) -> bool {
+ // Speeded-up version of
+ // self.public_suffix(domain) != domain &&
+ // self.registrable_suffix(domain) == domain.
+ let domain = domain.trim_left_matches(".");
+ match domain.find(".") {
+ None => false,
+ Some(index) => self.exceptions.contains(domain) ||
+ !self.wildcards.contains(&domain[index + 1..]) &&
+ !self.rules.contains(domain) &&
+ self.is_public_suffix(&domain[index + 1..]),
+ }
+ }
+}
+
+fn load_pub_domains() -> PubDomainRules {
+ let content = read_resource_file("public_domains.txt")
+ .expect("Could not find public suffix list file");
+ let content = from_utf8(&content)
+ .expect("Could not read public suffix list file");
+ PubDomainRules::parse(content)
+}
+
+pub fn pub_suffix(domain: &str) -> &str {
+ PUB_DOMAINS.public_suffix(domain)
+}
+
+pub fn reg_suffix(domain: &str) -> &str {
+ PUB_DOMAINS.registrable_suffix(domain)
+}
+
+pub fn is_pub_domain(domain: &str) -> bool {
+ PUB_DOMAINS.is_public_suffix(domain)
+}
+
+pub fn is_reg_domain(domain: &str) -> bool {
+ PUB_DOMAINS.is_registrable_suffix(domain)
+}
diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs
index c31f821680d..2a84c91c759 100644
--- a/components/net_traits/request.rs
+++ b/components/net_traits/request.rs
@@ -120,7 +120,6 @@ pub struct RequestInit {
serialize_with = "::hyper_serde::serialize")]
pub headers: Headers,
pub unsafe_request: bool,
- pub same_origin_data: bool,
pub body: Option<Vec<u8>>,
// TODO: client object
pub type_: Type,
@@ -146,7 +145,6 @@ impl Default for RequestInit {
url: Url::parse("about:blank").unwrap(),
headers: Headers::new(),
unsafe_request: false,
- same_origin_data: false,
body: None,
type_: Type::None,
destination: Destination::None,
@@ -188,7 +186,6 @@ pub struct Request {
// TODO: priority object
pub origin: RefCell<Origin>,
pub omit_origin_header: Cell<bool>,
- pub same_origin_data: Cell<bool>,
/// https://fetch.spec.whatwg.org/#concept-request-referrer
pub referrer: RefCell<Referrer>,
pub referrer_policy: Cell<Option<ReferrerPolicy>>,
@@ -230,7 +227,6 @@ impl Request {
destination: Destination::None,
origin: RefCell::new(origin.unwrap_or(Origin::Client)),
omit_origin_header: Cell::new(false),
- same_origin_data: Cell::new(false),
referrer: RefCell::new(Referrer::Client),
referrer_policy: Cell::new(None),
pipeline_id: Cell::new(pipeline_id),
@@ -256,7 +252,6 @@ impl Request {
*req.method.borrow_mut() = init.method;
*req.headers.borrow_mut() = init.headers;
req.unsafe_request = init.unsafe_request;
- req.same_origin_data.set(init.same_origin_data);
*req.body.borrow_mut() = init.body;
req.type_ = init.type_;
req.destination = init.destination;
diff --git a/components/profile_traits/Cargo.toml b/components/profile_traits/Cargo.toml
index f4b3687fc08..150760b2ad2 100644
--- a/components/profile_traits/Cargo.toml
+++ b/components/profile_traits/Cargo.toml
@@ -19,4 +19,7 @@ energy-monitor = {version = "0.2.0", optional = true}
plugins = {path = "../plugins"}
serde = "0.8"
serde_macros = "0.8"
+signpost = {git = "https://github.com/pcwalton/signpost.git"}
time = "0.1.12"
+util = {path = "../util"}
+
diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs
index ed404df1458..78fab60a4fa 100644
--- a/components/profile_traits/lib.rs
+++ b/components/profile_traits/lib.rs
@@ -14,6 +14,8 @@
extern crate ipc_channel;
extern crate serde;
+extern crate signpost;
+extern crate util;
pub mod energy;
pub mod mem;
diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs
index 5b969ecd8f7..64664265a1a 100644
--- a/components/profile_traits/time.rs
+++ b/components/profile_traits/time.rs
@@ -7,6 +7,8 @@ extern crate time as std_time;
use energy::read_energy_uj;
use ipc_channel::ipc::IpcSender;
use self::std_time::precise_time_ns;
+use signpost;
+use util::opts;
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord, Debug, Deserialize, Serialize)]
pub struct TimerMetadata {
@@ -37,51 +39,51 @@ pub enum ProfilerMsg {
#[repr(u32)]
#[derive(PartialEq, Clone, Copy, PartialOrd, Eq, Ord, Deserialize, Serialize, Debug, Hash)]
pub enum ProfilerCategory {
- Compositing,
- LayoutPerform,
- LayoutStyleRecalc,
- LayoutTextShaping,
- LayoutRestyleDamagePropagation,
- LayoutNonIncrementalReset,
- LayoutSelectorMatch,
- LayoutTreeBuilder,
- LayoutDamagePropagate,
- LayoutGeneratedContent,
- LayoutDisplayListSorting,
- LayoutFloatPlacementSpeculation,
- LayoutMain,
- LayoutStoreOverflow,
- LayoutParallelWarmup,
- LayoutDispListBuild,
- NetHTTPRequestResponse,
- PaintingPerTile,
- PaintingPrepBuff,
- Painting,
- ImageDecoding,
- ImageSaving,
- ScriptAttachLayout,
- ScriptConstellationMsg,
- ScriptDevtoolsMsg,
- ScriptDocumentEvent,
- ScriptDomEvent,
- ScriptEvaluate,
- ScriptEvent,
- ScriptFileRead,
- ScriptImageCacheMsg,
- ScriptInputEvent,
- ScriptNetworkEvent,
- ScriptParseHTML,
- ScriptPlannedNavigation,
- ScriptResize,
- ScriptSetScrollState,
- ScriptSetViewport,
- ScriptTimerEvent,
- ScriptStylesheetLoad,
- ScriptUpdateReplacedElement,
- ScriptWebSocketEvent,
- ScriptWorkerEvent,
- ScriptServiceWorkerEvent,
- ApplicationHeartbeat,
+ Compositing = 0x00,
+ LayoutPerform = 0x10,
+ LayoutStyleRecalc = 0x11,
+ LayoutTextShaping = 0x12,
+ LayoutRestyleDamagePropagation = 0x13,
+ LayoutNonIncrementalReset = 0x14,
+ LayoutSelectorMatch = 0x15,
+ LayoutTreeBuilder = 0x16,
+ LayoutDamagePropagate = 0x17,
+ LayoutGeneratedContent = 0x18,
+ LayoutDisplayListSorting = 0x19,
+ LayoutFloatPlacementSpeculation = 0x1a,
+ LayoutMain = 0x1b,
+ LayoutStoreOverflow = 0x1c,
+ LayoutParallelWarmup = 0x1d,
+ LayoutDispListBuild = 0x1e,
+ NetHTTPRequestResponse = 0x30,
+ PaintingPerTile = 0x41,
+ PaintingPrepBuff = 0x42,
+ Painting = 0x43,
+ ImageDecoding = 0x50,
+ ImageSaving = 0x51,
+ ScriptAttachLayout = 0x60,
+ ScriptConstellationMsg = 0x61,
+ ScriptDevtoolsMsg = 0x62,
+ ScriptDocumentEvent = 0x63,
+ ScriptDomEvent = 0x64,
+ ScriptEvaluate = 0x65,
+ ScriptEvent = 0x66,
+ ScriptFileRead = 0x67,
+ ScriptImageCacheMsg = 0x68,
+ ScriptInputEvent = 0x69,
+ ScriptNetworkEvent = 0x6a,
+ ScriptParseHTML = 0x6b,
+ ScriptPlannedNavigation = 0x6c,
+ ScriptResize = 0x6d,
+ ScriptSetScrollState = 0x6e,
+ ScriptSetViewport = 0x6f,
+ ScriptTimerEvent = 0x70,
+ ScriptStylesheetLoad = 0x71,
+ ScriptUpdateReplacedElement = 0x72,
+ ScriptWebSocketEvent = 0x73,
+ ScriptWorkerEvent = 0x74,
+ ScriptServiceWorkerEvent = 0x75,
+ ApplicationHeartbeat = 0x90,
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Deserialize, Serialize)]
@@ -103,11 +105,20 @@ pub fn profile<T, F>(category: ProfilerCategory,
-> T
where F: FnOnce() -> T
{
+ if opts::get().signpost {
+ signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]);
+ }
let start_energy = read_energy_uj();
let start_time = precise_time_ns();
+
let val = callback();
+
let end_time = precise_time_ns();
let end_energy = read_energy_uj();
+ if opts::get().signpost {
+ signpost::end(category as u32, &[0, 0, 0, (category as usize) >> 4]);
+ }
+
send_profile_data(category,
meta,
profiler_chan,
diff --git a/components/script/body.rs b/components/script/body.rs
new file mode 100644
index 00000000000..7777ef62a4e
--- /dev/null
+++ b/components/script/body.rs
@@ -0,0 +1,164 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods;
+use dom::bindings::error::{Error, Fallible};
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::Root;
+use dom::bindings::reflector::Reflectable;
+use dom::bindings::str::USVString;
+use dom::blob::{Blob, BlobImpl};
+use dom::formdata::FormData;
+use dom::promise::Promise;
+use encoding::all::UTF_8;
+use encoding::types::{DecoderTrap, Encoding};
+use js::jsapi::JSContext;
+use js::jsapi::JS_ClearPendingException;
+use js::jsapi::JS_ParseJSON;
+use js::jsapi::Value as JSValue;
+use js::jsval::UndefinedValue;
+use mime::{Mime, TopLevel, SubLevel};
+use std::rc::Rc;
+use std::str;
+use style::refcell::Ref;
+use url::form_urlencoded;
+
+pub enum BodyType {
+ ArrayBuffer,
+ Blob,
+ FormData,
+ Json,
+ Text
+}
+
+pub enum FetchedData {
+ Text(String),
+ Json(JSValue),
+ BlobData(Root<Blob>),
+ FormData(Root<FormData>),
+}
+
+// https://fetch.spec.whatwg.org/#concept-body-consume-body
+#[allow(unrooted_must_root)]
+pub fn consume_body<T: BodyOperations + Reflectable>(object: &T, body_type: BodyType) -> Rc<Promise> {
+ let promise = Promise::new(object.global().r());
+
+ // Step 1
+ if object.get_body_used() || object.is_locked() {
+ promise.reject_error(promise.global().r().get_cx(), Error::Type(
+ "The response's stream is disturbed or locked".to_string()));
+ }
+
+ // Steps 2-4
+ // TODO: Body does not yet have a stream.
+
+ // Step 5
+ let pkg_data_results = run_package_data_algorithm(object,
+ object.take_body(),
+ body_type,
+ object.get_mime_type());
+
+ let cx = promise.global().r().get_cx();
+ match pkg_data_results {
+ Ok(results) => {
+ match results {
+ FetchedData::Text(s) => promise.resolve_native(cx, &USVString(s)),
+ FetchedData::Json(j) => promise.resolve_native(cx, &j),
+ FetchedData::BlobData(b) => promise.resolve_native(cx, &b),
+ FetchedData::FormData(f) => promise.resolve_native(cx, &f),
+ };
+ },
+ Err(err) => promise.reject_error(cx, err),
+ }
+ promise
+}
+
+// https://fetch.spec.whatwg.org/#concept-body-package-data
+#[allow(unsafe_code)]
+fn run_package_data_algorithm<T: BodyOperations + Reflectable>(object: &T,
+ bytes: Option<Vec<u8>>,
+ body_type: BodyType,
+ mime_type: Ref<Vec<u8>>)
+ -> Fallible<FetchedData> {
+ let bytes = match bytes {
+ Some(b) => b,
+ _ => vec![],
+ };
+ let cx = object.global().r().get_cx();
+ let mime = &*mime_type;
+ match body_type {
+ BodyType::Text => run_text_data_algorithm(bytes),
+ BodyType::Json => run_json_data_algorithm(cx, bytes),
+ BodyType::Blob => run_blob_data_algorithm(object.global().r(), bytes, mime),
+ BodyType::FormData => run_form_data_algorithm(object.global().r(), bytes, mime),
+ _ => Err(Error::Type("Unable to process body type".to_string()))
+ }
+}
+
+fn run_text_data_algorithm(bytes: Vec<u8>) -> Fallible<FetchedData> {
+ let text = UTF_8.decode(&bytes, DecoderTrap::Replace).unwrap();
+ Ok(FetchedData::Text(text))
+}
+
+#[allow(unsafe_code)]
+fn run_json_data_algorithm(cx: *mut JSContext,
+ bytes: Vec<u8>) -> Fallible<FetchedData> {
+ let json_text = UTF_8.decode(&bytes, DecoderTrap::Replace).unwrap();
+ let json_text: Vec<u16> = json_text.encode_utf16().collect();
+ rooted!(in(cx) let mut rval = UndefinedValue());
+ unsafe {
+ if !JS_ParseJSON(cx,
+ json_text.as_ptr(),
+ json_text.len() as u32,
+ rval.handle_mut()) {
+ JS_ClearPendingException(cx);
+ // TODO: See issue #13464. Exception should be thrown instead of cleared.
+ return Err(Error::Type("Failed to parse JSON".to_string()));
+ }
+ Ok(FetchedData::Json(rval.get()))
+ }
+}
+
+fn run_blob_data_algorithm(root: GlobalRef,
+ bytes: Vec<u8>,
+ mime: &[u8]) -> Fallible<FetchedData> {
+ let mime_string = if let Ok(s) = String::from_utf8(mime.to_vec()) {
+ s
+ } else {
+ "".to_string()
+ };
+ let blob = Blob::new(root, BlobImpl::new_from_bytes(bytes), mime_string);
+ Ok(FetchedData::BlobData(blob))
+}
+
+fn run_form_data_algorithm(root: GlobalRef, bytes: Vec<u8>, mime: &[u8]) -> Fallible<FetchedData> {
+ let mime_str = if let Ok(s) = str::from_utf8(mime) {
+ s
+ } else {
+ ""
+ };
+ let mime: Mime = try!(mime_str.parse().map_err(
+ |_| Error::Type("Inappropriate MIME-type for Body".to_string())));
+ match mime {
+ // TODO
+ // ... Parser for Mime(TopLevel::Multipart, SubLevel::FormData, _)
+ // ... is not fully determined yet.
+ Mime(TopLevel::Application, SubLevel::WwwFormUrlEncoded, _) => {
+ let entries = form_urlencoded::parse(&bytes);
+ let formdata = FormData::new(None, root);
+ for (k, e) in entries {
+ formdata.Append(USVString(k.into_owned()), USVString(e.into_owned()));
+ }
+ return Ok(FetchedData::FormData(formdata));
+ },
+ _ => return Err(Error::Type("Inappropriate MIME-type for Body".to_string())),
+ }
+}
+
+pub trait BodyOperations {
+ fn get_body_used(&self) -> bool;
+ fn take_body(&self) -> Option<Vec<u8>>;
+ fn is_locked(&self) -> bool;
+ fn get_mime_type(&self) -> Ref<Vec<u8>>;
+}
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index 5209b68b9ac..cfb04f614fa 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -9,8 +9,8 @@ use dom::bindings::js::JS;
use dom::document::Document;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
-use net_traits::{AsyncResponseTarget, PendingAsyncLoad, LoadContext};
-use net_traits::{FetchResponseMsg, ResourceThreads, IpcSend};
+use net_traits::{AsyncResponseTarget, CoreResourceMsg, load_async};
+use net_traits::{FetchResponseMsg, LoadContext, ResourceThreads, IpcSend};
use net_traits::request::RequestInit;
use std::thread;
use url::Url;
@@ -49,7 +49,7 @@ impl LoadType {
}
/// Canary value ensuring that manually added blocking loads (ie. ones that weren't
-/// created via DocumentLoader::prepare_async_load) are always removed by the time
+/// created via DocumentLoader::{load_async, fetch_async}) are always removed by the time
/// that the owner is destroyed.
#[derive(JSTraceable, HeapSizeOf)]
#[must_root]
@@ -63,7 +63,7 @@ pub struct LoadBlocker {
impl LoadBlocker {
/// Mark the document's load event as blocked on this new load.
pub fn new(doc: &Document, load: LoadType) -> LoadBlocker {
- doc.add_blocking_load(load.clone());
+ doc.mut_loader().add_blocking_load(load.clone());
LoadBlocker {
doc: JS::from_ref(doc),
load: Some(load),
@@ -119,46 +119,35 @@ impl DocumentLoader {
}
/// Add a load to the list of blocking loads.
- pub fn add_blocking_load(&mut self, load: LoadType) {
+ fn add_blocking_load(&mut self, load: LoadType) {
self.blocking_loads.push(load);
}
- /// Create a new pending network request, which can be initiated at some point in
- /// the future.
- pub fn prepare_async_load(&mut self,
- load: LoadType,
- referrer: &Document,
- referrer_policy: Option<ReferrerPolicy>) -> PendingAsyncLoad {
- let context = load.to_load_context();
- let url = load.url().clone();
- self.add_blocking_load(load);
- PendingAsyncLoad::new(context,
- self.resource_threads.sender(),
- url,
- self.pipeline,
- referrer_policy.or(referrer.get_referrer_policy()),
- Some(referrer.url().clone()))
- }
-
/// Create and initiate a new network request.
pub fn load_async(&mut self,
load: LoadType,
listener: AsyncResponseTarget,
referrer: &Document,
referrer_policy: Option<ReferrerPolicy>) {
- let pending = self.prepare_async_load(load, referrer, referrer_policy);
- pending.load_async(listener)
+ let context = load.to_load_context();
+ let url = load.url().clone();
+ self.add_blocking_load(load);
+ load_async(context,
+ self.resource_threads.sender(),
+ url,
+ self.pipeline,
+ referrer_policy.or(referrer.get_referrer_policy()),
+ Some(referrer.url().clone()),
+ listener);
}
/// Initiate a new fetch.
pub fn fetch_async(&mut self,
load: LoadType,
request: RequestInit,
- fetch_target: IpcSender<FetchResponseMsg>,
- referrer: &Document,
- referrer_policy: Option<ReferrerPolicy>) {
- let pending = self.prepare_async_load(load, referrer, referrer_policy);
- pending.fetch_async(request, fetch_target);
+ fetch_target: IpcSender<FetchResponseMsg>) {
+ self.add_blocking_load(load);
+ self.resource_threads.sender().send(CoreResourceMsg::Fetch(request, fetch_target)).unwrap();
}
/// Mark an in-progress network request complete.
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 711f44b4cd4..7c6b2fe3718 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -462,8 +462,7 @@ class CGMethodCall(CGThing):
pickFirstSignature("%s.get().is_object() && is_array_like(cx, %s)" %
(distinguishingArg, distinguishingArg),
lambda s:
- (s[1][distinguishingIndex].type.isArray() or
- s[1][distinguishingIndex].type.isSequence() or
+ (s[1][distinguishingIndex].type.isSequence() or
s[1][distinguishingIndex].type.isObject()))
# Check for Date objects
@@ -537,9 +536,6 @@ def typeIsSequenceOrHasSequenceMember(type):
type = type.inner
if type.isSequence():
return True
- if type.isArray():
- elementType = type.inner
- return typeIsSequenceOrHasSequenceMember(elementType)
if type.isDictionary():
return dictionaryHasSequenceMember(type.inner)
if type.isUnion():
@@ -732,9 +728,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
assert not (isEnforceRange and isClamp) # These are mutually exclusive
- if type.isArray():
- raise TypeError("Can't handle array arguments yet")
-
if type.isSequence() or type.isMozMap():
innerInfo = getJSToNativeConversionInfo(innerContainerType(type),
descriptorProvider,
@@ -1309,7 +1302,7 @@ def typeNeedsCx(type, retVal=False):
return False
if type.nullable():
type = type.inner
- if type.isSequence() or type.isArray():
+ if type.isSequence():
type = type.inner
if type.isUnion():
return any(typeNeedsCx(t) for t in type.unroll().flatMemberTypes)
@@ -1612,7 +1605,7 @@ class MethodDefiner(PropertyDefiner):
"name": "forEach",
"methodInfo": False,
"selfHostedName": "ArrayForEach",
- "length": 0,
+ "length": 1,
"condition": PropertyDefiner.getControllingCondition(m,
descriptor)
})
@@ -3809,9 +3802,6 @@ class CGMemberJITInfo(CGThing):
if t.isVoid():
# No return, every time
return "JSVAL_TYPE_UNDEFINED"
- if t.isArray():
- # No idea yet
- assert False
if t.isSequence():
return "JSVAL_TYPE_OBJECT"
if t.isMozMap():
@@ -3887,9 +3877,6 @@ class CGMemberJITInfo(CGThing):
if t.nullable():
# Sometimes it might return null, sometimes not
return "JSJitInfo_ArgType::Null as i32 | %s" % CGMemberJITInfo.getJSArgType(t.inner)
- if t.isArray():
- # No idea yet
- assert False
if t.isSequence():
return "JSJitInfo_ArgType::Object as i32"
if t.isGeckoInterface():
@@ -4153,7 +4140,7 @@ class CGUnionConversionStruct(CGThing):
else:
interfaceObject = None
- arrayObjectMemberTypes = filter(lambda t: t.isArray() or t.isSequence(), memberTypes)
+ arrayObjectMemberTypes = filter(lambda t: t.isSequence(), memberTypes)
if len(arrayObjectMemberTypes) > 0:
assert len(arrayObjectMemberTypes) == 1
typeName = arrayObjectMemberTypes[0].name
@@ -4767,7 +4754,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
def __init__(self, descriptor):
args = [Argument('*mut JSContext', 'cx'), Argument('HandleObject', 'proxy'),
Argument('HandleId', 'id'),
- Argument('MutableHandle<PropertyDescriptor>', 'desc', mutable=True)]
+ Argument('MutableHandle<PropertyDescriptor>', 'desc')]
CGAbstractExternMethod.__init__(self, descriptor, "getOwnPropertyDescriptor",
"bool", args)
self.descriptor = descriptor
@@ -4786,7 +4773,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
attrs += " | JSPROP_READONLY"
# FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
fillDescriptor = ("desc.get().value = result_root.get();\n"
- "fill_property_descriptor(&mut desc, proxy.get(), %s);\n"
+ "fill_property_descriptor(desc, proxy.get(), %s);\n"
"return true;" % attrs)
templateValues = {
'jsvalRef': 'result_root.handle_mut()',
@@ -4812,7 +4799,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
attrs = "0"
# FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
fillDescriptor = ("desc.get().value = result_root.get();\n"
- "fill_property_descriptor(&mut desc, proxy.get(), %s);\n"
+ "fill_property_descriptor(desc, proxy.get(), %s);\n"
"return true;" % attrs)
templateValues = {
'jsvalRef': 'result_root.handle_mut()',
@@ -5641,13 +5628,6 @@ class CGDescriptor(CGThing):
return name
cgThings = []
- if not descriptor.interface.isCallback() and not descriptor.interface.isNamespace():
- cgThings.append(CGGetProtoObjectMethod(descriptor))
- reexports.append('GetProtoObject')
- if (descriptor.interface.hasInterfaceObject() and
- descriptor.shouldHaveGetConstructorObjectMethod()):
- cgThings.append(CGGetConstructorObjectMethod(descriptor))
- reexports.append('GetConstructorObject')
unscopableNames = []
for m in descriptor.interface.members:
@@ -5694,17 +5674,6 @@ class CGDescriptor(CGThing):
cgThings.append(CGClassFinalizeHook(descriptor))
cgThings.append(CGClassTraceHook(descriptor))
- if descriptor.interface.hasInterfaceObject():
- if descriptor.interface.ctor():
- cgThings.append(CGClassConstructHook(descriptor))
- for ctor in descriptor.interface.namedConstructors:
- cgThings.append(CGClassConstructHook(descriptor, ctor))
- if not descriptor.interface.isCallback():
- cgThings.append(CGInterfaceObjectJSClass(descriptor))
-
- if not descriptor.interface.isCallback() and not descriptor.interface.isNamespace():
- cgThings.append(CGPrototypeJSClass(descriptor))
-
# If there are no constant members, don't make a module for constants
constMembers = [m for m in descriptor.interface.members if m.isConst()]
if constMembers:
@@ -5713,11 +5682,6 @@ class CGDescriptor(CGThing):
public=True))
reexports.append(descriptor.name + 'Constants')
- if descriptor.interface.hasInterfaceObject() and descriptor.register:
- cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
- reexports.append('DefineDOMInterface')
- cgThings.append(CGConstructorEnabled(descriptor))
-
if descriptor.proxy:
cgThings.append(CGDefineProxyHandler(descriptor))
@@ -5779,6 +5743,25 @@ class CGDescriptor(CGThing):
cgThings.append(CGWeakReferenceableTrait(descriptor))
cgThings.append(CGGeneric(str(properties)))
+
+ if not descriptor.interface.isCallback() and not descriptor.interface.isNamespace():
+ cgThings.append(CGGetProtoObjectMethod(descriptor))
+ reexports.append('GetProtoObject')
+ cgThings.append(CGPrototypeJSClass(descriptor))
+ if descriptor.interface.hasInterfaceObject():
+ if descriptor.interface.ctor():
+ cgThings.append(CGClassConstructHook(descriptor))
+ for ctor in descriptor.interface.namedConstructors:
+ cgThings.append(CGClassConstructHook(descriptor, ctor))
+ if not descriptor.interface.isCallback():
+ cgThings.append(CGInterfaceObjectJSClass(descriptor))
+ if descriptor.shouldHaveGetConstructorObjectMethod():
+ cgThings.append(CGGetConstructorObjectMethod(descriptor))
+ reexports.append('GetConstructorObject')
+ if descriptor.register:
+ cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
+ reexports.append('DefineDOMInterface')
+ cgThings.append(CGConstructorEnabled(descriptor))
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables))
cgThings = generate_imports(config, CGList(cgThings, '\n'), [descriptor])
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py
index 878c221f01c..2894bbeb82e 100644
--- a/components/script/dom/bindings/codegen/parser/WebIDL.py
+++ b/components/script/dom/bindings/codegen/parser/WebIDL.py
@@ -9,6 +9,7 @@ import re
import os
import traceback
import math
+import string
from collections import defaultdict
# Machinery
@@ -1850,7 +1851,6 @@ class IDLDictionary(IDLObjectWithScope):
"""
if (memberType.nullable() or
- memberType.isArray() or
memberType.isSequence() or
memberType.isMozMap()):
return typeContainsDictionary(memberType.inner, dictionary)
@@ -1973,8 +1973,7 @@ class IDLType(IDLObject):
'callback',
'union',
'sequence',
- 'mozmap',
- 'array'
+ 'mozmap'
)
def __init__(self, location, name):
@@ -2027,9 +2026,6 @@ class IDLType(IDLObject):
def isMozMap(self):
return False
- def isArray(self):
- return False
-
def isArrayBuffer(self):
return False
@@ -2255,9 +2251,6 @@ class IDLNullableType(IDLParameterizedType):
def isMozMap(self):
return self.inner.isMozMap()
- def isArray(self):
- return self.inner.isArray()
-
def isArrayBuffer(self):
return self.inner.isArrayBuffer()
@@ -2360,9 +2353,6 @@ class IDLSequenceType(IDLParameterizedType):
def isSequence(self):
return True
- def isArray(self):
- return False
-
def isDictionary(self):
return False
@@ -2575,106 +2565,6 @@ class IDLUnionType(IDLType):
return set(self.memberTypes)
-class IDLArrayType(IDLType):
- def __init__(self, location, parameterType):
- assert not parameterType.isVoid()
- if parameterType.isSequence():
- raise WebIDLError("Array type cannot parameterize over a sequence type",
- [location])
- if parameterType.isMozMap():
- raise WebIDLError("Array type cannot parameterize over a MozMap type",
- [location])
- if parameterType.isDictionary():
- raise WebIDLError("Array type cannot parameterize over a dictionary type",
- [location])
-
- IDLType.__init__(self, location, parameterType.name)
- self.inner = parameterType
- self.builtin = False
-
- def __eq__(self, other):
- return isinstance(other, IDLArrayType) and self.inner == other.inner
-
- def __str__(self):
- return self.inner.__str__() + "Array"
-
- def nullable(self):
- return False
-
- def isPrimitive(self):
- return False
-
- def isString(self):
- return False
-
- def isByteString(self):
- return False
-
- def isDOMString(self):
- return False
-
- def isUSVString(self):
- return False
-
- def isVoid(self):
- return False
-
- def isSequence(self):
- assert not self.inner.isSequence()
- return False
-
- def isArray(self):
- return True
-
- def isDictionary(self):
- assert not self.inner.isDictionary()
- return False
-
- def isInterface(self):
- return False
-
- def isEnum(self):
- return False
-
- def tag(self):
- return IDLType.Tags.array
-
- def resolveType(self, parentScope):
- assert isinstance(parentScope, IDLScope)
- self.inner.resolveType(parentScope)
-
- def isComplete(self):
- return self.inner.isComplete()
-
- def complete(self, scope):
- self.inner = self.inner.complete(scope)
- self.name = self.inner.name
-
- if self.inner.isDictionary():
- raise WebIDLError("Array type must not contain "
- "dictionary as element type.",
- [self.inner.location])
-
- assert not self.inner.isSequence()
-
- return self
-
- def unroll(self):
- return self.inner.unroll()
-
- def isDistinguishableFrom(self, other):
- if other.isPromise():
- return False
- if other.isUnion():
- # Just forward to the union; it'll deal
- return other.isDistinguishableFrom(self)
- return (other.isPrimitive() or other.isString() or other.isEnum() or
- other.isDate() or other.isNonCallbackInterface())
-
- def _getDependentObjects(self):
- return self.inner._getDependentObjects()
-
-
class IDLTypedefType(IDLType):
def __init__(self, location, innerType, name):
IDLType.__init__(self, location, name)
@@ -2720,9 +2610,6 @@ class IDLTypedefType(IDLType):
def isMozMap(self):
return self.inner.isMozMap()
- def isArray(self):
- return self.inner.isArray()
-
def isDictionary(self):
return self.inner.isDictionary()
@@ -2838,9 +2725,6 @@ class IDLWrapperType(IDLType):
def isSequence(self):
return False
- def isArray(self):
- return False
-
def isDictionary(self):
return isinstance(self.inner, IDLDictionary)
@@ -2907,8 +2791,7 @@ class IDLWrapperType(IDLType):
if self.isEnum():
return (other.isPrimitive() or other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or
- other.isSequence() or other.isMozMap() or other.isArray() or
- other.isDate())
+ other.isSequence() or other.isMozMap() or other.isDate())
if self.isDictionary() and other.nullable():
return False
if (other.isPrimitive() or other.isString() or other.isEnum() or
@@ -2930,7 +2813,7 @@ class IDLWrapperType(IDLType):
(self.isNonCallbackInterface() or
other.isNonCallbackInterface()))
if (other.isDictionary() or other.isCallback() or
- other.isMozMap() or other.isArray()):
+ other.isMozMap()):
return self.isNonCallbackInterface()
# Not much else |other| can be
@@ -3140,20 +3023,17 @@ class IDLBuiltinType(IDLType):
return (other.isNumeric() or other.isString() or other.isEnum() or
other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or
- other.isSequence() or other.isMozMap() or other.isArray() or
- other.isDate())
+ other.isSequence() or other.isMozMap() or other.isDate())
if self.isNumeric():
return (other.isBoolean() or other.isString() or other.isEnum() or
other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or
- other.isSequence() or other.isMozMap() or other.isArray() or
- other.isDate())
+ other.isSequence() or other.isMozMap() or other.isDate())
if self.isString():
return (other.isPrimitive() or other.isInterface() or
other.isObject() or
other.isCallback() or other.isDictionary() or
- other.isSequence() or other.isMozMap() or other.isArray() or
- other.isDate())
+ other.isSequence() or other.isMozMap() or other.isDate())
if self.isAny():
# Can't tell "any" apart from anything
return False
@@ -3163,7 +3043,7 @@ class IDLBuiltinType(IDLType):
return (other.isPrimitive() or other.isString() or other.isEnum() or
other.isInterface() or other.isCallback() or
other.isDictionary() or other.isSequence() or
- other.isMozMap() or other.isArray())
+ other.isMozMap())
if self.isVoid():
return not other.isVoid()
# Not much else we could be!
@@ -3171,8 +3051,7 @@ class IDLBuiltinType(IDLType):
# Like interfaces, but we know we're not a callback
return (other.isPrimitive() or other.isString() or other.isEnum() or
other.isCallback() or other.isDictionary() or
- other.isSequence() or other.isMozMap() or other.isArray() or
- other.isDate() or
+ other.isSequence() or other.isMozMap() or other.isDate() or
(other.isInterface() and (
# ArrayBuffer is distinguishable from everything
# that's not an ArrayBuffer or a callback interface
@@ -3311,6 +3190,11 @@ def matchIntegerValueToType(value):
return None
+class NoCoercionFoundError(WebIDLError):
+ """
+ A class we use to indicate generic coercion failures because none of the
+ types worked out in IDLValue.coerceToType.
+ """
class IDLValue(IDLObject):
def __init__(self, location, type, value):
@@ -3338,8 +3222,18 @@ class IDLValue(IDLObject):
# use the value's type when it is a default value of a
# union, and the union cares about the exact float type.
return IDLValue(self.location, subtype, coercedValue.value)
- except:
- pass
+ except Exception as e:
+ # Make sure to propagate out WebIDLErrors that are not the
+ # generic "hey, we could not coerce to this type at all"
+ # exception, because those are specific "coercion failed for
+ # reason X" exceptions. Note that we want to swallow
+ # non-WebIDLErrors here, because those can just happen if
+ # "type" is not something that can have a default value at
+ # all.
+ if (isinstance(e, WebIDLError) and
+ not isinstance(e, NoCoercionFoundError)):
+ raise e
+
# If the type allows null, rerun this matching on the inner type, except
# nullable enums. We handle those specially, because we want our
# default string values to stay strings even when assigned to a nullable
@@ -3388,12 +3282,21 @@ class IDLValue(IDLObject):
assert self.type.isDOMString()
return self
elif self.type.isString() and type.isByteString():
- # Allow ByteStrings to use default value just like
- # DOMString. No coercion is required here.
- assert self.type.isDOMString()
- return self
- raise WebIDLError("Cannot coerce type %s to type %s." %
- (self.type, type), [location])
+ # Allow ByteStrings to use a default value like DOMString.
+ # No coercion is required as Codegen.py will handle the
+ # extra steps. We want to make sure that our string contains
+ # only valid characters, so we check that here.
+ valid_ascii_lit = " " + string.ascii_letters + string.digits + string.punctuation
+ for idx, c in enumerate(self.value):
+ if c not in valid_ascii_lit:
+ raise WebIDLError("Coercing this string literal %s to a ByteString is not supported yet. "
+ "Coercion failed due to an unsupported byte %d at index %d."
+ % (self.value.__repr__(), ord(c), idx), [location])
+
+ return IDLValue(self.location, type, self.value)
+
+ raise NoCoercionFoundError("Cannot coerce type %s to type %s." %
+ (self.type, type), [location])
def _getDependentObjects(self):
return set()
@@ -4568,12 +4471,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
base=IDLInterfaceMember.Special
)
- TypeSuffixModifier = enum(
- 'None',
- 'QMark',
- 'Brackets'
- )
-
NamedOrIndexed = enum(
'Neither',
'Named',
@@ -5743,14 +5640,6 @@ class Parser(Tokenizer):
booleanType = BuiltinTypes[IDLBuiltinType.Types.boolean]
p[0] = IDLValue(location, booleanType, p[1])
- def p_ConstValueByteString(self, p):
- """
- ConstValue : BYTESTRING
- """
- location = self.getLocation(p, 1)
- bytestringType = BuiltinTypes[IDLBuiltinType.Types.bytestring]
- p[0] = IDLValue(location, bytestringType, p[1])
-
def p_ConstValueInteger(self, p):
"""
ConstValue : INTEGER
@@ -6383,9 +6272,9 @@ class Parser(Tokenizer):
def p_TypeUnionType(self, p):
"""
- Type : UnionType TypeSuffix
+ Type : UnionType Null
"""
- p[0] = self.handleModifiers(p[1], p[2])
+ p[0] = self.handleNullable(p[1], p[2])
def p_SingleTypeNonAnyType(self, p):
"""
@@ -6395,9 +6284,9 @@ class Parser(Tokenizer):
def p_SingleTypeAnyType(self, p):
"""
- SingleType : ANY TypeSuffixStartingWithArray
+ SingleType : ANY
"""
- p[0] = self.handleModifiers(BuiltinTypes[IDLBuiltinType.Types.any], p[2])
+ p[0] = BuiltinTypes[IDLBuiltinType.Types.any]
def p_UnionType(self, p):
"""
@@ -6413,19 +6302,11 @@ class Parser(Tokenizer):
"""
p[0] = p[1]
- def p_UnionMemberTypeArrayOfAny(self, p):
- """
- UnionMemberTypeArrayOfAny : ANY LBRACKET RBRACKET
- """
- p[0] = IDLArrayType(self.getLocation(p, 2),
- BuiltinTypes[IDLBuiltinType.Types.any])
-
def p_UnionMemberType(self, p):
"""
- UnionMemberType : UnionType TypeSuffix
- | UnionMemberTypeArrayOfAny TypeSuffix
+ UnionMemberType : UnionType Null
"""
- p[0] = self.handleModifiers(p[1], p[2])
+ p[0] = self.handleNullable(p[1], p[2])
def p_UnionMemberTypes(self, p):
"""
@@ -6442,10 +6323,10 @@ class Parser(Tokenizer):
def p_NonAnyType(self, p):
"""
- NonAnyType : PrimitiveOrStringType TypeSuffix
- | ARRAYBUFFER TypeSuffix
- | SHAREDARRAYBUFFER TypeSuffix
- | OBJECT TypeSuffix
+ NonAnyType : PrimitiveOrStringType Null
+ | ARRAYBUFFER Null
+ | SHAREDARRAYBUFFER Null
+ | OBJECT Null
"""
if p[1] == "object":
type = BuiltinTypes[IDLBuiltinType.Types.object]
@@ -6456,7 +6337,7 @@ class Parser(Tokenizer):
else:
type = BuiltinTypes[p[1]]
- p[0] = self.handleModifiers(type, p[2])
+ p[0] = self.handleNullable(type, p[2])
def p_NonAnyTypeSequenceType(self, p):
"""
@@ -6464,9 +6345,7 @@ class Parser(Tokenizer):
"""
innerType = p[3]
type = IDLSequenceType(self.getLocation(p, 1), innerType)
- if p[5]:
- type = IDLNullableType(self.getLocation(p, 5), type)
- p[0] = type
+ p[0] = self.handleNullable(type, p[5])
# Note: Promise<void> is allowed, so we want to parametrize on
# ReturnType, not Type. Also, we want this to end up picking up
@@ -6478,9 +6357,7 @@ class Parser(Tokenizer):
innerType = p[3]
promiseIdent = IDLUnresolvedIdentifier(self.getLocation(p, 1), "Promise")
type = IDLUnresolvedType(self.getLocation(p, 1), promiseIdent, p[3])
- if p[5]:
- type = IDLNullableType(self.getLocation(p, 5), type)
- p[0] = type
+ p[0] = self.handleNullable(type, p[5])
def p_NonAnyTypeMozMapType(self, p):
"""
@@ -6488,13 +6365,11 @@ class Parser(Tokenizer):
"""
innerType = p[3]
type = IDLMozMapType(self.getLocation(p, 1), innerType)
- if p[5]:
- type = IDLNullableType(self.getLocation(p, 5), type)
- p[0] = type
+ p[0] = self.handleNullable(type, p[5])
def p_NonAnyTypeScopedName(self, p):
"""
- NonAnyType : ScopedName TypeSuffix
+ NonAnyType : ScopedName Null
"""
assert isinstance(p[1], IDLUnresolvedIdentifier)
@@ -6516,29 +6391,27 @@ class Parser(Tokenizer):
type = IDLCallbackType(obj.location, obj)
else:
type = IDLWrapperType(self.getLocation(p, 1), p[1])
- p[0] = self.handleModifiers(type, p[2])
+ p[0] = self.handleNullable(type, p[2])
return
except:
pass
type = IDLUnresolvedType(self.getLocation(p, 1), p[1])
- p[0] = self.handleModifiers(type, p[2])
+ p[0] = self.handleNullable(type, p[2])
def p_NonAnyTypeDate(self, p):
"""
- NonAnyType : DATE TypeSuffix
+ NonAnyType : DATE Null
"""
- p[0] = self.handleModifiers(BuiltinTypes[IDLBuiltinType.Types.date],
- p[2])
+ p[0] = self.handleNullable(BuiltinTypes[IDLBuiltinType.Types.date],
+ p[2])
def p_ConstType(self, p):
"""
ConstType : PrimitiveOrStringType Null
"""
type = BuiltinTypes[p[1]]
- if p[2]:
- type = IDLNullableType(self.getLocation(p, 1), type)
- p[0] = type
+ p[0] = self.handleNullable(type, p[2])
def p_ConstTypeIdentifier(self, p):
"""
@@ -6547,9 +6420,7 @@ class Parser(Tokenizer):
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 1), p[1])
type = IDLUnresolvedType(self.getLocation(p, 1), identifier)
- if p[2]:
- type = IDLNullableType(self.getLocation(p, 1), type)
- p[0] = type
+ p[0] = self.handleNullable(type, p[2])
def p_PrimitiveOrStringTypeUint(self, p):
"""
@@ -6657,48 +6528,15 @@ class Parser(Tokenizer):
"""
p[0] = False
- def p_TypeSuffixBrackets(self, p):
- """
- TypeSuffix : LBRACKET RBRACKET TypeSuffix
- """
- p[0] = [(IDLMethod.TypeSuffixModifier.Brackets, self.getLocation(p, 1))]
- p[0].extend(p[3])
-
- def p_TypeSuffixQMark(self, p):
- """
- TypeSuffix : QUESTIONMARK TypeSuffixStartingWithArray
- """
- p[0] = [(IDLMethod.TypeSuffixModifier.QMark, self.getLocation(p, 1))]
- p[0].extend(p[2])
-
- def p_TypeSuffixEmpty(self, p):
- """
- TypeSuffix :
- """
- p[0] = []
-
- def p_TypeSuffixStartingWithArray(self, p):
- """
- TypeSuffixStartingWithArray : LBRACKET RBRACKET TypeSuffix
- """
- p[0] = [(IDLMethod.TypeSuffixModifier.Brackets, self.getLocation(p, 1))]
- p[0].extend(p[3])
-
- def p_TypeSuffixStartingWithArrayEmpty(self, p):
- """
- TypeSuffixStartingWithArray :
- """
- p[0] = []
-
def p_Null(self, p):
"""
Null : QUESTIONMARK
|
"""
if len(p) > 1:
- p[0] = True
+ p[0] = self.getLocation(p, 1)
else:
- p[0] = False
+ p[0] = None
def p_ReturnTypeType(self, p):
"""
@@ -6857,15 +6695,9 @@ class Parser(Tokenizer):
typedef = IDLTypedef(BuiltinLocation("<builtin type>"), scope, builtin, name)
@ staticmethod
- def handleModifiers(type, modifiers):
- for (modifier, modifierLocation) in modifiers:
- assert (modifier == IDLMethod.TypeSuffixModifier.QMark or
- modifier == IDLMethod.TypeSuffixModifier.Brackets)
-
- if modifier == IDLMethod.TypeSuffixModifier.QMark:
- type = IDLNullableType(modifierLocation, type)
- elif modifier == IDLMethod.TypeSuffixModifier.Brackets:
- type = IDLArrayType(modifierLocation, type)
+ def handleNullable(type, questionMarkLocation):
+ if questionMarkLocation is not None:
+ type = IDLNullableType(questionMarkLocation, type)
return type
diff --git a/components/script/dom/bindings/codegen/parser/bytestring.patch b/components/script/dom/bindings/codegen/parser/bytestring.patch
deleted file mode 100644
index 823f14cf996..00000000000
--- a/components/script/dom/bindings/codegen/parser/bytestring.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- WebIDL.py
-+++ WebIDL.py
-@@ -3391,6 +3391,11 @@ class IDLValue(IDLObject):
- # extra normalization step.
- assert self.type.isDOMString()
- return self
-+ elif self.type.isString() and type.isByteString():
-+ # Allow ByteStrings to use default value just like
-+ # DOMString. No coercion is required here.
-+ assert self.type.isDOMString()
-+ return self
- raise WebIDLError("Cannot coerce type %s to type %s." %
- (self.type, type), [location])
-
-@@ -5759,6 +5764,14 @@ class Parser(Tokenizer):
- booleanType = BuiltinTypes[IDLBuiltinType.Types.boolean]
- p[0] = IDLValue(location, booleanType, p[1])
-
-+ def p_ConstValueByteString(self, p):
-+ """
-+ ConstValue : BYTESTRING
-+ """
-+ location = self.getLocation(p, 1)
-+ bytestringType = BuiltinTypes[IDLBuiltinType.Types.bytestring]
-+ p[0] = IDLValue(location, bytestringType, p[1])
-+
- def p_ConstValueInteger(self, p):
- """
- ConstValue : INTEGER
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_array.py b/components/script/dom/bindings/codegen/parser/tests/test_array.py
deleted file mode 100644
index 8f9e9c96854..00000000000
--- a/components/script/dom/bindings/codegen/parser/tests/test_array.py
+++ /dev/null
@@ -1,18 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- dictionary Foo {
- short a;
- };
-
- dictionary Foo1 {
- Foo[] b;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Array must not contain dictionary "
- "as element type.")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py b/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py
deleted file mode 100644
index 26528984595..00000000000
--- a/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py
+++ /dev/null
@@ -1,13 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface A {
- attribute long a;
- };
-
- interface B {
- attribute A[] b;
- };
- """);
- parser.finish()
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py b/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py
index 5b8e56f86ca..4a96c0ff512 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py
@@ -4,37 +4,37 @@ def WebIDLTest(parser, harness):
parser.parse("""
interface TestArrayBuffer {
attribute ArrayBuffer bufferAttr;
- void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, ArrayBuffer[] arg3, sequence<ArrayBuffer> arg4);
+ void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, sequence<ArrayBuffer> arg3);
attribute ArrayBufferView viewAttr;
- void viewMethod(ArrayBufferView arg1, ArrayBufferView? arg2, ArrayBufferView[] arg3, sequence<ArrayBufferView> arg4);
+ void viewMethod(ArrayBufferView arg1, ArrayBufferView? arg2, sequence<ArrayBufferView> arg3);
attribute Int8Array int8ArrayAttr;
- void int8ArrayMethod(Int8Array arg1, Int8Array? arg2, Int8Array[] arg3, sequence<Int8Array> arg4);
+ void int8ArrayMethod(Int8Array arg1, Int8Array? arg2, sequence<Int8Array> arg3);
attribute Uint8Array uint8ArrayAttr;
- void uint8ArrayMethod(Uint8Array arg1, Uint8Array? arg2, Uint8Array[] arg3, sequence<Uint8Array> arg4);
+ void uint8ArrayMethod(Uint8Array arg1, Uint8Array? arg2, sequence<Uint8Array> arg3);
attribute Uint8ClampedArray uint8ClampedArrayAttr;
- void uint8ClampedArrayMethod(Uint8ClampedArray arg1, Uint8ClampedArray? arg2, Uint8ClampedArray[] arg3, sequence<Uint8ClampedArray> arg4);
+ void uint8ClampedArrayMethod(Uint8ClampedArray arg1, Uint8ClampedArray? arg2, sequence<Uint8ClampedArray> arg3);
attribute Int16Array int16ArrayAttr;
- void int16ArrayMethod(Int16Array arg1, Int16Array? arg2, Int16Array[] arg3, sequence<Int16Array> arg4);
+ void int16ArrayMethod(Int16Array arg1, Int16Array? arg2, sequence<Int16Array> arg3);
attribute Uint16Array uint16ArrayAttr;
- void uint16ArrayMethod(Uint16Array arg1, Uint16Array? arg2, Uint16Array[] arg3, sequence<Uint16Array> arg4);
+ void uint16ArrayMethod(Uint16Array arg1, Uint16Array? arg2, sequence<Uint16Array> arg3);
attribute Int32Array int32ArrayAttr;
- void int32ArrayMethod(Int32Array arg1, Int32Array? arg2, Int32Array[] arg3, sequence<Int32Array> arg4);
+ void int32ArrayMethod(Int32Array arg1, Int32Array? arg2, sequence<Int32Array> arg3);
attribute Uint32Array uint32ArrayAttr;
- void uint32ArrayMethod(Uint32Array arg1, Uint32Array? arg2, Uint32Array[] arg3, sequence<Uint32Array> arg4);
+ void uint32ArrayMethod(Uint32Array arg1, Uint32Array? arg2, sequence<Uint32Array> arg3);
attribute Float32Array float32ArrayAttr;
- void float32ArrayMethod(Float32Array arg1, Float32Array? arg2, Float32Array[] arg3, sequence<Float32Array> arg4);
+ void float32ArrayMethod(Float32Array arg1, Float32Array? arg2, sequence<Float32Array> arg3);
attribute Float64Array float64ArrayAttr;
- void float64ArrayMethod(Float64Array arg1, Float64Array? arg2, Float64Array[] arg3, sequence<Float64Array> arg4);
+ void float64ArrayMethod(Float64Array arg1, Float64Array? arg2, sequence<Float64Array> arg3);
};
""")
@@ -56,7 +56,7 @@ def WebIDLTest(parser, harness):
(retType, arguments) = method.signatures()[0]
harness.ok(retType.isVoid(), "Should have a void return type")
- harness.check(len(arguments), 4, "Expect 4 arguments")
+ harness.check(len(arguments), 3, "Expect 3 arguments")
harness.check(str(arguments[0].type), t, "Expect an ArrayBuffer type")
harness.ok(arguments[0].type.isSpiderMonkeyInterface(), "Should test as a js interface")
@@ -64,12 +64,9 @@ def WebIDLTest(parser, harness):
harness.check(str(arguments[1].type), t + "OrNull", "Expect an ArrayBuffer type")
harness.ok(arguments[1].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
- harness.check(str(arguments[2].type), t + "Array", "Expect an ArrayBuffer type")
+ harness.check(str(arguments[2].type), t + "Sequence", "Expect an ArrayBuffer type")
harness.ok(arguments[2].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
- harness.check(str(arguments[3].type), t + "Sequence", "Expect an ArrayBuffer type")
- harness.ok(arguments[3].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
-
checkStuff(members[0], members[1], "ArrayBuffer")
checkStuff(members[2], members[3], "ArrayBufferView")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_attr.py b/components/script/dom/bindings/codegen/parser/tests/test_attr.py
index fb0c9196460..ad7aabc1918 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_attr.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_attr.py
@@ -77,110 +77,6 @@ def WebIDLTest(parser, harness):
attribute float? f;
readonly attribute float? rf;
};
-
- interface TestAttrArray {
- attribute byte[] b;
- readonly attribute byte[] rb;
- attribute octet[] o;
- readonly attribute octet[] ro;
- attribute short[] s;
- readonly attribute short[] rs;
- attribute unsigned short[] us;
- readonly attribute unsigned short[] rus;
- attribute long[] l;
- readonly attribute long[] rl;
- attribute unsigned long[] ul;
- readonly attribute unsigned long[] rul;
- attribute long long[] ll;
- readonly attribute long long[] rll;
- attribute unsigned long long[] ull;
- readonly attribute unsigned long long[] rull;
- attribute DOMString[] str;
- readonly attribute DOMString[] rstr;
- attribute object[] obj;
- readonly attribute object[] robj;
- attribute object[] _object;
- attribute float[] f;
- readonly attribute float[] rf;
- };
-
- interface TestAttrNullableArray {
- attribute byte[]? b;
- readonly attribute byte[]? rb;
- attribute octet[]? o;
- readonly attribute octet[]? ro;
- attribute short[]? s;
- readonly attribute short[]? rs;
- attribute unsigned short[]? us;
- readonly attribute unsigned short[]? rus;
- attribute long[]? l;
- readonly attribute long[]? rl;
- attribute unsigned long[]? ul;
- readonly attribute unsigned long[]? rul;
- attribute long long[]? ll;
- readonly attribute long long[]? rll;
- attribute unsigned long long[]? ull;
- readonly attribute unsigned long long[]? rull;
- attribute DOMString[]? str;
- readonly attribute DOMString[]? rstr;
- attribute object[]? obj;
- readonly attribute object[]? robj;
- attribute object[]? _object;
- attribute float[]? f;
- readonly attribute float[]? rf;
- };
-
- interface TestAttrArrayOfNullableTypes {
- attribute byte?[] b;
- readonly attribute byte?[] rb;
- attribute octet?[] o;
- readonly attribute octet?[] ro;
- attribute short?[] s;
- readonly attribute short?[] rs;
- attribute unsigned short?[] us;
- readonly attribute unsigned short?[] rus;
- attribute long?[] l;
- readonly attribute long?[] rl;
- attribute unsigned long?[] ul;
- readonly attribute unsigned long?[] rul;
- attribute long long?[] ll;
- readonly attribute long long?[] rll;
- attribute unsigned long long?[] ull;
- readonly attribute unsigned long long?[] rull;
- attribute DOMString?[] str;
- readonly attribute DOMString?[] rstr;
- attribute object?[] obj;
- readonly attribute object?[] robj;
- attribute object?[] _object;
- attribute float?[] f;
- readonly attribute float?[] rf;
- };
-
- interface TestAttrNullableArrayOfNullableTypes {
- attribute byte?[]? b;
- readonly attribute byte?[]? rb;
- attribute octet?[]? o;
- readonly attribute octet?[]? ro;
- attribute short?[]? s;
- readonly attribute short?[]? rs;
- attribute unsigned short?[]? us;
- readonly attribute unsigned short?[]? rus;
- attribute long?[]? l;
- readonly attribute long?[]? rl;
- attribute unsigned long?[]? ul;
- readonly attribute unsigned long?[]? rul;
- attribute long long?[]? ll;
- readonly attribute long long?[]? rll;
- attribute unsigned long long?[]? ull;
- readonly attribute unsigned long long?[]? rull;
- attribute DOMString?[]? str;
- readonly attribute DOMString?[]? rstr;
- attribute object?[]? obj;
- readonly attribute object?[]? robj;
- attribute object?[]? _object;
- attribute float?[]? f;
- readonly attribute float?[]? rf;
- };
""")
results = parser.finish()
@@ -197,7 +93,7 @@ def WebIDLTest(parser, harness):
harness.check(attr.readonly, readonly, "Attr's readonly state is correct")
harness.ok(True, "TestAttr interface parsed without error.")
- harness.check(len(results), 6, "Should be six productions.")
+ harness.check(len(results), 2, "Should be two productions.")
iface = results[0]
harness.ok(isinstance(iface, WebIDL.IDLInterface),
"Should be an IDLInterface")
@@ -228,66 +124,6 @@ def WebIDLTest(parser, harness):
(QName, name, type, readonly) = data
checkAttr(attr, QName % "Nullable", name, type % "OrNull", readonly)
- iface = results[2]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrArray", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrArray", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "Array", name, type % "Array", readonly)
-
- iface = results[3]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrNullableArray", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrNullableArray", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "NullableArray", name, type % "ArrayOrNull", readonly)
-
- iface = results[4]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrArrayOfNullableTypes", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrArrayOfNullableTypes", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "ArrayOfNullableTypes", name, type % "OrNullArray", readonly)
-
- iface = results[5]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrNullableArrayOfNullableTypes", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrNullableArrayOfNullableTypes", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "NullableArrayOfNullableTypes", name, type % "OrNullArrayOrNull", readonly)
-
parser = parser.reset()
threw = False
try:
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_bytestring.py b/components/script/dom/bindings/codegen/parser/tests/test_bytestring.py
index d73455f8812..fa83e9e2d57 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_bytestring.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_bytestring.py
@@ -13,7 +13,7 @@ def WebIDLTest(parser, harness):
results = parser.finish();
harness.ok(True, "TestByteString interface parsed without error.")
-
+
harness.check(len(results), 1, "Should be one production")
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
@@ -54,10 +54,9 @@ def WebIDLTest(parser, harness):
""")
except WebIDL.WebIDLError:
threw = True
- harness.ok(threw, "Should have thrown a WebIDL error")
+ harness.ok(threw, "Should have thrown a WebIDL error for ByteString default in interface")
- # Cannot have optional ByteStrings with default values
- threw = False
+ # Can have optional ByteStrings with default values
try:
parser.parse("""
interface OptionalByteString {
@@ -65,8 +64,36 @@ def WebIDLTest(parser, harness):
};
""")
results2 = parser.finish();
- except WebIDL.WebIDLError:
- threw = True
+ except WebIDL.WebIDLError as e:
+ harness.ok(False,
+ "Should not have thrown a WebIDL error for ByteString "
+ "default in dictionary. " + str(e))
- harness.ok(threw, "Should have thrown a WebIDL error")
+ # Can have a default ByteString value in a dictionary
+ try:
+ parser.parse("""
+ dictionary OptionalByteStringDict {
+ ByteString item = "some string";
+ };
+ """)
+ results3 = parser.finish();
+ except WebIDL.WebIDLError as e:
+ harness.ok(False,
+ "Should not have thrown a WebIDL error for ByteString "
+ "default in dictionary. " + str(e))
+
+ # Don't allow control characters in ByteString literals
+ threw = False
+ try:
+ parser.parse("""
+ dictionary OptionalByteStringDict2 {
+ ByteString item = "\x03";
+ };
+ """)
+ results4 = parser.finish()
+ except WebIDL.WebIDLError as e:
+ threw = True
+ harness.ok(threw,
+ "Should have thrown a WebIDL error for invalid ByteString "
+ "default in dictionary")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py b/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py
index 866816f2e0c..d7780c1ffa1 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py
@@ -159,7 +159,7 @@ def WebIDLTest(parser, harness):
"object", "Callback", "Callback2", "optional Dict",
"optional Dict2", "sequence<long>", "sequence<short>",
"MozMap<object>", "MozMap<Dict>", "MozMap<long>",
- "long[]", "short[]", "Date", "Date?", "any",
+ "Date", "Date?", "any",
"Promise<any>", "Promise<any>?",
"USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
"Uint8Array", "Uint16Array" ]
@@ -187,7 +187,6 @@ def WebIDLTest(parser, harness):
"Date?", "any", "Promise<any>?"]
dates = [ "Date", "Date?" ]
sequences = [ "sequence<long>", "sequence<short>" ]
- arrays = [ "long[]", "short[]" ]
nonUserObjects = nonObjects + interfaces + dates + sequences
otherObjects = allBut(argTypes, nonUserObjects + ["object"])
notRelatedInterfaces = (nonObjects + ["UnrelatedInterface"] +
@@ -229,14 +228,12 @@ def WebIDLTest(parser, harness):
setDistinguishable("optional Dict", allBut(nonUserObjects, nullables))
setDistinguishable("optional Dict2", allBut(nonUserObjects, nullables))
setDistinguishable("sequence<long>",
- allBut(argTypes, sequences + arrays + ["object"]))
+ allBut(argTypes, sequences + ["object"]))
setDistinguishable("sequence<short>",
- allBut(argTypes, sequences + arrays + ["object"]))
+ allBut(argTypes, sequences + ["object"]))
setDistinguishable("MozMap<object>", nonUserObjects)
setDistinguishable("MozMap<Dict>", nonUserObjects)
setDistinguishable("MozMap<long>", nonUserObjects)
- setDistinguishable("long[]", allBut(nonUserObjects, sequences))
- setDistinguishable("short[]", allBut(nonUserObjects, sequences))
setDistinguishable("Date", allBut(argTypes, dates + ["object"]))
setDistinguishable("Date?", allBut(argTypes, dates + nullables + ["object"]))
setDistinguishable("any", [])
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_method.py b/components/script/dom/bindings/codegen/parser/tests/test_method.py
index f6f54c33ab6..cf7f1b40d76 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_method.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_method.py
@@ -11,7 +11,6 @@ def WebIDLTest(parser, harness):
boolean basicBooleanWithSimpleArgs(boolean arg1, byte arg2, unsigned long arg3);
void optionalArg(optional byte? arg1, optional sequence<byte> arg2);
void variadicArg(byte?... arg1);
- void crazyTypes(sequence<long?[]>? arg1, boolean?[][]? arg2);
object getObject();
void setObject(object arg1);
void setAny(any arg1);
@@ -28,7 +27,7 @@ def WebIDLTest(parser, harness):
"Should be an IDLInterface")
harness.check(iface.identifier.QName(), "::TestMethods", "Interface has the right QName")
harness.check(iface.identifier.name, "TestMethods", "Interface has the right name")
- harness.check(len(iface.members), 13, "Expect 13 members")
+ harness.check(len(iface.members), 12, "Expect 12 members")
methods = iface.members
@@ -98,22 +97,17 @@ def WebIDLTest(parser, harness):
"variadicArg",
[("Void",
[("::TestMethods::variadicArg::arg1", "arg1", "ByteOrNull", True, True)])])
- checkMethod(methods[8], "::TestMethods::crazyTypes",
- "crazyTypes",
- [("Void",
- [("::TestMethods::crazyTypes::arg1", "arg1", "LongOrNullArraySequenceOrNull", False, False),
- ("::TestMethods::crazyTypes::arg2", "arg2", "BooleanOrNullArrayArrayOrNull", False, False)])])
- checkMethod(methods[9], "::TestMethods::getObject",
+ checkMethod(methods[8], "::TestMethods::getObject",
"getObject", [("Object", [])])
- checkMethod(methods[10], "::TestMethods::setObject",
+ checkMethod(methods[9], "::TestMethods::setObject",
"setObject",
[("Void",
[("::TestMethods::setObject::arg1", "arg1", "Object", False, False)])])
- checkMethod(methods[11], "::TestMethods::setAny",
+ checkMethod(methods[10], "::TestMethods::setAny",
"setAny",
[("Void",
[("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
- checkMethod(methods[12], "::TestMethods::doFloats",
+ checkMethod(methods[11], "::TestMethods::doFloats",
"doFloats",
[("Float",
[("::TestMethods::doFloats::arg1", "arg1", "Float", False, False)])])
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py b/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py
index 1f72b2c6e67..2b48b615dd4 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py
@@ -53,16 +53,6 @@ def WebIDLTest(parser, harness):
attribute object a;
attribute object? b;
};
-
- interface TestNullableEquivalency11 {
- attribute double[] a;
- attribute double[]? b;
- };
-
- interface TestNullableEquivalency12 {
- attribute TestNullableEquivalency9[] a;
- attribute TestNullableEquivalency9[]? b;
- };
""")
for decl in parser.finish():
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_union.py b/components/script/dom/bindings/codegen/parser/tests/test_union.py
index 36cacf3ccf4..9c4f2a56ab6 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_union.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_union.py
@@ -139,9 +139,6 @@ def WebIDLTest(parser, harness):
void method${i}(${type} arg);
${type} returnMethod${i}();
attribute ${type} attr${i};
- void arrayMethod${i}(${type}[] arg);
- ${type}[] arrayReturnMethod${i}();
- attribute ${type}[] arrayAttr${i};
void optionalMethod${i}(${type}? arg);
""").substitute(i=i, type=type)
interface += """
diff --git a/components/script/dom/bindings/codegen/parser/union-typedef.patch b/components/script/dom/bindings/codegen/parser/union-typedef.patch
new file mode 100644
index 00000000000..3021e14193f
--- /dev/null
+++ b/components/script/dom/bindings/codegen/parser/union-typedef.patch
@@ -0,0 +1,22 @@
+--- WebIDL.py
++++ WebIDL.py
+@@ -2481,10 +2481,18 @@ class IDLUnionType(IDLType):
+ return type.name
+
+ for (i, type) in enumerate(self.memberTypes):
++ # Exclude typedefs because if given "typedef (B or C) test",
++ # we want AOrTest, not AOrBOrC
++ if not type.isComplete() and not isinstance(type, IDLTypedefType):
++ self.memberTypes[i] = type.complete(scope)
++
++ self.name = "Or".join(typeName(type) for type in self.memberTypes)
++
++ # We do this again to complete the typedef types
++ for (i, type) in enumerate(self.memberTypes):
+ if not type.isComplete():
+ self.memberTypes[i] = type.complete(scope)
+
+- self.name = "Or".join(typeName(type) for type in self.memberTypes)
+ self.flatMemberTypes = list(self.memberTypes)
+ i = 0
+ while i < len(self.flatMemberTypes):
diff --git a/components/script/dom/bindings/codegen/parser/update.sh b/components/script/dom/bindings/codegen/parser/update.sh
index ef1da728b13..6bf56cead30 100755
--- a/components/script/dom/bindings/codegen/parser/update.sh
+++ b/components/script/dom/bindings/codegen/parser/update.sh
@@ -3,7 +3,7 @@ patch < abstract.patch
patch < debug.patch
patch < pref-main-thread.patch
patch < callback-location.patch
-patch < bytestring.patch
+patch < union-typedef.patch
wget https://hg.mozilla.org/mozilla-central/archive/tip.tar.gz/dom/bindings/parser/tests/ -O tests.tar.gz
rm -r tests
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index 9b4125bdc6a..5d679cce2e9 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -10,25 +10,29 @@
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::root_from_object;
-use dom::bindings::error::ErrorInfo;
+use dom::bindings::error::{ErrorInfo, report_pending_exception};
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector};
use dom::console::TimerSet;
-use dom::window::{self, ScriptHelpers};
+use dom::window;
use dom::workerglobalscope::WorkerGlobalScope;
use ipc_channel::ipc::IpcSender;
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use js::glue::{IsWrapper, UnwrapObject};
-use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
-use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
-use js::jsapi::HandleValue;
+use js::jsapi::{CurrentGlobalOrNull, Evaluate2, GetGlobalForObjectCrossCompartment};
+use js::jsapi::{HandleValue, JS_GetClass, JSAutoCompartment, JSContext};
+use js::jsapi::{JSObject, MutableHandleValue};
+use js::rust::CompileOptionsWrapper;
+use libc;
use msg::constellation_msg::PipelineId;
use net_traits::{CoreResourceThread, IpcSend, ResourceThreads};
use profile_traits::{mem, time};
-use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, EnqueuedPromiseCallback};
+use script_runtime::{CommonScriptMsg, EnqueuedPromiseCallback, ScriptChan};
+use script_runtime::{ScriptPort, maybe_take_panic_result};
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest};
-use task_source::dom_manipulation::DOMManipulationTaskSource;
+use std::ffi::CString;
+use std::panic;
use task_source::file_reading::FileReadingTaskSource;
use timers::{OneshotTimerCallback, OneshotTimerHandle};
use url::Url;
@@ -181,15 +185,6 @@ impl<'a> GlobalRef<'a> {
}
}
- /// `TaskSource` used to queue DOM manipulation messages to the event loop of this global's
- /// thread.
- pub fn dom_manipulation_task_source(&self) -> DOMManipulationTaskSource {
- match *self {
- GlobalRef::Window(ref window) => window.dom_manipulation_task_source(),
- GlobalRef::Worker(_) => unimplemented!(),
- }
- }
-
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {
@@ -201,15 +196,6 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> {
- match *self {
- GlobalRef::Window(ref window) => window.history_traversal_task_source(),
- GlobalRef::Worker(ref worker) => worker.script_chan(),
- }
- }
-
- /// `ScriptChan` used to send messages to the event loop of this global's
- /// thread.
pub fn file_reading_task_source(&self) -> FileReadingTaskSource {
match *self {
GlobalRef::Window(ref window) => window.file_reading_task_source(),
@@ -236,12 +222,51 @@ impl<'a> GlobalRef<'a> {
}
}
- /// Evaluate the JS messages on the `RootedValue` of this global
- pub fn evaluate_js_on_global_with_result(&self, code: &str, rval: MutableHandleValue) {
- match *self {
- GlobalRef::Window(window) => window.evaluate_js_on_global_with_result(code, rval),
- GlobalRef::Worker(worker) => worker.evaluate_js_on_global_with_result(code, rval),
- }
+ /// Evaluate JS code on this global.
+ pub fn evaluate_js_on_global_with_result(
+ &self, code: &str, rval: MutableHandleValue) {
+ self.evaluate_script_on_global_with_result(code, "", rval)
+ }
+
+ /// Evaluate a JS script on this global.
+ #[allow(unsafe_code)]
+ pub fn evaluate_script_on_global_with_result(
+ &self, code: &str, filename: &str, rval: MutableHandleValue) {
+ let metadata = time::TimerMetadata {
+ url: if filename.is_empty() {
+ self.get_url().as_str().into()
+ } else {
+ filename.into()
+ },
+ iframe: time::TimerMetadataFrameType::RootWindow,
+ incremental: time::TimerMetadataReflowType::FirstReflow,
+ };
+ time::profile(
+ time::ProfilerCategory::ScriptEvaluate,
+ Some(metadata),
+ self.time_profiler_chan().clone(),
+ || {
+ let cx = self.get_cx();
+ let globalhandle = self.reflector().get_jsobject();
+ let code: Vec<u16> = code.encode_utf16().collect();
+ let filename = CString::new(filename).unwrap();
+
+ let _ac = JSAutoCompartment::new(cx, globalhandle.get());
+ let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), 1);
+ unsafe {
+ if !Evaluate2(cx, options.ptr, code.as_ptr(),
+ code.len() as libc::size_t,
+ rval) {
+ debug!("error evaluating JS string");
+ report_pending_exception(cx, true);
+ }
+ }
+
+ if let Some(error) = maybe_take_panic_result() {
+ panic::resume_unwind(error);
+ }
+ }
+ )
}
/// Set the `bool` value to indicate whether developer tools has requested
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index cacac064376..b5230b1b81a 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -186,7 +186,7 @@ pub fn ensure_expando_object(cx: *mut JSContext, obj: HandleObject) -> *mut JSOb
/// Set the property descriptor's object to `obj` and set it to enumerable,
/// and writable if `readonly` is true.
-pub fn fill_property_descriptor(desc: &mut PropertyDescriptor,
+pub fn fill_property_descriptor(mut desc: MutableHandle<PropertyDescriptor>,
obj: *mut JSObject,
attrs: u32) {
desc.obj = obj;
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index 2940a211bf3..42ad4c2730a 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -15,10 +15,13 @@ use dom::bindings::str::DOMString;
use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;
use dom::bluetoothdevice::BluetoothDevice;
use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
+use dom::promise::Promise;
use ipc_channel::ipc::{self, IpcSender};
+use js::conversions::ToJSValConvertible;
use net_traits::bluetooth_scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence};
use net_traits::bluetooth_scanfilter::{RequestDeviceoptions, ServiceUUIDSequence};
use net_traits::bluetooth_thread::{BluetoothError, BluetoothMethodMsg};
+use std::rc::Rc;
const FILTER_EMPTY_ERROR: &'static str = "'filters' member, if present, must be nonempty to find any devices.";
const FILTER_ERROR: &'static str = "A filter must restrict the devices in some way.";
@@ -61,6 +64,22 @@ impl Bluetooth {
global_ref.as_window().bluetooth_thread()
}
+ fn request_device(&self, option: &RequestDeviceOptions) -> Fallible<Root<BluetoothDevice>> {
+ // Step 1.
+ // TODO(#4282): Reject promise.
+ if (option.filters.is_some() && option.acceptAllDevices) ||
+ (option.filters.is_none() && !option.acceptAllDevices) {
+ return Err(Type(OPTIONS_ERROR.to_owned()));
+ }
+ // Step 2.
+ if !option.acceptAllDevices {
+ return self.request_bluetooth_devices(&option.filters, &option.optionalServices);
+ }
+
+ self.request_bluetooth_devices(&None, &option.optionalServices)
+ // TODO(#4282): Step 3-5: Reject and resolve promise.
+ }
+
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
fn request_bluetooth_devices(&self,
filters: &Option<Vec<BluetoothRequestDeviceFilter>>,
@@ -69,7 +88,7 @@ impl Bluetooth {
// TODO: Step 1: Triggered by user activation.
// Step 2.
- let option = try!(convert_request_device_options(self.global().r(), filters, optional_services));
+ let option = try!(convert_request_device_options(filters, optional_services));
// TODO: Step 3-5: Implement the permission API.
@@ -104,8 +123,7 @@ impl Bluetooth {
}
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
-fn convert_request_device_options(global: GlobalRef,
- filters: &Option<Vec<BluetoothRequestDeviceFilter>>,
+fn convert_request_device_options(filters: &Option<Vec<BluetoothRequestDeviceFilter>>,
optional_services: &Option<Vec<BluetoothServiceUUID>>)
-> Fallible<RequestDeviceoptions> {
// Step 2.2: There is no requiredServiceUUIDS, we scan for all devices.
@@ -122,7 +140,7 @@ fn convert_request_device_options(global: GlobalRef,
// Step 2.4.
for filter in filters {
// Step 2.4.8.
- uuid_filters.push(try!(canonicalize_filter(&filter, global)));
+ uuid_filters.push(try!(canonicalize_filter(&filter)));
}
}
@@ -130,7 +148,7 @@ fn convert_request_device_options(global: GlobalRef,
if let &Some(ref opt_services) = optional_services {
for opt_service in opt_services {
// Step 2.5 - 2.6.
- let uuid = try!(BluetoothUUID::GetService(global, opt_service.clone())).to_string();
+ let uuid = try!(BluetoothUUID::service(opt_service.clone())).to_string();
// Step 2.7.
// Note: What we are doing here is adding the not blacklisted UUIDs to the result vector,
@@ -146,7 +164,7 @@ fn convert_request_device_options(global: GlobalRef,
}
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
-fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter, global: GlobalRef) -> Fallible<BluetoothScanfilter> {
+fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter) -> Fallible<BluetoothScanfilter> {
// Step 2.4.1.
if filter.services.is_none() &&
filter.name.is_none() &&
@@ -171,7 +189,7 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter, global: GlobalRef)
for service in services {
// Step 2.4.3.2 - 2.4.3.3.
- let uuid = try!(BluetoothUUID::GetService(global, service.clone())).to_string();
+ let uuid = try!(BluetoothUUID::service(service.clone())).to_string();
// Step 2.4.3.4.
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
@@ -232,7 +250,7 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter, global: GlobalRef)
let service_data_uuid = match filter.serviceDataUUID {
Some(ref service_data_uuid) => {
// Step 2.4.7.1 - 2.4.7.2.
- let uuid = try!(BluetoothUUID::GetService(global, service_data_uuid.clone())).to_string();
+ let uuid = try!(BluetoothUUID::service(service_data_uuid.clone())).to_string();
// Step 2.4.7.3.
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
@@ -252,6 +270,18 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter, global: GlobalRef)
service_data_uuid))
}
+#[allow(unrooted_must_root)]
+pub fn result_to_promise<T: ToJSValConvertible>(global_ref: GlobalRef,
+ bluetooth_result: Fallible<T>)
+ -> Rc<Promise> {
+ let p = Promise::new(global_ref);
+ match bluetooth_result {
+ Ok(v) => p.resolve_native(p.global().r().get_cx(), &v),
+ Err(e) => p.reject_error(p.global().r().get_cx(), e),
+ }
+ p
+}
+
impl From<BluetoothError> for Error {
fn from(error: BluetoothError) -> Self {
match error {
@@ -265,20 +295,9 @@ impl From<BluetoothError> for Error {
}
impl BluetoothMethods for Bluetooth {
+ #[allow(unrooted_must_root)]
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
- fn RequestDevice(&self, option: &RequestDeviceOptions) -> Fallible<Root<BluetoothDevice>> {
- // Step 1.
- // TODO(#4282): Reject promise.
- if (option.filters.is_some() && option.acceptAllDevices) ||
- (option.filters.is_none() && !option.acceptAllDevices) {
- return Err(Type(OPTIONS_ERROR.to_owned()));
- }
- // Step 2.
- if !option.acceptAllDevices {
- return self.request_bluetooth_devices(&option.filters, &option.optionalServices);
- }
-
- self.request_bluetooth_devices(&None, &option.optionalServices)
- // TODO(#4282): Step 3-5: Reject and resolve promise.
+ fn RequestDevice(&self, option: &RequestDeviceOptions) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.request_device(option))
}
}
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs
index 15ca7af2235..6b7ba1dcfad 100644
--- a/components/script/dom/bluetoothremotegattcharacteristic.rs
+++ b/components/script/dom/bluetoothremotegattcharacteristic.rs
@@ -18,12 +18,15 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
+use dom::bluetooth::result_to_promise;
use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;
use dom::bluetoothremotegattdescriptor::BluetoothRemoteGATTDescriptor;
use dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
use dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
+use dom::promise::Promise;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
+use std::rc::Rc;
// Maximum length of an attribute value.
// https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 2169)
@@ -79,27 +82,10 @@ impl BluetoothRemoteGATTCharacteristic {
fn get_instance_id(&self) -> String {
self.instance_id.clone()
}
-}
-
-impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
- fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
- self.properties.get()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
- fn Service(&self) -> Root<BluetoothRemoteGATTService> {
- self.service.get()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid
- fn Uuid(&self) -> DOMString {
- self.uuid.clone()
- }
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor
- fn GetDescriptor(&self, descriptor: BluetoothDescriptorUUID) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> {
- let uuid = try!(BluetoothUUID::GetDescriptor(self.global().r(), descriptor)).to_string();
+ fn get_descriptor(&self, descriptor: BluetoothDescriptorUUID) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> {
+ let uuid = try!(BluetoothUUID::descriptor(descriptor)).to_string();
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
@@ -121,12 +107,12 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors
- fn GetDescriptors(&self,
- descriptor: Option<BluetoothDescriptorUUID>)
- -> Fallible<Vec<Root<BluetoothRemoteGATTDescriptor>>> {
+ fn get_descriptors(&self,
+ descriptor: Option<BluetoothDescriptorUUID>)
+ -> Fallible<Vec<Root<BluetoothRemoteGATTDescriptor>>> {
let mut uuid: Option<String> = None;
if let Some(d) = descriptor {
- uuid = Some(try!(BluetoothUUID::GetDescriptor(self.global().r(), d)).to_string());
+ uuid = Some(try!(BluetoothUUID::descriptor(d)).to_string());
if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
@@ -152,13 +138,8 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
}
}
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-value
- fn GetValue(&self) -> Option<ByteString> {
- self.value.borrow().clone()
- }
-
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-readvalue
- fn ReadValue(&self) -> Fallible<ByteString> {
+ fn read_value(&self) -> Fallible<ByteString> {
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Reads) {
return Err(Security)
}
@@ -185,7 +166,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
- fn WriteValue(&self, value: Vec<u8>) -> ErrorResult {
+ fn write_value(&self, value: Vec<u8>) -> ErrorResult {
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Writes) {
return Err(Security)
}
@@ -213,3 +194,51 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
}
}
}
+
+impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
+ fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
+ self.properties.get()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
+ fn Service(&self) -> Root<BluetoothRemoteGATTService> {
+ self.service.get()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid
+ fn Uuid(&self) -> DOMString {
+ self.uuid.clone()
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor
+ fn GetDescriptor(&self, descriptor: BluetoothDescriptorUUID) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_descriptor(descriptor))
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors
+ fn GetDescriptors(&self,
+ descriptor: Option<BluetoothDescriptorUUID>)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_descriptors(descriptor))
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-value
+ fn GetValue(&self) -> Option<ByteString> {
+ self.value.borrow().clone()
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-readvalue
+ fn ReadValue(&self) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.read_value())
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
+ fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.write_value(value))
+ }
+}
diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs
index 99065a9aec0..d036f8bd9ea 100644
--- a/components/script/dom/bluetoothremotegattdescriptor.rs
+++ b/components/script/dom/bluetoothremotegattdescriptor.rs
@@ -17,9 +17,12 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
+use dom::bluetooth::result_to_promise;
use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH};
+use dom::promise::Promise;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
+use std::rc::Rc;
// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattdescriptor
#[dom_struct]
@@ -66,26 +69,9 @@ impl BluetoothRemoteGATTDescriptor {
fn get_instance_id(&self) -> String {
self.instance_id.clone()
}
-}
-
-impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
- fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
- self.characteristic.get()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid
- fn Uuid(&self) -> DOMString {
- self.uuid.clone()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-value
- fn GetValue(&self) -> Option<ByteString> {
- self.value.borrow().clone()
- }
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-readvalue
- fn ReadValue(&self) -> Fallible<ByteString> {
+ fn read_value(&self) -> Fallible<ByteString> {
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Reads) {
return Err(Security)
}
@@ -109,7 +95,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue
- fn WriteValue(&self, value: Vec<u8>) -> ErrorResult {
+ fn write_value(&self, value: Vec<u8>) -> ErrorResult {
if uuid_is_blacklisted(self.uuid.as_ref(), Blacklist::Writes) {
return Err(Security)
}
@@ -131,3 +117,32 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
}
}
}
+
+impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
+ fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
+ self.characteristic.get()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid
+ fn Uuid(&self) -> DOMString {
+ self.uuid.clone()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-value
+ fn GetValue(&self) -> Option<ByteString> {
+ self.value.borrow().clone()
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-readvalue
+ fn ReadValue(&self) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.read_value())
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue
+ fn WriteValue(&self, value: Vec<u8>) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.write_value(value))
+ }
+}
diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs
index 615094623e9..3439ba53350 100644
--- a/components/script/dom/bluetoothremotegattserver.rs
+++ b/components/script/dom/bluetoothremotegattserver.rs
@@ -12,12 +12,15 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
+use dom::bluetooth::result_to_promise;
use dom::bluetoothdevice::BluetoothDevice;
use dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
+use dom::promise::Promise;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
use std::cell::Cell;
+use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattserver
#[dom_struct]
@@ -47,21 +50,9 @@ impl BluetoothRemoteGATTServer {
let global_ref = global_root.r();
global_ref.as_window().bluetooth_thread()
}
-}
-
-impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
- fn Device(&self) -> Root<BluetoothDevice> {
- self.device.get()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected
- fn Connected(&self) -> bool {
- self.connected.get()
- }
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
- fn Connect(&self) -> Fallible<Root<BluetoothRemoteGATTServer>> {
+ fn connect(&self) -> Fallible<Root<BluetoothRemoteGATTServer>> {
let (sender, receiver) = ipc::channel().unwrap();
self.get_bluetooth_thread().send(
BluetoothMethodMsg::GATTServerConnect(String::from(self.Device().Id()), sender)).unwrap();
@@ -77,26 +68,9 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
}
}
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
- fn Disconnect(&self) -> ErrorResult {
- let (sender, receiver) = ipc::channel().unwrap();
- self.get_bluetooth_thread().send(
- BluetoothMethodMsg::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();
- let server = receiver.recv().unwrap();
- match server {
- Ok(connected) => {
- self.connected.set(connected);
- Ok(())
- },
- Err(error) => {
- Err(Error::from(error))
- },
- }
- }
-
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
- fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Fallible<Root<BluetoothRemoteGATTService>> {
- let uuid = try!(BluetoothUUID::GetService(self.global().r(), service)).to_string();
+ fn get_primary_service(&self, service: BluetoothServiceUUID) -> Fallible<Root<BluetoothRemoteGATTService>> {
+ let uuid = try!(BluetoothUUID::service(service)).to_string();
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
@@ -119,12 +93,12 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
- fn GetPrimaryServices(&self,
- service: Option<BluetoothServiceUUID>)
- -> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
+ fn get_primary_services(&self,
+ service: Option<BluetoothServiceUUID>)
+ -> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
let mut uuid: Option<String> = None;
if let Some(s) = service {
- uuid = Some(try!(BluetoothUUID::GetService(self.global().r(), s)).to_string());
+ uuid = Some(try!(BluetoothUUID::service(s)).to_string());
if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
@@ -151,3 +125,52 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
}
}
}
+
+impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
+ fn Device(&self) -> Root<BluetoothDevice> {
+ self.device.get()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected
+ fn Connected(&self) -> bool {
+ self.connected.get()
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
+ fn Connect(&self) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.connect())
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
+ fn Disconnect(&self) -> ErrorResult {
+ let (sender, receiver) = ipc::channel().unwrap();
+ self.get_bluetooth_thread().send(
+ BluetoothMethodMsg::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();
+ let server = receiver.recv().unwrap();
+ match server {
+ Ok(connected) => {
+ self.connected.set(connected);
+ Ok(())
+ },
+ Err(error) => {
+ Err(Error::from(error))
+ },
+ }
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
+ fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_primary_service(service))
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
+ fn GetPrimaryServices(&self,
+ service: Option<BluetoothServiceUUID>)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_primary_services(service))
+ }
+}
diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs
index a39bb4fdfd5..3ece2507cd3 100644
--- a/components/script/dom/bluetoothremotegattservice.rs
+++ b/components/script/dom/bluetoothremotegattservice.rs
@@ -11,12 +11,15 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
+use dom::bluetooth::result_to_promise;
use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;
use dom::bluetoothdevice::BluetoothDevice;
use dom::bluetoothremotegattcharacteristic::BluetoothRemoteGATTCharacteristic;
use dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUID, BluetoothUUID};
+use dom::promise::Promise;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::bluetooth_thread::BluetoothMethodMsg;
+use std::rc::Rc;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattservice
#[dom_struct]
@@ -66,29 +69,12 @@ impl BluetoothRemoteGATTService {
fn get_instance_id(&self) -> String {
self.instance_id.clone()
}
-}
-
-impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
- fn Device(&self) -> Root<BluetoothDevice> {
- self.device.get()
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary
- fn IsPrimary(&self) -> bool {
- self.is_primary
- }
-
- // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-uuid
- fn Uuid(&self) -> DOMString {
- self.uuid.clone()
- }
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
- fn GetCharacteristic(&self,
- characteristic: BluetoothCharacteristicUUID)
- -> Fallible<Root<BluetoothRemoteGATTCharacteristic>> {
- let uuid = try!(BluetoothUUID::GetCharacteristic(self.global().r(), characteristic)).to_string();
+ fn get_characteristic(&self,
+ characteristic: BluetoothCharacteristicUUID)
+ -> Fallible<Root<BluetoothRemoteGATTCharacteristic>> {
+ let uuid = try!(BluetoothUUID::characteristic(characteristic)).to_string();
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
@@ -121,12 +107,12 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
- fn GetCharacteristics(&self,
- characteristic: Option<BluetoothCharacteristicUUID>)
- -> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> {
+ fn get_characteristics(&self,
+ characteristic: Option<BluetoothCharacteristicUUID>)
+ -> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> {
let mut uuid: Option<String> = None;
if let Some(c) = characteristic {
- uuid = Some(try!(BluetoothUUID::GetCharacteristic(self.global().r(), c)).to_string());
+ uuid = Some(try!(BluetoothUUID::characteristic(c)).to_string());
if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
@@ -166,10 +152,10 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservice
- fn GetIncludedService(&self,
- service: BluetoothServiceUUID)
- -> Fallible<Root<BluetoothRemoteGATTService>> {
- let uuid = try!(BluetoothUUID::GetService(self.global().r(), service)).to_string();
+ fn get_included_service(&self,
+ service: BluetoothServiceUUID)
+ -> Fallible<Root<BluetoothRemoteGATTService>> {
+ let uuid = try!(BluetoothUUID::service(service)).to_string();
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
@@ -194,12 +180,12 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservices
- fn GetIncludedServices(&self,
- service: Option<BluetoothServiceUUID>)
- -> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
+ fn get_included_services(&self,
+ service: Option<BluetoothServiceUUID>)
+ -> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
let mut uuid: Option<String> = None;
if let Some(s) = service {
- uuid = Some(try!(BluetoothUUID::GetService(self.global().r(), s)).to_string());
+ uuid = Some(try!(BluetoothUUID::service(s)).to_string());
if let Some(ref uuid) = uuid {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
@@ -228,3 +214,52 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
}
}
}
+
+impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
+ fn Device(&self) -> Root<BluetoothDevice> {
+ self.device.get()
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary
+ fn IsPrimary(&self) -> bool {
+ self.is_primary
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-uuid
+ fn Uuid(&self) -> DOMString {
+ self.uuid.clone()
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
+ fn GetCharacteristic(&self,
+ characteristic: BluetoothCharacteristicUUID)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_characteristic(characteristic))
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
+ fn GetCharacteristics(&self,
+ characteristic: Option<BluetoothCharacteristicUUID>)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_characteristics(characteristic))
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservice
+ fn GetIncludedService(&self,
+ service: BluetoothServiceUUID)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_included_service(service))
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getincludedservices
+ fn GetIncludedServices(&self,
+ service: Option<BluetoothServiceUUID>)
+ -> Rc<Promise> {
+ result_to_promise(self.global().r(), self.get_included_services(service))
+ }
+}
diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs
index dafda71a12b..e9669cc8acb 100644
--- a/components/script/dom/bluetoothuuid.rs
+++ b/components/script/dom/bluetoothuuid.rs
@@ -272,60 +272,36 @@ const VALID_UUID_REGEX: &'static str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-
impl BluetoothUUID {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid
pub fn CanonicalUUID(_: GlobalRef, alias: u32) -> UUID {
- DOMString::from(format!("{:08x}", &alias) + BASE_UUID)
+ canonical_uuid(alias)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice
- pub fn GetService(globalref: GlobalRef, name: BluetoothServiceUUID) -> Fallible<UUID> {
- BluetoothUUID::resolve_uuid_name(globalref,
- name,
- BLUETOOTH_ASSIGNED_SERVICES,
- DOMString::from(SERVICE_PREFIX))
+ pub fn GetService(_: GlobalRef, name: BluetoothServiceUUID) -> Fallible<UUID> {
+ Self::service(name)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getcharacteristic
- pub fn GetCharacteristic(globalref: GlobalRef, name: BluetoothCharacteristicUUID) -> Fallible<UUID> {
- BluetoothUUID::resolve_uuid_name(globalref,
- name,
- BLUETOOTH_ASSIGNED_CHARCTERISTICS,
- DOMString::from(CHARACTERISTIC_PREFIX))
+ pub fn GetCharacteristic(_: GlobalRef, name: BluetoothCharacteristicUUID) -> Fallible<UUID> {
+ Self::characteristic(name)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getdescriptor
- pub fn GetDescriptor(globalref: GlobalRef, name: BluetoothDescriptorUUID) -> Fallible<UUID> {
- BluetoothUUID::resolve_uuid_name(globalref,
- name,
- BLUETOOTH_ASSIGNED_DESCRIPTORS,
- DOMString::from(DESCRIPTOR_PREFIX))
+ pub fn GetDescriptor(_: GlobalRef, name: BluetoothDescriptorUUID) -> Fallible<UUID> {
+ Self::descriptor(name)
}
+}
- // https://webbluetoothcg.github.io/web-bluetooth/#resolveuuidname
- pub fn resolve_uuid_name(globalref: GlobalRef,
- name: StringOrUnsignedLong,
- assigned_numbers_table: &'static [(&'static str, u32)],
- prefix: DOMString)
- -> Fallible<DOMString> {
- match name {
- // Step 1
- StringOrUnsignedLong::UnsignedLong(unsigned32) => {
- Ok(BluetoothUUID::CanonicalUUID(globalref, unsigned32))
- },
- StringOrUnsignedLong::String(dstring) => {
- // Step 2
- let regex = Regex::new(VALID_UUID_REGEX).unwrap();
- if regex.is_match(&*dstring) {
- Ok(dstring)
- } else {
- // Step 3
- let concatenated = format!("{}.{}", prefix, dstring);
- let is_in_table = assigned_numbers_table.iter().find(|p| p.0 == concatenated);
- match is_in_table {
- Some(&(_, alias)) => Ok(BluetoothUUID::CanonicalUUID(globalref, alias)),
- None => Err(Syntax),
- }
- }
- },
- }
+impl BluetoothUUID {
+ pub fn service(name: BluetoothServiceUUID) -> Fallible<UUID> {
+ resolve_uuid_name(name, BLUETOOTH_ASSIGNED_SERVICES, SERVICE_PREFIX)
+ }
+
+ pub fn characteristic(name: BluetoothServiceUUID) -> Fallible<UUID> {
+ resolve_uuid_name(name, BLUETOOTH_ASSIGNED_CHARCTERISTICS, CHARACTERISTIC_PREFIX)
+ }
+
+ pub fn descriptor(name: BluetoothDescriptorUUID) -> Fallible<UUID> {
+ resolve_uuid_name(name, BLUETOOTH_ASSIGNED_DESCRIPTORS, DESCRIPTOR_PREFIX)
}
}
@@ -337,3 +313,36 @@ impl Clone for StringOrUnsignedLong {
}
}
}
+
+fn canonical_uuid(alias: u32) -> UUID {
+ UUID::from(format!("{:08x}", &alias) + BASE_UUID)
+}
+
+// https://webbluetoothcg.github.io/web-bluetooth/#resolveuuidname
+fn resolve_uuid_name(
+ name: StringOrUnsignedLong,
+ assigned_numbers_table: &'static [(&'static str, u32)],
+ prefix: &str)
+ -> Fallible<DOMString> {
+ match name {
+ // Step 1
+ StringOrUnsignedLong::UnsignedLong(unsigned32) => {
+ Ok(canonical_uuid(unsigned32))
+ },
+ StringOrUnsignedLong::String(dstring) => {
+ // Step 2
+ let regex = Regex::new(VALID_UUID_REGEX).unwrap();
+ if regex.is_match(&*dstring) {
+ Ok(dstring)
+ } else {
+ // Step 3
+ let concatenated = format!("{}.{}", prefix, dstring);
+ let is_in_table = assigned_numbers_table.iter().find(|p| p.0 == concatenated);
+ match is_in_table {
+ Some(&(_, alias)) => Ok(canonical_uuid(alias)),
+ None => Err(Syntax),
+ }
+ }
+ },
+ }
+}
diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs
index 02d153296ae..36179279967 100644
--- a/components/script/dom/browsingcontext.rs
+++ b/components/script/dom/browsingcontext.rs
@@ -256,7 +256,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext,
rooted!(in(cx) let mut val = UndefinedValue());
window.to_jsval(cx, val.handle_mut());
desc.value = val.get();
- fill_property_descriptor(&mut desc, proxy.get(), JSPROP_READONLY);
+ fill_property_descriptor(desc, proxy.get(), JSPROP_READONLY);
return true;
}
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index c425c38b86b..49a46b88575 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -17,10 +17,6 @@ use dom::bindings::js::{Root, RootCollection};
use dom::bindings::reflector::Reflectable;
use dom::bindings::str::DOMString;
use dom::bindings::structuredclone::StructuredCloneData;
-use dom::errorevent::ErrorEvent;
-use dom::event::{Event, EventBubbles, EventCancelable};
-use dom::eventdispatcher::EventStatus;
-use dom::eventtarget::EventTarget;
use dom::messageevent::MessageEvent;
use dom::worker::{TrustedWorkerAddress, WorkerErrorHandler, WorkerMessageHandler};
use dom::workerglobalscope::WorkerGlobalScope;
@@ -36,7 +32,6 @@ use rand::random;
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
use script_runtime::ScriptThreadEventCategory::WorkerEvent;
use script_traits::{TimerEvent, TimerSource, WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
-use std::cell::Cell;
use std::mem::replace;
use std::sync::{Arc, Mutex};
use std::sync::atomic::AtomicBool;
@@ -81,7 +76,6 @@ enum MixedMessage {
#[dom_struct]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
- id: PipelineId,
#[ignore_heap_size_of = "Defined in std"]
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
#[ignore_heap_size_of = "Defined in std"]
@@ -93,14 +87,11 @@ pub struct DedicatedWorkerGlobalScope {
#[ignore_heap_size_of = "Can't measure trait objects"]
/// Sender to the parent thread.
parent_sender: Box<ScriptChan + Send>,
- /// https://html.spec.whatwg.org/multipage/#in-error-reporting-mode
- in_error_reporting_mode: Cell<bool>
}
impl DedicatedWorkerGlobalScope {
fn new_inherited(init: WorkerGlobalScopeInit,
worker_url: Url,
- id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
@@ -117,19 +108,16 @@ impl DedicatedWorkerGlobalScope {
from_devtools_receiver,
timer_event_chan,
Some(closing)),
- id: id,
receiver: receiver,
own_sender: own_sender,
timer_event_port: timer_event_port,
parent_sender: parent_sender,
worker: DOMRefCell::new(None),
- in_error_reporting_mode: Cell::new(false),
}
}
pub fn new(init: WorkerGlobalScopeInit,
worker_url: Url,
- id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
@@ -142,7 +130,6 @@ impl DedicatedWorkerGlobalScope {
let cx = runtime.cx();
let scope = box DedicatedWorkerGlobalScope::new_inherited(init,
worker_url,
- id,
from_devtools_receiver,
runtime,
parent_sender,
@@ -157,7 +144,6 @@ impl DedicatedWorkerGlobalScope {
#[allow(unsafe_code)]
pub fn run_worker_scope(init: WorkerGlobalScopeInit,
worker_url: Url,
- id: PipelineId,
from_devtools_receiver: IpcReceiver<DevtoolScriptControlMsg>,
worker_rt_for_mainthread: Arc<Mutex<Option<SharedRt>>>,
worker: TrustedWorkerAddress,
@@ -170,7 +156,7 @@ impl DedicatedWorkerGlobalScope {
let name = format!("WebWorker for {}", serialized_worker_url);
spawn_named(name, move || {
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
- PipelineId::install(id);
+ PipelineId::install(init.pipeline_id);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
@@ -204,7 +190,7 @@ impl DedicatedWorkerGlobalScope {
});
let global = DedicatedWorkerGlobalScope::new(
- init, url, id, devtools_mpsc_port, runtime,
+ init, url, devtools_mpsc_port, runtime,
parent_sender.clone(), own_sender, receiver,
timer_ipc_chan, timer_rx, closing);
// FIXME(njn): workers currently don't have a unique ID suitable for using in reporter
@@ -244,10 +230,6 @@ impl DedicatedWorkerGlobalScope {
}
}
- pub fn pipeline_id(&self) -> PipelineId {
- self.id
- }
-
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
let (tx, rx) = channel();
let chan = box SendableWorkerScriptChan {
@@ -348,43 +330,13 @@ impl DedicatedWorkerGlobalScope {
}
}
- /// https://html.spec.whatwg.org/multipage/#report-the-error
- pub fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue) {
- // Step 1.
- if self.in_error_reporting_mode.get() {
- return;
- }
-
- // Step 2.
- self.in_error_reporting_mode.set(true);
-
- // Steps 3-12.
- // FIXME(#13195): muted errors.
- let event = ErrorEvent::new(GlobalRef::Worker(self.upcast()),
- atom!("error"),
- EventBubbles::DoesNotBubble,
- EventCancelable::Cancelable,
- error_info.message.as_str().into(),
- error_info.filename.as_str().into(),
- error_info.lineno,
- error_info.column,
- value);
-
- // Step 13.
- let event_status = event.upcast::<Event>().fire(self.upcast::<EventTarget>());
-
- // Step 15
- if event_status == EventStatus::NotCanceled {
- let worker = self.worker.borrow().as_ref().unwrap().clone();
- // TODO: Should use the DOM manipulation task source.
- self.parent_sender
- .send(CommonScriptMsg::RunnableMsg(WorkerEvent,
- box WorkerErrorHandler::new(worker, error_info)))
- .unwrap();
- }
-
- // Step 14
- self.in_error_reporting_mode.set(false);
+ pub fn forward_error_to_worker_object(&self, error_info: ErrorInfo) {
+ let worker = self.worker.borrow().as_ref().unwrap().clone();
+ // TODO: Should use the DOM manipulation task source.
+ self.parent_sender
+ .send(CommonScriptMsg::RunnableMsg(WorkerEvent,
+ box WorkerErrorHandler::new(worker, error_info)))
+ .unwrap();
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 1b91e743a78..f8238d645e1 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -96,7 +96,7 @@ use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
-use net_traits::{AsyncResponseTarget, FetchResponseMsg, IpcSend, PendingAsyncLoad};
+use net_traits::{AsyncResponseTarget, FetchResponseMsg, IpcSend};
use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::request::RequestInit;
@@ -1423,17 +1423,6 @@ impl Document {
ReflowReason::RequestAnimationFrame);
}
- /// Add a load to the list of loads blocking this document's load.
- pub fn add_blocking_load(&self, load: LoadType) {
- let mut loader = self.loader.borrow_mut();
- loader.add_blocking_load(load)
- }
-
- pub fn prepare_async_load(&self, load: LoadType, referrer_policy: Option<ReferrerPolicy>) -> PendingAsyncLoad {
- let mut loader = self.loader.borrow_mut();
- loader.prepare_async_load(load, self, referrer_policy)
- }
-
pub fn load_async(&self, load: LoadType, listener: AsyncResponseTarget, referrer_policy: Option<ReferrerPolicy>) {
let mut loader = self.loader.borrow_mut();
loader.load_async(load, listener, self, referrer_policy);
@@ -1441,10 +1430,9 @@ impl Document {
pub fn fetch_async(&self, load: LoadType,
request: RequestInit,
- fetch_target: IpcSender<FetchResponseMsg>,
- referrer_policy: Option<ReferrerPolicy>) {
+ fetch_target: IpcSender<FetchResponseMsg>) {
let mut loader = self.loader.borrow_mut();
- loader.fetch_async(load, request, fetch_target, self, referrer_policy);
+ loader.fetch_async(load, request, fetch_target);
}
pub fn finish_load(&self, load: LoadType) {
diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs
index 4b832121654..7f43dd6b07a 100644
--- a/components/script/dom/headers.rs
+++ b/components/script/dom/headers.rs
@@ -229,6 +229,10 @@ impl Headers {
*self.header_list.borrow_mut() = HyperHeaders::new();
}
+ pub fn set_headers(&self, hyper_headers: HyperHeaders) {
+ *self.header_list.borrow_mut() = hyper_headers;
+ }
+
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
pub fn extract_mime_type(&self) -> Vec<u8> {
self.header_list.borrow().get_raw("content-type").map_or(vec![], |v| v[0].clone())
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 1c84fbba784..7c6cabd345e 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -154,7 +154,9 @@ impl VirtualMethods for HTMLLinkElement {
},
&atom!("media") => {
if string_is_stylesheet(&rel) {
- self.handle_stylesheet_url(&attr.value());
+ if let Some(href) = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href")) {
+ self.handle_stylesheet_url(&href.value());
+ }
}
},
_ => {},
@@ -195,62 +197,69 @@ impl VirtualMethods for HTMLLinkElement {
impl HTMLLinkElement {
+ /// https://html.spec.whatwg.org/multipage/#concept-link-obtain
fn handle_stylesheet_url(&self, href: &str) {
let document = document_from_node(self);
if document.browsing_context().is_none() {
return;
}
- match document.base_url().join(href) {
- Ok(url) => {
- let element = self.upcast::<Element>();
-
- let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
- let value = mq_attribute.r().map(|a| a.value());
- let mq_str = match value {
- Some(ref value) => &***value,
- None => "",
- };
- let mut css_parser = CssParser::new(&mq_str);
- let media = parse_media_query_list(&mut css_parser);
-
- // TODO: #8085 - Don't load external stylesheets if the node's mq doesn't match.
- let elem = Trusted::new(self);
-
- let context = Arc::new(Mutex::new(StylesheetContext {
- elem: elem,
- media: Some(media),
- data: vec!(),
- metadata: None,
- url: url.clone(),
- }));
-
- let (action_sender, action_receiver) = ipc::channel().unwrap();
- let listener = NetworkListener {
- context: context,
- script_chan: document.window().networking_task_source(),
- wrapper: Some(document.window().get_runnable_wrapper()),
- };
- let response_target = AsyncResponseTarget {
- sender: action_sender,
- };
- ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
- listener.notify_action(message.to().unwrap());
- });
+ // Step 1.
+ if href.is_empty() {
+ return;
+ }
- if self.parser_inserted.get() {
- document.increment_script_blocking_stylesheet_count();
- }
+ // Step 2.
+ let url = match document.base_url().join(href) {
+ Err(e) => return debug!("Parsing url {} failed: {}", href, e),
+ Ok(url) => url,
+ };
+
+ let element = self.upcast::<Element>();
+
+ let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
+ let value = mq_attribute.r().map(|a| a.value());
+ let mq_str = match value {
+ Some(ref value) => &***value,
+ None => "",
+ };
+ let mut css_parser = CssParser::new(&mq_str);
+ let media = parse_media_query_list(&mut css_parser);
+
+ // TODO: #8085 - Don't load external stylesheets if the node's mq doesn't match.
+ let elem = Trusted::new(self);
+
+ let context = Arc::new(Mutex::new(StylesheetContext {
+ elem: elem,
+ media: Some(media),
+ data: vec!(),
+ metadata: None,
+ url: url.clone(),
+ }));
+
+ let (action_sender, action_receiver) = ipc::channel().unwrap();
+ let listener = NetworkListener {
+ context: context,
+ script_chan: document.window().networking_task_source(),
+ wrapper: Some(document.window().get_runnable_wrapper()),
+ };
+ let response_target = AsyncResponseTarget {
+ sender: action_sender,
+ };
+ ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
+ listener.notify_action(message.to().unwrap());
+ });
+
+ if self.parser_inserted.get() {
+ document.increment_script_blocking_stylesheet_count();
+ }
- let referrer_policy = match self.RelList().Contains("noreferrer".into()) {
- true => Some(ReferrerPolicy::NoReferrer),
- false => None,
- };
+ let referrer_policy = match self.RelList().Contains("noreferrer".into()) {
+ true => Some(ReferrerPolicy::NoReferrer),
+ false => None,
+ };
- document.load_async(LoadType::Stylesheet(url), response_target, referrer_policy);
- }
- Err(e) => debug!("Parsing url {} failed: {}", href, e)
- }
+ document.load_async(LoadType::Stylesheet(url), response_target, referrer_policy);
}
fn handle_favicon_url(&self, rel: &str, href: &str, sizes: &Option<String>) {
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 4b16908968f..e96ceb6d834 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -25,7 +25,6 @@ use dom::htmlelement::HTMLElement;
use dom::node::{ChildrenMutation, CloneChildrenFlag, Node};
use dom::node::{document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
-use dom::window::ScriptHelpers;
use encoding::label::encoding_from_whatwg_label;
use encoding::types::{DecoderTrap, EncodingRef};
use html5ever::tree_builder::NextParserState;
@@ -244,8 +243,6 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
},
origin: doc.url().clone(),
pipeline_id: Some(script.global().r().pipeline_id()),
- // FIXME: Set to true for now, discussion in https://github.com/whatwg/fetch/issues/381
- same_origin_data: true,
referrer_url: Some(doc.url().clone()),
referrer_policy: doc.get_referrer_policy(),
.. RequestInit::default()
@@ -262,8 +259,6 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
status: Ok(())
}));
- let doc = document_from_node(script);
-
let (action_sender, action_receiver) = ipc::channel().unwrap();
let listener = NetworkListener {
context: context,
@@ -274,7 +269,7 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
listener.notify_fetch(message.to().unwrap());
});
- doc.fetch_async(LoadType::Script(url), request, action_sender, None);
+ doc.fetch_async(LoadType::Script(url), request, action_sender);
}
impl HTMLScriptElement {
@@ -509,9 +504,8 @@ impl HTMLScriptElement {
// Step 5.a.2.
let window = window_from_node(self);
rooted!(in(window.get_cx()) let mut rval = UndefinedValue());
- window.evaluate_script_on_global_with_result(&script.text,
- script.url.as_str(),
- rval.handle_mut());
+ GlobalRef::Window(&window).evaluate_script_on_global_with_result(
+ &script.text, script.url.as_str(), rval.handle_mut());
// Step 6.
document.set_current_script(old_script.r());
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index 149c61c96ee..ba15f565c27 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -2,8 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use body::{BodyOperations, BodyType, consume_body};
use dom::bindings::cell::DOMRefCell;
-use dom::bindings::codegen::Bindings::HeadersBinding::HeadersInit;
+use dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
use dom::bindings::codegen::Bindings::RequestBinding;
use dom::bindings::codegen::Bindings::RequestBinding::ReferrerPolicy;
use dom::bindings::codegen::Bindings::RequestBinding::RequestCache;
@@ -21,7 +22,9 @@ use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::headers::{Guard, Headers};
-use hyper;
+use dom::promise::Promise;
+use dom::xmlhttprequest::Extractable;
+use hyper::method::Method as HttpMethod;
use msg::constellation_msg::ReferrerPolicy as MsgReferrerPolicy;
use net_traits::request::{Origin, Window};
use net_traits::request::CacheMode as NetTraitsRequestCache;
@@ -33,6 +36,9 @@ use net_traits::request::Request as NetTraitsRequest;
use net_traits::request::RequestMode as NetTraitsRequestMode;
use net_traits::request::Type as NetTraitsRequestType;
use std::cell::Cell;
+use std::mem;
+use std::rc::Rc;
+use style::refcell::Ref;
use url::Url;
#[dom_struct]
@@ -153,7 +159,6 @@ impl Request {
// TODO: `entry settings object` is not implemented in Servo yet.
*request.origin.borrow_mut() = Origin::Client;
request.omit_origin_header = temporary_request.omit_origin_header;
- request.same_origin_data.set(true);
request.referrer = temporary_request.referrer;
request.referrer_policy = temporary_request.referrer_policy;
request.mode = temporary_request.mode;
@@ -340,7 +345,7 @@ impl Request {
try!(r.Headers().fill(Some(HeadersInit::Headers(headers_copy))));
// Step 32
- let input_body = if let RequestInfo::Request(ref input_request) = input {
+ let mut input_body = if let RequestInfo::Request(ref input_request) = input {
let input_request_request = input_request.request.borrow();
let body = input_request_request.body.borrow();
body.clone()
@@ -354,9 +359,9 @@ impl Request {
let req = r.request.borrow();
let req_method = req.method.borrow();
match &*req_method {
- &hyper::method::Method::Get => return Err(Error::Type(
+ &HttpMethod::Get => return Err(Error::Type(
"Init's body is non-null, and request method is GET".to_string())),
- &hyper::method::Method::Head => return Err(Error::Type(
+ &HttpMethod::Head => return Err(Error::Type(
"Init's body is non-null, and request method is HEAD".to_string())),
_ => {},
}
@@ -365,6 +370,20 @@ impl Request {
// Step 34
// TODO: `ReadableStream` object is not implemented in Servo yet.
+ if let Some(Some(ref init_body)) = init.body {
+ // Step 34.2
+ let extracted_body_tmp = init_body.extract();
+ input_body = Some(extracted_body_tmp.0);
+ let content_type = extracted_body_tmp.1;
+
+ // Step 34.3
+ if let Some(contents) = content_type {
+ if !r.Headers().Has(ByteString::new(b"Content-Type".to_vec())).unwrap() {
+ try!(r.Headers().Append(ByteString::new(b"Content-Type".to_vec()),
+ ByteString::new(contents.as_bytes().to_vec())));
+ }
+ }
+ }
// Step 35
{
@@ -382,6 +401,13 @@ impl Request {
// Step 38
Ok(r)
}
+
+ // https://fetch.spec.whatwg.org/#concept-body-locked
+ fn locked(&self) -> bool {
+ // TODO: ReadableStream is unimplemented. Just return false
+ // for now.
+ false
+ }
}
impl Request {
@@ -418,6 +444,10 @@ impl Request {
r_clone.Headers().set_guard(headers_guard);
r_clone
}
+
+ pub fn get_request(&self) -> NetTraitsRequest {
+ self.request.borrow().clone()
+ }
}
fn net_request_from_global(global: GlobalRef,
@@ -431,15 +461,15 @@ fn net_request_from_global(global: GlobalRef,
Some(pipeline_id))
}
-fn normalized_method_to_typed_method(m: &str) -> hyper::method::Method {
+fn normalized_method_to_typed_method(m: &str) -> HttpMethod {
match m {
- "DELETE" => hyper::method::Method::Delete,
- "GET" => hyper::method::Method::Get,
- "HEAD" => hyper::method::Method::Head,
- "OPTIONS" => hyper::method::Method::Options,
- "POST" => hyper::method::Method::Post,
- "PUT" => hyper::method::Method::Put,
- a => hyper::method::Method::Extension(a.to_string())
+ "DELETE" => HttpMethod::Delete,
+ "GET" => HttpMethod::Get,
+ "HEAD" => HttpMethod::Head,
+ "OPTIONS" => HttpMethod::Options,
+ "POST" => HttpMethod::Post,
+ "PUT" => HttpMethod::Put,
+ a => HttpMethod::Extension(a.to_string())
}
}
@@ -482,10 +512,10 @@ fn is_forbidden_method(m: &ByteString) -> bool {
}
// https://fetch.spec.whatwg.org/#cors-safelisted-method
-fn is_cors_safelisted_method(m: &hyper::method::Method) -> bool {
- m == &hyper::method::Method::Get ||
- m == &hyper::method::Method::Head ||
- m == &hyper::method::Method::Post
+fn is_cors_safelisted_method(m: &HttpMethod) -> bool {
+ m == &HttpMethod::Get ||
+ m == &HttpMethod::Head ||
+ m == &HttpMethod::Post
}
// https://url.spec.whatwg.org/#include-credentials
@@ -602,6 +632,56 @@ impl RequestMethods for Request {
// Step 2
Ok(Request::clone_from(self))
}
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-text
+ fn Text(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Text)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-blob
+ fn Blob(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Blob)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-formdata
+ fn FormData(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::FormData)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-json
+ fn Json(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Json)
+ }
+}
+
+impl BodyOperations for Request {
+ fn get_body_used(&self) -> bool {
+ self.BodyUsed()
+ }
+
+ fn is_locked(&self) -> bool {
+ self.locked()
+ }
+
+ fn take_body(&self) -> Option<Vec<u8>> {
+ let ref mut net_traits_req = *self.request.borrow_mut();
+ let body: Option<Vec<u8>> = mem::replace(&mut *net_traits_req.body.borrow_mut(), None);
+ match body {
+ Some(_) => {
+ self.body_used.set(true);
+ body
+ },
+ _ => None,
+ }
+ }
+
+ fn get_mime_type(&self) -> Ref<Vec<u8>> {
+ self.mime_type.borrow()
+ }
}
impl Into<NetTraitsRequestCache> for RequestCache {
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs
index acfc181283a..b8eeb81fb66 100644
--- a/components/script/dom/response.rs
+++ b/components/script/dom/response.rs
@@ -2,11 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use body::{BodyOperations, BodyType, consume_body};
use core::cell::Cell;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
use dom::bindings::codegen::Bindings::ResponseBinding;
use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, ResponseType as DOMResponseType};
+use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutNullableHeap, Root};
@@ -14,9 +16,16 @@ use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString};
use dom::headers::{Headers, Guard};
use dom::headers::{is_vchar, is_obs_text};
+use dom::promise::Promise;
+use dom::xmlhttprequest::Extractable;
+use hyper::header::Headers as HyperHeaders;
use hyper::status::StatusCode;
+use hyper_serde::Serde;
use net_traits::response::{ResponseBody as NetTraitsResponseBody};
+use std::mem;
+use std::rc::Rc;
use std::str::FromStr;
+use style::refcell::Ref;
use url::Position;
use url::Url;
@@ -33,8 +42,7 @@ pub struct Response {
response_type: DOMRefCell<DOMResponseType>,
url: DOMRefCell<Option<Url>>,
url_list: DOMRefCell<Vec<Url>>,
- // For now use the existing NetTraitsResponseBody enum, until body
- // is implemented.
+ // For now use the existing NetTraitsResponseBody enum
body: DOMRefCell<NetTraitsResponseBody>,
}
@@ -59,7 +67,7 @@ impl Response {
reflect_dom_object(box Response::new_inherited(), global, ResponseBinding::Wrap)
}
- pub fn Constructor(global: GlobalRef, _body: Option<USVString>, init: &ResponseBinding::ResponseInit)
+ pub fn Constructor(global: GlobalRef, body: Option<BodyInit>, init: &ResponseBinding::ResponseInit)
-> Fallible<Root<Response>> {
// Step 1
if init.status < 200 || init.status > 599 {
@@ -86,11 +94,6 @@ impl Response {
// Step 6
if let Some(ref headers_member) = init.headers {
// Step 6.1
- // TODO: Figure out how/if we should make r's response's
- // header list and r's Headers object the same thing. For
- // now just working with r's Headers object. Also, the
- // header list should already be empty so this step may be
- // unnecessary.
r.Headers().empty_header_list();
// Step 6.2
@@ -98,23 +101,22 @@ impl Response {
}
// Step 7
- if let Some(_) = _body {
+ if let Some(ref body) = body {
// Step 7.1
if is_null_body_status(init.status) {
return Err(Error::Type(
"Body is non-null but init's status member is a null body status".to_string()));
};
- // Step 7.2
- let content_type: Option<ByteString> = None;
-
// Step 7.3
- // TODO: Extract body and implement step 7.3.
+ let (extracted_body, content_type) = body.extract();
+ *r.body.borrow_mut() = NetTraitsResponseBody::Done(extracted_body);
// Step 7.4
if let Some(content_type_contents) = content_type {
if !r.Headers().Has(ByteString::new(b"Content-Type".to_vec())).unwrap() {
- try!(r.Headers().Append(ByteString::new(b"Content-Type".to_vec()), content_type_contents));
+ try!(r.Headers().Append(ByteString::new(b"Content-Type".to_vec()),
+ ByteString::new(content_type_contents.as_bytes().to_vec())));
}
};
}
@@ -178,6 +180,38 @@ impl Response {
// Step 7
Ok(r)
}
+
+ // https://fetch.spec.whatwg.org/#concept-body-locked
+ fn locked(&self) -> bool {
+ // TODO: ReadableStream is unimplemented. Just return false
+ // for now.
+ false
+ }
+}
+
+impl BodyOperations for Response {
+ fn get_body_used(&self) -> bool {
+ self.BodyUsed()
+ }
+
+ fn is_locked(&self) -> bool {
+ self.locked()
+ }
+
+ fn take_body(&self) -> Option<Vec<u8>> {
+ let body: NetTraitsResponseBody = mem::replace(&mut *self.body.borrow_mut(), NetTraitsResponseBody::Empty);
+ match body {
+ NetTraitsResponseBody::Done(bytes) | NetTraitsResponseBody::Receiving(bytes) => {
+ self.body_used.set(true);
+ Some(bytes)
+ },
+ _ => None,
+ }
+ }
+
+ fn get_mime_type(&self) -> Ref<Vec<u8>> {
+ self.mime_type.borrow()
+ }
}
// https://fetch.spec.whatwg.org/#redirect-status
@@ -283,8 +317,53 @@ impl ResponseMethods for Response {
fn BodyUsed(&self) -> bool {
self.body_used.get()
}
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-text
+ fn Text(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Text)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-blob
+ fn Blob(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Blob)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-formdata
+ fn FormData(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::FormData)
+ }
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#dom-body-json
+ fn Json(&self) -> Rc<Promise> {
+ consume_body(self, BodyType::Json)
+ }
}
fn serialize_without_fragment(url: &Url) -> &str {
&url[..Position::AfterQuery]
}
+
+impl Response {
+ pub fn set_type(&self, new_response_type: DOMResponseType) {
+ *self.response_type.borrow_mut() = new_response_type;
+ }
+
+ pub fn set_headers(&self, option_hyper_headers: Option<Serde<HyperHeaders>>) {
+ self.Headers().set_headers(match option_hyper_headers {
+ Some(hyper_headers) => hyper_headers.into_inner(),
+ None => HyperHeaders::new(),
+ });
+ }
+
+ pub fn set_raw_status(&self, status: Option<(u16, Vec<u8>)>) {
+ *self.raw_status.borrow_mut() = status;
+ }
+
+ pub fn set_final_url(&self, final_url: Url) {
+ *self.url.borrow_mut() = Some(final_url);
+ }
+}
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index f6208b63586..6efd555c909 100644
--- a/components/script/dom/serviceworkerglobalscope.rs
+++ b/components/script/dom/serviceworkerglobalscope.rs
@@ -23,7 +23,6 @@ use ipc_channel::router::ROUTER;
use js::jsapi::{JS_SetInterruptCallback, JSAutoCompartment, JSContext};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
-use msg::constellation_msg::PipelineId;
use net_traits::{LoadContext, load_whole_resource, IpcSend, CustomResponseMediator};
use rand::random;
use script_runtime::{CommonScriptMsg, StackRootTLS, get_reports, new_rt_and_cx, ScriptChan};
@@ -72,7 +71,6 @@ impl ScriptChan for ServiceWorkerChan {
#[dom_struct]
pub struct ServiceWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
- id: PipelineId,
#[ignore_heap_size_of = "Defined in std"]
receiver: Receiver<ServiceWorkerScriptMsg>,
#[ignore_heap_size_of = "Defined in std"]
@@ -87,7 +85,6 @@ pub struct ServiceWorkerGlobalScope {
impl ServiceWorkerGlobalScope {
fn new_inherited(init: WorkerGlobalScopeInit,
worker_url: Url,
- id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
own_sender: Sender<ServiceWorkerScriptMsg>,
@@ -104,7 +101,6 @@ impl ServiceWorkerGlobalScope {
from_devtools_receiver,
timer_event_chan,
None),
- id: id,
receiver: receiver,
timer_event_port: timer_event_port,
own_sender: own_sender,
@@ -115,7 +111,6 @@ impl ServiceWorkerGlobalScope {
pub fn new(init: WorkerGlobalScopeInit,
worker_url: Url,
- id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Runtime,
own_sender: Sender<ServiceWorkerScriptMsg>,
@@ -128,7 +123,6 @@ impl ServiceWorkerGlobalScope {
let cx = runtime.cx();
let scope = box ServiceWorkerGlobalScope::new_inherited(init,
worker_url,
- id,
from_devtools_receiver,
runtime,
own_sender,
@@ -148,7 +142,6 @@ impl ServiceWorkerGlobalScope {
swmanager_sender: IpcSender<ServiceWorkerMsg>,
scope_url: Url) {
let ScopeThings { script_url,
- pipeline_id,
init,
worker_load_origin,
.. } = scope_things;
@@ -179,7 +172,7 @@ impl ServiceWorkerGlobalScope {
let (timer_ipc_chan, _timer_ipc_port) = ipc::channel().unwrap();
let (timer_chan, timer_port) = channel();
let global = ServiceWorkerGlobalScope::new(
- init, url, pipeline_id, devtools_mpsc_port, runtime,
+ init, url, devtools_mpsc_port, runtime,
own_sender, receiver,
timer_ipc_chan, timer_port, swmanager_sender, scope_url);
let scope = global.upcast::<WorkerGlobalScope>();
@@ -298,10 +291,6 @@ impl ServiceWorkerGlobalScope {
}
}
- pub fn pipeline_id(&self) -> PipelineId {
- self.id
- }
-
pub fn process_event(&self, msg: CommonScriptMsg) {
self.handle_script_event(ServiceWorkerScriptMsg::CommonWorker(WorkerScriptMsg::Common(msg)));
}
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 9ac3f4e1ad4..6382897efb3 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -24,6 +24,7 @@ pub struct WebGLProgram {
webgl_object: WebGLObject,
id: WebGLProgramId,
is_deleted: Cell<bool>,
+ link_called: Cell<bool>,
linked: Cell<bool>,
fragment_shader: MutNullableHeap<JS<WebGLShader>>,
vertex_shader: MutNullableHeap<JS<WebGLShader>>,
@@ -39,6 +40,7 @@ impl WebGLProgram {
webgl_object: WebGLObject::new_inherited(),
id: id,
is_deleted: Cell::new(false),
+ link_called: Cell::new(false),
linked: Cell::new(false),
fragment_shader: Default::default(),
vertex_shader: Default::default(),
@@ -91,27 +93,38 @@ impl WebGLProgram {
self.is_deleted.get()
}
+ pub fn is_linked(&self) -> bool {
+ self.linked.get()
+ }
+
/// glLinkProgram
- pub fn link(&self) {
+ pub fn link(&self) -> WebGLResult<()> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
self.linked.set(false);
+ self.link_called.set(true);
match self.fragment_shader.get() {
Some(ref shader) if shader.successfully_compiled() => {},
- _ => return,
+ _ => return Ok(()), // callers use gl.LINK_STATUS to check link errors
}
match self.vertex_shader.get() {
Some(ref shader) if shader.successfully_compiled() => {},
- _ => return,
+ _ => return Ok(()), // callers use gl.LINK_STATUS to check link errors
}
self.linked.set(true);
-
self.renderer.send(CanvasMsg::WebGL(WebGLCommand::LinkProgram(self.id))).unwrap();
+ Ok(())
}
/// glUseProgram
pub fn use_program(&self) -> WebGLResult<()> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
if !self.linked.get() {
return Err(WebGLError::InvalidOperation);
}
@@ -120,8 +133,20 @@ impl WebGLProgram {
Ok(())
}
+ /// glValidateProgram
+ pub fn validate(&self) -> WebGLResult<()> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
+ self.renderer.send(CanvasMsg::WebGL(WebGLCommand::ValidateProgram(self.id))).unwrap();
+ Ok(())
+ }
+
/// glAttachShader
pub fn attach_shader(&self, shader: &WebGLShader) -> WebGLResult<()> {
+ if self.is_deleted() || shader.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
let shader_slot = match shader.gl_type() {
constants::FRAGMENT_SHADER => &self.fragment_shader,
constants::VERTEX_SHADER => &self.vertex_shader,
@@ -147,6 +172,9 @@ impl WebGLProgram {
/// glDetachShader
pub fn detach_shader(&self, shader: &WebGLShader) -> WebGLResult<()> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
let shader_slot = match shader.gl_type() {
constants::FRAGMENT_SHADER => &self.fragment_shader,
constants::VERTEX_SHADER => &self.vertex_shader,
@@ -174,6 +202,9 @@ impl WebGLProgram {
/// glBindAttribLocation
pub fn bind_attrib_location(&self, index: u32, name: DOMString) -> WebGLResult<()> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
return Err(WebGLError::InvalidValue);
}
@@ -190,6 +221,9 @@ impl WebGLProgram {
}
pub fn get_active_uniform(&self, index: u32) -> WebGLResult<Root<WebGLActiveInfo>> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidValue);
+ }
let (sender, receiver) = ipc::channel().unwrap();
self.renderer
.send(CanvasMsg::WebGL(WebGLCommand::GetActiveUniform(self.id, index, sender)))
@@ -201,6 +235,9 @@ impl WebGLProgram {
/// glGetActiveAttrib
pub fn get_active_attrib(&self, index: u32) -> WebGLResult<Root<WebGLActiveInfo>> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidValue);
+ }
let (sender, receiver) = ipc::channel().unwrap();
self.renderer
.send(CanvasMsg::WebGL(WebGLCommand::GetActiveAttrib(self.id, index, sender)))
@@ -212,6 +249,9 @@ impl WebGLProgram {
/// glGetAttribLocation
pub fn get_attrib_location(&self, name: DOMString) -> WebGLResult<Option<i32>> {
+ if !self.is_linked() || self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
return Err(WebGLError::InvalidValue);
}
@@ -234,6 +274,9 @@ impl WebGLProgram {
/// glGetUniformLocation
pub fn get_uniform_location(&self, name: DOMString) -> WebGLResult<Option<i32>> {
+ if !self.is_linked() || self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
return Err(WebGLError::InvalidValue);
}
@@ -250,6 +293,25 @@ impl WebGLProgram {
Ok(receiver.recv().unwrap())
}
+ /// glGetProgramInfoLog
+ pub fn get_info_log(&self) -> WebGLResult<String> {
+ if self.is_deleted() {
+ return Err(WebGLError::InvalidOperation);
+ }
+ if self.link_called.get() {
+ let shaders_compiled = match (self.fragment_shader.get(), self.vertex_shader.get()) {
+ (Some(fs), Some(vs)) => fs.successfully_compiled() && vs.successfully_compiled(),
+ _ => false
+ };
+ if !shaders_compiled {
+ return Ok("One or more shaders failed to compile".to_string());
+ }
+ }
+ let (sender, receiver) = ipc::channel().unwrap();
+ self.renderer.send(CanvasMsg::WebGL(WebGLCommand::GetProgramInfoLog(self.id, sender))).unwrap();
+ Ok(receiver.recv().unwrap())
+ }
+
/// glGetProgramParameter
pub fn parameter(&self, param_id: u32) -> WebGLResult<WebGLParameter> {
let (sender, receiver) = ipc::channel().unwrap();
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index d1342190f73..b69f11146fd 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -1281,15 +1281,36 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return self.webgl_error(InvalidOperation);
}
- if count <= 0 {
- return self.webgl_error(InvalidOperation);
+ if count < 0 {
+ return self.webgl_error(InvalidValue);
}
if offset < 0 {
return self.webgl_error(InvalidValue);
}
- if self.current_program.get().is_none() || self.bound_buffer_element_array.get().is_none() {
+ if self.current_program.get().is_none() {
+ // From the WebGL spec
+ //
+ // If the CURRENT_PROGRAM is null, an INVALID_OPERATION error will be generated.
+ // WebGL performs additional error checking beyond that specified
+ // in OpenGL ES 2.0 during calls to drawArrays and drawElements.
+ //
+ return self.webgl_error(InvalidOperation);
+ }
+
+ if let Some(array_buffer) = self.bound_buffer_element_array.get() {
+ // WebGL Spec: check buffer overflows, must be a valid multiple of the size.
+ let val = offset as u64 + (count as u64 * type_size as u64);
+ if val > array_buffer.capacity() as u64 {
+ return self.webgl_error(InvalidOperation);
+ }
+ } else {
+ // From the WebGL spec
+ //
+ // a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER binding point
+ // or an INVALID_OPERATION error will be generated.
+ //
return self.webgl_error(InvalidOperation);
}
@@ -1323,25 +1344,68 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn DisableVertexAttribArray(&self, attrib_id: u32) {
+ if attrib_id > self.limits.max_vertex_attribs {
+ return self.webgl_error(InvalidValue);
+ }
+
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(WebGLCommand::DisableVertexAttribArray(attrib_id)))
+ .unwrap()
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn GetActiveUniform(&self, program: Option<&WebGLProgram>, index: u32) -> Option<Root<WebGLActiveInfo>> {
- program.and_then(|p| match p.get_active_uniform(index) {
+ let program = match program {
+ Some(program) => program,
+ None => {
+ // Reasons to generate InvalidValue error
+ // From the GLES 2.0 spec
+ //
+ // "INVALID_VALUE is generated if index is greater than or equal
+ // to the number of active uniform variables in program"
+ //
+ // A null program has no uniforms so any index is always greater than the active uniforms
+ // WebGl conformance expects error with null programs. Check tests in get-active-test.html
+ self.webgl_error(InvalidValue);
+ return None;
+ }
+ };
+
+ match program.get_active_uniform(index) {
Ok(ret) => Some(ret),
- Err(error) => {
- self.webgl_error(error);
- None
- },
- })
+ Err(e) => {
+ self.webgl_error(e);
+ return None;
+ }
+ }
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option<Root<WebGLActiveInfo>> {
- program.and_then(|p| match p.get_active_attrib(index) {
+ let program = match program {
+ Some(program) => program,
+ None => {
+ // Reasons to generate InvalidValue error
+ // From the GLES 2.0 spec
+ //
+ // "INVALID_VALUE is generated if index is greater than or equal
+ // to the number of active attribute variables in program"
+ //
+ // A null program has no attributes so any index is always greater than the active uniforms
+ // WebGl conformance expects error with null programs. Check tests in get-active-test.html
+ self.webgl_error(InvalidValue);
+ return None;
+ }
+ };
+
+ match program.get_active_attrib(index) {
Ok(ret) => Some(ret),
- Err(error) => {
- self.webgl_error(error);
- None
- },
- })
+ Err(e) => {
+ self.webgl_error(e);
+ return None;
+ }
+ }
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@@ -1354,6 +1418,22 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn GetProgramInfoLog(&self, program: Option<&WebGLProgram>) -> Option<DOMString> {
+ if let Some(program) = program {
+ match program.get_info_log() {
+ Ok(value) => Some(DOMString::from(value)),
+ Err(e) => {
+ self.webgl_error(e);
+ None
+ }
+ }
+ } else {
+ self.webgl_error(WebGLError::InvalidValue);
+ None
+ }
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetProgramParameter(&self, _: *mut JSContext, program: Option<&WebGLProgram>, param_id: u32) -> JSVal {
if let Some(program) = program {
match handle_potential_webgl_error!(self, program.parameter(param_id), WebGLParameter::Invalid) {
@@ -1699,7 +1779,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn LinkProgram(&self, program: Option<&WebGLProgram>) {
if let Some(program) = program {
- program.link()
+ if let Err(e) = program.link() {
+ self.webgl_error(e);
+ }
}
}
@@ -1940,6 +2022,15 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
}
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn ValidateProgram(&self, program: Option<&WebGLProgram>) {
+ if let Some(program) = program {
+ if let Err(e) = program.validate() {
+ self.webgl_error(e);
+ }
+ }
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib1f(&self, indx: u32, x: f32) {
self.vertex_attrib(indx, x, 0f32, 0f32, 1f32)
@@ -2016,13 +2107,38 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return self.webgl_error(InvalidValue);
}
- if let constants::FLOAT = data_type {
- let msg = CanvasMsg::WebGL(
- WebGLCommand::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset as u32));
- self.ipc_renderer.send(msg).unwrap()
- } else {
- panic!("VertexAttribPointer: Data Type not supported")
+ // GLES spec: If offset or stride is negative, an INVALID_VALUE error will be generated
+ // WebGL spec: the maximum supported stride is 255
+ if stride < 0 || stride > 255 || offset < 0 {
+ return self.webgl_error(InvalidValue);
+ }
+ if size < 1 || size > 4 {
+ return self.webgl_error(InvalidValue);
+ }
+ if self.bound_buffer_array.get().is_none() {
+ return self.webgl_error(InvalidOperation);
+ }
+
+ // stride and offset must be multiple of data_type
+ match data_type {
+ constants::BYTE | constants::UNSIGNED_BYTE => {},
+ constants::SHORT | constants::UNSIGNED_SHORT => {
+ if offset % 2 > 0 || stride % 2 > 0 {
+ return self.webgl_error(InvalidOperation);
+ }
+ },
+ constants::FLOAT => {
+ if offset % 4 > 0 || stride % 4 > 0 {
+ return self.webgl_error(InvalidOperation);
+ }
+ },
+ _ => return self.webgl_error(InvalidEnum),
+
}
+
+ let msg = CanvasMsg::WebGL(
+ WebGLCommand::VertexAttribPointer(attrib_id, size, data_type, normalized, stride, offset as u32));
+ self.ipc_renderer.send(msg).unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
diff --git a/components/script/dom/webidls/Bluetooth.webidl b/components/script/dom/webidls/Bluetooth.webidl
index 6c575db150c..16c30c770d4 100644
--- a/components/script/dom/webidls/Bluetooth.webidl
+++ b/components/script/dom/webidls/Bluetooth.webidl
@@ -23,9 +23,7 @@ interface Bluetooth {
// [SecureContext]
// readonly attribute BluetoothDevice? referringDevice;
// [SecureContext]
-// Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options);
- [Throws]
- BluetoothDevice requestDevice(optional RequestDeviceOptions options);
+ Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
};
// Bluetooth implements EventTarget;
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
index fdb3afa8b9a..293ac7f742c 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl
@@ -10,18 +10,12 @@ interface BluetoothRemoteGATTCharacteristic {
readonly attribute DOMString uuid;
readonly attribute BluetoothCharacteristicProperties properties;
readonly attribute ByteString? value;
- [Throws]
- BluetoothRemoteGATTDescriptor getDescriptor(BluetoothDescriptorUUID descriptor);
- [Throws]
- sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional BluetoothDescriptorUUID descriptor);
- //Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
- //Promise<sequence<BluetoothRemoteGATTDescriptor>>
- //getDescriptors(optional BluetoothDescriptorUUID descriptor);
- [Throws]
- ByteString readValue();
+ Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
+ Promise<sequence<BluetoothRemoteGATTDescriptor>>
+ getDescriptors(optional BluetoothDescriptorUUID descriptor);
+ Promise<ByteString> readValue();
//Promise<DataView> readValue();
- [Throws]
- void writeValue(sequence<octet> value);
+ Promise<void> writeValue(sequence<octet> value);
//Promise<void> writeValue(BufferSource value);
//Promise<void> startNotifications();
//Promise<void> stopNotifications();
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl b/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
index 8c744929542..7ffd3f2ebb5 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl
@@ -9,10 +9,8 @@ interface BluetoothRemoteGATTDescriptor {
readonly attribute BluetoothRemoteGATTCharacteristic characteristic;
readonly attribute DOMString uuid;
readonly attribute ByteString? value;
- [Throws]
- ByteString readValue();
+ Promise<ByteString> readValue();
//Promise<DataView> readValue();
- [Throws]
- void writeValue(sequence<octet> value);
+ Promise<void> writeValue(sequence<octet> value);
//Promise<void> writeValue(BufferSource value);
};
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
index 13314d7c6e1..45e3df198fe 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl
@@ -8,15 +8,9 @@
interface BluetoothRemoteGATTServer {
readonly attribute BluetoothDevice device;
readonly attribute boolean connected;
- [Throws]
- BluetoothRemoteGATTServer connect();
+ Promise<BluetoothRemoteGATTServer> connect();
[Throws]
void disconnect();
- [Throws]
- BluetoothRemoteGATTService getPrimaryService(BluetoothServiceUUID service);
- [Throws]
- sequence<BluetoothRemoteGATTService> getPrimaryServices(optional BluetoothServiceUUID service);
- //Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
- //Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
- //Promise<BluetoothRemoteGATTServer> connect();
+ Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
+ Promise<sequence<BluetoothRemoteGATTService>> getPrimaryServices(optional BluetoothServiceUUID service);
};
diff --git a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
index a7ee941232a..a484ae64f80 100644
--- a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
+++ b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl
@@ -9,18 +9,9 @@ interface BluetoothRemoteGATTService {
readonly attribute BluetoothDevice device;
readonly attribute DOMString uuid;
readonly attribute boolean isPrimary;
- [Throws]
- BluetoothRemoteGATTCharacteristic getCharacteristic(BluetoothCharacteristicUUID characteristic);
- [Throws]
- sequence<BluetoothRemoteGATTCharacteristic> getCharacteristics
- (optional BluetoothCharacteristicUUID characteristic);
- //Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
- //Promise<sequence<BluetoothRemoteGATTCharacteristic>>
- //getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
- [Throws]
- BluetoothRemoteGATTService getIncludedService(BluetoothServiceUUID service);
- [Throws]
- sequence<BluetoothRemoteGATTService> getIncludedServices(optional BluetoothServiceUUID service);
- //Promise<BluetoothRemoteGATTService>getIncludedService(BluetoothServiceUUID service);
- //Promise<sequence<BluetoothRemoteGATTService>>getIncludedServices(optional BluetoothServiceUUID service);
+ Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic);
+ Promise<sequence<BluetoothRemoteGATTCharacteristic>>
+ getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
+ Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service);
+ Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
};
diff --git a/components/script/dom/webidls/Body.webidl b/components/script/dom/webidls/Body.webidl
index a020228a01d..bb7aa5c6859 100644
--- a/components/script/dom/webidls/Body.webidl
+++ b/components/script/dom/webidls/Body.webidl
@@ -10,10 +10,9 @@
interface Body {
readonly attribute boolean bodyUsed;
- // Servo does not support Promise at this moment.
// [NewObject] Promise<ArrayBuffer> arrayBuffer();
- // [NewObject] Promise<Blob> blob();
- // [NewObject] Promise<FormData> formData();
- // [NewObject] Promise<JSON> json();
- // [NewObject] Promise<USVString> text();
+ [NewObject] Promise<Blob> blob();
+ [NewObject] Promise<FormData> formData();
+ [NewObject] Promise<any> json();
+ [NewObject] Promise<USVString> text();
};
diff --git a/components/script/dom/webidls/EventSource.webidl b/components/script/dom/webidls/EventSource.webidl
index 11c30e959d4..b9cf82d6a3e 100644
--- a/components/script/dom/webidls/EventSource.webidl
+++ b/components/script/dom/webidls/EventSource.webidl
@@ -7,7 +7,8 @@
*/
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict),
- Exposed=(Window,Worker)]
+ Exposed=(Window,Worker),
+ Pref="dom.eventsource.enabled"]
interface EventSource : EventTarget {
readonly attribute DOMString url;
readonly attribute boolean withCredentials;
diff --git a/components/script/dom/webidls/Fetch.webidl b/components/script/dom/webidls/Fetch.webidl
new file mode 100644
index 00000000000..fe062994598
--- /dev/null
+++ b/components/script/dom/webidls/Fetch.webidl
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://fetch.spec.whatwg.org/#fetch-method
+
+[Exposed=(Window,Worker)]
+
+partial interface WindowOrWorkerGlobalScope {
+ [NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init);
+};
diff --git a/components/script/dom/webidls/Response.webidl b/components/script/dom/webidls/Response.webidl
index 2052f5c6371..a1b3cf7dd9a 100644
--- a/components/script/dom/webidls/Response.webidl
+++ b/components/script/dom/webidls/Response.webidl
@@ -4,8 +4,7 @@
// https://fetch.spec.whatwg.org/#response-class
-// TODO: pass 'optional ResponseBodyInit? body = null' to constructor in place of USVString
- [Constructor(optional USVString? body = null, optional ResponseInit init),
+ [Constructor(optional BodyInit? body = null, optional ResponseInit init),
Exposed=(Window,Worker)]
interface Response {
[NewObject] static Response error();
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index 06727b3a536..19e5f029168 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -552,7 +552,7 @@ interface WebGLRenderingContextBase
void depthRange(GLclampf zNear, GLclampf zFar);
void detachShader(WebGLProgram? program, WebGLShader? shader);
void disable(GLenum cap);
- //void disableVertexAttribArray(GLuint index);
+ void disableVertexAttribArray(GLuint index);
void drawArrays(GLenum mode, GLint first, GLsizei count);
void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
@@ -583,7 +583,7 @@ interface WebGLRenderingContextBase
//any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
// GLenum pname);
any getProgramParameter(WebGLProgram? program, GLenum pname);
- //DOMString? getProgramInfoLog(WebGLProgram? program);
+ DOMString? getProgramInfoLog(WebGLProgram? program);
//any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader? shader, GLenum pname);
//WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
@@ -704,7 +704,7 @@ interface WebGLRenderingContextBase
// sequence<GLfloat> value);
void useProgram(WebGLProgram? program);
- //void validateProgram(WebGLProgram? program);
+ void validateProgram(WebGLProgram? program);
// FIXME(dmarcos)
// The code generator doesn't handle Float32Array so we're using 'object'
diff --git a/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl b/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl
new file mode 100644
index 00000000000..f0b8218fbe2
--- /dev/null
+++ b/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://html.spec.whatwg.org/multipage/#windoworworkerglobalscope
+
+// typedef (DOMString or Function) TimerHandler;
+
+[NoInterfaceObject, Exposed=(Window,Worker)]
+interface WindowOrWorkerGlobalScope {
+ // [Replaceable] readonly attribute USVString origin;
+
+ // base64 utility methods
+ // DOMString btoa(DOMString data);
+ // DOMString atob(DOMString data);
+
+ // timers
+ // long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments);
+ // void clearTimeout(optional long handle = 0);
+ // long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
+ // void clearInterval(optional long handle = 0);
+
+ // ImageBitmap
+ // Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options);
+ // Promise<ImageBitmap> createImageBitmap(
+ // ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
+};
+
+Window implements WindowOrWorkerGlobalScope;
+WorkerGlobalScope implements WindowOrWorkerGlobalScope;
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 3e841116acd..3ac5c4e37f9 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -12,9 +12,11 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::OnBeforeUnloadEventHa
use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
use dom::bindings::codegen::Bindings::FunctionBinding::Function;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
+use dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
use dom::bindings::codegen::Bindings::WindowBinding::{self, FrameRequestCallback, WindowMethods};
use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions};
-use dom::bindings::error::{Error, ErrorInfo, ErrorResult, Fallible, report_pending_exception};
+use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
+use dom::bindings::error::{Error, ErrorInfo, ErrorResult, Fallible};
use dom::bindings::global::{GlobalRef, global_root_from_object};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
@@ -40,17 +42,17 @@ use dom::messageevent::MessageEvent;
use dom::navigator::Navigator;
use dom::node::{Node, from_untrusted_node_address, window_from_node};
use dom::performance::Performance;
+use dom::promise::Promise;
use dom::screen::Screen;
use dom::storage::Storage;
use euclid::{Point2D, Rect, Size2D};
+use fetch;
use gfx_traits::LayerId;
use ipc_channel::ipc::{self, IpcSender};
-use js::jsapi::{Evaluate2, HandleObject, HandleValue, JSAutoCompartment, JSContext};
-use js::jsapi::{JS_GC, JS_GetRuntime, MutableHandleValue, SetWindowProxy};
+use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
+use js::jsapi::{JS_GC, JS_GetRuntime, SetWindowProxy};
use js::jsval::UndefinedValue;
-use js::rust::CompileOptionsWrapper;
use js::rust::Runtime;
-use libc;
use msg::constellation_msg::{FrameType, LoadData, PipelineId, ReferrerPolicy, WindowSizeType};
use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg;
@@ -60,15 +62,14 @@ use num_traits::ToPrimitive;
use open;
use origin::Origin;
use profile_traits::mem;
-use profile_traits::time::{ProfilerCategory, TimerMetadata, TimerMetadataFrameType};
-use profile_traits::time::{ProfilerChan, TimerMetadataReflowType, profile};
+use profile_traits::time::ProfilerChan;
use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
use script_layout_interface::TrustedNodeAddress;
use script_layout_interface::message::{Msg, Reflow, ReflowQueryType, ScriptReflow};
use script_layout_interface::reporter::CSSErrorReporter;
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
use script_layout_interface::rpc::{MarginStyleResponse, ResolvedStyleResponse};
-use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, maybe_take_panic_result};
+use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory};
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper};
use script_thread::SendableMainThreadScriptChan;
use script_traits::{ConstellationControlMsg, MozBrowserEvent, UntrustedNodeAddress};
@@ -80,9 +81,7 @@ use std::borrow::ToOwned;
use std::cell::Cell;
use std::collections::{HashMap, HashSet};
use std::default::Default;
-use std::ffi::CString;
use std::io::{Write, stderr, stdout};
-use std::panic;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicBool, Ordering};
@@ -191,7 +190,6 @@ pub struct Window {
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
/// For sending timeline markers. Will be ignored if
/// no devtools server
- #[ignore_heap_size_of = "TODO(#6909) need to measure HashSet"]
devtools_markers: DOMRefCell<HashSet<TimelineMarkerType>>,
#[ignore_heap_size_of = "channels are hard"]
devtools_marker_sender: DOMRefCell<Option<IpcSender<TimelineMarker>>>,
@@ -902,60 +900,11 @@ impl WindowMethods for Window {
Err(e) => Err(Error::Type(format!("Couldn't open URL: {}", e))),
}
}
-}
-
-pub trait ScriptHelpers {
- fn evaluate_js_on_global_with_result(self, code: &str,
- rval: MutableHandleValue);
- fn evaluate_script_on_global_with_result(self, code: &str, filename: &str,
- rval: MutableHandleValue);
-}
-
-impl<'a, T: Reflectable> ScriptHelpers for &'a T {
- fn evaluate_js_on_global_with_result(self, code: &str,
- rval: MutableHandleValue) {
- self.evaluate_script_on_global_with_result(code, "", rval)
- }
-
- #[allow(unsafe_code)]
- fn evaluate_script_on_global_with_result(self, code: &str, filename: &str,
- rval: MutableHandleValue) {
- let global = self.global();
- let metadata = TimerMetadata {
- url: if filename.is_empty() {
- global.r().get_url().as_str().into()
- } else {
- filename.into()
- },
- iframe: TimerMetadataFrameType::RootWindow,
- incremental: TimerMetadataReflowType::FirstReflow,
- };
- profile(
- ProfilerCategory::ScriptEvaluate,
- Some(metadata),
- global.r().time_profiler_chan().clone(),
- || {
- let cx = global.r().get_cx();
- let globalhandle = global.r().reflector().get_jsobject();
- let code: Vec<u16> = code.encode_utf16().collect();
- let filename = CString::new(filename).unwrap();
-
- let _ac = JSAutoCompartment::new(cx, globalhandle.get());
- let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), 1);
- unsafe {
- if !Evaluate2(cx, options.ptr, code.as_ptr(),
- code.len() as libc::size_t,
- rval) {
- debug!("error evaluating JS string");
- report_pending_exception(cx, true);
- }
- }
- if let Some(error) = maybe_take_panic_result() {
- panic::resume_unwind(error);
- }
- }
- )
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#fetch-method
+ fn Fetch(&self, input: RequestOrUSVString, init: &RequestInit) -> Rc<Promise> {
+ fetch::Fetch(self.global().r(), input, init)
}
}
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index 1821b2d2dee..fb6b170ab1d 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -106,7 +106,7 @@ impl Worker {
let init = prepare_workerscope_init(global, Some(devtools_sender));
DedicatedWorkerGlobalScope::run_worker_scope(
- init, worker_url, global.pipeline_id(), devtools_receiver, worker.runtime.clone(), worker_ref,
+ init, worker_url, devtools_receiver, worker.runtime.clone(), worker_ref,
global.script_chan(), sender, receiver, worker_load_origin, closing);
Ok(worker)
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 2520f57dbac..9c7768ce5e7 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -5,8 +5,10 @@
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
use dom::bindings::codegen::Bindings::FunctionBinding::Function;
+use dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
use dom::bindings::codegen::Bindings::WorkerGlobalScopeBinding::WorkerGlobalScopeMethods;
-use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exception, ErrorInfo};
+use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
+use dom::bindings::error::{Error, ErrorInfo, ErrorResult, Fallible, report_pending_exception};
use dom::bindings::global::{GlobalRef, GlobalRoot};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root};
@@ -16,11 +18,16 @@ use dom::bindings::str::DOMString;
use dom::console::TimerSet;
use dom::crypto::Crypto;
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;
+use dom::errorevent::ErrorEvent;
+use dom::event::{Event, EventBubbles, EventCancelable};
+use dom::eventdispatcher::EventStatus;
use dom::eventtarget::EventTarget;
+use dom::promise::Promise;
use dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
use dom::window::{base64_atob, base64_btoa};
use dom::workerlocation::WorkerLocation;
use dom::workernavigator::WorkerNavigator;
+use fetch;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, JSAutoCompartment, JSContext, JSRuntime};
use js::jsval::UndefinedValue;
@@ -62,7 +69,8 @@ pub fn prepare_workerscope_init(global: GlobalRef,
from_devtools_sender: devtools_sender,
constellation_chan: global.constellation_chan().clone(),
scheduler_chan: global.scheduler_chan().clone(),
- worker_id: worker_id
+ worker_id: worker_id,
+ pipeline_id: global.pipeline_id(),
};
init
@@ -73,6 +81,7 @@ pub fn prepare_workerscope_init(global: GlobalRef,
pub struct WorkerGlobalScope {
eventtarget: EventTarget,
worker_id: WorkerId,
+ pipeline_id: PipelineId,
worker_url: Url,
closing: Option<Arc<AtomicBool>>,
#[ignore_heap_size_of = "Defined in js"]
@@ -116,6 +125,9 @@ pub struct WorkerGlobalScope {
console_timers: TimerSet,
promise_job_queue: PromiseJobQueue,
+
+ /// https://html.spec.whatwg.org/multipage/#in-error-reporting-mode
+ in_error_reporting_mode: Cell<bool>
}
impl WorkerGlobalScope {
@@ -130,6 +142,7 @@ impl WorkerGlobalScope {
eventtarget: EventTarget::new_inherited(),
next_worker_id: Cell::new(WorkerId(0)),
worker_id: init.worker_id,
+ pipeline_id: init.pipeline_id,
worker_url: worker_url,
closing: closing,
runtime: runtime,
@@ -148,6 +161,7 @@ impl WorkerGlobalScope {
scheduler_chan: init.scheduler_chan,
console_timers: TimerSet::new(),
promise_job_queue: PromiseJobQueue::new(),
+ in_error_reporting_mode: Default::default(),
}
}
@@ -393,6 +407,12 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
fn ClearInterval(&self, handle: i32) {
self.ClearTimeout(handle);
}
+
+ #[allow(unrooted_must_root)]
+ // https://fetch.spec.whatwg.org/#fetch-method
+ fn Fetch(&self, input: RequestOrUSVString, init: &RequestInit) -> Rc<Promise> {
+ fetch::Fetch(self.global().r(), input, init)
+ }
}
@@ -437,15 +457,7 @@ impl WorkerGlobalScope {
}
pub fn pipeline_id(&self) -> PipelineId {
- let dedicated = self.downcast::<DedicatedWorkerGlobalScope>();
- let service_worker = self.downcast::<ServiceWorkerGlobalScope>();
- if let Some(dedicated) = dedicated {
- return dedicated.pipeline_id();
- } else if let Some(service_worker) = service_worker {
- return service_worker.pipeline_id();
- } else {
- panic!("need to implement a sender for SharedWorker")
- }
+ self.pipeline_id
}
pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) {
@@ -485,9 +497,38 @@ impl WorkerGlobalScope {
/// https://html.spec.whatwg.org/multipage/#report-the-error
pub fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue) {
- self.downcast::<DedicatedWorkerGlobalScope>()
- .expect("Should implement report_an_error for this worker")
- .report_an_error(error_info, value);
+ // Step 1.
+ if self.in_error_reporting_mode.get() {
+ return;
+ }
+
+ // Step 2.
+ self.in_error_reporting_mode.set(true);
+
+ // Steps 3-12.
+ // FIXME(#13195): muted errors.
+ let event = ErrorEvent::new(GlobalRef::Worker(self),
+ atom!("error"),
+ EventBubbles::DoesNotBubble,
+ EventCancelable::Cancelable,
+ error_info.message.as_str().into(),
+ error_info.filename.as_str().into(),
+ error_info.lineno,
+ error_info.column,
+ value);
+
+ // Step 13.
+ let event_status = event.upcast::<Event>().fire(self.upcast::<EventTarget>());
+
+ // Step 15
+ if event_status == EventStatus::NotCanceled {
+ if let Some(dedicated) = self.downcast::<DedicatedWorkerGlobalScope>() {
+ dedicated.forward_error_to_worker_object(error_info);
+ }
+ }
+
+ // Step 14
+ self.in_error_reporting_mode.set(false);
}
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 0d21f9026fc..caebbddd09e 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -587,7 +587,6 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
url: self.request_url.borrow().clone().unwrap(),
headers: (*self.request_headers.borrow()).clone(),
unsafe_request: true,
- same_origin_data: true,
// XXXManishearth figure out how to avoid this clone
body: extracted.as_ref().map(|e| e.0.clone()),
// XXXManishearth actually "subresource", but it doesn't exist
@@ -1371,7 +1370,7 @@ impl XHRTimeoutCallback {
}
}
-trait Extractable {
+pub trait Extractable {
fn extract(&self) -> (Vec<u8>, Option<DOMString>);
}
impl Extractable for BodyInit {
diff --git a/components/script/fetch.rs b/components/script/fetch.rs
new file mode 100644
index 00000000000..0fc0fef1f89
--- /dev/null
+++ b/components/script/fetch.rs
@@ -0,0 +1,171 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::RequestBinding::RequestInit;
+use dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::ResponseMethods;
+use dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMResponseType;
+use dom::bindings::codegen::UnionTypes::RequestOrUSVString;
+use dom::bindings::error::Error;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::Root;
+use dom::bindings::refcounted::{Trusted, TrustedPromise};
+use dom::bindings::reflector::Reflectable;
+use dom::headers::Guard;
+use dom::promise::Promise;
+use dom::request::Request;
+use dom::response::Response;
+use ipc_channel::ipc;
+use ipc_channel::router::ROUTER;
+use js::jsapi::JSAutoCompartment;
+use net_traits::{FetchResponseListener, NetworkError};
+use net_traits::{FilteredMetadata, FetchMetadata, Metadata};
+use net_traits::CoreResourceMsg::Fetch as NetTraitsFetch;
+use net_traits::request::Request as NetTraitsRequest;
+use net_traits::request::RequestInit as NetTraitsRequestInit;
+use network_listener::{NetworkListener, PreInvoke};
+use std::rc::Rc;
+use std::sync::{Arc, Mutex};
+use url::Url;
+
+struct FetchContext {
+ fetch_promise: Option<TrustedPromise>,
+ response_object: Trusted<Response>,
+}
+
+fn from_referrer_to_referrer_url(request: &NetTraitsRequest) -> Option<Url> {
+ let referrer = request.referrer.borrow();
+ referrer.to_url().map(|url| url.clone())
+}
+
+fn request_init_from_request(request: NetTraitsRequest) -> NetTraitsRequestInit {
+ NetTraitsRequestInit {
+ method: request.method.borrow().clone(),
+ url: request.url(),
+ headers: request.headers.borrow().clone(),
+ unsafe_request: request.unsafe_request,
+ body: request.body.borrow().clone(),
+ type_: request.type_,
+ destination: request.destination,
+ synchronous: request.synchronous,
+ mode: request.mode,
+ use_cors_preflight: request.use_cors_preflight,
+ credentials_mode: request.credentials_mode,
+ use_url_credentials: request.use_url_credentials,
+ // TODO: NetTraitsRequestInit and NetTraitsRequest have different "origin"
+ // ... NetTraitsRequestInit.origin: Url
+ // ... NetTraitsRequest.origin: RefCell<Origin>
+ origin: request.url(),
+ referrer_url: from_referrer_to_referrer_url(&request),
+ referrer_policy: request.referrer_policy.get(),
+ pipeline_id: request.pipeline_id.get(),
+ }
+}
+
+// https://fetch.spec.whatwg.org/#fetch-method
+#[allow(unrooted_must_root)]
+pub fn Fetch(global: GlobalRef, input: RequestOrUSVString, init: &RequestInit) -> Rc<Promise> {
+ let core_resource_thread = global.core_resource_thread();
+
+ // Step 1
+ let promise = Promise::new(global);
+ let response = Response::new(global);
+
+ // Step 2
+ let request = match Request::Constructor(global, input, init) {
+ Err(e) => {
+ promise.reject_error(promise.global().r().get_cx(), e);
+ return promise;
+ },
+ Ok(r) => r.get_request(),
+ };
+ let request_init = request_init_from_request(request);
+
+ // Step 3
+ response.Headers().set_guard(Guard::Immutable);
+
+ // Step 4
+ let (action_sender, action_receiver) = ipc::channel().unwrap();
+ let fetch_context = Arc::new(Mutex::new(FetchContext {
+ fetch_promise: Some(TrustedPromise::new(promise.clone())),
+ response_object: Trusted::new(&*response),
+ }));
+ let listener = NetworkListener {
+ context: fetch_context,
+ script_chan: global.networking_task_source(),
+ wrapper: None,
+ };
+
+ ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
+ listener.notify_fetch(message.to().unwrap());
+ });
+ core_resource_thread.send(NetTraitsFetch(request_init, action_sender)).unwrap();
+
+ promise
+}
+
+impl PreInvoke for FetchContext {}
+
+impl FetchResponseListener for FetchContext {
+ fn process_request_body(&mut self) {
+ // TODO
+ }
+
+ fn process_request_eof(&mut self) {
+ // TODO
+ }
+
+ #[allow(unrooted_must_root)]
+ fn process_response(&mut self, fetch_metadata: Result<FetchMetadata, NetworkError>) {
+ let promise = self.fetch_promise.take().expect("fetch promise is missing").root();
+
+ // JSAutoCompartment needs to be manually made.
+ // Otherwise, Servo will crash.
+ let promise_cx = promise.global().r().get_cx();
+ let _ac = JSAutoCompartment::new(promise_cx, promise.reflector().get_jsobject().get());
+ match fetch_metadata {
+ // Step 4.1
+ Err(_) => {
+ promise.reject_error(
+ promise.global().r().get_cx(),
+ Error::Type("Network error occurred".to_string()));
+ self.fetch_promise = Some(TrustedPromise::new(promise));
+ return;
+ },
+ // Step 4.2
+ Ok(metadata) => {
+ match metadata {
+ FetchMetadata::Unfiltered(m) =>
+ fill_headers_with_metadata(self.response_object.root(), m),
+ FetchMetadata::Filtered { filtered, .. } => match filtered {
+ FilteredMetadata::Transparent(m) =>
+ fill_headers_with_metadata(self.response_object.root(), m),
+ FilteredMetadata::Opaque =>
+ self.response_object.root().set_type(DOMResponseType::Opaque),
+ }
+ }
+ }
+ }
+ // Step 4.3
+ promise.resolve_native(
+ promise_cx,
+ &self.response_object.root());
+ self.fetch_promise = Some(TrustedPromise::new(promise));
+ }
+
+ fn process_response_chunk(&mut self, mut chunk: Vec<u8>) {
+ // TODO when body is implemented
+ // ... this will append the chunk to Response's body.
+ }
+
+ fn process_response_eof(&mut self, response: Result<(), NetworkError>) {
+ // TODO
+ // ... trailerObject is not supported in Servo yet.
+ }
+}
+
+fn fill_headers_with_metadata(r: Root<Response>, m: Metadata) {
+ r.set_headers(m.headers);
+ r.set_raw_status(m.status);
+ r.set_final_url(m.final_url);
+}
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 19e6c7c4e79..b609a545277 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -43,7 +43,7 @@ use gfx_traits::ByteIndex;
use msg::constellation_msg::PipelineId;
use range::Range;
use script_layout_interface::{HTMLCanvasData, LayoutNodeType, TrustedNodeAddress};
-use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
+use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData};
use script_layout_interface::restyle_damage::RestyleDamage;
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, LayoutNode, PseudoElementType};
use script_layout_interface::wrapper_traits::{ThreadSafeLayoutElement, ThreadSafeLayoutNode};
@@ -54,15 +54,15 @@ use std::marker::PhantomData;
use std::mem::transmute;
use std::sync::Arc;
use string_cache::{Atom, Namespace};
+use style::atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use style::attr::AttrValue;
use style::computed_values::display;
use style::context::SharedStyleContext;
-use style::data::PrivateStyleData;
+use style::data::PersistentStyleData;
use style::dom::{LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthetizer, TDocument, TElement, TNode};
use style::dom::UnsafeNode;
use style::element_state::*;
use style::properties::{ComputedValues, PropertyDeclarationBlock};
-use style::refcell::{Ref, RefCell, RefMut};
use style::selector_impl::{ElementSnapshot, NonTSPseudoClass, PseudoElement, ServoSelectorImpl};
use style::selector_matching::ApplicableDeclarationBlock;
use style::sink::Push;
@@ -220,30 +220,20 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
self.node.set_flag(CAN_BE_FRAGMENTED, value)
}
- unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
- self.get_style_data().map(|d| {
- &(*d.as_unsafe_cell().get()).style_data as *const _
- })
+ fn borrow_data(&self) -> Option<AtomicRef<PersistentStyleData>> {
+ self.get_style_data().map(|d| d.borrow())
}
- fn borrow_data(&self) -> Option<Ref<PrivateStyleData>> {
- self.get_style_data().map(|d| {
- Ref::map(d.borrow(), |d| &d.style_data)
- })
- }
-
- fn mutate_data(&self) -> Option<RefMut<PrivateStyleData>> {
- self.get_style_data().map(|d| {
- RefMut::map(d.borrow_mut(), |d| &mut d.style_data)
- })
+ fn mutate_data(&self) -> Option<AtomicRefMut<PersistentStyleData>> {
+ self.get_style_data().map(|d| d.borrow_mut())
}
fn restyle_damage(self) -> RestyleDamage {
- self.get_style_data().unwrap().borrow().restyle_damage
+ self.get_partial_layout_data().unwrap().borrow().restyle_damage
}
fn set_restyle_damage(self, damage: RestyleDamage) {
- self.get_style_data().unwrap().borrow_mut().restyle_damage = damage;
+ self.get_partial_layout_data().unwrap().borrow_mut().restyle_damage = damage;
}
fn parent_node(&self) -> Option<ServoLayoutNode<'ln>> {
@@ -309,10 +299,12 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
self.script_type_id().into()
}
- fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>> {
+ fn get_style_data(&self) -> Option<&AtomicRefCell<PersistentStyleData>> {
unsafe {
self.get_jsmanaged().get_style_and_layout_data().map(|d| {
- &**d.ptr
+ let ppld: &AtomicRefCell<PartialPersistentLayoutData> = &**d.ptr;
+ let psd: &AtomicRefCell<PersistentStyleData> = transmute(ppld);
+ psd
})
}
}
@@ -331,6 +323,14 @@ impl<'ln> LayoutNode for ServoLayoutNode<'ln> {
}
impl<'ln> ServoLayoutNode<'ln> {
+ fn get_partial_layout_data(&self) -> Option<&AtomicRefCell<PartialPersistentLayoutData>> {
+ unsafe {
+ self.get_jsmanaged().get_style_and_layout_data().map(|d| {
+ &**d.ptr
+ })
+ }
+ }
+
fn dump_indent(self, indent: u32) {
let mut s = String::new();
for _ in 0..indent {
@@ -871,7 +871,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
}
}
- fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>> {
+ fn get_style_data(&self) -> Option<&AtomicRefCell<PersistentStyleData>> {
self.node.get_style_data()
}
}
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 89479c4c291..234f6c0f224 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -92,11 +92,13 @@ extern crate websocket;
extern crate xml5ever;
pub mod bluetooth_blacklist;
+mod body;
pub mod clipboard_provider;
mod devtools;
pub mod document_loader;
#[macro_use]
pub mod dom;
+pub mod fetch;
pub mod layout_wrapper;
mod mem;
mod network_listener;
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index f1878501500..282fd90a08b 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -46,7 +46,7 @@ use dom::serviceworker::TrustedServiceWorkerAddress;
use dom::serviceworkerregistration::ServiceWorkerRegistration;
use dom::servohtmlparser::ParserContext;
use dom::uievent::UIEvent;
-use dom::window::{ReflowReason, ScriptHelpers, Window};
+use dom::window::{ReflowReason, Window};
use dom::worker::TrustedWorkerAddress;
use euclid::Rect;
use euclid::point::Point2D;
@@ -1775,7 +1775,8 @@ impl ScriptThread {
unsafe {
let _ac = JSAutoCompartment::new(self.get_cx(), window.reflector().get_jsobject().get());
rooted!(in(self.get_cx()) let mut jsval = UndefinedValue());
- window.evaluate_js_on_global_with_result(&script_source, jsval.handle_mut());
+ GlobalRef::Window(&window).evaluate_js_on_global_with_result(
+ &script_source, jsval.handle_mut());
let strval = DOMString::from_jsval(self.get_cx(),
jsval.handle(),
StringificationBehavior::Empty);
diff --git a/components/script/timers.rs b/components/script/timers.rs
index f75ebf907d5..601755c6fc4 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -9,7 +9,6 @@ use dom::bindings::global::GlobalRef;
use dom::bindings::reflector::Reflectable;
use dom::bindings::str::DOMString;
use dom::testbinding::TestBindingCallback;
-use dom::window::ScriptHelpers;
use dom::xmlhttprequest::XHRTimeoutCallback;
use euclid::length::Length;
use heapsize::HeapSizeOf;
@@ -490,10 +489,12 @@ impl JsTimerTask {
// step 4.2
match *&self.callback {
InternalTimerCallback::StringTimerCallback(ref code_str) => {
- let cx = this.global().r().get_cx();
+ let global = this.global();
+ let cx = global.r().get_cx();
rooted!(in(cx) let mut rval = UndefinedValue());
- this.evaluate_js_on_global_with_result(code_str, rval.handle_mut());
+ global.r().evaluate_js_on_global_with_result(
+ code_str, rval.handle_mut());
},
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
let arguments: Vec<JSVal> = arguments.iter().map(|arg| arg.get()).collect();
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index b4e80bddac7..03281464765 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -13,6 +13,7 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, StringificationBehavior};
+use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::str::DOMString;
@@ -23,7 +24,6 @@ use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlinputelement::HTMLInputElement;
use dom::htmloptionelement::HTMLOptionElement;
use dom::node::Node;
-use dom::window::ScriptHelpers;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
@@ -92,7 +92,8 @@ pub fn handle_execute_script(context: &BrowsingContext,
let result = unsafe {
let cx = window.get_cx();
rooted!(in(cx) let mut rval = UndefinedValue());
- window.evaluate_js_on_global_with_result(&eval, rval.handle_mut());
+ GlobalRef::Window(&window).evaluate_js_on_global_with_result(
+ &eval, rval.handle_mut());
jsval_to_webdriver(cx, rval.handle())
};
reply.send(result).unwrap();
@@ -111,7 +112,8 @@ pub fn handle_execute_async_script(context: &BrowsingContext,
let cx = window.get_cx();
window.set_webdriver_script_chan(Some(reply));
rooted!(in(cx) let mut rval = UndefinedValue());
- window.evaluate_js_on_global_with_result(&eval, rval.handle_mut());
+ GlobalRef::Window(&window).evaluate_js_on_global_with_result(
+ &eval, rval.handle_mut());
}
pub fn handle_get_frame_id(context: &BrowsingContext,
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index d3554422dd7..cad2e012c7c 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -52,11 +52,11 @@ use core::nonzero::NonZero;
use ipc_channel::ipc::IpcSender;
use libc::c_void;
use restyle_damage::RestyleDamage;
-use style::data::PrivateStyleData;
-use style::refcell::RefCell;
+use style::atomic_refcell::AtomicRefCell;
+use style::data::PersistentStyleData;
-pub struct PartialStyleAndLayoutData {
- pub style_data: PrivateStyleData,
+pub struct PartialPersistentLayoutData {
+ pub style_data: PersistentStyleData,
pub restyle_damage: RestyleDamage,
}
@@ -64,7 +64,7 @@ pub struct PartialStyleAndLayoutData {
pub struct OpaqueStyleAndLayoutData {
#[ignore_heap_size_of = "TODO(#6910) Box value that should be counted but \
the type lives in layout"]
- pub ptr: NonZero<*mut RefCell<PartialStyleAndLayoutData>>
+ pub ptr: NonZero<*mut AtomicRefCell<PartialPersistentLayoutData>>
}
#[allow(unsafe_code)]
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index dcb1f68cfb4..c02d76a2f4e 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -5,7 +5,6 @@
use HTMLCanvasData;
use LayoutNodeType;
use OpaqueStyleAndLayoutData;
-use PartialStyleAndLayoutData;
use gfx_traits::{ByteIndex, LayerId, LayerType};
use msg::constellation_msg::PipelineId;
use range::Range;
@@ -13,12 +12,13 @@ use restyle_damage::RestyleDamage;
use std::fmt::Debug;
use std::sync::Arc;
use string_cache::{Atom, Namespace};
+use style::atomic_refcell::AtomicRefCell;
use style::computed_values::display;
use style::context::SharedStyleContext;
+use style::data::PersistentStyleData;
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::OpaqueNode;
use style::properties::ServoComputedValues;
-use style::refcell::{Ref, RefCell};
use style::selector_impl::{PseudoElement, PseudoElementCascadeType, ServoSelectorImpl};
use url::Url;
@@ -76,7 +76,7 @@ pub trait LayoutNode: TNode {
/// Returns the type ID of this node.
fn type_id(&self) -> LayoutNodeType;
- fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
+ fn get_style_data(&self) -> Option<&AtomicRefCell<PersistentStyleData>>;
fn init_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData);
fn get_style_and_layout_data(&self) -> Option<OpaqueStyleAndLayoutData>;
@@ -183,7 +183,6 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
if self.get_style_data()
.unwrap()
.borrow()
- .style_data
.per_pseudo
.contains_key(&PseudoElement::Before) {
Some(self.with_pseudo(PseudoElementType::Before(None)))
@@ -197,7 +196,6 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
if self.get_style_data()
.unwrap()
.borrow()
- .style_data
.per_pseudo
.contains_key(&PseudoElement::After) {
Some(self.with_pseudo(PseudoElementType::After(None)))
@@ -240,12 +238,11 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
///
/// Unlike the version on TNode, this handles pseudo-elements.
#[inline]
- fn style(&self, context: &SharedStyleContext) -> Ref<Arc<ServoComputedValues>> {
+ fn style(&self, context: &SharedStyleContext) -> Arc<ServoComputedValues> {
match self.get_pseudo_element_type() {
PseudoElementType::Normal => {
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- data.style_data.style.as_ref().unwrap()
- })
+ self.get_style_data().unwrap().borrow()
+ .style.as_ref().unwrap().clone()
},
other => {
// Precompute non-eagerly-cascaded pseudo-element styles if not
@@ -258,14 +255,13 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
if !self.get_style_data()
.unwrap()
.borrow()
- .style_data
.per_pseudo.contains_key(&style_pseudo) {
let mut data = self.get_style_data().unwrap().borrow_mut();
let new_style =
context.stylist
.precomputed_values_for_pseudo(&style_pseudo,
- data.style_data.style.as_ref());
- data.style_data.per_pseudo
+ data.style.as_ref());
+ data.per_pseudo
.insert(style_pseudo.clone(), new_style.unwrap());
}
}
@@ -274,7 +270,6 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
if !self.get_style_data()
.unwrap()
.borrow()
- .style_data
.per_pseudo.contains_key(&style_pseudo) {
let mut data = self.get_style_data().unwrap().borrow_mut();
let new_style =
@@ -282,16 +277,16 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
.lazily_compute_pseudo_element_style(
&self.as_element(),
&style_pseudo,
- data.style_data.style.as_ref().unwrap());
- data.style_data.per_pseudo
+ data.style.as_ref().unwrap());
+ data.per_pseudo
.insert(style_pseudo.clone(), new_style.unwrap());
}
}
}
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- data.style_data.per_pseudo.get(&style_pseudo).unwrap()
- })
+ self.get_style_data().unwrap().borrow()
+ .per_pseudo.get(&style_pseudo)
+ .unwrap().clone()
}
}
}
@@ -304,24 +299,22 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
/// This should be used just for querying layout, or when we know the
/// element style is precomputed, not from general layout itself.
#[inline]
- fn resolved_style(&self) -> Ref<Arc<ServoComputedValues>> {
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- match self.get_pseudo_element_type() {
- PseudoElementType::Normal
- => data.style_data.style.as_ref().unwrap(),
- other
- => data.style_data.per_pseudo.get(&other.style_pseudo_element()).unwrap(),
- }
- })
+ fn resolved_style(&self) -> Arc<ServoComputedValues> {
+ let data = self.get_style_data().unwrap().borrow();
+ match self.get_pseudo_element_type() {
+ PseudoElementType::Normal
+ => data.style.as_ref().unwrap().clone(),
+ other
+ => data.per_pseudo.get(&other.style_pseudo_element()).unwrap().clone(),
+ }
}
#[inline]
- fn selected_style(&self, _context: &SharedStyleContext) -> Ref<Arc<ServoComputedValues>> {
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- data.style_data.per_pseudo
- .get(&PseudoElement::Selection)
- .unwrap_or(data.style_data.style.as_ref().unwrap())
- })
+ fn selected_style(&self, _context: &SharedStyleContext) -> Arc<ServoComputedValues> {
+ let data = self.get_style_data().unwrap().borrow();
+ data.per_pseudo
+ .get(&PseudoElement::Selection)
+ .unwrap_or(data.style.as_ref().unwrap()).clone()
}
/// Removes the style from this node.
@@ -332,10 +325,10 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
match self.get_pseudo_element_type() {
PseudoElementType::Normal => {
- data.style_data.style = None;
+ data.style = None;
}
other => {
- data.style_data.per_pseudo.remove(&other.style_pseudo_element());
+ data.per_pseudo.remove(&other.style_pseudo_element());
}
};
}
@@ -390,7 +383,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
LayerId::new_of_type(LayerType::OverflowScroll, self.opaque().id() as usize)
}
- fn get_style_data(&self) -> Option<&RefCell<PartialStyleAndLayoutData>>;
+ fn get_style_data(&self) -> Option<&AtomicRefCell<PersistentStyleData>>;
}
// This trait is only public so that it can be implemented by the gecko wrapper.
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index c28942688e5..65c52153a63 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -663,6 +663,8 @@ pub struct WorkerGlobalScopeInit {
pub scheduler_chan: IpcSender<TimerEventRequest>,
/// The worker id
pub worker_id: WorkerId,
+ /// The pipeline id
+ pub pipeline_id: PipelineId,
}
/// Common entities representing a network load origin
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 40c268d6b24..c88c090559e 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -70,8 +70,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "angle"
-version = "0.1.1"
-source = "git+https://github.com/servo/angle?branch=servo#f19aefbf3db45952480e7255cdf844db827c0bcb"
+version = "0.1.2"
+source = "git+https://github.com/servo/angle?branch=servo#99128001400771ee9c8a74dcf54cf6fe11b1e532"
dependencies = [
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -107,7 +107,7 @@ name = "audio-video-metadata"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "mp3-metadata 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mp3-metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ogg_metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1402,7 +1402,7 @@ dependencies = [
[[package]]
name = "mp3-metadata"
-version = "0.2.1"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1729,6 +1729,32 @@ dependencies = [
]
[[package]]
+name = "owning_ref"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "parking_lot"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "owning_ref 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot_core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "phf"
version = "0.7.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1846,7 +1872,9 @@ dependencies = [
"plugins 0.0.1",
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "util 0.0.1",
]
[[package]]
@@ -1958,7 +1986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "script"
version = "0.0.1"
dependencies = [
- "angle 0.1.1 (git+https://github.com/servo/angle?branch=servo)",
+ "angle 0.1.2 (git+https://github.com/servo/angle?branch=servo)",
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"audio-video-metadata 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2251,6 +2279,11 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "signpost"
+version = "0.1.0"
+source = "git+https://github.com/pcwalton/signpost.git#81803b4d09af51a3a1133a62ef8dbb3cf0595de9"
+
+[[package]]
name = "simd"
version = "0.1.1"
source = "git+https://github.com/huonw/simd#0d85d25d5cc3788062b252e31ad48dd19e805e90"
@@ -2305,6 +2338,7 @@ dependencies = [
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"quickersort 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2661,7 +2695,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
+source = "git+https://github.com/servo/webrender#dfa4246ebe40c78882cdd3e69e776b1e09a2f58e"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2686,7 +2720,7 @@ dependencies = [
[[package]]
name = "webrender_traits"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
+source = "git+https://github.com/servo/webrender#dfa4246ebe40c78882cdd3e69e776b1e09a2f58e"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2791,7 +2825,7 @@ dependencies = [
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
"checksum alloc-no-stdlib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b21f6ad9c9957eb5d70c3dee16d31c092b3cab339628f821766b05e6833d72b8"
"checksum android_glue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e2b80445d331077679dfc6f3014f3e9ab7083e588423d35041d3fc017198189"
-"checksum angle 0.1.1 (git+https://github.com/servo/angle?branch=servo)" = "<none>"
+"checksum angle 0.1.2 (git+https://github.com/servo/angle?branch=servo)" = "<none>"
"checksum app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "636ee56f12e31dbc11dc0a1ac6004f08b04e6e6595963716fc8130e90d4e04cf"
"checksum arrayvec 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "80a137392e2e92ce7387c063d98a11f0d47115426c5f8759657af3c7b385c860"
"checksum aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258989846dd255a1e0eeef92d425d345477c9999433cecc9f0879f4549d5e5c9"
@@ -2905,7 +2939,7 @@ dependencies = [
"checksum mime_guess 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a7d89cb3bce9145b0d0339a0588b044e3e3e3faa1dcd74822ebdc36bfac020"
"checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54"
"checksum mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)" = "<none>"
-"checksum mp3-metadata 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ceb0f016543197868f060e560c0bd9fbdcf6fe4c7555e04b5d8b34ecd81e7aa"
+"checksum mp3-metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2f61cf32f7fc3cec83a15a255ac60bceb6cac59a7ce190cb824ca25c0fce0feb"
"checksum mp4parse 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e3d4b79704ee1a9d307a92d2cb2c7186a8eb7e40bfca41e1c2fa9fcb152390a"
"checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2"
"checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5"
@@ -2930,6 +2964,9 @@ dependencies = [
"checksum osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)" = "<none>"
"checksum osmesa-sys 0.1.2 (git+https://github.com/daggerbot/osmesa-rs)" = "<none>"
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
+"checksum owning_ref 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88084505837507cbec6a9f39b5d3b985db3c84e9a741c80200b619001283293d"
+"checksum parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3562f3de7bdff194212be82366abf5c6565aff8a433b71c53c63d0e7c9913878"
+"checksum parking_lot_core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "06f24c980718110494e9cfb7db7438895c3f54505101bb6170329d5e43a53f64"
"checksum phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "52c875926de24c01b5b69153eaa258b57920a39b44bbce8ef1f2052a6c5a6a1a"
"checksum phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a8912c2cc0ea2e8ae70388ec0af9a445e7ab37b3c9cc61f059c2b34db8ed50b"
"checksum phf_generator 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "04b5ea825e28cb6efd89d9133b129b2003b45a221aeda025509b125b00ecb7c4"
@@ -2967,6 +3004,7 @@ dependencies = [
"checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a"
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
"checksum sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6649e43c1a1e68d29ed56d0dc3b5b6cf3b901da77cf107c4066b9e3da036df5"
+"checksum signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)" = "<none>"
"checksum simd 0.1.1 (git+https://github.com/huonw/simd)" = "<none>"
"checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410"
"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2"
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml
index 4943a01d98d..33875799061 100644
--- a/components/servo/Cargo.toml
+++ b/components/servo/Cargo.toml
@@ -24,6 +24,7 @@ default = ["webdriver", "max_log_level"]
max_log_level = ["log/release_max_level_info"]
webdriver = ["webdriver_server"]
energy-profiling = ["profile_traits/energy-profiling"]
+testing = ["style/testing"]
[profile.release]
opt-level = 3
diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml
index 0197d29df0a..358df77ff8c 100644
--- a/components/style/Cargo.toml
+++ b/components/style/Cargo.toml
@@ -39,6 +39,7 @@ num-integer = "0.1.32"
num-traits = "0.1.32"
num_cpus = "0.2.2"
ordered-float = "0.2.2"
+parking_lot = "0.3.3"
quickersort = "2.0.0"
rand = "0.3"
rustc-serialize = "0.3"
diff --git a/components/style/atomic_refcell.rs b/components/style/atomic_refcell.rs
new file mode 100644
index 00000000000..a45a682b638
--- /dev/null
+++ b/components/style/atomic_refcell.rs
@@ -0,0 +1,41 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
+
+/// Container type providing RefCell-like semantics for objects shared across
+/// threads.
+///
+/// RwLock is traditionally considered to be the |Sync| analogue of RefCell.
+/// However, for consumers that can guarantee that they will never mutably
+/// borrow the contents concurrently with immutable borrows, an RwLock feels
+/// like overkill.
+///
+/// The RwLock in the standard library is indeed heavyweight, since it heap-
+/// allocates an OS-specific primitive and delegates operations to it. However,
+/// parking_lot provides a pure-rust implementation of the standard
+/// synchronization primitives, with uncontended borrows compiling down to a
+/// single atomic operation. This is exactly how we would build an atomic
+/// RefCell, so we newtype it with some API sugar.
+pub struct AtomicRefCell<T>(RwLock<T>);
+
+pub type AtomicRef<'a, T> = RwLockReadGuard<'a, T>;
+pub type AtomicRefMut<'a, T> = RwLockWriteGuard<'a, T>;
+impl<T> AtomicRefCell<T> {
+ pub fn new(value: T) -> Self {
+ AtomicRefCell(RwLock::new(value))
+ }
+ pub fn borrow(&self) -> AtomicRef<T> {
+ self.0.try_read().unwrap()
+ }
+ pub fn borrow_mut(&self) -> AtomicRefMut<T> {
+ self.0.try_write().unwrap()
+ }
+}
+
+impl<T: Default> Default for AtomicRefCell<T> {
+ fn default() -> Self {
+ Self::new(T::default())
+ }
+}
diff --git a/components/style/binding_tools/README.md b/components/style/binding_tools/README.md
index dbd9ae4526d..5b23c7a57bb 100644
--- a/components/style/binding_tools/README.md
+++ b/components/style/binding_tools/README.md
@@ -1,26 +1,12 @@
-# GeckoLib tools
+# Geckolib tools
-This directory contains mostly simple tools for working with
-[stylo](https://public.etherpad-mozilla.org/p/stylo).
-
-Some scripts require [multirust](https://github.com/brson/multirust) in order to
-work.
-
-You can see a description of them below.
+This directory contains simple tools for generating the Rust bindings for [stylo](https://public.etherpad-mozilla.org/p/stylo).
## `setup_bindgen.sh`
-This uses downloads a custom version of bindgen, up to date to generate the
-bindings, and uses the required `llvm38` to build it.
-
-It will also rebuild it if it's already downloaded.
+This clones Servo's version of bindgen, and uses `llvm-3.8` library to build it. It will then be used to generate the Rust bindings.
-## `regen_bindings.sh`
+## `regen.sh`
This will regenerate the bindings for the `ServoBindings.h` file in your gecko
-build (which are in `ports/geckolib/bindings.rs`).
-
-## `regen_style_structs.sh`
-
-This will generate the bindings for Gecko's style structs. Current bindings are
-actually in `ports/geckolib/structs.rs`.
+build. The generated bindings live in `components/style/gecko_bindings/bindings.rs`. For structs, the bindings are in `components/style/gecko_bindings/structs_*`
diff --git a/components/style/binding_tools/regen.py b/components/style/binding_tools/regen.py
index 3ff6e2c9396..18fef011d74 100755
--- a/components/style/binding_tools/regen.py
+++ b/components/style/binding_tools/regen.py
@@ -48,6 +48,7 @@ COMPILATION_TARGETS = {
"--ignore-methods",
],
"includes": [
+ "{}/dist/include/gfxFontConstants.h",
"{}/dist/include/nsThemeConstants.h",
"{}/dist/include/mozilla/dom/AnimationEffectReadOnlyBinding.h",
"{}/dist/include/mozilla/ServoElementSnapshot.h",
@@ -73,6 +74,7 @@ COMPILATION_TARGETS = {
"whitelist_vars": [
"NS_THEME_.*",
"NODE_.*",
+ "NS_FONT_STRETCH_.*",
"NS_FONT_STYLE_.*",
"NS_STYLE_.*",
"NS_CORNER_.*",
@@ -270,7 +272,6 @@ def platform_dependent_defines():
elif system == "Windows":
ret.append("-DOS_WIN=1")
ret.append("-DWIN32=1")
- ret.append("-use-msvc-mangling")
msvc_platform = os.environ["PLATFORM"]
if msvc_platform == "X86":
ret.append("--target=i686-pc-win32")
@@ -392,6 +393,9 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
clang_flags.extend(platform_dependent_defines())
+ if platform.system() == "Windows":
+ flags.append("--use-msvc-mangling")
+
if "raw_lines" in current_target:
for raw_line in current_target["raw_lines"]:
flags.append("--raw-line")
@@ -438,7 +442,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = \
- ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
+::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
flags.append("--blacklist-type")
flags.append("{}Borrowed".format(ty))
flags.append("--raw-line")
@@ -455,7 +459,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = \
- ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
+::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
# Right now the only immutable borrow types are ones which we import
# from the |structs| module. As such, we don't need to create an opaque
# type with zero_size_type. If we ever introduce immutable borrow types
diff --git a/components/style/binding_tools/regen.sh b/components/style/binding_tools/regen.sh
index fc2ed08a833..d08e17116b0 100755
--- a/components/style/binding_tools/regen.sh
+++ b/components/style/binding_tools/regen.sh
@@ -8,13 +8,15 @@ set -o errexit
set -o nounset
set -o pipefail
+TOOLS_DIR="$(dirname ${0})"
+
if [[ ${#} -eq 0 ]]; then
echo "Usage: ${0} /path/to/gecko/objdir [other-regen.py-flags]"
exit 1
fi
# Check for rust-bindgen
-if [[ ! -d rust-bindgen ]]; then
+if [[ ! -d "${TOOLS_DIR}/rust-bindgen" ]]; then
echo "rust-bindgen not found. Run setup_bindgen.sh first."
exit 1
fi
@@ -22,7 +24,7 @@ fi
# Check for /usr/include
if [[ ! -d /usr/include ]]; then
echo "/usr/include doesn't exist." \
- "Mac users may need to run xcode-select --install."
+ "Mac users may need to run 'xcode-select --install.'"
exit 1
fi
@@ -32,4 +34,4 @@ else
LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
-./regen.py --target all "${@}"
+"./${TOOLS_DIR}/regen.py" --target all "${@}"
diff --git a/components/style/binding_tools/regen_atoms.py b/components/style/binding_tools/regen_atoms.py
index 260d2e1903f..1745fe8a84d 100755
--- a/components/style/binding_tools/regen_atoms.py
+++ b/components/style/binding_tools/regen_atoms.py
@@ -8,18 +8,27 @@ import re
import os
+PRELUDE = """
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Autogenerated file, DO NOT EDIT DIRECTLY */
+"""[1:]
+
+
def gnu_symbolify(source, ident):
- return "_ZN" + str(len(source.CLASS)) + source.CLASS + str(len(ident)) + ident + "E"
+ return "_ZN{}{}{}{}E".format(len(source.CLASS), source.CLASS, len(ident), ident)
def msvc64_symbolify(source, ident):
- return "?" + ident + "@" + source.CLASS + "@@2PEAV" + source.TYPE + "@@EA"
+ return "?{}@{}@@2PEAV{}@@EA".format(ident, source.CLASS, source.TYPE)
def msvc32_symbolify(source, ident):
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
# See https://github.com/rust-lang/rust/issues/36097
- return "\\x01?" + ident + "@" + source.CLASS + "@@2PAV" + source.TYPE + "@@A"
+ return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, source.TYPE)
class GkAtomSource:
@@ -92,56 +101,71 @@ def collect_atoms(objdir):
atoms.append(Atom(source, result.group(1), result.group(2)))
return atoms
-PRELUDE = """
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* Autogenerated file, DO NOT EDIT DIRECTLY */
-"""[1:]
+IMPORTS = ("\nuse gecko_bindings::structs::nsIAtom;"
+ "\nuse string_cache::Atom;\n\n")
+
+ATOM_TEMPLATE = (" #[link_name = \"{link_name}\"]\n"
+ " pub static {name}: *mut {type};")
+
+UNSAFE_STATIC = ("#[inline(always)]\n"
+ "pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {\n"
+ " unsafe { Atom::from_static(ptr) }\n"
+ "}\n\n")
+
+CFG_IF = '''
+cfg_if! {{
+ if #[cfg(not(target_env = "msvc"))] {{
+ extern {{
+{gnu}
+ }}
+ }} else if #[cfg(target_pointer_width = "64")] {{
+ extern {{
+{msvc64}
+ }}
+ }} else {{
+ extern {{
+{msvc32}
+ }}
+ }}
+}}
+'''
+
+RULE_TEMPLATE = ('("{atom}") => '
+ '{{ $crate::string_cache::atom_macro::unsafe_atom_from_static'
+ '($crate::string_cache::atom_macro::{name} as *mut _) }};')
+
+MACRO = '''
+#[macro_export]
+macro_rules! atom {{
+{}
+}}
+'''
def write_atom_macro(atoms, file_name):
- ATOM_TEMPLATE = """
- #[link_name = "{link_name}"]
- pub static {name}: *mut {type};
-"""[1:]
-
- def write_items(f, func):
- f.write(" extern {\n")
- for atom in atoms:
- f.write(ATOM_TEMPLATE.format(name=atom.ident,
- link_name=func(atom),
- type=atom.type()))
- f.write(" }\n")
+ def get_symbols(func):
+ return '\n'.join([ATOM_TEMPLATE.format(name=atom.ident,
+ link_name=func(atom),
+ type=atom.type()) for atom in atoms])
with open(file_name, "wb") as f:
f.write(PRELUDE)
- f.write("use style::gecko_bindings::structs::nsIAtom;\n\n")
- f.write("use Atom;\n\n")
+ f.write(IMPORTS)
+
for source in SOURCES:
if source.TYPE != "nsIAtom":
f.write("pub enum {} {{}}\n\n".format(source.TYPE))
- f.write("""
- #[inline(always)] pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {
- unsafe { Atom::from_static(ptr) }
- }\n\n
- """)
- f.write("cfg_if! {\n")
- f.write(" if #[cfg(not(target_env = \"msvc\"))] {\n")
- write_items(f, Atom.gnu_symbol)
- f.write(" } else if #[cfg(target_pointer_width = \"64\")] {\n")
- write_items(f, Atom.msvc64_symbol)
- f.write(" } else {\n")
- write_items(f, Atom.msvc32_symbol)
- f.write(" }\n")
- f.write("}\n\n")
- f.write("#[macro_export]\n")
- f.write("macro_rules! atom {\n")
- f.writelines(['("%s") => { $crate::string_cache::atom_macro::unsafe_atom_from_static(\
- $crate::string_cache::atom_macro::%s as *mut _) };\n'
- % (atom.value, atom.ident) for atom in atoms])
- f.write("}\n")
+
+ f.write(UNSAFE_STATIC)
+
+ gnu_symbols = get_symbols(Atom.gnu_symbol)
+ msvc32_symbols = get_symbols(Atom.msvc32_symbol)
+ msvc64_symbols = get_symbols(Atom.msvc64_symbol)
+ f.write(CFG_IF.format(gnu=gnu_symbols, msvc32=msvc32_symbols, msvc64=msvc64_symbols))
+
+ macro_rules = [RULE_TEMPLATE.format(atom=atom.value, name=atom.ident) for atom in atoms]
+ f.write(MACRO.format('\n'.join(macro_rules)))
PSEUDO_ELEMENT_HEADER = """
diff --git a/components/style/binding_tools/setup_bindgen.sh b/components/style/binding_tools/setup_bindgen.sh
index 4d1b67e3f43..cb0c5f175db 100755
--- a/components/style/binding_tools/setup_bindgen.sh
+++ b/components/style/binding_tools/setup_bindgen.sh
@@ -18,28 +18,21 @@ else
export LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
-# Make sure we have llvm38.
+# Make sure we have llvm-3.8.
if [[ ! -x "$(command -v clang-3.8)" ]]; then
- echo "llmv38 must be installed." \
- "Mac users should |brew install llvm38|, Linux varies by distro."
- exit 1
+ echo "llvm-3.8 is required." \
+ "Mac users should |brew install llvm38|," \
+ "Linux users can find it in clang-3.8."
+ exit 1
fi
export LD_LIBRARY_PATH="${LIBCLANG_PATH}"
export DYLD_LIBRARY_PATH="${LIBCLANG_PATH}"
-# Check for multirust
-if [[ ! -x "$(command -v multirust)" ]]; then
- echo "multirust must be installed."
- exit 1
-fi
-
# Don't try to clone twice.
if [[ ! -d rust-bindgen ]]; then
git clone https://github.com/servo/rust-bindgen.git
fi
cd rust-bindgen
-
-multirust override nightly
cargo build --features llvm_stable
diff --git a/components/style/data.rs b/components/style/data.rs
index 44920c72c98..c1c87d5f96e 100644
--- a/components/style/data.rs
+++ b/components/style/data.rs
@@ -11,7 +11,7 @@ use std::hash::BuildHasherDefault;
use std::sync::Arc;
use std::sync::atomic::AtomicIsize;
-pub struct PrivateStyleData {
+pub struct PersistentStyleData {
/// The results of CSS styling for this node.
pub style: Option<Arc<ComputedValues>>,
@@ -23,9 +23,9 @@ pub struct PrivateStyleData {
pub parallel: DomParallelInfo,
}
-impl PrivateStyleData {
+impl PersistentStyleData {
pub fn new() -> Self {
- PrivateStyleData {
+ PersistentStyleData {
style: None,
per_pseudo: HashMap::with_hasher(Default::default()),
parallel: DomParallelInfo::new(),
diff --git a/components/style/dom.rs b/components/style/dom.rs
index ec18ae65db6..a8da0d72fc3 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -6,11 +6,10 @@
#![allow(unsafe_code)]
-use context::SharedStyleContext;
-use data::PrivateStyleData;
+use atomic_refcell::{AtomicRef, AtomicRefMut};
+use data::PersistentStyleData;
use element_state::ElementState;
use properties::{ComputedValues, PropertyDeclarationBlock};
-use refcell::{Ref, RefMut};
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
use selector_impl::{ElementExt, PseudoElement};
use selector_matching::ApplicableDeclarationBlock;
@@ -139,17 +138,13 @@ pub trait TNode : Sized + Copy + Clone + NodeInfo {
unsafe fn set_can_be_fragmented(&self, value: bool);
- /// Borrows the PrivateStyleData without checks.
+ /// Borrows the style data immutably. Fails on a conflicting borrow.
#[inline(always)]
- unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData>;
+ fn borrow_data(&self) -> Option<AtomicRef<PersistentStyleData>>;
- /// Borrows the PrivateStyleData immutably. Fails on a conflicting borrow.
+ /// Borrows the style data mutably. Fails on a conflicting borrow.
#[inline(always)]
- fn borrow_data(&self) -> Option<Ref<PrivateStyleData>>;
-
- /// Borrows the PrivateStyleData mutably. Fails on a conflicting borrow.
- #[inline(always)]
- fn mutate_data(&self) -> Option<RefMut<PrivateStyleData>>;
+ fn mutate_data(&self) -> Option<AtomicRefMut<PersistentStyleData>>;
/// Get the description of how to account for recent style changes.
fn restyle_damage(self) -> Self::ConcreteRestyleDamage;
@@ -167,13 +162,6 @@ pub trait TNode : Sized + Copy + Clone + NodeInfo {
fn next_sibling(&self) -> Option<Self>;
-
- /// Returns the style results for the given node. If CSS selector matching
- /// has not yet been performed, fails.
- fn style(&self, _context: &SharedStyleContext) -> Ref<Arc<ComputedValues>> {
- Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
- }
-
/// Removes the style from this node.
fn unstyle(self) {
self.mutate_data().unwrap().style = None;
diff --git a/components/style/gecko/selector_impl.rs b/components/style/gecko/selector_impl.rs
index e1dbffbdc19..bcd3a48158d 100644
--- a/components/style/gecko/selector_impl.rs
+++ b/components/style/gecko/selector_impl.rs
@@ -61,7 +61,7 @@ impl PseudoElement {
}
#[inline]
- fn from_atom(atom: &WeakAtom, in_ua: bool) -> Option<Self> {
+ fn from_atom(atom: &WeakAtom, _in_ua: bool) -> Option<Self> {
macro_rules! pseudo_element {
($pseudo_str_with_colon:expr, $atom:expr, $is_anon_box:expr) => {{
if atom == &*$atom {
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index e2db71fecc7..6212e0da05f 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -5,7 +5,8 @@
#![allow(unsafe_code)]
-use data::PrivateStyleData;
+use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
+use data::PersistentStyleData;
use dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
use element_state::ElementState;
@@ -17,28 +18,23 @@ use gecko_bindings::bindings;
use gecko_bindings::bindings::{Gecko_CalcStyleDifference, Gecko_StoreStyleDifference};
use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentElement};
-use gecko_bindings::bindings::{Gecko_GetFirstChild, Gecko_GetFirstChildElement};
-use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetLastChildElement};
-use gecko_bindings::bindings::{Gecko_GetNextSibling, Gecko_GetNextSiblingElement, Gecko_GetNextStyleChild};
-use gecko_bindings::bindings::{Gecko_GetNodeFlags, Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
-use gecko_bindings::bindings::{Gecko_GetParentElement, Gecko_GetParentNode};
-use gecko_bindings::bindings::{Gecko_GetPrevSibling, Gecko_GetPrevSiblingElement};
+use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument};
-use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement, Gecko_IsTextNode};
-use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink};
-use gecko_bindings::bindings::{Gecko_LocalName, Gecko_Namespace, Gecko_NodeIsElement};
+use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement};
+use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace};
+use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
use gecko_bindings::bindings::Gecko_ClassOrClassList;
use gecko_bindings::bindings::Gecko_GetStyleContext;
+use gecko_bindings::structs;
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
use gecko_bindings::structs::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
-use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsStyleContext};
+use gecko_bindings::structs::{nsChangeHint, nsIAtom, nsIContent, nsStyleContext};
use gecko_bindings::structs::OpaqueStyleData;
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasFFI};
use libc::uintptr_t;
use parser::ParserContextExtraData;
use properties::{ComputedValues, parse_style_attribute};
use properties::PropertyDeclarationBlock;
-use refcell::{Ref, RefCell, RefMut};
use selector_impl::ElementExt;
use selector_matching::ApplicableDeclarationBlock;
use selectors::Element;
@@ -52,11 +48,11 @@ use std::sync::atomic::{AtomicBool, AtomicPtr};
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use url::Url;
-pub struct NonOpaqueStyleData(RefCell<PrivateStyleData>);
+pub struct NonOpaqueStyleData(AtomicRefCell<PersistentStyleData>);
impl NonOpaqueStyleData {
pub fn new() -> Self {
- NonOpaqueStyleData(RefCell::new(PrivateStyleData::new()))
+ NonOpaqueStyleData(AtomicRefCell::new(PersistentStyleData::new()))
}
}
@@ -96,10 +92,36 @@ fn from_opaque_style_data(d: *mut OpaqueStyleData) -> *mut NonOpaqueStyleData {
pub struct GeckoNode<'ln>(pub &'ln RawGeckoNode);
impl<'ln> GeckoNode<'ln> {
+ fn from_content(content: &'ln nsIContent) -> Self {
+ use std::mem;
+ GeckoNode(&content._base)
+ }
+
+ fn node_info(&self) -> &structs::NodeInfo {
+ debug_assert!(!self.0.mNodeInfo.mRawPtr.is_null());
+ unsafe { &*self.0.mNodeInfo.mRawPtr }
+ }
+
+ fn flags(&self) -> u32 {
+ (self.0)._base._base_1.mFlags
+ }
+
+ // FIXME: We can implement this without OOL calls, but we can't easily given
+ // GeckoNode is a raw reference.
+ //
+ // We can use a Cell<T>, but that's a bit of a pain.
+ fn set_flags(&self, flags: u32) {
+ unsafe { Gecko_SetNodeFlags(self.0, flags) }
+ }
+
+ fn unset_flags(&self, flags: u32) {
+ unsafe { Gecko_UnsetNodeFlags(self.0, flags) }
+ }
+
fn get_node_data(&self) -> Option<&NonOpaqueStyleData> {
- unsafe {
- from_opaque_style_data(self.0.mServoData.get()).as_ref()
- }
+ unsafe {
+ from_opaque_style_data(self.0.mServoData.get()).as_ref()
+ }
}
pub fn initialize_data(self) {
@@ -154,15 +176,14 @@ impl BitOr for GeckoRestyleDamage {
impl<'ln> NodeInfo for GeckoNode<'ln> {
fn is_element(&self) -> bool {
- unsafe {
- Gecko_NodeIsElement(self.0)
- }
+ use gecko_bindings::structs::nsINode_BooleanFlag;
+ self.0.mBoolFlags & nsINode_BooleanFlag::NodeIsElement as u32 != 0
}
fn is_text_node(&self) -> bool {
- unsafe {
- Gecko_IsTextNode(self.0)
- }
+ // This is a DOM constant that isn't going to change.
+ const TEXT_NODE: u16 = 3;
+ self.node_info().mInner.mNodeType == TEXT_NODE
}
}
@@ -241,15 +262,14 @@ impl<'ln> TNode for GeckoNode<'ln> {
return true;
}
- let flags = unsafe { Gecko_GetNodeFlags(self.0) };
- flags & (NODE_IS_DIRTY_FOR_SERVO as u32) != 0
+ self.flags() & (NODE_IS_DIRTY_FOR_SERVO as u32) != 0
}
unsafe fn set_dirty(&self, value: bool) {
if value {
- Gecko_SetNodeFlags(self.0, NODE_IS_DIRTY_FOR_SERVO as u32)
+ self.set_flags(NODE_IS_DIRTY_FOR_SERVO as u32)
} else {
- Gecko_UnsetNodeFlags(self.0, NODE_IS_DIRTY_FOR_SERVO as u32)
+ self.unset_flags(NODE_IS_DIRTY_FOR_SERVO as u32)
}
}
@@ -259,15 +279,14 @@ impl<'ln> TNode for GeckoNode<'ln> {
if self.get_node_data().is_none() {
return true;
}
- let flags = unsafe { Gecko_GetNodeFlags(self.0) };
- flags & (NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
+ self.flags() & (NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32) != 0
}
unsafe fn set_dirty_descendants(&self, value: bool) {
if value {
- Gecko_SetNodeFlags(self.0, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
+ self.set_flags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
} else {
- Gecko_UnsetNodeFlags(self.0, NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
+ self.unset_flags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32)
}
}
@@ -283,18 +302,12 @@ impl<'ln> TNode for GeckoNode<'ln> {
}
#[inline(always)]
- unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
- self.get_node_data().as_ref().map(|d| d.0.as_unsafe_cell().get()
- as *const PrivateStyleData)
- }
-
- #[inline(always)]
- fn borrow_data(&self) -> Option<Ref<PrivateStyleData>> {
+ fn borrow_data(&self) -> Option<AtomicRef<PersistentStyleData>> {
self.get_node_data().as_ref().map(|d| d.0.borrow())
}
#[inline(always)]
- fn mutate_data(&self) -> Option<RefMut<PrivateStyleData>> {
+ fn mutate_data(&self) -> Option<AtomicRefMut<PersistentStyleData>> {
self.get_node_data().as_ref().map(|d| d.0.borrow_mut())
}
@@ -308,33 +321,23 @@ impl<'ln> TNode for GeckoNode<'ln> {
}
fn parent_node(&self) -> Option<GeckoNode<'ln>> {
- unsafe {
- Gecko_GetParentNode(self.0).borrow_opt().map(|n| GeckoNode(n))
- }
+ unsafe { self.0.mParent.as_ref().map(GeckoNode) }
}
fn first_child(&self) -> Option<GeckoNode<'ln>> {
- unsafe {
- Gecko_GetFirstChild(self.0).borrow_opt().map(|n| GeckoNode(n))
- }
+ unsafe { self.0.mFirstChild.as_ref().map(GeckoNode::from_content) }
}
fn last_child(&self) -> Option<GeckoNode<'ln>> {
- unsafe {
- Gecko_GetLastChild(self.0).borrow_opt().map(|n| GeckoNode(n))
- }
+ unsafe { Gecko_GetLastChild(self.0).borrow_opt().map(GeckoNode) }
}
fn prev_sibling(&self) -> Option<GeckoNode<'ln>> {
- unsafe {
- Gecko_GetPrevSibling(self.0).borrow_opt().map(|n| GeckoNode(n))
- }
+ unsafe { self.0.mPreviousSibling.as_ref().map(GeckoNode::from_content) }
}
fn next_sibling(&self) -> Option<GeckoNode<'ln>> {
- unsafe {
- Gecko_GetNextSibling(self.0).borrow_opt().map(|n| GeckoNode(n))
- }
+ unsafe { self.0.mNextSibling.as_ref().map(GeckoNode::from_content) }
}
fn existing_style_for_restyle_damage<'a>(&'a self,
@@ -518,33 +521,52 @@ impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
impl<'le> ::selectors::Element for GeckoElement<'le> {
fn parent_element(&self) -> Option<Self> {
- unsafe {
- Gecko_GetParentElement(self.0).borrow_opt().map(|el| GeckoElement(el))
- }
+ let parent = self.as_node().parent_node();
+ parent.and_then(|parent| parent.as_element())
}
fn first_child_element(&self) -> Option<Self> {
- unsafe {
- Gecko_GetFirstChildElement(self.0).borrow_opt().map(|el| GeckoElement(el))
+ let mut child = self.as_node().first_child();
+ while let Some(child_node) = child {
+ if let Some(el) = child_node.as_element() {
+ return Some(el)
+ }
+ child = child_node.next_sibling();
}
+ None
}
fn last_child_element(&self) -> Option<Self> {
- unsafe {
- Gecko_GetLastChildElement(self.0).borrow_opt().map(|el| GeckoElement(el))
+ let mut child = self.as_node().last_child();
+ while let Some(child_node) = child {
+ if let Some(el) = child_node.as_element() {
+ return Some(el)
+ }
+ child = child_node.prev_sibling();
}
+ None
}
fn prev_sibling_element(&self) -> Option<Self> {
- unsafe {
- Gecko_GetPrevSiblingElement(self.0).borrow_opt().map(|el| GeckoElement(el))
+ let mut sibling = self.as_node().prev_sibling();
+ while let Some(sibling_node) = sibling {
+ if let Some(el) = sibling_node.as_element() {
+ return Some(el)
+ }
+ sibling = sibling_node.prev_sibling();
}
+ None
}
fn next_sibling_element(&self) -> Option<Self> {
- unsafe {
- Gecko_GetNextSiblingElement(self.0).borrow_opt().map(|el| GeckoElement(el))
+ let mut sibling = self.as_node().next_sibling();
+ while let Some(sibling_node) = sibling {
+ if let Some(el) = sibling_node.as_element() {
+ return Some(el)
+ }
+ sibling = sibling_node.next_sibling();
}
+ None
}
fn is_root(&self) -> bool {
@@ -560,7 +582,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
fn get_local_name(&self) -> &WeakAtom {
unsafe {
- WeakAtom::new(Gecko_LocalName(self.0))
+ WeakAtom::new(self.as_node().node_info().mInner.mName.raw())
}
}
diff --git a/components/style/gecko_bindings/mod.rs b/components/style/gecko_bindings/mod.rs
index 38811ed321c..877af7b6ca9 100644
--- a/components/style/gecko_bindings/mod.rs
+++ b/components/style/gecko_bindings/mod.rs
@@ -2,17 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#[allow(dead_code, non_camel_case_types)]
+#[allow(dead_code, improper_ctypes, non_camel_case_types)]
pub mod bindings;
pub mod ptr;
+
+// FIXME: We allow `improper_ctypes` (for now), because the lint doesn't allow
+// foreign structs to have `PhantomData`. We should remove this once the lint
+// ignores this case.
+
#[cfg(debug_assertions)]
-#[allow(dead_code, non_camel_case_types, non_snake_case, non_upper_case_globals)]
+#[allow(dead_code, improper_ctypes, non_camel_case_types, non_snake_case, non_upper_case_globals)]
pub mod structs {
include!("structs_debug.rs");
}
+
#[cfg(not(debug_assertions))]
-#[allow(dead_code, non_camel_case_types, non_snake_case, non_upper_case_globals)]
+#[allow(dead_code, improper_ctypes, non_camel_case_types, non_snake_case, non_upper_case_globals)]
pub mod structs {
include!("structs_release.rs");
}
+
pub mod sugar;
diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs
index 090359eb467..118ecd6d174 100644
--- a/components/style/gecko_bindings/structs_debug.rs
+++ b/components/style/gecko_bindings/structs_debug.rs
@@ -25,6 +25,18 @@ impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0;
+pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1;
+pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2;
+pub const NS_FONT_STRETCH_ULTRA_CONDENSED: ::std::os::raw::c_int = -4;
+pub const NS_FONT_STRETCH_EXTRA_CONDENSED: ::std::os::raw::c_int = -3;
+pub const NS_FONT_STRETCH_CONDENSED: ::std::os::raw::c_int = -2;
+pub const NS_FONT_STRETCH_SEMI_CONDENSED: ::std::os::raw::c_int = -1;
+pub const NS_FONT_STRETCH_NORMAL: ::std::os::raw::c_uint = 0;
+pub const NS_FONT_STRETCH_SEMI_EXPANDED: ::std::os::raw::c_uint = 1;
+pub const NS_FONT_STRETCH_EXPANDED: ::std::os::raw::c_uint = 2;
+pub const NS_FONT_STRETCH_EXTRA_EXPANDED: ::std::os::raw::c_uint = 3;
+pub const NS_FONT_STRETCH_ULTRA_EXPANDED: ::std::os::raw::c_uint = 4;
pub const NS_THEME_NONE: ::std::os::raw::c_uint = 0;
pub const NS_THEME_BUTTON: ::std::os::raw::c_uint = 1;
pub const NS_THEME_RADIO: ::std::os::raw::c_uint = 2;
@@ -148,9 +160,6 @@ pub const NS_THEME_MAC_DISCLOSURE_BUTTON_OPEN: ::std::os::raw::c_uint = 245;
pub const NS_THEME_MAC_DISCLOSURE_BUTTON_CLOSED: ::std::os::raw::c_uint = 246;
pub const NS_THEME_GTK_INFO_BAR: ::std::os::raw::c_uint = 247;
pub const NS_THEME_MAC_SOURCE_LIST: ::std::os::raw::c_uint = 248;
-pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0;
-pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1;
-pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2;
pub const NS_CORNER_TOP_LEFT_X: ::std::os::raw::c_uint = 0;
pub const NS_CORNER_TOP_LEFT_Y: ::std::os::raw::c_uint = 1;
pub const NS_CORNER_TOP_RIGHT_X: ::std::os::raw::c_uint = 2;
@@ -221,8 +230,13 @@ pub const NS_STYLE_VOLUME_SOFT: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_VOLUME_MEDIUM: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_VOLUME_LOUD: ::std::os::raw::c_uint = 4;
pub const NS_STYLE_VOLUME_X_LOUD: ::std::os::raw::c_uint = 5;
-pub const NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_COLOR_INHERIT_FROM_BODY: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_WILL_CHANGE_STACKING_CONTEXT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_TRANSFORM: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_SCROLL: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_OPACITY: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_FIXPOS_CB: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_ABSPOS_CB: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_ANIMATION_ITERATION_COUNT_INFINITE: ::std::os::raw::c_uint
=
0;
@@ -241,6 +255,11 @@ pub const NS_STYLE_IMAGELAYER_CLIP_MOZ_ALMOST_PADDING: ::std::os::raw::c_uint
pub const NS_STYLE_IMAGELAYER_ORIGIN_BORDER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_IMAGELAYER_ORIGIN_PADDING: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_ORIGIN_CONTENT: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_IMAGELAYER_POSITION_CENTER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_TOP: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_BOTTOM: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_LEFT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_RIGHT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y: ::std::os::raw::c_uint = 2;
@@ -372,6 +391,8 @@ pub const NS_STYLE_FILTER_SATURATE: ::std::os::raw::c_uint = 8;
pub const NS_STYLE_FILTER_SEPIA: ::std::os::raw::c_uint = 9;
pub const NS_STYLE_FILTER_HUE_ROTATE: ::std::os::raw::c_uint = 10;
pub const NS_STYLE_FILTER_DROP_SHADOW: ::std::os::raw::c_uint = 11;
+pub const NS_STYLE_FONT_WEIGHT_BOLDER: ::std::os::raw::c_int = -1;
+pub const NS_STYLE_FONT_WEIGHT_LIGHTER: ::std::os::raw::c_int = -2;
pub const NS_STYLE_FONT_SIZE_XXSMALL: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_FONT_SIZE_XSMALL: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_FONT_SIZE_SMALL: ::std::os::raw::c_uint = 2;
@@ -398,6 +419,9 @@ pub const NS_STYLE_FONT_BUTTON: ::std::os::raw::c_uint = 13;
pub const NS_STYLE_FONT_PULL_DOWN_MENU: ::std::os::raw::c_uint = 14;
pub const NS_STYLE_FONT_LIST: ::std::os::raw::c_uint = 15;
pub const NS_STYLE_FONT_FIELD: ::std::os::raw::c_uint = 16;
+pub const NS_STYLE_GRID_AUTO_FLOW_ROW: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_GRID_AUTO_FLOW_COLUMN: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_GRID_AUTO_FLOW_DENSE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_GRID_TEMPLATE_SUBGRID: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_GRID_TRACK_BREADTH_MAX_CONTENT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_GRID_TRACK_BREADTH_MIN_CONTENT: ::std::os::raw::c_uint = 2;
@@ -437,6 +461,7 @@ pub const NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: ::std::os::raw::c_uint = 5;
pub const NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: ::std::os::raw::c_uint = 6;
pub const NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_LIST_STYLE_CUSTOM: ::std::os::raw::c_int = -1;
pub const NS_STYLE_LIST_STYLE_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_LIST_STYLE_DISC: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_LIST_STYLE_CIRCLE: ::std::os::raw::c_uint = 2;
@@ -532,6 +557,11 @@ pub const NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_TRANSFORM_LOWERCASE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_TEXT_TRANSFORM_UPPERCASE: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH: ::std::os::raw::c_uint = 4;
+pub const NS_STYLE_TOUCH_ACTION_NONE: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_AUTO: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_PAN_X: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_PAN_Y: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_MANIPULATION: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TOP_LAYER_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TOP_LAYER_TOP: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TRANSFORM_BOX_BORDER_BOX: ::std::os::raw::c_uint = 0;
@@ -635,6 +665,7 @@ pub const NS_STYLE_PAGE_BREAK_AVOID: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_PAGE_BREAK_LEFT: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_PAGE_BREAK_RIGHT: ::std::os::raw::c_uint = 4;
pub const NS_STYLE_COLUMN_COUNT_AUTO: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_COLUMN_COUNT_UNLIMITED: ::std::os::raw::c_int = -1;
pub const NS_STYLE_COLUMN_FILL_AUTO: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_COLUMN_FILL_BALANCE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IME_MODE_AUTO: ::std::os::raw::c_uint = 0;
@@ -693,7 +724,14 @@ pub const NS_STYLE_STROKE_PROP_CONTEXT_VALUE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TEXT_ANCHOR_START: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TEXT_ANCHOR_MIDDLE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_ANCHOR_END: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_OVER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_NONE: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_FILL_MASK: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_FILLED: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_SHAPE_MASK: ::std::os::raw::c_uint = 7;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_DOT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE: ::std::os::raw::c_uint = 2;
@@ -774,7 +812,10 @@ pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3;
+pub const NS_STYLE_INHERIT_BIT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215;
+pub const NS_STYLE_INHERITED_STRUCT_MASK: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_RESET_STRUCT_MASK: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint =
16777216;
pub const NS_STYLE_HAS_PSEUDO_ELEMENT_DATA: ::std::os::raw::c_uint = 33554432;
@@ -795,9 +836,6 @@ pub const NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE:
pub const NS_STYLE_IS_TEXT_COMBINED: ::std::os::raw::c_ulonglong =
34359738368;
pub const NS_STYLE_CONTEXT_TYPE_SHIFT: ::std::os::raw::c_uint = 36;
-pub const BORDER_COLOR_FOREGROUND: ::std::os::raw::c_uint = 32;
-pub const BORDER_COLOR_SPECIAL: ::std::os::raw::c_uint = 160;
-pub const BORDER_STYLE_MASK: ::std::os::raw::c_uint = 31;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct fallible_t {
@@ -1083,6 +1121,20 @@ pub enum nsresult {
NS_ERROR_UNCATCHABLE_EXCEPTION = 2152924152,
NS_ERROR_DOM_DOMEXCEPTION = 2152924153,
NS_ERROR_DOM_EXCEPTION_ON_JSCONTEXT = 2152924154,
+ NS_ERROR_DOM_MALFORMED_URI = 2152924155,
+ NS_ERROR_DOM_INVALID_HEADER_NAME = 2152924156,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT = 2152924157,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED = 2152924158,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING = 2152924159,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE = 2152924160,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSEXML =
+ 2152924161,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT =
+ 2152924162,
+ NS_ERROR_DOM_INVALID_STATE_XHR_CHUNKED_RESPONSETYPES_UNSUPPORTED_FOR_SYNC
+ = 2152924163,
+ NS_ERROR_DOM_INVALID_ACCESS_XHR_TIMEOUT_AND_RESPONSETYPE_UNSUPPORTED_FOR_SYNC
+ = 2152924164,
NS_SUCCESS_DOM_NO_OPERATION = 5439489,
NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW = 5439490,
NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE = 5439491,
@@ -1307,6 +1359,7 @@ pub enum nsresult {
NS_ERROR_DOM_MEDIA_MEDIASINK_ERR = 2154692619,
NS_ERROR_DOM_MEDIA_DEMUXER_ERR = 2154692620,
NS_ERROR_DOM_MEDIA_CDM_ERR = 2154692621,
+ NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR = 2154692709,
NS_ERROR_DOWNLOAD_COMPLETE = 2155347969,
NS_ERROR_DOWNLOAD_NOT_PARTIAL = 2155347970,
NS_ERROR_UNORM_MOREOUTPUT = 2155348001,
@@ -1501,8 +1554,8 @@ pub enum JSWhyMagic {
#[derive(Debug, Copy)]
pub struct jsval_layout {
pub asBits: __BindgenUnionField<u64>,
- pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_61264>,
- pub s: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_61271>,
+ pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_61833>,
+ pub s: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_61840>,
pub asDouble: __BindgenUnionField<f64>,
pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub asWord: __BindgenUnionField<usize>,
@@ -1511,20 +1564,20 @@ pub struct jsval_layout {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_61264 {
+pub struct jsval_layout__bindgen_ty_bindgen_id_61833 {
pub _bitfield_1: u64,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61264() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61264>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61833() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61833>()
, 8usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61264>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61833>()
, 8usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_61264 {
+impl Clone for jsval_layout__bindgen_ty_bindgen_id_61833 {
fn clone(&self) -> Self { *self }
}
-impl jsval_layout__bindgen_ty_bindgen_id_61264 {
+impl jsval_layout__bindgen_ty_bindgen_id_61833 {
#[inline]
pub fn payload47(&self) -> u64 {
unsafe {
@@ -1557,36 +1610,36 @@ impl jsval_layout__bindgen_ty_bindgen_id_61264 {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_61271 {
- pub payload: jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272,
+pub struct jsval_layout__bindgen_ty_bindgen_id_61840 {
+ pub payload: jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272 {
+pub struct jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841 {
pub i32: __BindgenUnionField<i32>,
pub u32: __BindgenUnionField<u32>,
pub why: __BindgenUnionField<JSWhyMagic>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841>()
, 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841>()
, 4usize);
}
impl Clone for
- jsval_layout__bindgen_ty_bindgen_id_61271__bindgen_ty_bindgen_id_61272 {
+ jsval_layout__bindgen_ty_bindgen_id_61840__bindgen_ty_bindgen_id_61841 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61271() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61271>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_61840() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_61840>()
, 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61271>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_61840>()
, 4usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_61271 {
+impl Clone for jsval_layout__bindgen_ty_bindgen_id_61840 {
fn clone(&self) -> Self { *self }
}
impl Clone for jsval_layout {
@@ -1620,7 +1673,7 @@ pub type nsAString_internal_size_type = u32;
pub type nsAString_internal_index_type = u32;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsAString_internal__bindgen_ty_bindgen_id_63109 {
+pub enum nsAString_internal__bindgen_ty_bindgen_id_63710 {
F_NONE = 0,
F_TERMINATED = 1,
F_VOIDED = 2,
@@ -1682,12 +1735,12 @@ fn bindgen_test_layout_nsString() {
assert_eq!(::std::mem::align_of::<nsString>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_63719 {
+pub struct bindgen_vtable__bindgen_id_64320 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsStringComparator {
- pub vtable_: *const bindgen_vtable__bindgen_id_63719,
+ pub vtable_: *const bindgen_vtable__bindgen_id_64320,
}
pub type nsStringComparator_char_type = u16;
#[test]
@@ -1729,7 +1782,7 @@ pub type nsACString_internal_size_type = u32;
pub type nsACString_internal_index_type = u32;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsACString_internal__bindgen_ty_bindgen_id_64949 {
+pub enum nsACString_internal__bindgen_ty_bindgen_id_65550 {
F_NONE = 0,
F_TERMINATED = 1,
F_VOIDED = 2,
@@ -1791,12 +1844,12 @@ fn bindgen_test_layout_nsCString() {
assert_eq!(::std::mem::align_of::<nsCString>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_65501 {
+pub struct bindgen_vtable__bindgen_id_66102 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsCStringComparator {
- pub vtable_: *const bindgen_vtable__bindgen_id_65501,
+ pub vtable_: *const bindgen_vtable__bindgen_id_66102,
}
pub type nsCStringComparator_char_type = ::std::os::raw::c_char;
#[test]
@@ -1808,7 +1861,7 @@ impl Clone for nsCStringComparator {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_65545 {
+pub struct bindgen_vtable__bindgen_id_66146 {
}
/**
* Basic component object model interface. Objects which implement
@@ -1819,7 +1872,7 @@ pub struct bindgen_vtable__bindgen_id_65545 {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsISupports {
- pub vtable_: *const bindgen_vtable__bindgen_id_65545,
+ pub vtable_: *const bindgen_vtable__bindgen_id_66146,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -1837,7 +1890,7 @@ impl Clone for nsISupports {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_65828 {
+pub struct bindgen_vtable__bindgen_id_66429 {
}
/**
* Participant implementation classes
@@ -1845,7 +1898,7 @@ pub struct bindgen_vtable__bindgen_id_65828 {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsCycleCollectionParticipant {
- pub vtable_: *const bindgen_vtable__bindgen_id_65828,
+ pub vtable_: *const bindgen_vtable__bindgen_id_66429,
pub mMightSkip: bool,
}
#[test]
@@ -1898,6 +1951,7 @@ pub struct nsReadingIterator<CharT> {
}
pub type nsReadingIterator_self_type<CharT> = nsReadingIterator<CharT>;
pub type nsReadingIterator_difference_type = isize;
+pub type nsReadingIterator_size_type = usize;
pub type nsReadingIterator_value_type<CharT> = CharT;
pub type nsReadingIterator_pointer<CharT> = *mut CharT;
pub type nsReadingIterator_reference = [u8; 0usize];
@@ -1913,6 +1967,7 @@ pub struct nsWritingIterator<CharT> {
}
pub type nsWritingIterator_self_type<CharT> = nsWritingIterator<CharT>;
pub type nsWritingIterator_difference_type = isize;
+pub type nsWritingIterator_size_type = usize;
pub type nsWritingIterator_value_type<CharT> = CharT;
pub type nsWritingIterator_pointer<CharT> = *mut CharT;
pub type nsWritingIterator_reference = [u8; 0usize];
@@ -2154,7 +2209,7 @@ fn bindgen_test_layout_ErrorResult() {
#[derive(Debug)]
pub struct TErrorResult<CleanupPolicy> {
pub mResult: nsresult,
- pub __bindgen_anon_1: TErrorResult__bindgen_ty_bindgen_id_73321<CleanupPolicy>,
+ pub __bindgen_anon_1: TErrorResult__bindgen_ty_bindgen_id_73928<CleanupPolicy>,
pub mMightHaveUnreportedJSException: bool,
pub mUnionState: TErrorResult_UnionState,
pub _mOwningThread: nsAutoOwningThread,
@@ -2184,7 +2239,7 @@ pub struct TErrorResult_DOMExceptionInfo<CleanupPolicy> {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct TErrorResult__bindgen_ty_bindgen_id_73321<CleanupPolicy> {
+pub struct TErrorResult__bindgen_ty_bindgen_id_73928<CleanupPolicy> {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message<CleanupPolicy>>,
pub mJSException: __BindgenUnionField<Value>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo<CleanupPolicy>>,
@@ -2331,7 +2386,55 @@ impl nsIAtom {
}
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_74308 {
+#[derive(Debug, Copy)]
+pub struct nsIPrincipal {
+ pub _base: nsISerializable,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsIPrincipal_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsIPrincipal__bindgen_ty_bindgen_id_75167 {
+ APP_STATUS_NOT_INSTALLED = 0,
+ APP_STATUS_INSTALLED = 1,
+ APP_STATUS_PRIVILEGED = 2,
+ APP_STATUS_CERTIFIED = 3,
+}
+#[test]
+fn bindgen_test_layout_nsIPrincipal() {
+ assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize);
+}
+impl Clone for nsIPrincipal {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsISerializable {
+ pub _base: nsISupports,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsISerializable_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[test]
+fn bindgen_test_layout_nsISerializable() {
+ assert_eq!(::std::mem::size_of::<nsISerializable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsISerializable>() , 8usize);
+}
+impl Clone for nsISerializable {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct bindgen_vtable__bindgen_id_75335 {
}
/**
* Class to store the wrapper for an object. This can only be used with objects
@@ -2373,7 +2476,7 @@ pub struct bindgen_vtable__bindgen_id_74308 {
#[repr(C)]
#[derive(Debug)]
pub struct nsWrapperCache {
- pub vtable_: *const bindgen_vtable__bindgen_id_74308,
+ pub vtable_: *const bindgen_vtable__bindgen_id_75335,
pub mWrapper: *mut JSObject,
pub mFlags: nsWrapperCache_FlagsType,
}
@@ -2398,7 +2501,7 @@ pub type nsWrapperCache_FlagsType = u32;
* NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER).
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_74515 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_75542 {
WRAPPER_BIT_PRESERVED = 1,
}
#[repr(u32)]
@@ -2407,12 +2510,12 @@ pub enum nsWrapperCache__bindgen_ty_bindgen_id_74515 {
* binding.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_74518 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_75545 {
WRAPPER_IS_NOT_DOM_BINDING = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_74521 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_75548 {
kWrapperFlagsMask = 3,
}
#[test]
@@ -2446,78 +2549,6 @@ fn bindgen_test_layout_GlobalObject() {
assert_eq!(::std::mem::align_of::<GlobalObject>() , 8usize);
}
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct pair<_T1, _T2> {
- pub first: _T1,
- pub second: _T2,
-}
-pub type pair_first_type<_T1> = _T1;
-pub type pair_second_type<_T2> = _T2;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct input_iterator_tag {
- pub _address: u8,
-}
-impl Clone for input_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct forward_iterator_tag {
- pub _address: u8,
-}
-impl Clone for forward_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct bidirectional_iterator_tag {
- pub _address: u8,
-}
-impl Clone for bidirectional_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct random_access_iterator_tag {
- pub _address: u8,
-}
-impl Clone for random_access_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_93424 {
-}
-/**
- * A class of objects that return source code on demand.
- *
- * When code is compiled with setSourceIsLazy(true), SpiderMonkey doesn't
- * retain the source code (and doesn't do lazy bytecode generation). If we ever
- * need the source code, say, in response to a call to Function.prototype.
- * toSource or Debugger.Source.prototype.text, then we call the 'load' member
- * function of the instance of this class that has hopefully been registered
- * with the runtime, passing the code's URL, and hope that it will be able to
- * find the source.
- */
-#[repr(C)]
-#[derive(Debug)]
-pub struct SourceHook {
- pub vtable_: *const bindgen_vtable__bindgen_id_93424,
-}
-#[test]
-fn bindgen_test_layout_SourceHook() {
- assert_eq!(::std::mem::size_of::<SourceHook>() , 8usize);
- assert_eq!(::std::mem::align_of::<SourceHook>() , 8usize);
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __bit_const_reference<_Cp> {
- pub __seg_: __bit_const_reference___storage_pointer<_Cp>,
- pub __mask_: __bit_const_reference___storage_type<_Cp>,
-}
-pub type __bit_const_reference___storage_type<_Cp> = _Cp;
-pub type __bit_const_reference___storage_pointer<_Cp> = _Cp;
-#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsScriptObjectTracer {
pub _base: nsCycleCollectionParticipant,
@@ -2552,244 +2583,69 @@ fn bindgen_test_layout_nsXPCOMCycleCollectionParticipant() {
impl Clone for nsXPCOMCycleCollectionParticipant {
fn clone(&self) -> Self { *self }
}
-pub type PLDHashNumber = u32;
#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable {
- pub mOps: *const PLDHashTableOps,
- pub mHashShift: i16,
- pub mEntrySize: u32,
- pub mEntryCount: u32,
- pub mRemovedCount: u32,
- pub mEntryStore: PLDHashTable_EntryStore,
- pub mChecker: Checker,
-}
-#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable_EntryStore {
- pub mEntryStore: *mut ::std::os::raw::c_char,
- pub mGeneration: u32,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable_EntryStore() {
- assert_eq!(::std::mem::size_of::<PLDHashTable_EntryStore>() , 16usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable_EntryStore>() , 8usize);
-}
-#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable_Iterator {
- pub mTable: *mut PLDHashTable,
- pub mStart: *mut ::std::os::raw::c_char,
- pub mLimit: *mut ::std::os::raw::c_char,
- pub mCurrent: *mut ::std::os::raw::c_char,
- pub mNexts: u32,
- pub mNextsLimit: u32,
- pub mHaveRemoved: bool,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable_Iterator() {
- assert_eq!(::std::mem::size_of::<PLDHashTable_Iterator>() , 48usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable_Iterator>() , 8usize);
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum PLDHashTable_SearchReason { ForSearchOrRemove = 0, ForAdd = 1, }
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kMaxCapacityE"]
- pub static PLDHashTable_kMaxCapacity: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kMinCapacityE"]
- pub static PLDHashTable_kMinCapacity: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable17kMaxInitialLengthE"]
- pub static PLDHashTable_kMaxInitialLength: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable21kDefaultInitialLengthE"]
- pub static PLDHashTable_kDefaultInitialLength: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable9kHashBitsE"]
- pub static PLDHashTable_kHashBits: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kGoldenRatioE"]
- pub static PLDHashTable_kGoldenRatio: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable14kCollisionFlagE"]
- pub static PLDHashTable_kCollisionFlag: PLDHashNumber;
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable() {
- assert_eq!(::std::mem::size_of::<PLDHashTable>() , 48usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize);
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct PLDHashTableOps {
- pub hashKey: PLDHashHashKey,
- pub matchEntry: PLDHashMatchEntry,
- pub moveEntry: PLDHashMoveEntry,
- pub clearEntry: PLDHashClearEntry,
- pub initEntry: PLDHashInitEntry,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTableOps() {
- assert_eq!(::std::mem::size_of::<PLDHashTableOps>() , 40usize);
- assert_eq!(::std::mem::align_of::<PLDHashTableOps>() , 8usize);
-}
-impl Clone for PLDHashTableOps {
- fn clone(&self) -> Self { *self }
+#[derive(Debug, Copy, Clone)]
+pub struct pair<_T1, _T2> {
+ pub first: _T1,
+ pub second: _T2,
}
+pub type pair_first_type<_T1> = _T1;
+pub type pair_second_type<_T2> = _T2;
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct PLDHashEntryHdr {
- pub mKeyHash: PLDHashNumber,
-}
-#[test]
-fn bindgen_test_layout_PLDHashEntryHdr() {
- assert_eq!(::std::mem::size_of::<PLDHashEntryHdr>() , 4usize);
- assert_eq!(::std::mem::align_of::<PLDHashEntryHdr>() , 4usize);
+pub struct input_iterator_tag {
+ pub _address: u8,
}
-impl Clone for PLDHashEntryHdr {
+impl Clone for input_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct Checker {
- pub mState: u32,
- pub mIsWritable: u32,
-}
-extern "C" {
- #[link_name = "_ZN7Checker5kIdleE"]
- pub static Checker_kIdle: u32;
-}
-extern "C" {
- #[link_name = "_ZN7Checker6kRead1E"]
- pub static Checker_kRead1: u32;
-}
-extern "C" {
- #[link_name = "_ZN7Checker8kReadMaxE"]
- pub static Checker_kReadMax: u32;
-}
-extern "C" {
- #[link_name = "_ZN7Checker6kWriteE"]
- pub static Checker_kWrite: u32;
-}
-#[test]
-fn bindgen_test_layout_Checker() {
- assert_eq!(::std::mem::size_of::<Checker>() , 8usize);
- assert_eq!(::std::mem::align_of::<Checker>() , 4usize);
+pub struct forward_iterator_tag {
+ pub _address: u8,
}
-impl Clone for Checker {
+impl Clone for forward_iterator_tag {
fn clone(&self) -> Self { *self }
}
-pub type PLDHashHashKey =
- ::std::option::Option<unsafe extern "C" fn(aKey:
- *const ::std::os::raw::c_void)
- -> ::std::os::raw::c_uint>;
-pub type PLDHashMatchEntry =
- ::std::option::Option<unsafe extern "C" fn(aEntry: *const PLDHashEntryHdr,
- aKey:
- *const ::std::os::raw::c_void)
- -> bool>;
-pub type PLDHashMoveEntry =
- ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
- aFrom: *const PLDHashEntryHdr,
- aTo: *mut PLDHashEntryHdr)>;
-pub type PLDHashClearEntry =
- ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
- aEntry: *mut PLDHashEntryHdr)>;
-pub type PLDHashInitEntry =
- ::std::option::Option<unsafe extern "C" fn(aEntry: *mut PLDHashEntryHdr,
- aKey:
- *const ::std::os::raw::c_void)>;
-/**
- * hashkey wrapper using T* KeyType
- *
- * @see nsTHashtable::EntryType for specification
- */
-#[repr(C)]
-#[derive(Debug)]
-pub struct nsPtrHashKey<T> {
- pub _base: PLDHashEntryHdr,
- pub mKey: *mut T,
-}
-pub type nsPtrHashKey_KeyType<T> = *mut T;
-pub type nsPtrHashKey_KeyTypePointer<T> = *mut T;
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsPtrHashKey__bindgen_ty_bindgen_id_104414 { ALLOW_MEMMOVE = 0, }
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsIRunnable {
- pub _base: nsISupports,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsIRunnable_COMTypeInfo<T, U> {
+pub struct bidirectional_iterator_tag {
pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
-}
-#[test]
-fn bindgen_test_layout_nsIRunnable() {
- assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize);
}
-impl Clone for nsIRunnable {
+impl Clone for bidirectional_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsIPrincipal {
- pub _base: nsISerializable,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsIPrincipal_COMTypeInfo<T, U> {
+pub struct random_access_iterator_tag {
pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPrincipal__bindgen_ty_bindgen_id_106456 {
- APP_STATUS_NOT_INSTALLED = 0,
- APP_STATUS_INSTALLED = 1,
- APP_STATUS_PRIVILEGED = 2,
- APP_STATUS_CERTIFIED = 3,
-}
-#[test]
-fn bindgen_test_layout_nsIPrincipal() {
- assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize);
}
-impl Clone for nsIPrincipal {
+impl Clone for random_access_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct nsISerializable {
- pub _base: nsISupports,
+pub struct bindgen_vtable__bindgen_id_95272 {
}
+/**
+ * A class of objects that return source code on demand.
+ *
+ * When code is compiled with setSourceIsLazy(true), SpiderMonkey doesn't
+ * retain the source code (and doesn't do lazy bytecode generation). If we ever
+ * need the source code, say, in response to a call to Function.prototype.
+ * toSource or Debugger.Source.prototype.text, then we call the 'load' member
+ * function of the instance of this class that has hopefully been registered
+ * with the runtime, passing the code's URL, and hope that it will be able to
+ * find the source.
+ */
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsISerializable_COMTypeInfo<T, U> {
- pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
+#[derive(Debug)]
+pub struct SourceHook {
+ pub vtable_: *const bindgen_vtable__bindgen_id_95272,
}
#[test]
-fn bindgen_test_layout_nsISerializable() {
- assert_eq!(::std::mem::size_of::<nsISerializable>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsISerializable>() , 8usize);
-}
-impl Clone for nsISerializable {
- fn clone(&self) -> Self { *self }
+fn bindgen_test_layout_SourceHook() {
+ assert_eq!(::std::mem::size_of::<SourceHook>() , 8usize);
+ assert_eq!(::std::mem::align_of::<SourceHook>() , 8usize);
}
#[repr(C)]
#[derive(Debug)]
@@ -2868,6 +2724,7 @@ pub struct nsIDocument {
pub mBlockAllMixedContentPreloads: bool,
pub mUpgradeInsecureRequests: bool,
pub mUpgradeInsecurePreloads: bool,
+ pub mHSTSPrimingURIList: [u64; 6usize],
pub mDocumentContainer: u64,
pub mCharacterSet: nsCString,
pub mCharacterSetSource: i32,
@@ -3080,7 +2937,7 @@ pub type nsIDocument_FrameRequestCallbackList =
nsTArray<RefPtr<FrameRequestCallback>>;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDocument__bindgen_ty_bindgen_id_115186 { REQUEST_DISCARD = 1, }
+pub enum nsIDocument__bindgen_ty_bindgen_id_108839 { REQUEST_DISCARD = 1, }
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum nsIDocument_DeprecatedOperations {
@@ -3107,22 +2964,23 @@ pub enum nsIDocument_DeprecatedOperations {
eUseOfCaptureEvents = 20,
eUseOfReleaseEvents = 21,
eUseOfDOM3LoadMethod = 22,
- eShowModalDialog = 23,
- eWindow_Content = 24,
- eSyncXMLHttpRequest = 25,
- eDataContainerEvent = 26,
- eWindow_Controllers = 27,
- eImportXULIntoContent = 28,
- ePannerNodeDoppler = 29,
- eNavigatorGetUserMedia = 30,
- eWebrtcDeprecatedPrefix = 31,
- eRTCPeerConnectionGetStreams = 32,
- eAppCache = 33,
- ePrefixedImageSmoothingEnabled = 34,
- ePrefixedFullscreenAPI = 35,
- eLenientSetter = 36,
- eFileLastModifiedDate = 37,
- eDeprecatedOperationCount = 38,
+ eChromeUseOfDOM3LoadMethod = 23,
+ eShowModalDialog = 24,
+ eWindow_Content = 25,
+ eSyncXMLHttpRequest = 26,
+ eDataContainerEvent = 27,
+ eWindow_Controllers = 28,
+ eImportXULIntoContent = 29,
+ ePannerNodeDoppler = 30,
+ eNavigatorGetUserMedia = 31,
+ eWebrtcDeprecatedPrefix = 32,
+ eRTCPeerConnectionGetStreams = 33,
+ eAppCache = 34,
+ ePrefixedImageSmoothingEnabled = 35,
+ ePrefixedFullscreenAPI = 36,
+ eLenientSetter = 37,
+ eFileLastModifiedDate = 38,
+ eDeprecatedOperationCount = 39,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -3162,7 +3020,7 @@ impl Clone for nsIDocument_FrameRequest {
}
#[test]
fn bindgen_test_layout_nsIDocument() {
- assert_eq!(::std::mem::size_of::<nsIDocument>() , 912usize);
+ assert_eq!(::std::mem::size_of::<nsIDocument>() , 960usize);
assert_eq!(::std::mem::align_of::<nsIDocument>() , 8usize);
}
impl nsIDocument {
@@ -3718,20 +3576,6 @@ impl nsIDocument {
((val as u8 as u64) << 41u32) & (2199023255552usize as u64);
}
#[inline]
- pub fn mMayHavePluginFramesForPrinting(&self) -> bool {
- unsafe {
- ::std::mem::transmute(((self._bitfield_1 &
- (4398046511104usize as u64)) >> 42u32)
- as u8)
- }
- }
- #[inline]
- pub fn set_mMayHavePluginFramesForPrinting(&mut self, val: bool) {
- self._bitfield_1 &= !(4398046511104usize as u64);
- self._bitfield_1 |=
- ((val as u8 as u64) << 42u32) & (4398046511104usize as u64);
- }
- #[inline]
pub fn mDidFireDOMContentLoaded(&self) -> bool {
unsafe {
::std::mem::transmute(((self._bitfield_2 & (1usize as u8)) >>
@@ -3771,7 +3615,7 @@ pub struct nsINode {
pub mNextSibling: *mut nsIContent,
pub mPreviousSibling: *mut nsIContent,
pub mFirstChild: *mut nsIContent,
- pub __bindgen_anon_1: nsINode__bindgen_ty_bindgen_id_111874,
+ pub __bindgen_anon_1: nsINode__bindgen_ty_bindgen_id_105742,
pub mSlots: *mut nsINode_nsSlots,
pub mServoData: ServoCell<*mut ServoNodeData>,
}
@@ -3796,7 +3640,7 @@ pub struct nsINode_COMTypeInfo<T, U> {
* Bit-flags to pass (or'ed together) to IsNodeOfType()
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsINode__bindgen_ty_bindgen_id_107999 {
+pub enum nsINode__bindgen_ty_bindgen_id_101867 {
eCONTENT = 1,
eDOCUMENT = 2,
eATTRIBUTE = 4,
@@ -3811,12 +3655,12 @@ pub enum nsINode__bindgen_ty_bindgen_id_107999 {
eFILTER = 2048,
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_108768 {
+pub struct bindgen_vtable__bindgen_id_102636 {
}
#[repr(C)]
#[derive(Debug)]
pub struct nsINode_nsSlots {
- pub vtable_: *const bindgen_vtable__bindgen_id_108768,
+ pub vtable_: *const bindgen_vtable__bindgen_id_102636,
/**
* A list of mutation observers
*/
@@ -3885,19 +3729,19 @@ pub enum nsINode_BooleanFlag {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsINode__bindgen_ty_bindgen_id_111874 {
+pub struct nsINode__bindgen_ty_bindgen_id_105742 {
pub mPrimaryFrame: __BindgenUnionField<*mut nsIFrame>,
pub mSubtreeRoot: __BindgenUnionField<*mut nsINode>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsINode__bindgen_ty_bindgen_id_111874() {
- assert_eq!(::std::mem::size_of::<nsINode__bindgen_ty_bindgen_id_111874>()
+fn bindgen_test_layout_nsINode__bindgen_ty_bindgen_id_105742() {
+ assert_eq!(::std::mem::size_of::<nsINode__bindgen_ty_bindgen_id_105742>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsINode__bindgen_ty_bindgen_id_111874>()
+ assert_eq!(::std::mem::align_of::<nsINode__bindgen_ty_bindgen_id_105742>()
, 8usize);
}
-impl Clone for nsINode__bindgen_ty_bindgen_id_111874 {
+impl Clone for nsINode__bindgen_ty_bindgen_id_105742 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -3996,49 +3840,6 @@ pub enum SheetType {
Unknown = 255,
}
/**
- * Smart pointer class that can hold a pointer to either a CSSStyleSheet
- * or a ServoStyleSheet.
- */
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct StyleSheetHandle {
- pub mPtr: StyleSheetHandle_Ptr,
-}
-pub type StyleSheetHandle_RefPtr = HandleRefPtr<StyleSheetHandle>;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct StyleSheetHandle_Ptr {
- pub mValue: usize,
-}
-#[test]
-fn bindgen_test_layout_StyleSheetHandle_Ptr() {
- assert_eq!(::std::mem::size_of::<StyleSheetHandle_Ptr>() , 8usize);
- assert_eq!(::std::mem::align_of::<StyleSheetHandle_Ptr>() , 8usize);
-}
-impl Clone for StyleSheetHandle_Ptr {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_StyleSheetHandle() {
- assert_eq!(::std::mem::size_of::<StyleSheetHandle>() , 8usize);
- assert_eq!(::std::mem::align_of::<StyleSheetHandle>() , 8usize);
-}
-impl Clone for StyleSheetHandle {
- fn clone(&self) -> Self { *self }
-}
-pub const ReferrerPolicy_RP_Default: ReferrerPolicy =
- ReferrerPolicy::RP_No_Referrer_When_Downgrade;
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum ReferrerPolicy {
- RP_No_Referrer = 1,
- RP_Origin = 2,
- RP_No_Referrer_When_Downgrade = 0,
- RP_Origin_When_Crossorigin = 3,
- RP_Unsafe_URL = 4,
- RP_Unset = 4294967295,
-}
-/**
* EventStates is the class used to represent the event states of nsIContent
* instances. These states are calculated by IntrinsicState() and
* ContentStatesChanged() has to be called when one of them changes thus
@@ -4181,6 +3982,26 @@ impl Clone for nsIVariant {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsIRunnable {
+ pub _base: nsISupports,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsIRunnable_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[test]
+fn bindgen_test_layout_nsIRunnable() {
+ assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize);
+}
+impl Clone for nsIRunnable {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
#[derive(Debug)]
pub struct Runnable {
pub _base: nsIRunnable,
@@ -4227,7 +4048,7 @@ pub struct nsIDOMNode_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDOMNode__bindgen_ty_bindgen_id_120024 {
+pub enum nsIDOMNode__bindgen_ty_bindgen_id_113677 {
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
@@ -4243,7 +4064,7 @@ pub enum nsIDOMNode__bindgen_ty_bindgen_id_120024 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDOMNode__bindgen_ty_bindgen_id_120243 {
+pub enum nsIDOMNode__bindgen_ty_bindgen_id_113896 {
DOCUMENT_POSITION_DISCONNECTED = 1,
DOCUMENT_POSITION_PRECEDING = 2,
DOCUMENT_POSITION_FOLLOWING = 4,
@@ -5087,7 +4908,8 @@ pub enum nsChangeHint {
nsChangeHint_UpdateComputedBSize = 16777216,
nsChangeHint_UpdateUsesOpacity = 33554432,
nsChangeHint_UpdateBackgroundPosition = 67108864,
- nsChangeHint_AllHints = 134217727,
+ nsChangeHint_AddOrRemoveTransform = 134217728,
+ nsChangeHint_AllHints = 268435455,
}
pub type nscolor = u32;
#[repr(u32)]
@@ -5098,6 +4920,273 @@ pub enum Side {
eSideBottom = 2,
eSideLeft = 3,
}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackFunction {
+ pub _base: CallbackObject,
+}
+#[test]
+fn bindgen_test_layout_CallbackFunction() {
+ assert_eq!(::std::mem::size_of::<CallbackFunction>() , 56usize);
+ assert_eq!(::std::mem::align_of::<CallbackFunction>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackObject {
+ pub _base: nsISupports,
+ pub mRefCnt: nsCycleCollectingAutoRefCnt,
+ pub _mOwningThread: nsAutoOwningThread,
+ pub mCallback: u64,
+ pub mCreationStack: u64,
+ pub mIncumbentGlobal: nsCOMPtr<nsIGlobalObject>,
+ pub mIncumbentJSGlobal: u64,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct CallbackObject_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+pub type CallbackObject_HasThreadSafeRefCnt = FalseType;
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct CallbackObject_cycleCollection {
+ pub _base: nsXPCOMCycleCollectionParticipant,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_cycleCollection() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_cycleCollection>() ,
+ 16usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_cycleCollection>() ,
+ 8usize);
+}
+impl Clone for CallbackObject_cycleCollection {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum CallbackObject_ExceptionHandling {
+ eReportExceptions = 0,
+ eRethrowContentExceptions = 1,
+ eRethrowExceptions = 2,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct CallbackObject_FastCallbackConstructor {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_FastCallbackConstructor() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_FastCallbackConstructor>()
+ , 1usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_FastCallbackConstructor>()
+ , 1usize);
+}
+impl Clone for CallbackObject_FastCallbackConstructor {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackObject_CallSetup {
+ pub mCx: *mut JSContext,
+ pub mCompartment: *mut JSCompartment,
+ pub mAutoEntryScript: [u64; 21usize],
+ pub mAutoIncumbentScript: [u64; 6usize],
+ pub mRootedCallable: [u64; 4usize],
+ pub mAsyncStack: [u64; 4usize],
+ pub mAsyncStackSetter: [u64; 7usize],
+ pub mAc: [u64; 4usize],
+ pub mErrorResult: *mut ErrorResult,
+ pub mExceptionHandling: CallbackObject_ExceptionHandling,
+ pub mIsMainThread: bool,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_CallSetup() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_CallSetup>() , 400usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_CallSetup>() , 8usize);
+}
+extern "C" {
+ #[link_name = "_ZN7mozilla3dom14CallbackObject21_cycleCollectorGlobalE"]
+ pub static mut CallbackObject__cycleCollectorGlobal:
+ CallbackObject_cycleCollection;
+}
+#[test]
+fn bindgen_test_layout_CallbackObject() {
+ assert_eq!(::std::mem::size_of::<CallbackObject>() , 56usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject>() , 8usize);
+}
+pub type PLDHashNumber = u32;
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable {
+ pub mOps: *const PLDHashTableOps,
+ pub mHashShift: i16,
+ pub mEntrySize: u32,
+ pub mEntryCount: u32,
+ pub mRemovedCount: u32,
+ pub mEntryStore: PLDHashTable_EntryStore,
+ pub mChecker: Checker,
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable_EntryStore {
+ pub mEntryStore: *mut ::std::os::raw::c_char,
+ pub mGeneration: u32,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable_EntryStore() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable_EntryStore>() , 16usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable_EntryStore>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable_Iterator {
+ pub mTable: *mut PLDHashTable,
+ pub mStart: *mut ::std::os::raw::c_char,
+ pub mLimit: *mut ::std::os::raw::c_char,
+ pub mCurrent: *mut ::std::os::raw::c_char,
+ pub mNexts: u32,
+ pub mNextsLimit: u32,
+ pub mHaveRemoved: bool,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable_Iterator() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable_Iterator>() , 48usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable_Iterator>() , 8usize);
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum PLDHashTable_SearchReason { ForSearchOrRemove = 0, ForAdd = 1, }
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kMaxCapacityE"]
+ pub static PLDHashTable_kMaxCapacity: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kMinCapacityE"]
+ pub static PLDHashTable_kMinCapacity: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable17kMaxInitialLengthE"]
+ pub static PLDHashTable_kMaxInitialLength: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable21kDefaultInitialLengthE"]
+ pub static PLDHashTable_kDefaultInitialLength: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable9kHashBitsE"]
+ pub static PLDHashTable_kHashBits: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kGoldenRatioE"]
+ pub static PLDHashTable_kGoldenRatio: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable14kCollisionFlagE"]
+ pub static PLDHashTable_kCollisionFlag: PLDHashNumber;
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable>() , 48usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct PLDHashTableOps {
+ pub hashKey: PLDHashHashKey,
+ pub matchEntry: PLDHashMatchEntry,
+ pub moveEntry: PLDHashMoveEntry,
+ pub clearEntry: PLDHashClearEntry,
+ pub initEntry: PLDHashInitEntry,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTableOps() {
+ assert_eq!(::std::mem::size_of::<PLDHashTableOps>() , 40usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTableOps>() , 8usize);
+}
+impl Clone for PLDHashTableOps {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct PLDHashEntryHdr {
+ pub mKeyHash: PLDHashNumber,
+}
+#[test]
+fn bindgen_test_layout_PLDHashEntryHdr() {
+ assert_eq!(::std::mem::size_of::<PLDHashEntryHdr>() , 4usize);
+ assert_eq!(::std::mem::align_of::<PLDHashEntryHdr>() , 4usize);
+}
+impl Clone for PLDHashEntryHdr {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Checker {
+ pub mState: u32,
+ pub mIsWritable: u32,
+}
+extern "C" {
+ #[link_name = "_ZN7Checker5kIdleE"]
+ pub static Checker_kIdle: u32;
+}
+extern "C" {
+ #[link_name = "_ZN7Checker6kRead1E"]
+ pub static Checker_kRead1: u32;
+}
+extern "C" {
+ #[link_name = "_ZN7Checker8kReadMaxE"]
+ pub static Checker_kReadMax: u32;
+}
+extern "C" {
+ #[link_name = "_ZN7Checker6kWriteE"]
+ pub static Checker_kWrite: u32;
+}
+#[test]
+fn bindgen_test_layout_Checker() {
+ assert_eq!(::std::mem::size_of::<Checker>() , 8usize);
+ assert_eq!(::std::mem::align_of::<Checker>() , 4usize);
+}
+impl Clone for Checker {
+ fn clone(&self) -> Self { *self }
+}
+pub type PLDHashHashKey =
+ ::std::option::Option<unsafe extern "C" fn(aKey:
+ *const ::std::os::raw::c_void)
+ -> ::std::os::raw::c_uint>;
+pub type PLDHashMatchEntry =
+ ::std::option::Option<unsafe extern "C" fn(aEntry: *const PLDHashEntryHdr,
+ aKey:
+ *const ::std::os::raw::c_void)
+ -> bool>;
+pub type PLDHashMoveEntry =
+ ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
+ aFrom: *const PLDHashEntryHdr,
+ aTo: *mut PLDHashEntryHdr)>;
+pub type PLDHashClearEntry =
+ ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
+ aEntry: *mut PLDHashEntryHdr)>;
+pub type PLDHashInitEntry =
+ ::std::option::Option<unsafe extern "C" fn(aEntry: *mut PLDHashEntryHdr,
+ aKey:
+ *const ::std::os::raw::c_void)>;
+/**
+ * hashkey wrapper using T* KeyType
+ *
+ * @see nsTHashtable::EntryType for specification
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct nsPtrHashKey<T> {
+ pub _base: PLDHashEntryHdr,
+ pub mKey: *mut T,
+}
+pub type nsPtrHashKey_KeyType<T> = *mut T;
+pub type nsPtrHashKey_KeyTypePointer<T> = *mut T;
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsPtrHashKey__bindgen_ty_bindgen_id_118426 { ALLOW_MEMMOVE = 0, }
/**
* A node of content in a document's content model. This interface
* is supported by all content objects.
@@ -5117,14 +5206,14 @@ pub struct nsIContent_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIContent__bindgen_ty_bindgen_id_124178 {
+pub enum nsIContent__bindgen_ty_bindgen_id_119766 {
eAllChildren = 0,
eAllButXBL = 1,
eSkipPlaceholderContent = 2,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIContent__bindgen_ty_bindgen_id_124414 {
+pub enum nsIContent__bindgen_ty_bindgen_id_120002 {
ATTR_MISSING = -1,
ATTR_VALUE_NO_MATCH = -2,
}
@@ -5330,7 +5419,7 @@ pub struct FragmentOrElement_nsDOMSlots {
* @see FragmentOrElement::GetAttributes
*/
pub mAttributeMap: RefPtr<nsDOMAttributeMap>,
- pub __bindgen_anon_1: FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545,
+ pub __bindgen_anon_1: FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135,
/**
* An object implementing the .children property for this element.
*/
@@ -5367,7 +5456,7 @@ pub struct FragmentOrElement_nsDOMSlots {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545 {
+pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135 {
/**
* The nearest enclosing content node with a binding that created us.
* @see FragmentOrElement::GetBindingParent
@@ -5380,13 +5469,13 @@ pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545 {
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545() {
- assert_eq!(::std::mem::size_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545>()
+fn bindgen_test_layout_FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135() {
+ assert_eq!(::std::mem::size_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135>()
, 8usize);
- assert_eq!(::std::mem::align_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545>()
+ assert_eq!(::std::mem::align_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135>()
, 8usize);
}
-impl Clone for FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_125545 {
+impl Clone for FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_121135 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -5407,6 +5496,21 @@ fn bindgen_test_layout_FragmentOrElement() {
assert_eq!(::std::mem::size_of::<FragmentOrElement>() , 128usize);
assert_eq!(::std::mem::align_of::<FragmentOrElement>() , 8usize);
}
+pub const ReferrerPolicy_RP_Default: ReferrerPolicy =
+ ReferrerPolicy::RP_No_Referrer_When_Downgrade;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum ReferrerPolicy {
+ RP_No_Referrer = 1,
+ RP_Origin = 2,
+ RP_No_Referrer_When_Downgrade = 0,
+ RP_Origin_When_Crossorigin = 3,
+ RP_Unsafe_URL = 4,
+ RP_Same_Origin = 5,
+ RP_Strict_Origin = 6,
+ RP_Strict_Origin_When_Cross_Origin = 7,
+ RP_Unset = 4294967295,
+}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsIWeakReference {
@@ -5437,91 +5541,13 @@ impl Clone for PrefSetting {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackObject {
- pub _base: nsISupports,
- pub mRefCnt: nsCycleCollectingAutoRefCnt,
- pub _mOwningThread: nsAutoOwningThread,
- pub mCallback: u64,
- pub mCreationStack: u64,
- pub mIncumbentGlobal: nsCOMPtr<nsIGlobalObject>,
- pub mIncumbentJSGlobal: u64,
-}
-#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct CallbackObject_COMTypeInfo<T, U> {
- pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
-}
-pub type CallbackObject_HasThreadSafeRefCnt = FalseType;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct CallbackObject_cycleCollection {
- pub _base: nsXPCOMCycleCollectionParticipant,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_cycleCollection() {
- assert_eq!(::std::mem::size_of::<CallbackObject_cycleCollection>() ,
- 16usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_cycleCollection>() ,
- 8usize);
-}
-impl Clone for CallbackObject_cycleCollection {
- fn clone(&self) -> Self { *self }
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum CallbackObject_ExceptionHandling {
- eReportExceptions = 0,
- eRethrowContentExceptions = 1,
- eRethrowExceptions = 2,
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct CallbackObject_FastCallbackConstructor {
- pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_FastCallbackConstructor() {
- assert_eq!(::std::mem::size_of::<CallbackObject_FastCallbackConstructor>()
- , 1usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_FastCallbackConstructor>()
- , 1usize);
-}
-impl Clone for CallbackObject_FastCallbackConstructor {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackObject_CallSetup {
- pub mCx: *mut JSContext,
- pub mCompartment: *mut JSCompartment,
- pub mAutoEntryScript: [u64; 21usize],
- pub mAutoIncumbentScript: [u64; 6usize],
- pub mRootedCallable: [u64; 4usize],
- pub mAsyncStack: [u64; 4usize],
- pub mAsyncStackSetter: [u64; 7usize],
- pub mAc: [u64; 4usize],
- pub mErrorResult: *mut ErrorResult,
- pub mExceptionHandling: CallbackObject_ExceptionHandling,
- pub mIsMainThread: bool,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_CallSetup() {
- assert_eq!(::std::mem::size_of::<CallbackObject_CallSetup>() , 400usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_CallSetup>() , 8usize);
-}
-extern "C" {
- #[link_name = "_ZN7mozilla3dom14CallbackObject21_cycleCollectorGlobalE"]
- pub static mut CallbackObject__cycleCollectorGlobal:
- CallbackObject_cycleCollection;
-}
-#[test]
-fn bindgen_test_layout_CallbackObject() {
- assert_eq!(::std::mem::size_of::<CallbackObject>() , 56usize);
- assert_eq!(::std::mem::align_of::<CallbackObject>() , 8usize);
+pub struct __bit_const_reference<_Cp> {
+ pub __seg_: __bit_const_reference___storage_pointer<_Cp>,
+ pub __mask_: __bit_const_reference___storage_type<_Cp>,
}
+pub type __bit_const_reference___storage_type<_Cp> = _Cp;
+pub type __bit_const_reference___storage_pointer<_Cp> = _Cp;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsIChannel {
@@ -5536,7 +5562,7 @@ pub struct nsIChannel_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIChannel__bindgen_ty_bindgen_id_137651 {
+pub enum nsIChannel__bindgen_ty_bindgen_id_138644 {
LOAD_DOCUMENT_URI = 65536,
LOAD_RETARGETED_DOCUMENT_URI = 131072,
LOAD_REPLACE = 262144,
@@ -5550,7 +5576,7 @@ pub enum nsIChannel__bindgen_ty_bindgen_id_137651 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIChannel__bindgen_ty_bindgen_id_137671 {
+pub enum nsIChannel__bindgen_ty_bindgen_id_138664 {
DISPOSITION_INLINE = 0,
DISPOSITION_ATTACHMENT = 1,
}
@@ -5576,7 +5602,7 @@ pub struct nsIRequest_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIRequest__bindgen_ty_bindgen_id_137489 {
+pub enum nsIRequest__bindgen_ty_bindgen_id_138482 {
LOAD_REQUESTMASK = 65535,
LOAD_NORMAL = 0,
LOAD_BACKGROUND = 1,
@@ -5704,16 +5730,24 @@ pub enum SheetParsingMode {
eAgentSheetFeatures = 2,
}
/**
- * A class for holding strong references to handle-managed objects.
- *
- * This is intended for use with objects like StyleSheetHandle, where
- * the handle type is not a pointer but which can still have ->AddRef()
- * and ->Release() called on it.
+ * Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
#[repr(C)]
-#[derive(Debug)]
-pub struct HandleRefPtr<T> {
- pub mHandle: T,
+#[derive(Debug, Copy)]
+pub struct StyleSheet {
+ pub mDocument: *mut nsIDocument,
+ pub mOwningNode: *mut nsINode,
+ pub mParsingMode: SheetParsingMode,
+ pub mType: StyleBackendType,
+ pub mDisabled: bool,
+}
+#[test]
+fn bindgen_test_layout_StyleSheet() {
+ assert_eq!(::std::mem::size_of::<StyleSheet>() , 32usize);
+ assert_eq!(::std::mem::align_of::<StyleSheet>() , 8usize);
+}
+impl Clone for StyleSheet {
+ fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug)]
@@ -6131,13 +6165,13 @@ pub enum nsIPresShell_ReflowRootHandling {
eNoPositionOrSizeChange = 1,
eInferFromBitToAdd = 2,
}
-pub const SCROLL_LEFT: nsIPresShell__bindgen_ty_bindgen_id_155504 =
- nsIPresShell__bindgen_ty_bindgen_id_155504::SCROLL_TOP;
-pub const SCROLL_RIGHT: nsIPresShell__bindgen_ty_bindgen_id_155504 =
- nsIPresShell__bindgen_ty_bindgen_id_155504::SCROLL_BOTTOM;
+pub const SCROLL_LEFT: nsIPresShell__bindgen_ty_bindgen_id_156907 =
+ nsIPresShell__bindgen_ty_bindgen_id_156907::SCROLL_TOP;
+pub const SCROLL_RIGHT: nsIPresShell__bindgen_ty_bindgen_id_156907 =
+ nsIPresShell__bindgen_ty_bindgen_id_156907::SCROLL_BOTTOM;
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_155504 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_156907 {
SCROLL_TOP = 0,
SCROLL_BOTTOM = 100,
SCROLL_CENTER = 50,
@@ -6165,7 +6199,7 @@ impl Clone for nsIPresShell_ScrollAxis {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_155535 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_156938 {
SCROLL_FIRST_ANCESTOR_ONLY = 1,
SCROLL_OVERFLOW_HIDDEN = 2,
SCROLL_NO_PARENT_FRAMES = 4,
@@ -6212,7 +6246,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_155535 {
* transform.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_155934 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_157393 {
RENDER_IS_UNTRUSTED = 1,
RENDER_IGNORE_VIEWPORT_SCROLLING = 2,
RENDER_CARET = 4,
@@ -6223,7 +6257,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_155934 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_155952 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_157411 {
RENDER_IS_IMAGE = 256,
RENDER_AUTO_SCALE = 128,
}
@@ -6236,7 +6270,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_155952 {
* transparent by default.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_156075 { FORCE_DRAW = 1, }
+pub enum nsIPresShell__bindgen_ty_bindgen_id_157534 { FORCE_DRAW = 1, }
#[repr(C)]
#[derive(Debug)]
pub struct nsIPresShell_PointerCaptureInfo {
@@ -6623,67 +6657,67 @@ pub struct DOMPointInit {
impl Clone for DOMPointInit {
fn clone(&self) -> Self { *self }
}
-pub const NODE_HAS_LISTENERMANAGER: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_LISTENERMANAGER;
-pub const NODE_HAS_PROPERTIES: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_PROPERTIES;
-pub const NODE_IS_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_ANONYMOUS_ROOT;
-pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
-pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_NATIVE_ANONYMOUS_ROOT;
-pub const NODE_FORCE_XBL_BINDINGS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_FORCE_XBL_BINDINGS;
-pub const NODE_MAY_BE_IN_BINDING_MNGR: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_MAY_BE_IN_BINDING_MNGR;
-pub const NODE_IS_EDITABLE: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_EDITABLE;
-pub const NODE_MAY_HAVE_CLASS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_MAY_HAVE_CLASS;
-pub const NODE_IS_IN_SHADOW_TREE: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_IN_SHADOW_TREE;
-pub const NODE_HAS_EMPTY_SELECTOR: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_EMPTY_SELECTOR;
-pub const NODE_HAS_SLOW_SELECTOR: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_SLOW_SELECTOR;
-pub const NODE_HAS_EDGE_CHILD_SELECTOR: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_EDGE_CHILD_SELECTOR;
-pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: _bindgen_ty_bindgen_id_157496
+pub const NODE_HAS_LISTENERMANAGER: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_LISTENERMANAGER;
+pub const NODE_HAS_PROPERTIES: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_PROPERTIES;
+pub const NODE_IS_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_ANONYMOUS_ROOT;
+pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
+pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_NATIVE_ANONYMOUS_ROOT;
+pub const NODE_FORCE_XBL_BINDINGS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_FORCE_XBL_BINDINGS;
+pub const NODE_MAY_BE_IN_BINDING_MNGR: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_MAY_BE_IN_BINDING_MNGR;
+pub const NODE_IS_EDITABLE: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_EDITABLE;
+pub const NODE_MAY_HAVE_CLASS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_MAY_HAVE_CLASS;
+pub const NODE_IS_IN_SHADOW_TREE: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_IN_SHADOW_TREE;
+pub const NODE_HAS_EMPTY_SELECTOR: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_EMPTY_SELECTOR;
+pub const NODE_HAS_SLOW_SELECTOR: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_SLOW_SELECTOR;
+pub const NODE_HAS_EDGE_CHILD_SELECTOR: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_EDGE_CHILD_SELECTOR;
+pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: _bindgen_ty_bindgen_id_158955
=
- _bindgen_ty_bindgen_id_157496::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS;
-pub const NODE_ALL_SELECTOR_FLAGS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_ALL_SELECTOR_FLAGS;
-pub const NODE_NEEDS_FRAME: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_NEEDS_FRAME;
-pub const NODE_DESCENDANTS_NEED_FRAMES: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_DESCENDANTS_NEED_FRAMES;
-pub const NODE_HAS_ACCESSKEY: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_ACCESSKEY;
-pub const NODE_HAS_DIRECTION_RTL: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_DIRECTION_RTL;
-pub const NODE_HAS_DIRECTION_LTR: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_HAS_DIRECTION_LTR;
-pub const NODE_ALL_DIRECTION_FLAGS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_ALL_DIRECTION_FLAGS;
-pub const NODE_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_CHROME_ONLY_ACCESS;
-pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS;
-pub const NODE_SHARED_RESTYLE_BIT_1: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_SHARED_RESTYLE_BIT_1;
-pub const NODE_SHARED_RESTYLE_BIT_2: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_SHARED_RESTYLE_BIT_2;
-pub const NODE_IS_DIRTY_FOR_SERVO: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_SHARED_RESTYLE_BIT_1;
-pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: _bindgen_ty_bindgen_id_157496
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS;
+pub const NODE_ALL_SELECTOR_FLAGS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_ALL_SELECTOR_FLAGS;
+pub const NODE_NEEDS_FRAME: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_NEEDS_FRAME;
+pub const NODE_DESCENDANTS_NEED_FRAMES: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_DESCENDANTS_NEED_FRAMES;
+pub const NODE_HAS_ACCESSKEY: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_ACCESSKEY;
+pub const NODE_HAS_DIRECTION_RTL: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_DIRECTION_RTL;
+pub const NODE_HAS_DIRECTION_LTR: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_HAS_DIRECTION_LTR;
+pub const NODE_ALL_DIRECTION_FLAGS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_ALL_DIRECTION_FLAGS;
+pub const NODE_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_CHROME_ONLY_ACCESS;
+pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS;
+pub const NODE_SHARED_RESTYLE_BIT_1: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_SHARED_RESTYLE_BIT_1;
+pub const NODE_SHARED_RESTYLE_BIT_2: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_SHARED_RESTYLE_BIT_2;
+pub const NODE_IS_DIRTY_FOR_SERVO: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_SHARED_RESTYLE_BIT_1;
+pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: _bindgen_ty_bindgen_id_158955
=
- _bindgen_ty_bindgen_id_157496::NODE_SHARED_RESTYLE_BIT_2;
-pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: _bindgen_ty_bindgen_id_157496 =
- _bindgen_ty_bindgen_id_157496::NODE_TYPE_SPECIFIC_BITS_OFFSET;
+ _bindgen_ty_bindgen_id_158955::NODE_SHARED_RESTYLE_BIT_2;
+pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: _bindgen_ty_bindgen_id_158955 =
+ _bindgen_ty_bindgen_id_158955::NODE_TYPE_SPECIFIC_BITS_OFFSET;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum _bindgen_ty_bindgen_id_157496 {
+pub enum _bindgen_ty_bindgen_id_158955 {
NODE_HAS_LISTENERMANAGER = 4,
NODE_HAS_PROPERTIES = 8,
NODE_IS_ANONYMOUS_ROOT = 16,
@@ -6741,7 +6775,7 @@ pub struct nsITimer_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsITimer__bindgen_ty_bindgen_id_174064 {
+pub enum nsITimer__bindgen_ty_bindgen_id_175571 {
TYPE_ONE_SHOT = 0,
TYPE_REPEATING_SLACK = 1,
TYPE_REPEATING_PRECISE = 2,
@@ -6767,7 +6801,7 @@ pub struct nsExpirationState {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsExpirationState__bindgen_ty_bindgen_id_174540 {
+pub enum nsExpirationState__bindgen_ty_bindgen_id_176047 {
NOT_TRACKED = 15,
MAX_INDEX_IN_GENERATION = 268435455,
}
@@ -6841,7 +6875,7 @@ pub struct imgIRequest_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgIRequest__bindgen_ty_bindgen_id_175132 {
+pub enum imgIRequest__bindgen_ty_bindgen_id_176631 {
STATUS_NONE = 0,
STATUS_SIZE_AVAILABLE = 1,
STATUS_LOAD_COMPLETE = 2,
@@ -6853,7 +6887,7 @@ pub enum imgIRequest__bindgen_ty_bindgen_id_175132 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgIRequest__bindgen_ty_bindgen_id_175212 {
+pub enum imgIRequest__bindgen_ty_bindgen_id_176711 {
CORS_NONE = 1,
CORS_ANONYMOUS = 2,
CORS_USE_CREDENTIALS = 3,
@@ -7066,16 +7100,6 @@ fn bindgen_test_layout_FrameRequestCallback() {
assert_eq!(::std::mem::align_of::<FrameRequestCallback>() , 8usize);
}
#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackFunction {
- pub _base: CallbackObject,
-}
-#[test]
-fn bindgen_test_layout_CallbackFunction() {
- assert_eq!(::std::mem::size_of::<CallbackFunction>() , 56usize);
- assert_eq!(::std::mem::align_of::<CallbackFunction>() , 8usize);
-}
-#[repr(C)]
#[derive(Debug, Copy)]
pub struct FullscreenRequest {
pub _address: u8,
@@ -7362,7 +7386,7 @@ pub type nsPresArena_FreeList_KeyType = u32;
pub type nsPresArena_FreeList_KeyTypePointer = *const ::std::os::raw::c_void;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsPresArena_FreeList__bindgen_ty_bindgen_id_187768 {
+pub enum nsPresArena_FreeList__bindgen_ty_bindgen_id_197183 {
ALLOW_MEMMOVE = 0,
}
#[test]
@@ -7389,7 +7413,7 @@ pub struct imgINotificationObserver_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgINotificationObserver__bindgen_ty_bindgen_id_187915 {
+pub enum imgINotificationObserver__bindgen_ty_bindgen_id_197330 {
SIZE_AVAILABLE = 1,
FRAME_UPDATE = 2,
FRAME_COMPLETE = 3,
@@ -7638,7 +7662,7 @@ pub type gfxFontFeatureValueSet_FeatureValueHashEntry_KeyTypePointer =
*const gfxFontFeatureValueSet_FeatureValueHashKey;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum gfxFontFeatureValueSet_FeatureValueHashEntry__bindgen_ty_bindgen_id_189169
+pub enum gfxFontFeatureValueSet_FeatureValueHashEntry__bindgen_ty_bindgen_id_198584
{
ALLOW_MEMMOVE = 1,
}
@@ -8034,23 +8058,23 @@ pub enum nsStyleUnit {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct _bindgen_ty_bindgen_id_189922 {
+pub struct _bindgen_ty_bindgen_id_199331 {
pub mInt: __BindgenUnionField<i32>,
pub mFloat: __BindgenUnionField<f32>,
pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout__bindgen_ty_bindgen_id_189922() {
- assert_eq!(::std::mem::size_of::<_bindgen_ty_bindgen_id_189922>() ,
+fn bindgen_test_layout__bindgen_ty_bindgen_id_199331() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_bindgen_id_199331>() ,
8usize);
- assert_eq!(::std::mem::align_of::<_bindgen_ty_bindgen_id_189922>() ,
+ assert_eq!(::std::mem::align_of::<_bindgen_ty_bindgen_id_199331>() ,
8usize);
}
-impl Clone for _bindgen_ty_bindgen_id_189922 {
+impl Clone for _bindgen_ty_bindgen_id_199331 {
fn clone(&self) -> Self { *self }
}
-pub type nsStyleUnion = _bindgen_ty_bindgen_id_189922;
+pub type nsStyleUnion = _bindgen_ty_bindgen_id_199331;
/**
* Class that hold a single size specification used by the style
* system. The size specification consists of two parts -- a number
@@ -8242,6 +8266,18 @@ fn bindgen_test_layout_nsStyleDisplay() {
assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 424usize);
assert_eq!(::std::mem::align_of::<nsStyleDisplay>() , 8usize);
}
+/**
+ * A class for holding strong references to handle-managed objects.
+ *
+ * This is intended for use with objects like RestyleManagerHandle,
+ * where the handle type is not a pointer but which can still have
+ * ->AddRef() and ->Release() called on it.
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct HandleRefPtr<T> {
+ pub mHandle: T,
+}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsILanguageAtomService {
@@ -9096,7 +9132,7 @@ fn bindgen_test_layout_imgRequestProxy() {
assert_eq!(::std::mem::align_of::<imgRequestProxy>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_199333 {
+pub struct bindgen_vtable__bindgen_id_208430 {
}
/**
* An interface for observing changes to image state, as reported by
@@ -9113,7 +9149,7 @@ pub struct bindgen_vtable__bindgen_id_199333 {
#[repr(C)]
#[derive(Debug)]
pub struct IProgressObserver {
- pub vtable_: *const bindgen_vtable__bindgen_id_199333,
+ pub vtable_: *const bindgen_vtable__bindgen_id_208430,
pub _base: u64,
}
#[test]
@@ -9135,7 +9171,7 @@ pub struct nsISupportsPriority_COMTypeInfo<T, U> {
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsISupportsPriority__bindgen_ty_bindgen_id_199414 {
+pub enum nsISupportsPriority__bindgen_ty_bindgen_id_208511 {
PRIORITY_HIGHEST = -20,
PRIORITY_HIGH = -10,
PRIORITY_NORMAL = 0,
@@ -9570,7 +9606,7 @@ fn bindgen_test_layout_nsCSSValueFloatColor() {
#[derive(Debug)]
pub struct nsCSSValue {
pub mUnit: nsCSSUnit,
- pub mValue: nsCSSValue__bindgen_ty_bindgen_id_202409,
+ pub mValue: nsCSSValue__bindgen_ty_bindgen_id_211506,
}
#[repr(C)]
#[derive(Debug)]
@@ -9586,7 +9622,7 @@ fn bindgen_test_layout_nsCSSValue_Array() {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsCSSValue__bindgen_ty_bindgen_id_202409 {
+pub struct nsCSSValue__bindgen_ty_bindgen_id_211506 {
pub mInt: __BindgenUnionField<i32>,
pub mFloat: __BindgenUnionField<f32>,
pub mString: __BindgenUnionField<*mut nsStringBuffer>,
@@ -9611,13 +9647,13 @@ pub struct nsCSSValue__bindgen_ty_bindgen_id_202409 {
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsCSSValue__bindgen_ty_bindgen_id_202409() {
- assert_eq!(::std::mem::size_of::<nsCSSValue__bindgen_ty_bindgen_id_202409>()
+fn bindgen_test_layout_nsCSSValue__bindgen_ty_bindgen_id_211506() {
+ assert_eq!(::std::mem::size_of::<nsCSSValue__bindgen_ty_bindgen_id_211506>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsCSSValue__bindgen_ty_bindgen_id_202409>()
+ assert_eq!(::std::mem::align_of::<nsCSSValue__bindgen_ty_bindgen_id_211506>()
, 8usize);
}
-impl Clone for nsCSSValue__bindgen_ty_bindgen_id_202409 {
+impl Clone for nsCSSValue__bindgen_ty_bindgen_id_211506 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -9638,12 +9674,12 @@ fn bindgen_test_layout_nsCSSValueGradientStop() {
assert_eq!(::std::mem::align_of::<nsCSSValueGradientStop>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_202617 {
+pub struct bindgen_vtable__bindgen_id_211714 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct CounterStyle {
- pub vtable_: *const bindgen_vtable__bindgen_id_202617,
+ pub vtable_: *const bindgen_vtable__bindgen_id_211714,
pub mStyle: i32,
}
#[test]
@@ -9843,26 +9879,26 @@ pub struct nsStyleImage {
pub mCachedBIData: UniquePtr<CachedBorderImageData,
DefaultDelete<CachedBorderImageData>>,
pub mType: nsStyleImageType,
- pub __bindgen_anon_1: nsStyleImage__bindgen_ty_bindgen_id_204585,
+ pub __bindgen_anon_1: nsStyleImage__bindgen_ty_bindgen_id_213682,
pub mCropRect: UniquePtr<nsStyleSides, DefaultDelete<nsStyleSides>>,
pub mImageTracked: bool,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleImage__bindgen_ty_bindgen_id_204585 {
+pub struct nsStyleImage__bindgen_ty_bindgen_id_213682 {
pub mImage: __BindgenUnionField<*mut imgRequestProxy>,
pub mGradient: __BindgenUnionField<*mut nsStyleGradient>,
pub mElementId: __BindgenUnionField<*mut u16>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleImage__bindgen_ty_bindgen_id_204585() {
- assert_eq!(::std::mem::size_of::<nsStyleImage__bindgen_ty_bindgen_id_204585>()
+fn bindgen_test_layout_nsStyleImage__bindgen_ty_bindgen_id_213682() {
+ assert_eq!(::std::mem::size_of::<nsStyleImage__bindgen_ty_bindgen_id_213682>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleImage__bindgen_ty_bindgen_id_204585>()
+ assert_eq!(::std::mem::align_of::<nsStyleImage__bindgen_ty_bindgen_id_213682>()
, 8usize);
}
-impl Clone for nsStyleImage__bindgen_ty_bindgen_id_204585 {
+impl Clone for nsStyleImage__bindgen_ty_bindgen_id_213682 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -9913,7 +9949,7 @@ pub struct nsStyleImageLayers {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsStyleImageLayers__bindgen_ty_bindgen_id_204640 {
+pub enum nsStyleImageLayers__bindgen_ty_bindgen_id_213737 {
shorthand = 0,
color = 1,
image = 2,
@@ -10103,15 +10139,51 @@ pub struct nsStyleBorder {
pub mBorderImageRepeatV: u8,
pub mFloatEdge: StyleFloatEdge,
pub mBoxDecorationBreak: StyleBoxDecorationBreak,
+ pub mBorderStyle: [u8; 4usize],
+ pub __bindgen_anon_1: nsStyleBorder__bindgen_ty_bindgen_id_214411,
pub mComputedBorder: nsMargin,
pub mBorder: nsMargin,
- pub mBorderStyle: [u8; 4usize],
- pub mBorderColor: [nscolor; 4usize],
pub mTwipsPerPixel: nscoord,
}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsStyleBorder__bindgen_ty_bindgen_id_214411 {
+ pub __bindgen_anon_1: __BindgenUnionField<nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412>,
+ pub mBorderColor: __BindgenUnionField<[StyleComplexColor; 4usize]>,
+ pub bindgen_union_field: [u32; 8usize],
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412 {
+ pub mBorderTopColor: StyleComplexColor,
+ pub mBorderRightColor: StyleComplexColor,
+ pub mBorderBottomColor: StyleComplexColor,
+ pub mBorderLeftColor: StyleComplexColor,
+}
+#[test]
+fn bindgen_test_layout_nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412() {
+ assert_eq!(::std::mem::size_of::<nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412>()
+ , 32usize);
+ assert_eq!(::std::mem::align_of::<nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412>()
+ , 4usize);
+}
+impl Clone for
+ nsStyleBorder__bindgen_ty_bindgen_id_214411__bindgen_ty_bindgen_id_214412 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_nsStyleBorder__bindgen_ty_bindgen_id_214411() {
+ assert_eq!(::std::mem::size_of::<nsStyleBorder__bindgen_ty_bindgen_id_214411>()
+ , 32usize);
+ assert_eq!(::std::mem::align_of::<nsStyleBorder__bindgen_ty_bindgen_id_214411>()
+ , 4usize);
+}
+impl Clone for nsStyleBorder__bindgen_ty_bindgen_id_214411 {
+ fn clone(&self) -> Self { *self }
+}
#[test]
fn bindgen_test_layout_nsStyleBorder() {
- assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 304usize);
+ assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 320usize);
assert_eq!(::std::mem::align_of::<nsStyleBorder>() , 8usize);
}
#[repr(C)]
@@ -10120,9 +10192,9 @@ pub struct nsStyleOutline {
pub mOutlineRadius: nsStyleCorners,
pub mOutlineWidth: nsStyleCoord,
pub mOutlineOffset: nscoord,
- pub mActualOutlineWidth: nscoord,
- pub mOutlineColor: nscolor,
+ pub mOutlineColor: StyleComplexColor,
pub mOutlineStyle: u8,
+ pub mActualOutlineWidth: nscoord,
pub mTwipsPerPixel: nscoord,
}
#[test]
@@ -10308,11 +10380,11 @@ fn bindgen_test_layout_nsStyleTextOverflow() {
pub struct nsStyleTextReset {
pub mTextOverflow: nsStyleTextOverflow,
pub mTextDecorationLine: u8,
+ pub mTextDecorationStyle: u8,
pub mUnicodeBidi: u8,
pub mInitialLetterSink: nscoord,
pub mInitialLetterSize: f32,
- pub mTextDecorationStyle: u8,
- pub mTextDecorationColor: nscolor,
+ pub mTextDecorationColor: StyleComplexColor,
}
#[test]
fn bindgen_test_layout_nsStyleTextReset() {
@@ -10413,7 +10485,7 @@ impl Clone for nsStyleImageOrientation {
#[derive(Debug, Copy)]
pub struct nsTimingFunction {
pub mType: nsTimingFunction_Type,
- pub __bindgen_anon_1: nsTimingFunction__bindgen_ty_bindgen_id_206393,
+ pub __bindgen_anon_1: nsTimingFunction__bindgen_ty_bindgen_id_215389,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -10432,56 +10504,56 @@ pub enum nsTimingFunction_Type {
pub enum nsTimingFunction_Keyword { Implicit = 0, Explicit = 1, }
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_206393 {
- pub mFunc: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394>,
- pub __bindgen_anon_1: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405>,
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_215389 {
+ pub mFunc: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390>,
+ pub __bindgen_anon_1: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401>,
pub bindgen_union_field: [u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394 {
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390 {
pub mX1: f32,
pub mY1: f32,
pub mX2: f32,
pub mY2: f32,
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390>()
, 16usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390>()
, 4usize);
}
impl Clone for
- nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206394
+ nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215390
{
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405 {
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401 {
pub mSteps: u32,
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401>()
, 4usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401>()
, 4usize);
}
impl Clone for
- nsTimingFunction__bindgen_ty_bindgen_id_206393__bindgen_ty_bindgen_id_206405
+ nsTimingFunction__bindgen_ty_bindgen_id_215389__bindgen_ty_bindgen_id_215401
{
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_206393() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_215389() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389>()
, 16usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_206393>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_215389>()
, 4usize);
}
-impl Clone for nsTimingFunction__bindgen_ty_bindgen_id_206393 {
+impl Clone for nsTimingFunction__bindgen_ty_bindgen_id_215389 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10542,13 +10614,13 @@ fn bindgen_test_layout_StyleBasicShape() {
#[repr(C)]
#[derive(Debug)]
pub struct StyleShapeSource<ReferenceBox> {
- pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_bindgen_id_206776<ReferenceBox>,
+ pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_bindgen_id_215772<ReferenceBox>,
pub mType: StyleShapeSourceType,
pub mReferenceBox: ReferenceBox,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct StyleShapeSource__bindgen_ty_bindgen_id_206776<ReferenceBox> {
+pub struct StyleShapeSource__bindgen_ty_bindgen_id_215772<ReferenceBox> {
pub mBasicShape: __BindgenUnionField<*mut StyleBasicShape>,
pub mURL: __BindgenUnionField<*mut FragmentOrURL>,
pub bindgen_union_field: u64,
@@ -10600,25 +10672,25 @@ pub enum nsStyleContentType {
#[derive(Debug)]
pub struct nsStyleContentData {
pub mType: nsStyleContentType,
- pub mContent: nsStyleContentData__bindgen_ty_bindgen_id_206860,
+ pub mContent: nsStyleContentData__bindgen_ty_bindgen_id_215856,
pub mImageTracked: bool,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleContentData__bindgen_ty_bindgen_id_206860 {
+pub struct nsStyleContentData__bindgen_ty_bindgen_id_215856 {
pub mString: __BindgenUnionField<*mut u16>,
pub mImage: __BindgenUnionField<*mut imgRequestProxy>,
pub mCounters: __BindgenUnionField<*mut nsCSSValue_Array>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleContentData__bindgen_ty_bindgen_id_206860() {
- assert_eq!(::std::mem::size_of::<nsStyleContentData__bindgen_ty_bindgen_id_206860>()
+fn bindgen_test_layout_nsStyleContentData__bindgen_ty_bindgen_id_215856() {
+ assert_eq!(::std::mem::size_of::<nsStyleContentData__bindgen_ty_bindgen_id_215856>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleContentData__bindgen_ty_bindgen_id_206860>()
+ assert_eq!(::std::mem::align_of::<nsStyleContentData__bindgen_ty_bindgen_id_215856>()
, 8usize);
}
-impl Clone for nsStyleContentData__bindgen_ty_bindgen_id_206860 {
+impl Clone for nsStyleContentData__bindgen_ty_bindgen_id_215856 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10685,12 +10757,11 @@ pub struct nsStyleUserInterface {
pub mUserFocus: StyleUserFocus,
pub mPointerEvents: u8,
pub mCursor: u8,
- pub mCursorArrayLength: u32,
- pub mCursorArray: *mut nsCursorImage,
+ pub mCursorImages: nsTArray<nsCursorImage>,
}
#[test]
fn bindgen_test_layout_nsStyleUserInterface() {
- assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 24usize);
+ assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 16usize);
assert_eq!(::std::mem::align_of::<nsStyleUserInterface>() , 8usize);
}
#[repr(C)]
@@ -10715,10 +10786,9 @@ pub struct nsStyleColumn {
pub mColumnCount: u32,
pub mColumnWidth: nsStyleCoord,
pub mColumnGap: nsStyleCoord,
- pub mColumnRuleColor: nscolor,
+ pub mColumnRuleColor: StyleComplexColor,
pub mColumnRuleStyle: u8,
pub mColumnFill: u8,
- pub mColumnRuleColorIsForeground: bool,
pub mColumnRuleWidth: nscoord,
pub mTwipsPerPixel: nscoord,
}
@@ -10728,7 +10798,7 @@ extern "C" {
}
#[test]
fn bindgen_test_layout_nsStyleColumn() {
- assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 56usize);
+ assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 64usize);
assert_eq!(::std::mem::align_of::<nsStyleColumn>() , 8usize);
}
#[repr(u32)]
@@ -10743,25 +10813,25 @@ pub enum nsStyleSVGPaintType {
#[repr(C)]
#[derive(Debug)]
pub struct nsStyleSVGPaint {
- pub mPaint: nsStyleSVGPaint__bindgen_ty_bindgen_id_207259,
+ pub mPaint: nsStyleSVGPaint__bindgen_ty_bindgen_id_216243,
pub mType: nsStyleSVGPaintType,
pub mFallbackColor: nscolor,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleSVGPaint__bindgen_ty_bindgen_id_207259 {
+pub struct nsStyleSVGPaint__bindgen_ty_bindgen_id_216243 {
pub mColor: __BindgenUnionField<nscolor>,
pub mPaintServer: __BindgenUnionField<*mut FragmentOrURL>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleSVGPaint__bindgen_ty_bindgen_id_207259() {
- assert_eq!(::std::mem::size_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_207259>()
+fn bindgen_test_layout_nsStyleSVGPaint__bindgen_ty_bindgen_id_216243() {
+ assert_eq!(::std::mem::size_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_216243>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_207259>()
+ assert_eq!(::std::mem::align_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_216243>()
, 8usize);
}
-impl Clone for nsStyleSVGPaint__bindgen_ty_bindgen_id_207259 {
+impl Clone for nsStyleSVGPaint__bindgen_ty_bindgen_id_216243 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10796,7 +10866,7 @@ pub struct nsStyleSVG {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsStyleSVG__bindgen_ty_bindgen_id_207436 {
+pub enum nsStyleSVG__bindgen_ty_bindgen_id_216420 {
FILL_OPACITY_SOURCE_MASK = 3,
STROKE_OPACITY_SOURCE_MASK = 12,
STROKE_DASHARRAY_CONTEXT = 16,
@@ -10815,23 +10885,23 @@ fn bindgen_test_layout_nsStyleSVG() {
pub struct nsStyleFilter {
pub mType: i32,
pub mFilterParameter: nsStyleCoord,
- pub __bindgen_anon_1: nsStyleFilter__bindgen_ty_bindgen_id_207502,
+ pub __bindgen_anon_1: nsStyleFilter__bindgen_ty_bindgen_id_216486,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleFilter__bindgen_ty_bindgen_id_207502 {
+pub struct nsStyleFilter__bindgen_ty_bindgen_id_216486 {
pub mURL: __BindgenUnionField<*mut FragmentOrURL>,
pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleFilter__bindgen_ty_bindgen_id_207502() {
- assert_eq!(::std::mem::size_of::<nsStyleFilter__bindgen_ty_bindgen_id_207502>()
+fn bindgen_test_layout_nsStyleFilter__bindgen_ty_bindgen_id_216486() {
+ assert_eq!(::std::mem::size_of::<nsStyleFilter__bindgen_ty_bindgen_id_216486>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleFilter__bindgen_ty_bindgen_id_207502>()
+ assert_eq!(::std::mem::align_of::<nsStyleFilter__bindgen_ty_bindgen_id_216486>()
, 8usize);
}
-impl Clone for nsStyleFilter__bindgen_ty_bindgen_id_207502 {
+impl Clone for nsStyleFilter__bindgen_ty_bindgen_id_216486 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs
index 342c1298ccf..359061c330a 100644
--- a/components/style/gecko_bindings/structs_release.rs
+++ b/components/style/gecko_bindings/structs_release.rs
@@ -25,6 +25,18 @@ impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
fn clone(&self) -> Self { Self::new() }
}
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0;
+pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1;
+pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2;
+pub const NS_FONT_STRETCH_ULTRA_CONDENSED: ::std::os::raw::c_int = -4;
+pub const NS_FONT_STRETCH_EXTRA_CONDENSED: ::std::os::raw::c_int = -3;
+pub const NS_FONT_STRETCH_CONDENSED: ::std::os::raw::c_int = -2;
+pub const NS_FONT_STRETCH_SEMI_CONDENSED: ::std::os::raw::c_int = -1;
+pub const NS_FONT_STRETCH_NORMAL: ::std::os::raw::c_uint = 0;
+pub const NS_FONT_STRETCH_SEMI_EXPANDED: ::std::os::raw::c_uint = 1;
+pub const NS_FONT_STRETCH_EXPANDED: ::std::os::raw::c_uint = 2;
+pub const NS_FONT_STRETCH_EXTRA_EXPANDED: ::std::os::raw::c_uint = 3;
+pub const NS_FONT_STRETCH_ULTRA_EXPANDED: ::std::os::raw::c_uint = 4;
pub const NS_THEME_NONE: ::std::os::raw::c_uint = 0;
pub const NS_THEME_BUTTON: ::std::os::raw::c_uint = 1;
pub const NS_THEME_RADIO: ::std::os::raw::c_uint = 2;
@@ -148,9 +160,6 @@ pub const NS_THEME_MAC_DISCLOSURE_BUTTON_OPEN: ::std::os::raw::c_uint = 245;
pub const NS_THEME_MAC_DISCLOSURE_BUTTON_CLOSED: ::std::os::raw::c_uint = 246;
pub const NS_THEME_GTK_INFO_BAR: ::std::os::raw::c_uint = 247;
pub const NS_THEME_MAC_SOURCE_LIST: ::std::os::raw::c_uint = 248;
-pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0;
-pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1;
-pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2;
pub const NS_CORNER_TOP_LEFT_X: ::std::os::raw::c_uint = 0;
pub const NS_CORNER_TOP_LEFT_Y: ::std::os::raw::c_uint = 1;
pub const NS_CORNER_TOP_RIGHT_X: ::std::os::raw::c_uint = 2;
@@ -221,8 +230,13 @@ pub const NS_STYLE_VOLUME_SOFT: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_VOLUME_MEDIUM: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_VOLUME_LOUD: ::std::os::raw::c_uint = 4;
pub const NS_STYLE_VOLUME_X_LOUD: ::std::os::raw::c_uint = 5;
-pub const NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_COLOR_INHERIT_FROM_BODY: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_WILL_CHANGE_STACKING_CONTEXT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_TRANSFORM: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_SCROLL: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_OPACITY: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_FIXPOS_CB: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_WILL_CHANGE_ABSPOS_CB: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_ANIMATION_ITERATION_COUNT_INFINITE: ::std::os::raw::c_uint
=
0;
@@ -241,6 +255,11 @@ pub const NS_STYLE_IMAGELAYER_CLIP_MOZ_ALMOST_PADDING: ::std::os::raw::c_uint
pub const NS_STYLE_IMAGELAYER_ORIGIN_BORDER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_IMAGELAYER_ORIGIN_PADDING: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_ORIGIN_CONTENT: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_IMAGELAYER_POSITION_CENTER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_TOP: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_BOTTOM: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_LEFT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_IMAGELAYER_POSITION_RIGHT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_IMAGELAYER_REPEAT_REPEAT_X: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IMAGELAYER_REPEAT_REPEAT_Y: ::std::os::raw::c_uint = 2;
@@ -372,6 +391,8 @@ pub const NS_STYLE_FILTER_SATURATE: ::std::os::raw::c_uint = 8;
pub const NS_STYLE_FILTER_SEPIA: ::std::os::raw::c_uint = 9;
pub const NS_STYLE_FILTER_HUE_ROTATE: ::std::os::raw::c_uint = 10;
pub const NS_STYLE_FILTER_DROP_SHADOW: ::std::os::raw::c_uint = 11;
+pub const NS_STYLE_FONT_WEIGHT_BOLDER: ::std::os::raw::c_int = -1;
+pub const NS_STYLE_FONT_WEIGHT_LIGHTER: ::std::os::raw::c_int = -2;
pub const NS_STYLE_FONT_SIZE_XXSMALL: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_FONT_SIZE_XSMALL: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_FONT_SIZE_SMALL: ::std::os::raw::c_uint = 2;
@@ -398,6 +419,9 @@ pub const NS_STYLE_FONT_BUTTON: ::std::os::raw::c_uint = 13;
pub const NS_STYLE_FONT_PULL_DOWN_MENU: ::std::os::raw::c_uint = 14;
pub const NS_STYLE_FONT_LIST: ::std::os::raw::c_uint = 15;
pub const NS_STYLE_FONT_FIELD: ::std::os::raw::c_uint = 16;
+pub const NS_STYLE_GRID_AUTO_FLOW_ROW: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_GRID_AUTO_FLOW_COLUMN: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_GRID_AUTO_FLOW_DENSE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_GRID_TEMPLATE_SUBGRID: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_GRID_TRACK_BREADTH_MAX_CONTENT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_GRID_TRACK_BREADTH_MIN_CONTENT: ::std::os::raw::c_uint = 2;
@@ -437,6 +461,7 @@ pub const NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: ::std::os::raw::c_uint = 5;
pub const NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: ::std::os::raw::c_uint = 6;
pub const NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_LIST_STYLE_CUSTOM: ::std::os::raw::c_int = -1;
pub const NS_STYLE_LIST_STYLE_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_LIST_STYLE_DISC: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_LIST_STYLE_CIRCLE: ::std::os::raw::c_uint = 2;
@@ -532,6 +557,11 @@ pub const NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_TRANSFORM_LOWERCASE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_TEXT_TRANSFORM_UPPERCASE: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH: ::std::os::raw::c_uint = 4;
+pub const NS_STYLE_TOUCH_ACTION_NONE: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_AUTO: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_PAN_X: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_PAN_Y: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TOUCH_ACTION_MANIPULATION: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TOP_LAYER_NONE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TOP_LAYER_TOP: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TRANSFORM_BOX_BORDER_BOX: ::std::os::raw::c_uint = 0;
@@ -635,6 +665,7 @@ pub const NS_STYLE_PAGE_BREAK_AVOID: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_PAGE_BREAK_LEFT: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_PAGE_BREAK_RIGHT: ::std::os::raw::c_uint = 4;
pub const NS_STYLE_COLUMN_COUNT_AUTO: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_COLUMN_COUNT_UNLIMITED: ::std::os::raw::c_int = -1;
pub const NS_STYLE_COLUMN_FILL_AUTO: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_COLUMN_FILL_BALANCE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_IME_MODE_AUTO: ::std::os::raw::c_uint = 0;
@@ -693,7 +724,14 @@ pub const NS_STYLE_STROKE_PROP_CONTEXT_VALUE: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TEXT_ANCHOR_START: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_TEXT_ANCHOR_MIDDLE: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_ANCHOR_END: ::std::os::raw::c_uint = 2;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_OVER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_NONE: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_FILL_MASK: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_FILLED: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_SHAPE_MASK: ::std::os::raw::c_uint = 7;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_DOT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE: ::std::os::raw::c_uint = 2;
@@ -774,7 +812,10 @@ pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3;
+pub const NS_STYLE_INHERIT_BIT: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215;
+pub const NS_STYLE_INHERITED_STRUCT_MASK: ::std::os::raw::c_uint = 1;
+pub const NS_STYLE_RESET_STRUCT_MASK: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint =
16777216;
pub const NS_STYLE_HAS_PSEUDO_ELEMENT_DATA: ::std::os::raw::c_uint = 33554432;
@@ -795,9 +836,6 @@ pub const NS_STYLE_HAS_CHILD_THAT_USES_RESET_STYLE:
pub const NS_STYLE_IS_TEXT_COMBINED: ::std::os::raw::c_ulonglong =
34359738368;
pub const NS_STYLE_CONTEXT_TYPE_SHIFT: ::std::os::raw::c_uint = 36;
-pub const BORDER_COLOR_FOREGROUND: ::std::os::raw::c_uint = 32;
-pub const BORDER_COLOR_SPECIAL: ::std::os::raw::c_uint = 160;
-pub const BORDER_STYLE_MASK: ::std::os::raw::c_uint = 31;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct fallible_t {
@@ -1083,6 +1121,20 @@ pub enum nsresult {
NS_ERROR_UNCATCHABLE_EXCEPTION = 2152924152,
NS_ERROR_DOM_DOMEXCEPTION = 2152924153,
NS_ERROR_DOM_EXCEPTION_ON_JSCONTEXT = 2152924154,
+ NS_ERROR_DOM_MALFORMED_URI = 2152924155,
+ NS_ERROR_DOM_INVALID_HEADER_NAME = 2152924156,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT = 2152924157,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED = 2152924158,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING = 2152924159,
+ NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE = 2152924160,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSEXML =
+ 2152924161,
+ NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT =
+ 2152924162,
+ NS_ERROR_DOM_INVALID_STATE_XHR_CHUNKED_RESPONSETYPES_UNSUPPORTED_FOR_SYNC
+ = 2152924163,
+ NS_ERROR_DOM_INVALID_ACCESS_XHR_TIMEOUT_AND_RESPONSETYPE_UNSUPPORTED_FOR_SYNC
+ = 2152924164,
NS_SUCCESS_DOM_NO_OPERATION = 5439489,
NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW = 5439490,
NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE = 5439491,
@@ -1307,6 +1359,7 @@ pub enum nsresult {
NS_ERROR_DOM_MEDIA_MEDIASINK_ERR = 2154692619,
NS_ERROR_DOM_MEDIA_DEMUXER_ERR = 2154692620,
NS_ERROR_DOM_MEDIA_CDM_ERR = 2154692621,
+ NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR = 2154692709,
NS_ERROR_DOWNLOAD_COMPLETE = 2155347969,
NS_ERROR_DOWNLOAD_NOT_PARTIAL = 2155347970,
NS_ERROR_UNORM_MOREOUTPUT = 2155348001,
@@ -1501,8 +1554,8 @@ pub enum JSWhyMagic {
#[derive(Debug, Copy)]
pub struct jsval_layout {
pub asBits: __BindgenUnionField<u64>,
- pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_58985>,
- pub s: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_58992>,
+ pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_59694>,
+ pub s: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_59701>,
pub asDouble: __BindgenUnionField<f64>,
pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub asWord: __BindgenUnionField<usize>,
@@ -1511,20 +1564,20 @@ pub struct jsval_layout {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_58985 {
+pub struct jsval_layout__bindgen_ty_bindgen_id_59694 {
pub _bitfield_1: u64,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_58985() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_58985>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_59694() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_59694>()
, 8usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_58985>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_59694>()
, 8usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_58985 {
+impl Clone for jsval_layout__bindgen_ty_bindgen_id_59694 {
fn clone(&self) -> Self { *self }
}
-impl jsval_layout__bindgen_ty_bindgen_id_58985 {
+impl jsval_layout__bindgen_ty_bindgen_id_59694 {
#[inline]
pub fn payload47(&self) -> u64 {
unsafe {
@@ -1557,36 +1610,36 @@ impl jsval_layout__bindgen_ty_bindgen_id_58985 {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_58992 {
- pub payload: jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993,
+pub struct jsval_layout__bindgen_ty_bindgen_id_59701 {
+ pub payload: jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993 {
+pub struct jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702 {
pub i32: __BindgenUnionField<i32>,
pub u32: __BindgenUnionField<u32>,
pub why: __BindgenUnionField<JSWhyMagic>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702>()
, 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702>()
, 4usize);
}
impl Clone for
- jsval_layout__bindgen_ty_bindgen_id_58992__bindgen_ty_bindgen_id_58993 {
+ jsval_layout__bindgen_ty_bindgen_id_59701__bindgen_ty_bindgen_id_59702 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_58992() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_58992>()
+fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_59701() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_59701>()
, 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_58992>()
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_59701>()
, 4usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_58992 {
+impl Clone for jsval_layout__bindgen_ty_bindgen_id_59701 {
fn clone(&self) -> Self { *self }
}
impl Clone for jsval_layout {
@@ -1620,7 +1673,7 @@ pub type nsAString_internal_size_type = u32;
pub type nsAString_internal_index_type = u32;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsAString_internal__bindgen_ty_bindgen_id_60817 {
+pub enum nsAString_internal__bindgen_ty_bindgen_id_61571 {
F_NONE = 0,
F_TERMINATED = 1,
F_VOIDED = 2,
@@ -1682,12 +1735,12 @@ fn bindgen_test_layout_nsString() {
assert_eq!(::std::mem::align_of::<nsString>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_61427 {
+pub struct bindgen_vtable__bindgen_id_62181 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsStringComparator {
- pub vtable_: *const bindgen_vtable__bindgen_id_61427,
+ pub vtable_: *const bindgen_vtable__bindgen_id_62181,
}
pub type nsStringComparator_char_type = u16;
#[test]
@@ -1729,7 +1782,7 @@ pub type nsACString_internal_size_type = u32;
pub type nsACString_internal_index_type = u32;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsACString_internal__bindgen_ty_bindgen_id_62657 {
+pub enum nsACString_internal__bindgen_ty_bindgen_id_63411 {
F_NONE = 0,
F_TERMINATED = 1,
F_VOIDED = 2,
@@ -1791,12 +1844,12 @@ fn bindgen_test_layout_nsCString() {
assert_eq!(::std::mem::align_of::<nsCString>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_63209 {
+pub struct bindgen_vtable__bindgen_id_63963 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsCStringComparator {
- pub vtable_: *const bindgen_vtable__bindgen_id_63209,
+ pub vtable_: *const bindgen_vtable__bindgen_id_63963,
}
pub type nsCStringComparator_char_type = ::std::os::raw::c_char;
#[test]
@@ -1808,7 +1861,7 @@ impl Clone for nsCStringComparator {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_63253 {
+pub struct bindgen_vtable__bindgen_id_64007 {
}
/**
* Basic component object model interface. Objects which implement
@@ -1819,7 +1872,7 @@ pub struct bindgen_vtable__bindgen_id_63253 {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsISupports {
- pub vtable_: *const bindgen_vtable__bindgen_id_63253,
+ pub vtable_: *const bindgen_vtable__bindgen_id_64007,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -1837,7 +1890,7 @@ impl Clone for nsISupports {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_63536 {
+pub struct bindgen_vtable__bindgen_id_64290 {
}
/**
* Participant implementation classes
@@ -1845,7 +1898,7 @@ pub struct bindgen_vtable__bindgen_id_63536 {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsCycleCollectionParticipant {
- pub vtable_: *const bindgen_vtable__bindgen_id_63536,
+ pub vtable_: *const bindgen_vtable__bindgen_id_64290,
pub mMightSkip: bool,
}
#[test]
@@ -1890,6 +1943,7 @@ pub struct nsReadingIterator<CharT> {
}
pub type nsReadingIterator_self_type<CharT> = nsReadingIterator<CharT>;
pub type nsReadingIterator_difference_type = isize;
+pub type nsReadingIterator_size_type = usize;
pub type nsReadingIterator_value_type<CharT> = CharT;
pub type nsReadingIterator_pointer<CharT> = *mut CharT;
pub type nsReadingIterator_reference = [u8; 0usize];
@@ -1905,6 +1959,7 @@ pub struct nsWritingIterator<CharT> {
}
pub type nsWritingIterator_self_type<CharT> = nsWritingIterator<CharT>;
pub type nsWritingIterator_difference_type = isize;
+pub type nsWritingIterator_size_type = usize;
pub type nsWritingIterator_value_type<CharT> = CharT;
pub type nsWritingIterator_pointer<CharT> = *mut CharT;
pub type nsWritingIterator_reference = [u8; 0usize];
@@ -2168,7 +2223,7 @@ fn bindgen_test_layout_ErrorResult() {
#[derive(Debug)]
pub struct TErrorResult<CleanupPolicy> {
pub mResult: nsresult,
- pub __bindgen_anon_1: TErrorResult__bindgen_ty_bindgen_id_68156<CleanupPolicy>,
+ pub __bindgen_anon_1: TErrorResult__bindgen_ty_bindgen_id_68916<CleanupPolicy>,
pub _phantom_0: ::std::marker::PhantomData<CleanupPolicy>,
}
#[repr(C)]
@@ -2185,7 +2240,7 @@ pub struct TErrorResult_DOMExceptionInfo<CleanupPolicy> {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct TErrorResult__bindgen_ty_bindgen_id_68156<CleanupPolicy> {
+pub struct TErrorResult__bindgen_ty_bindgen_id_68916<CleanupPolicy> {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message<CleanupPolicy>>,
pub mJSException: __BindgenUnionField<Value>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo<CleanupPolicy>>,
@@ -2318,7 +2373,55 @@ impl nsIAtom {
}
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_68927 {
+#[derive(Debug, Copy)]
+pub struct nsIPrincipal {
+ pub _base: nsISerializable,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsIPrincipal_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsIPrincipal__bindgen_ty_bindgen_id_69939 {
+ APP_STATUS_NOT_INSTALLED = 0,
+ APP_STATUS_INSTALLED = 1,
+ APP_STATUS_PRIVILEGED = 2,
+ APP_STATUS_CERTIFIED = 3,
+}
+#[test]
+fn bindgen_test_layout_nsIPrincipal() {
+ assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize);
+}
+impl Clone for nsIPrincipal {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsISerializable {
+ pub _base: nsISupports,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsISerializable_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[test]
+fn bindgen_test_layout_nsISerializable() {
+ assert_eq!(::std::mem::size_of::<nsISerializable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsISerializable>() , 8usize);
+}
+impl Clone for nsISerializable {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+pub struct bindgen_vtable__bindgen_id_70107 {
}
/**
* Class to store the wrapper for an object. This can only be used with objects
@@ -2360,7 +2463,7 @@ pub struct bindgen_vtable__bindgen_id_68927 {
#[repr(C)]
#[derive(Debug)]
pub struct nsWrapperCache {
- pub vtable_: *const bindgen_vtable__bindgen_id_68927,
+ pub vtable_: *const bindgen_vtable__bindgen_id_70107,
pub mWrapper: *mut JSObject,
pub mFlags: nsWrapperCache_FlagsType,
}
@@ -2385,7 +2488,7 @@ pub type nsWrapperCache_FlagsType = u32;
* NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER).
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_69123 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_70303 {
WRAPPER_BIT_PRESERVED = 1,
}
#[repr(u32)]
@@ -2394,12 +2497,12 @@ pub enum nsWrapperCache__bindgen_ty_bindgen_id_69123 {
* binding.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_69126 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_70306 {
WRAPPER_IS_NOT_DOM_BINDING = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsWrapperCache__bindgen_ty_bindgen_id_69129 {
+pub enum nsWrapperCache__bindgen_ty_bindgen_id_70309 {
kWrapperFlagsMask = 3,
}
#[test]
@@ -2433,78 +2536,6 @@ fn bindgen_test_layout_GlobalObject() {
assert_eq!(::std::mem::align_of::<GlobalObject>() , 8usize);
}
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct pair<_T1, _T2> {
- pub first: _T1,
- pub second: _T2,
-}
-pub type pair_first_type<_T1> = _T1;
-pub type pair_second_type<_T2> = _T2;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct input_iterator_tag {
- pub _address: u8,
-}
-impl Clone for input_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct forward_iterator_tag {
- pub _address: u8,
-}
-impl Clone for forward_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct bidirectional_iterator_tag {
- pub _address: u8,
-}
-impl Clone for bidirectional_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct random_access_iterator_tag {
- pub _address: u8,
-}
-impl Clone for random_access_iterator_tag {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_87800 {
-}
-/**
- * A class of objects that return source code on demand.
- *
- * When code is compiled with setSourceIsLazy(true), SpiderMonkey doesn't
- * retain the source code (and doesn't do lazy bytecode generation). If we ever
- * need the source code, say, in response to a call to Function.prototype.
- * toSource or Debugger.Source.prototype.text, then we call the 'load' member
- * function of the instance of this class that has hopefully been registered
- * with the runtime, passing the code's URL, and hope that it will be able to
- * find the source.
- */
-#[repr(C)]
-#[derive(Debug)]
-pub struct SourceHook {
- pub vtable_: *const bindgen_vtable__bindgen_id_87800,
-}
-#[test]
-fn bindgen_test_layout_SourceHook() {
- assert_eq!(::std::mem::size_of::<SourceHook>() , 8usize);
- assert_eq!(::std::mem::align_of::<SourceHook>() , 8usize);
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __bit_const_reference<_Cp> {
- pub __seg_: __bit_const_reference___storage_pointer<_Cp>,
- pub __mask_: __bit_const_reference___storage_type<_Cp>,
-}
-pub type __bit_const_reference___storage_type<_Cp> = _Cp;
-pub type __bit_const_reference___storage_pointer<_Cp> = _Cp;
-#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsScriptObjectTracer {
pub _base: nsCycleCollectionParticipant,
@@ -2539,213 +2570,69 @@ fn bindgen_test_layout_nsXPCOMCycleCollectionParticipant() {
impl Clone for nsXPCOMCycleCollectionParticipant {
fn clone(&self) -> Self { *self }
}
-pub type PLDHashNumber = u32;
-#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable {
- pub mOps: *const PLDHashTableOps,
- pub mHashShift: i16,
- pub mEntrySize: u32,
- pub mEntryCount: u32,
- pub mRemovedCount: u32,
- pub mEntryStore: PLDHashTable_EntryStore,
-}
-#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable_EntryStore {
- pub mEntryStore: *mut ::std::os::raw::c_char,
- pub mGeneration: u32,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable_EntryStore() {
- assert_eq!(::std::mem::size_of::<PLDHashTable_EntryStore>() , 16usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable_EntryStore>() , 8usize);
-}
#[repr(C)]
-#[derive(Debug)]
-pub struct PLDHashTable_Iterator {
- pub mTable: *mut PLDHashTable,
- pub mStart: *mut ::std::os::raw::c_char,
- pub mLimit: *mut ::std::os::raw::c_char,
- pub mCurrent: *mut ::std::os::raw::c_char,
- pub mNexts: u32,
- pub mNextsLimit: u32,
- pub mHaveRemoved: bool,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable_Iterator() {
- assert_eq!(::std::mem::size_of::<PLDHashTable_Iterator>() , 48usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable_Iterator>() , 8usize);
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum PLDHashTable_SearchReason { ForSearchOrRemove = 0, ForAdd = 1, }
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kMaxCapacityE"]
- pub static PLDHashTable_kMaxCapacity: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kMinCapacityE"]
- pub static PLDHashTable_kMinCapacity: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable17kMaxInitialLengthE"]
- pub static PLDHashTable_kMaxInitialLength: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable21kDefaultInitialLengthE"]
- pub static PLDHashTable_kDefaultInitialLength: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable9kHashBitsE"]
- pub static PLDHashTable_kHashBits: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable12kGoldenRatioE"]
- pub static PLDHashTable_kGoldenRatio: u32;
-}
-extern "C" {
- #[link_name = "_ZN12PLDHashTable14kCollisionFlagE"]
- pub static PLDHashTable_kCollisionFlag: PLDHashNumber;
-}
-#[test]
-fn bindgen_test_layout_PLDHashTable() {
- assert_eq!(::std::mem::size_of::<PLDHashTable>() , 40usize);
- assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize);
+#[derive(Debug, Copy, Clone)]
+pub struct pair<_T1, _T2> {
+ pub first: _T1,
+ pub second: _T2,
}
+pub type pair_first_type<_T1> = _T1;
+pub type pair_second_type<_T2> = _T2;
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct PLDHashTableOps {
- pub hashKey: PLDHashHashKey,
- pub matchEntry: PLDHashMatchEntry,
- pub moveEntry: PLDHashMoveEntry,
- pub clearEntry: PLDHashClearEntry,
- pub initEntry: PLDHashInitEntry,
-}
-#[test]
-fn bindgen_test_layout_PLDHashTableOps() {
- assert_eq!(::std::mem::size_of::<PLDHashTableOps>() , 40usize);
- assert_eq!(::std::mem::align_of::<PLDHashTableOps>() , 8usize);
+pub struct input_iterator_tag {
+ pub _address: u8,
}
-impl Clone for PLDHashTableOps {
+impl Clone for input_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct PLDHashEntryHdr {
- pub mKeyHash: PLDHashNumber,
-}
-#[test]
-fn bindgen_test_layout_PLDHashEntryHdr() {
- assert_eq!(::std::mem::size_of::<PLDHashEntryHdr>() , 4usize);
- assert_eq!(::std::mem::align_of::<PLDHashEntryHdr>() , 4usize);
+pub struct forward_iterator_tag {
+ pub _address: u8,
}
-impl Clone for PLDHashEntryHdr {
+impl Clone for forward_iterator_tag {
fn clone(&self) -> Self { *self }
}
-pub type PLDHashHashKey =
- ::std::option::Option<unsafe extern "C" fn(aKey:
- *const ::std::os::raw::c_void)
- -> ::std::os::raw::c_uint>;
-pub type PLDHashMatchEntry =
- ::std::option::Option<unsafe extern "C" fn(aEntry: *const PLDHashEntryHdr,
- aKey:
- *const ::std::os::raw::c_void)
- -> bool>;
-pub type PLDHashMoveEntry =
- ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
- aFrom: *const PLDHashEntryHdr,
- aTo: *mut PLDHashEntryHdr)>;
-pub type PLDHashClearEntry =
- ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
- aEntry: *mut PLDHashEntryHdr)>;
-pub type PLDHashInitEntry =
- ::std::option::Option<unsafe extern "C" fn(aEntry: *mut PLDHashEntryHdr,
- aKey:
- *const ::std::os::raw::c_void)>;
-/**
- * hashkey wrapper using T* KeyType
- *
- * @see nsTHashtable::EntryType for specification
- */
-#[repr(C)]
-#[derive(Debug)]
-pub struct nsPtrHashKey<T> {
- pub _base: PLDHashEntryHdr,
- pub mKey: *mut T,
-}
-pub type nsPtrHashKey_KeyType<T> = *mut T;
-pub type nsPtrHashKey_KeyTypePointer<T> = *mut T;
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsPtrHashKey__bindgen_ty_bindgen_id_98662 { ALLOW_MEMMOVE = 0, }
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsIRunnable {
- pub _base: nsISupports,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsIRunnable_COMTypeInfo<T, U> {
+pub struct bidirectional_iterator_tag {
pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
-}
-#[test]
-fn bindgen_test_layout_nsIRunnable() {
- assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize);
}
-impl Clone for nsIRunnable {
+impl Clone for bidirectional_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsIPrincipal {
- pub _base: nsISerializable,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsIPrincipal_COMTypeInfo<T, U> {
+pub struct random_access_iterator_tag {
pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPrincipal__bindgen_ty_bindgen_id_100679 {
- APP_STATUS_NOT_INSTALLED = 0,
- APP_STATUS_INSTALLED = 1,
- APP_STATUS_PRIVILEGED = 2,
- APP_STATUS_CERTIFIED = 3,
-}
-#[test]
-fn bindgen_test_layout_nsIPrincipal() {
- assert_eq!(::std::mem::size_of::<nsIPrincipal>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsIPrincipal>() , 8usize);
-}
-impl Clone for nsIPrincipal {
+impl Clone for random_access_iterator_tag {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct nsISerializable {
- pub _base: nsISupports,
+pub struct bindgen_vtable__bindgen_id_89978 {
}
+/**
+ * A class of objects that return source code on demand.
+ *
+ * When code is compiled with setSourceIsLazy(true), SpiderMonkey doesn't
+ * retain the source code (and doesn't do lazy bytecode generation). If we ever
+ * need the source code, say, in response to a call to Function.prototype.
+ * toSource or Debugger.Source.prototype.text, then we call the 'load' member
+ * function of the instance of this class that has hopefully been registered
+ * with the runtime, passing the code's URL, and hope that it will be able to
+ * find the source.
+ */
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct nsISerializable_COMTypeInfo<T, U> {
- pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
+#[derive(Debug)]
+pub struct SourceHook {
+ pub vtable_: *const bindgen_vtable__bindgen_id_89978,
}
#[test]
-fn bindgen_test_layout_nsISerializable() {
- assert_eq!(::std::mem::size_of::<nsISerializable>() , 8usize);
- assert_eq!(::std::mem::align_of::<nsISerializable>() , 8usize);
-}
-impl Clone for nsISerializable {
- fn clone(&self) -> Self { *self }
+fn bindgen_test_layout_SourceHook() {
+ assert_eq!(::std::mem::size_of::<SourceHook>() , 8usize);
+ assert_eq!(::std::mem::align_of::<SourceHook>() , 8usize);
}
#[repr(C)]
#[derive(Debug)]
@@ -2824,6 +2711,7 @@ pub struct nsIDocument {
pub mBlockAllMixedContentPreloads: bool,
pub mUpgradeInsecureRequests: bool,
pub mUpgradeInsecurePreloads: bool,
+ pub mHSTSPrimingURIList: [u64; 5usize],
pub mDocumentContainer: u64,
pub mCharacterSet: nsCString,
pub mCharacterSetSource: i32,
@@ -3031,7 +2919,7 @@ pub type nsIDocument_FrameRequestCallbackList =
nsTArray<RefPtr<FrameRequestCallback>>;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDocument__bindgen_ty_bindgen_id_109385 { REQUEST_DISCARD = 1, }
+pub enum nsIDocument__bindgen_ty_bindgen_id_103523 { REQUEST_DISCARD = 1, }
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum nsIDocument_DeprecatedOperations {
@@ -3058,22 +2946,23 @@ pub enum nsIDocument_DeprecatedOperations {
eUseOfCaptureEvents = 20,
eUseOfReleaseEvents = 21,
eUseOfDOM3LoadMethod = 22,
- eShowModalDialog = 23,
- eWindow_Content = 24,
- eSyncXMLHttpRequest = 25,
- eDataContainerEvent = 26,
- eWindow_Controllers = 27,
- eImportXULIntoContent = 28,
- ePannerNodeDoppler = 29,
- eNavigatorGetUserMedia = 30,
- eWebrtcDeprecatedPrefix = 31,
- eRTCPeerConnectionGetStreams = 32,
- eAppCache = 33,
- ePrefixedImageSmoothingEnabled = 34,
- ePrefixedFullscreenAPI = 35,
- eLenientSetter = 36,
- eFileLastModifiedDate = 37,
- eDeprecatedOperationCount = 38,
+ eChromeUseOfDOM3LoadMethod = 23,
+ eShowModalDialog = 24,
+ eWindow_Content = 25,
+ eSyncXMLHttpRequest = 26,
+ eDataContainerEvent = 27,
+ eWindow_Controllers = 28,
+ eImportXULIntoContent = 29,
+ ePannerNodeDoppler = 30,
+ eNavigatorGetUserMedia = 31,
+ eWebrtcDeprecatedPrefix = 32,
+ eRTCPeerConnectionGetStreams = 33,
+ eAppCache = 34,
+ ePrefixedImageSmoothingEnabled = 35,
+ ePrefixedFullscreenAPI = 36,
+ eLenientSetter = 37,
+ eFileLastModifiedDate = 38,
+ eDeprecatedOperationCount = 39,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -3113,7 +3002,7 @@ impl Clone for nsIDocument_FrameRequest {
}
#[test]
fn bindgen_test_layout_nsIDocument() {
- assert_eq!(::std::mem::size_of::<nsIDocument>() , 896usize);
+ assert_eq!(::std::mem::size_of::<nsIDocument>() , 936usize);
assert_eq!(::std::mem::align_of::<nsIDocument>() , 8usize);
}
impl nsIDocument {
@@ -3669,20 +3558,6 @@ impl nsIDocument {
((val as u8 as u64) << 41u32) & (2199023255552usize as u64);
}
#[inline]
- pub fn mMayHavePluginFramesForPrinting(&self) -> bool {
- unsafe {
- ::std::mem::transmute(((self._bitfield_1 &
- (4398046511104usize as u64)) >> 42u32)
- as u8)
- }
- }
- #[inline]
- pub fn set_mMayHavePluginFramesForPrinting(&mut self, val: bool) {
- self._bitfield_1 &= !(4398046511104usize as u64);
- self._bitfield_1 |=
- ((val as u8 as u64) << 42u32) & (4398046511104usize as u64);
- }
- #[inline]
pub fn mDidFireDOMContentLoaded(&self) -> bool {
unsafe {
::std::mem::transmute(((self._bitfield_2 & (1usize as u8)) >>
@@ -3722,7 +3597,7 @@ pub struct nsINode {
pub mNextSibling: *mut nsIContent,
pub mPreviousSibling: *mut nsIContent,
pub mFirstChild: *mut nsIContent,
- pub __bindgen_anon_1: nsINode__bindgen_ty_bindgen_id_106084,
+ pub __bindgen_anon_1: nsINode__bindgen_ty_bindgen_id_100426,
pub mSlots: *mut nsINode_nsSlots,
pub mServoData: ServoCell<*mut ServoNodeData>,
}
@@ -3747,7 +3622,7 @@ pub struct nsINode_COMTypeInfo<T, U> {
* Bit-flags to pass (or'ed together) to IsNodeOfType()
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsINode__bindgen_ty_bindgen_id_102222 {
+pub enum nsINode__bindgen_ty_bindgen_id_96564 {
eCONTENT = 1,
eDOCUMENT = 2,
eATTRIBUTE = 4,
@@ -3762,12 +3637,12 @@ pub enum nsINode__bindgen_ty_bindgen_id_102222 {
eFILTER = 2048,
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_102991 {
+pub struct bindgen_vtable__bindgen_id_97333 {
}
#[repr(C)]
#[derive(Debug)]
pub struct nsINode_nsSlots {
- pub vtable_: *const bindgen_vtable__bindgen_id_102991,
+ pub vtable_: *const bindgen_vtable__bindgen_id_97333,
/**
* A list of mutation observers
*/
@@ -3836,19 +3711,19 @@ pub enum nsINode_BooleanFlag {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsINode__bindgen_ty_bindgen_id_106084 {
+pub struct nsINode__bindgen_ty_bindgen_id_100426 {
pub mPrimaryFrame: __BindgenUnionField<*mut nsIFrame>,
pub mSubtreeRoot: __BindgenUnionField<*mut nsINode>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsINode__bindgen_ty_bindgen_id_106084() {
- assert_eq!(::std::mem::size_of::<nsINode__bindgen_ty_bindgen_id_106084>()
+fn bindgen_test_layout_nsINode__bindgen_ty_bindgen_id_100426() {
+ assert_eq!(::std::mem::size_of::<nsINode__bindgen_ty_bindgen_id_100426>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsINode__bindgen_ty_bindgen_id_106084>()
+ assert_eq!(::std::mem::align_of::<nsINode__bindgen_ty_bindgen_id_100426>()
, 8usize);
}
-impl Clone for nsINode__bindgen_ty_bindgen_id_106084 {
+impl Clone for nsINode__bindgen_ty_bindgen_id_100426 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -3947,49 +3822,6 @@ pub enum SheetType {
Unknown = 255,
}
/**
- * Smart pointer class that can hold a pointer to either a CSSStyleSheet
- * or a ServoStyleSheet.
- */
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct StyleSheetHandle {
- pub mPtr: StyleSheetHandle_Ptr,
-}
-pub type StyleSheetHandle_RefPtr = HandleRefPtr<StyleSheetHandle>;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct StyleSheetHandle_Ptr {
- pub mValue: usize,
-}
-#[test]
-fn bindgen_test_layout_StyleSheetHandle_Ptr() {
- assert_eq!(::std::mem::size_of::<StyleSheetHandle_Ptr>() , 8usize);
- assert_eq!(::std::mem::align_of::<StyleSheetHandle_Ptr>() , 8usize);
-}
-impl Clone for StyleSheetHandle_Ptr {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_StyleSheetHandle() {
- assert_eq!(::std::mem::size_of::<StyleSheetHandle>() , 8usize);
- assert_eq!(::std::mem::align_of::<StyleSheetHandle>() , 8usize);
-}
-impl Clone for StyleSheetHandle {
- fn clone(&self) -> Self { *self }
-}
-pub const ReferrerPolicy_RP_Default: ReferrerPolicy =
- ReferrerPolicy::RP_No_Referrer_When_Downgrade;
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum ReferrerPolicy {
- RP_No_Referrer = 1,
- RP_Origin = 2,
- RP_No_Referrer_When_Downgrade = 0,
- RP_Origin_When_Crossorigin = 3,
- RP_Unsafe_URL = 4,
- RP_Unset = 4294967295,
-}
-/**
* EventStates is the class used to represent the event states of nsIContent
* instances. These states are calculated by IntrinsicState() and
* ContentStatesChanged() has to be called when one of them changes thus
@@ -4132,6 +3964,26 @@ impl Clone for nsIVariant {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsIRunnable {
+ pub _base: nsISupports,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct nsIRunnable_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+#[test]
+fn bindgen_test_layout_nsIRunnable() {
+ assert_eq!(::std::mem::size_of::<nsIRunnable>() , 8usize);
+ assert_eq!(::std::mem::align_of::<nsIRunnable>() , 8usize);
+}
+impl Clone for nsIRunnable {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
#[derive(Debug)]
pub struct Runnable {
pub _base: nsIRunnable,
@@ -4178,7 +4030,7 @@ pub struct nsIDOMNode_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDOMNode__bindgen_ty_bindgen_id_114369 {
+pub enum nsIDOMNode__bindgen_ty_bindgen_id_108507 {
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
@@ -4194,7 +4046,7 @@ pub enum nsIDOMNode__bindgen_ty_bindgen_id_114369 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIDOMNode__bindgen_ty_bindgen_id_114588 {
+pub enum nsIDOMNode__bindgen_ty_bindgen_id_108726 {
DOCUMENT_POSITION_DISCONNECTED = 1,
DOCUMENT_POSITION_PRECEDING = 2,
DOCUMENT_POSITION_FOLLOWING = 4,
@@ -5035,7 +4887,8 @@ pub enum nsChangeHint {
nsChangeHint_UpdateComputedBSize = 16777216,
nsChangeHint_UpdateUsesOpacity = 33554432,
nsChangeHint_UpdateBackgroundPosition = 67108864,
- nsChangeHint_AllHints = 134217727,
+ nsChangeHint_AddOrRemoveTransform = 134217728,
+ nsChangeHint_AllHints = 268435455,
}
pub type nscolor = u32;
#[repr(u32)]
@@ -5046,6 +4899,242 @@ pub enum Side {
eSideBottom = 2,
eSideLeft = 3,
}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackFunction {
+ pub _base: CallbackObject,
+}
+#[test]
+fn bindgen_test_layout_CallbackFunction() {
+ assert_eq!(::std::mem::size_of::<CallbackFunction>() , 56usize);
+ assert_eq!(::std::mem::align_of::<CallbackFunction>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackObject {
+ pub _base: nsISupports,
+ pub mRefCnt: nsCycleCollectingAutoRefCnt,
+ pub _mOwningThread: nsAutoOwningThread,
+ pub mCallback: u64,
+ pub mCreationStack: u64,
+ pub mIncumbentGlobal: nsCOMPtr<nsIGlobalObject>,
+ pub mIncumbentJSGlobal: u64,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct CallbackObject_COMTypeInfo<T, U> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+ pub _phantom_1: ::std::marker::PhantomData<U>,
+}
+pub type CallbackObject_HasThreadSafeRefCnt = FalseType;
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct CallbackObject_cycleCollection {
+ pub _base: nsXPCOMCycleCollectionParticipant,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_cycleCollection() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_cycleCollection>() ,
+ 16usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_cycleCollection>() ,
+ 8usize);
+}
+impl Clone for CallbackObject_cycleCollection {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum CallbackObject_ExceptionHandling {
+ eReportExceptions = 0,
+ eRethrowContentExceptions = 1,
+ eRethrowExceptions = 2,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct CallbackObject_FastCallbackConstructor {
+ pub _address: u8,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_FastCallbackConstructor() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_FastCallbackConstructor>()
+ , 1usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_FastCallbackConstructor>()
+ , 1usize);
+}
+impl Clone for CallbackObject_FastCallbackConstructor {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct CallbackObject_CallSetup {
+ pub mCx: *mut JSContext,
+ pub mCompartment: *mut JSCompartment,
+ pub mAutoEntryScript: [u64; 19usize],
+ pub mAutoIncumbentScript: [u64; 5usize],
+ pub mRootedCallable: [u64; 4usize],
+ pub mAsyncStack: [u64; 4usize],
+ pub mAsyncStackSetter: [u64; 7usize],
+ pub mAc: [u64; 3usize],
+ pub mErrorResult: *mut ErrorResult,
+ pub mExceptionHandling: CallbackObject_ExceptionHandling,
+ pub mIsMainThread: bool,
+}
+#[test]
+fn bindgen_test_layout_CallbackObject_CallSetup() {
+ assert_eq!(::std::mem::size_of::<CallbackObject_CallSetup>() , 368usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject_CallSetup>() , 8usize);
+}
+extern "C" {
+ #[link_name = "_ZN7mozilla3dom14CallbackObject21_cycleCollectorGlobalE"]
+ pub static mut CallbackObject__cycleCollectorGlobal:
+ CallbackObject_cycleCollection;
+}
+#[test]
+fn bindgen_test_layout_CallbackObject() {
+ assert_eq!(::std::mem::size_of::<CallbackObject>() , 56usize);
+ assert_eq!(::std::mem::align_of::<CallbackObject>() , 8usize);
+}
+pub type PLDHashNumber = u32;
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable {
+ pub mOps: *const PLDHashTableOps,
+ pub mHashShift: i16,
+ pub mEntrySize: u32,
+ pub mEntryCount: u32,
+ pub mRemovedCount: u32,
+ pub mEntryStore: PLDHashTable_EntryStore,
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable_EntryStore {
+ pub mEntryStore: *mut ::std::os::raw::c_char,
+ pub mGeneration: u32,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable_EntryStore() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable_EntryStore>() , 16usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable_EntryStore>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug)]
+pub struct PLDHashTable_Iterator {
+ pub mTable: *mut PLDHashTable,
+ pub mStart: *mut ::std::os::raw::c_char,
+ pub mLimit: *mut ::std::os::raw::c_char,
+ pub mCurrent: *mut ::std::os::raw::c_char,
+ pub mNexts: u32,
+ pub mNextsLimit: u32,
+ pub mHaveRemoved: bool,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable_Iterator() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable_Iterator>() , 48usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable_Iterator>() , 8usize);
+}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum PLDHashTable_SearchReason { ForSearchOrRemove = 0, ForAdd = 1, }
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kMaxCapacityE"]
+ pub static PLDHashTable_kMaxCapacity: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kMinCapacityE"]
+ pub static PLDHashTable_kMinCapacity: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable17kMaxInitialLengthE"]
+ pub static PLDHashTable_kMaxInitialLength: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable21kDefaultInitialLengthE"]
+ pub static PLDHashTable_kDefaultInitialLength: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable9kHashBitsE"]
+ pub static PLDHashTable_kHashBits: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable12kGoldenRatioE"]
+ pub static PLDHashTable_kGoldenRatio: u32;
+}
+extern "C" {
+ #[link_name = "_ZN12PLDHashTable14kCollisionFlagE"]
+ pub static PLDHashTable_kCollisionFlag: PLDHashNumber;
+}
+#[test]
+fn bindgen_test_layout_PLDHashTable() {
+ assert_eq!(::std::mem::size_of::<PLDHashTable>() , 40usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize);
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct PLDHashTableOps {
+ pub hashKey: PLDHashHashKey,
+ pub matchEntry: PLDHashMatchEntry,
+ pub moveEntry: PLDHashMoveEntry,
+ pub clearEntry: PLDHashClearEntry,
+ pub initEntry: PLDHashInitEntry,
+}
+#[test]
+fn bindgen_test_layout_PLDHashTableOps() {
+ assert_eq!(::std::mem::size_of::<PLDHashTableOps>() , 40usize);
+ assert_eq!(::std::mem::align_of::<PLDHashTableOps>() , 8usize);
+}
+impl Clone for PLDHashTableOps {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct PLDHashEntryHdr {
+ pub mKeyHash: PLDHashNumber,
+}
+#[test]
+fn bindgen_test_layout_PLDHashEntryHdr() {
+ assert_eq!(::std::mem::size_of::<PLDHashEntryHdr>() , 4usize);
+ assert_eq!(::std::mem::align_of::<PLDHashEntryHdr>() , 4usize);
+}
+impl Clone for PLDHashEntryHdr {
+ fn clone(&self) -> Self { *self }
+}
+pub type PLDHashHashKey =
+ ::std::option::Option<unsafe extern "C" fn(aKey:
+ *const ::std::os::raw::c_void)
+ -> ::std::os::raw::c_uint>;
+pub type PLDHashMatchEntry =
+ ::std::option::Option<unsafe extern "C" fn(aEntry: *const PLDHashEntryHdr,
+ aKey:
+ *const ::std::os::raw::c_void)
+ -> bool>;
+pub type PLDHashMoveEntry =
+ ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
+ aFrom: *const PLDHashEntryHdr,
+ aTo: *mut PLDHashEntryHdr)>;
+pub type PLDHashClearEntry =
+ ::std::option::Option<unsafe extern "C" fn(aTable: *mut PLDHashTable,
+ aEntry: *mut PLDHashEntryHdr)>;
+pub type PLDHashInitEntry =
+ ::std::option::Option<unsafe extern "C" fn(aEntry: *mut PLDHashEntryHdr,
+ aKey:
+ *const ::std::os::raw::c_void)>;
+/**
+ * hashkey wrapper using T* KeyType
+ *
+ * @see nsTHashtable::EntryType for specification
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct nsPtrHashKey<T> {
+ pub _base: PLDHashEntryHdr,
+ pub mKey: *mut T,
+}
+pub type nsPtrHashKey_KeyType<T> = *mut T;
+pub type nsPtrHashKey_KeyTypePointer<T> = *mut T;
+#[repr(i32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum nsPtrHashKey__bindgen_ty_bindgen_id_113088 { ALLOW_MEMMOVE = 0, }
/**
* A node of content in a document's content model. This interface
* is supported by all content objects.
@@ -5065,14 +5154,14 @@ pub struct nsIContent_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIContent__bindgen_ty_bindgen_id_118479 {
+pub enum nsIContent__bindgen_ty_bindgen_id_114428 {
eAllChildren = 0,
eAllButXBL = 1,
eSkipPlaceholderContent = 2,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIContent__bindgen_ty_bindgen_id_118715 {
+pub enum nsIContent__bindgen_ty_bindgen_id_114664 {
ATTR_MISSING = -1,
ATTR_VALUE_NO_MATCH = -2,
}
@@ -5278,7 +5367,7 @@ pub struct FragmentOrElement_nsDOMSlots {
* @see FragmentOrElement::GetAttributes
*/
pub mAttributeMap: RefPtr<nsDOMAttributeMap>,
- pub __bindgen_anon_1: FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810,
+ pub __bindgen_anon_1: FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761,
/**
* An object implementing the .children property for this element.
*/
@@ -5315,7 +5404,7 @@ pub struct FragmentOrElement_nsDOMSlots {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810 {
+pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761 {
/**
* The nearest enclosing content node with a binding that created us.
* @see FragmentOrElement::GetBindingParent
@@ -5328,13 +5417,13 @@ pub struct FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810 {
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810() {
- assert_eq!(::std::mem::size_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810>()
+fn bindgen_test_layout_FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761() {
+ assert_eq!(::std::mem::size_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761>()
, 8usize);
- assert_eq!(::std::mem::align_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810>()
+ assert_eq!(::std::mem::align_of::<FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761>()
, 8usize);
}
-impl Clone for FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_119810 {
+impl Clone for FragmentOrElement_nsDOMSlots__bindgen_ty_bindgen_id_115761 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -5355,6 +5444,21 @@ fn bindgen_test_layout_FragmentOrElement() {
assert_eq!(::std::mem::size_of::<FragmentOrElement>() , 128usize);
assert_eq!(::std::mem::align_of::<FragmentOrElement>() , 8usize);
}
+pub const ReferrerPolicy_RP_Default: ReferrerPolicy =
+ ReferrerPolicy::RP_No_Referrer_When_Downgrade;
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum ReferrerPolicy {
+ RP_No_Referrer = 1,
+ RP_Origin = 2,
+ RP_No_Referrer_When_Downgrade = 0,
+ RP_Origin_When_Crossorigin = 3,
+ RP_Unsafe_URL = 4,
+ RP_Same_Origin = 5,
+ RP_Strict_Origin = 6,
+ RP_Strict_Origin_When_Cross_Origin = 7,
+ RP_Unset = 4294967295,
+}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsIWeakReference {
@@ -5385,91 +5489,13 @@ impl Clone for PrefSetting {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackObject {
- pub _base: nsISupports,
- pub mRefCnt: nsCycleCollectingAutoRefCnt,
- pub _mOwningThread: nsAutoOwningThread,
- pub mCallback: u64,
- pub mCreationStack: u64,
- pub mIncumbentGlobal: nsCOMPtr<nsIGlobalObject>,
- pub mIncumbentJSGlobal: u64,
-}
-#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct CallbackObject_COMTypeInfo<T, U> {
- pub _address: u8,
- pub _phantom_0: ::std::marker::PhantomData<T>,
- pub _phantom_1: ::std::marker::PhantomData<U>,
-}
-pub type CallbackObject_HasThreadSafeRefCnt = FalseType;
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct CallbackObject_cycleCollection {
- pub _base: nsXPCOMCycleCollectionParticipant,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_cycleCollection() {
- assert_eq!(::std::mem::size_of::<CallbackObject_cycleCollection>() ,
- 16usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_cycleCollection>() ,
- 8usize);
-}
-impl Clone for CallbackObject_cycleCollection {
- fn clone(&self) -> Self { *self }
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum CallbackObject_ExceptionHandling {
- eReportExceptions = 0,
- eRethrowContentExceptions = 1,
- eRethrowExceptions = 2,
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct CallbackObject_FastCallbackConstructor {
- pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_FastCallbackConstructor() {
- assert_eq!(::std::mem::size_of::<CallbackObject_FastCallbackConstructor>()
- , 1usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_FastCallbackConstructor>()
- , 1usize);
-}
-impl Clone for CallbackObject_FastCallbackConstructor {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackObject_CallSetup {
- pub mCx: *mut JSContext,
- pub mCompartment: *mut JSCompartment,
- pub mAutoEntryScript: [u64; 19usize],
- pub mAutoIncumbentScript: [u64; 5usize],
- pub mRootedCallable: [u64; 4usize],
- pub mAsyncStack: [u64; 4usize],
- pub mAsyncStackSetter: [u64; 7usize],
- pub mAc: [u64; 3usize],
- pub mErrorResult: *mut ErrorResult,
- pub mExceptionHandling: CallbackObject_ExceptionHandling,
- pub mIsMainThread: bool,
-}
-#[test]
-fn bindgen_test_layout_CallbackObject_CallSetup() {
- assert_eq!(::std::mem::size_of::<CallbackObject_CallSetup>() , 368usize);
- assert_eq!(::std::mem::align_of::<CallbackObject_CallSetup>() , 8usize);
-}
-extern "C" {
- #[link_name = "_ZN7mozilla3dom14CallbackObject21_cycleCollectorGlobalE"]
- pub static mut CallbackObject__cycleCollectorGlobal:
- CallbackObject_cycleCollection;
-}
-#[test]
-fn bindgen_test_layout_CallbackObject() {
- assert_eq!(::std::mem::size_of::<CallbackObject>() , 56usize);
- assert_eq!(::std::mem::align_of::<CallbackObject>() , 8usize);
+pub struct __bit_const_reference<_Cp> {
+ pub __seg_: __bit_const_reference___storage_pointer<_Cp>,
+ pub __mask_: __bit_const_reference___storage_type<_Cp>,
}
+pub type __bit_const_reference___storage_type<_Cp> = _Cp;
+pub type __bit_const_reference___storage_pointer<_Cp> = _Cp;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsIChannel {
@@ -5484,7 +5510,7 @@ pub struct nsIChannel_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIChannel__bindgen_ty_bindgen_id_131603 {
+pub enum nsIChannel__bindgen_ty_bindgen_id_132951 {
LOAD_DOCUMENT_URI = 65536,
LOAD_RETARGETED_DOCUMENT_URI = 131072,
LOAD_REPLACE = 262144,
@@ -5498,7 +5524,7 @@ pub enum nsIChannel__bindgen_ty_bindgen_id_131603 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIChannel__bindgen_ty_bindgen_id_131623 {
+pub enum nsIChannel__bindgen_ty_bindgen_id_132971 {
DISPOSITION_INLINE = 0,
DISPOSITION_ATTACHMENT = 1,
}
@@ -5524,7 +5550,7 @@ pub struct nsIRequest_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIRequest__bindgen_ty_bindgen_id_131441 {
+pub enum nsIRequest__bindgen_ty_bindgen_id_132789 {
LOAD_REQUESTMASK = 65535,
LOAD_NORMAL = 0,
LOAD_BACKGROUND = 1,
@@ -5652,16 +5678,24 @@ pub enum SheetParsingMode {
eAgentSheetFeatures = 2,
}
/**
- * A class for holding strong references to handle-managed objects.
- *
- * This is intended for use with objects like StyleSheetHandle, where
- * the handle type is not a pointer but which can still have ->AddRef()
- * and ->Release() called on it.
+ * Superclass for data common to CSSStyleSheet and ServoStyleSheet.
*/
#[repr(C)]
-#[derive(Debug)]
-pub struct HandleRefPtr<T> {
- pub mHandle: T,
+#[derive(Debug, Copy)]
+pub struct StyleSheet {
+ pub mDocument: *mut nsIDocument,
+ pub mOwningNode: *mut nsINode,
+ pub mParsingMode: SheetParsingMode,
+ pub mType: StyleBackendType,
+ pub mDisabled: bool,
+}
+#[test]
+fn bindgen_test_layout_StyleSheet() {
+ assert_eq!(::std::mem::size_of::<StyleSheet>() , 32usize);
+ assert_eq!(::std::mem::align_of::<StyleSheet>() , 8usize);
+}
+impl Clone for StyleSheet {
+ fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug)]
@@ -6077,13 +6111,13 @@ pub enum nsIPresShell_ReflowRootHandling {
eNoPositionOrSizeChange = 1,
eInferFromBitToAdd = 2,
}
-pub const SCROLL_LEFT: nsIPresShell__bindgen_ty_bindgen_id_149444 =
- nsIPresShell__bindgen_ty_bindgen_id_149444::SCROLL_TOP;
-pub const SCROLL_RIGHT: nsIPresShell__bindgen_ty_bindgen_id_149444 =
- nsIPresShell__bindgen_ty_bindgen_id_149444::SCROLL_BOTTOM;
+pub const SCROLL_LEFT: nsIPresShell__bindgen_ty_bindgen_id_151191 =
+ nsIPresShell__bindgen_ty_bindgen_id_151191::SCROLL_TOP;
+pub const SCROLL_RIGHT: nsIPresShell__bindgen_ty_bindgen_id_151191 =
+ nsIPresShell__bindgen_ty_bindgen_id_151191::SCROLL_BOTTOM;
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_149444 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_151191 {
SCROLL_TOP = 0,
SCROLL_BOTTOM = 100,
SCROLL_CENTER = 50,
@@ -6111,7 +6145,7 @@ impl Clone for nsIPresShell_ScrollAxis {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_149475 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_151222 {
SCROLL_FIRST_ANCESTOR_ONLY = 1,
SCROLL_OVERFLOW_HIDDEN = 2,
SCROLL_NO_PARENT_FRAMES = 4,
@@ -6158,7 +6192,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_149475 {
* transform.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_149843 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_151646 {
RENDER_IS_UNTRUSTED = 1,
RENDER_IGNORE_VIEWPORT_SCROLLING = 2,
RENDER_CARET = 4,
@@ -6169,7 +6203,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_149843 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_149861 {
+pub enum nsIPresShell__bindgen_ty_bindgen_id_151664 {
RENDER_IS_IMAGE = 256,
RENDER_AUTO_SCALE = 128,
}
@@ -6182,7 +6216,7 @@ pub enum nsIPresShell__bindgen_ty_bindgen_id_149861 {
* transparent by default.
*/
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsIPresShell__bindgen_ty_bindgen_id_149977 { FORCE_DRAW = 1, }
+pub enum nsIPresShell__bindgen_ty_bindgen_id_151780 { FORCE_DRAW = 1, }
#[repr(C)]
#[derive(Debug)]
pub struct nsIPresShell_PointerCaptureInfo {
@@ -6569,67 +6603,67 @@ pub struct DOMPointInit {
impl Clone for DOMPointInit {
fn clone(&self) -> Self { *self }
}
-pub const NODE_HAS_LISTENERMANAGER: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_LISTENERMANAGER;
-pub const NODE_HAS_PROPERTIES: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_PROPERTIES;
-pub const NODE_IS_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_ANONYMOUS_ROOT;
-pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
-pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_NATIVE_ANONYMOUS_ROOT;
-pub const NODE_FORCE_XBL_BINDINGS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_FORCE_XBL_BINDINGS;
-pub const NODE_MAY_BE_IN_BINDING_MNGR: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_MAY_BE_IN_BINDING_MNGR;
-pub const NODE_IS_EDITABLE: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_EDITABLE;
-pub const NODE_MAY_HAVE_CLASS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_MAY_HAVE_CLASS;
-pub const NODE_IS_IN_SHADOW_TREE: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_IN_SHADOW_TREE;
-pub const NODE_HAS_EMPTY_SELECTOR: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_EMPTY_SELECTOR;
-pub const NODE_HAS_SLOW_SELECTOR: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_SLOW_SELECTOR;
-pub const NODE_HAS_EDGE_CHILD_SELECTOR: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_EDGE_CHILD_SELECTOR;
-pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: _bindgen_ty_bindgen_id_151372
+pub const NODE_HAS_LISTENERMANAGER: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_LISTENERMANAGER;
+pub const NODE_HAS_PROPERTIES: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_PROPERTIES;
+pub const NODE_IS_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_ANONYMOUS_ROOT;
+pub const NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE;
+pub const NODE_IS_NATIVE_ANONYMOUS_ROOT: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_NATIVE_ANONYMOUS_ROOT;
+pub const NODE_FORCE_XBL_BINDINGS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_FORCE_XBL_BINDINGS;
+pub const NODE_MAY_BE_IN_BINDING_MNGR: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_MAY_BE_IN_BINDING_MNGR;
+pub const NODE_IS_EDITABLE: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_EDITABLE;
+pub const NODE_MAY_HAVE_CLASS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_MAY_HAVE_CLASS;
+pub const NODE_IS_IN_SHADOW_TREE: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_IN_SHADOW_TREE;
+pub const NODE_HAS_EMPTY_SELECTOR: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_EMPTY_SELECTOR;
+pub const NODE_HAS_SLOW_SELECTOR: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_SLOW_SELECTOR;
+pub const NODE_HAS_EDGE_CHILD_SELECTOR: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_EDGE_CHILD_SELECTOR;
+pub const NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS: _bindgen_ty_bindgen_id_153175
=
- _bindgen_ty_bindgen_id_151372::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS;
-pub const NODE_ALL_SELECTOR_FLAGS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_ALL_SELECTOR_FLAGS;
-pub const NODE_NEEDS_FRAME: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_NEEDS_FRAME;
-pub const NODE_DESCENDANTS_NEED_FRAMES: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_DESCENDANTS_NEED_FRAMES;
-pub const NODE_HAS_ACCESSKEY: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_ACCESSKEY;
-pub const NODE_HAS_DIRECTION_RTL: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_DIRECTION_RTL;
-pub const NODE_HAS_DIRECTION_LTR: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_HAS_DIRECTION_LTR;
-pub const NODE_ALL_DIRECTION_FLAGS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_ALL_DIRECTION_FLAGS;
-pub const NODE_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_CHROME_ONLY_ACCESS;
-pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS;
-pub const NODE_SHARED_RESTYLE_BIT_1: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_SHARED_RESTYLE_BIT_1;
-pub const NODE_SHARED_RESTYLE_BIT_2: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_SHARED_RESTYLE_BIT_2;
-pub const NODE_IS_DIRTY_FOR_SERVO: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_SHARED_RESTYLE_BIT_1;
-pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: _bindgen_ty_bindgen_id_151372
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS;
+pub const NODE_ALL_SELECTOR_FLAGS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_ALL_SELECTOR_FLAGS;
+pub const NODE_NEEDS_FRAME: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_NEEDS_FRAME;
+pub const NODE_DESCENDANTS_NEED_FRAMES: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_DESCENDANTS_NEED_FRAMES;
+pub const NODE_HAS_ACCESSKEY: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_ACCESSKEY;
+pub const NODE_HAS_DIRECTION_RTL: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_DIRECTION_RTL;
+pub const NODE_HAS_DIRECTION_LTR: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_HAS_DIRECTION_LTR;
+pub const NODE_ALL_DIRECTION_FLAGS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_ALL_DIRECTION_FLAGS;
+pub const NODE_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_CHROME_ONLY_ACCESS;
+pub const NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS;
+pub const NODE_SHARED_RESTYLE_BIT_1: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_SHARED_RESTYLE_BIT_1;
+pub const NODE_SHARED_RESTYLE_BIT_2: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_SHARED_RESTYLE_BIT_2;
+pub const NODE_IS_DIRTY_FOR_SERVO: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_SHARED_RESTYLE_BIT_1;
+pub const NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO: _bindgen_ty_bindgen_id_153175
=
- _bindgen_ty_bindgen_id_151372::NODE_SHARED_RESTYLE_BIT_2;
-pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: _bindgen_ty_bindgen_id_151372 =
- _bindgen_ty_bindgen_id_151372::NODE_TYPE_SPECIFIC_BITS_OFFSET;
+ _bindgen_ty_bindgen_id_153175::NODE_SHARED_RESTYLE_BIT_2;
+pub const NODE_TYPE_SPECIFIC_BITS_OFFSET: _bindgen_ty_bindgen_id_153175 =
+ _bindgen_ty_bindgen_id_153175::NODE_TYPE_SPECIFIC_BITS_OFFSET;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum _bindgen_ty_bindgen_id_151372 {
+pub enum _bindgen_ty_bindgen_id_153175 {
NODE_HAS_LISTENERMANAGER = 4,
NODE_HAS_PROPERTIES = 8,
NODE_IS_ANONYMOUS_ROOT = 16,
@@ -6687,7 +6721,7 @@ pub struct nsITimer_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsITimer__bindgen_ty_bindgen_id_168085 {
+pub enum nsITimer__bindgen_ty_bindgen_id_169936 {
TYPE_ONE_SHOT = 0,
TYPE_REPEATING_SLACK = 1,
TYPE_REPEATING_PRECISE = 2,
@@ -6713,7 +6747,7 @@ pub struct nsExpirationState {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsExpirationState__bindgen_ty_bindgen_id_168561 {
+pub enum nsExpirationState__bindgen_ty_bindgen_id_170412 {
NOT_TRACKED = 15,
MAX_INDEX_IN_GENERATION = 268435455,
}
@@ -6787,7 +6821,7 @@ pub struct imgIRequest_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgIRequest__bindgen_ty_bindgen_id_169153 {
+pub enum imgIRequest__bindgen_ty_bindgen_id_170996 {
STATUS_NONE = 0,
STATUS_SIZE_AVAILABLE = 1,
STATUS_LOAD_COMPLETE = 2,
@@ -6799,7 +6833,7 @@ pub enum imgIRequest__bindgen_ty_bindgen_id_169153 {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgIRequest__bindgen_ty_bindgen_id_169233 {
+pub enum imgIRequest__bindgen_ty_bindgen_id_171076 {
CORS_NONE = 1,
CORS_ANONYMOUS = 2,
CORS_USE_CREDENTIALS = 3,
@@ -7012,16 +7046,6 @@ fn bindgen_test_layout_FrameRequestCallback() {
assert_eq!(::std::mem::align_of::<FrameRequestCallback>() , 8usize);
}
#[repr(C)]
-#[derive(Debug)]
-pub struct CallbackFunction {
- pub _base: CallbackObject,
-}
-#[test]
-fn bindgen_test_layout_CallbackFunction() {
- assert_eq!(::std::mem::size_of::<CallbackFunction>() , 56usize);
- assert_eq!(::std::mem::align_of::<CallbackFunction>() , 8usize);
-}
-#[repr(C)]
#[derive(Debug, Copy)]
pub struct FullscreenRequest {
pub _address: u8,
@@ -7308,7 +7332,7 @@ pub type nsPresArena_FreeList_KeyType = u32;
pub type nsPresArena_FreeList_KeyTypePointer = *const ::std::os::raw::c_void;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsPresArena_FreeList__bindgen_ty_bindgen_id_181711 {
+pub enum nsPresArena_FreeList__bindgen_ty_bindgen_id_191458 {
ALLOW_MEMMOVE = 0,
}
#[test]
@@ -7335,7 +7359,7 @@ pub struct imgINotificationObserver_COMTypeInfo<T, U> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum imgINotificationObserver__bindgen_ty_bindgen_id_181858 {
+pub enum imgINotificationObserver__bindgen_ty_bindgen_id_191605 {
SIZE_AVAILABLE = 1,
FRAME_UPDATE = 2,
FRAME_COMPLETE = 3,
@@ -7584,7 +7608,7 @@ pub type gfxFontFeatureValueSet_FeatureValueHashEntry_KeyTypePointer =
*const gfxFontFeatureValueSet_FeatureValueHashKey;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum gfxFontFeatureValueSet_FeatureValueHashEntry__bindgen_ty_bindgen_id_183096
+pub enum gfxFontFeatureValueSet_FeatureValueHashEntry__bindgen_ty_bindgen_id_192843
{
ALLOW_MEMMOVE = 1,
}
@@ -7980,23 +8004,23 @@ pub enum nsStyleUnit {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct _bindgen_ty_bindgen_id_183849 {
+pub struct _bindgen_ty_bindgen_id_193590 {
pub mInt: __BindgenUnionField<i32>,
pub mFloat: __BindgenUnionField<f32>,
pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout__bindgen_ty_bindgen_id_183849() {
- assert_eq!(::std::mem::size_of::<_bindgen_ty_bindgen_id_183849>() ,
+fn bindgen_test_layout__bindgen_ty_bindgen_id_193590() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_bindgen_id_193590>() ,
8usize);
- assert_eq!(::std::mem::align_of::<_bindgen_ty_bindgen_id_183849>() ,
+ assert_eq!(::std::mem::align_of::<_bindgen_ty_bindgen_id_193590>() ,
8usize);
}
-impl Clone for _bindgen_ty_bindgen_id_183849 {
+impl Clone for _bindgen_ty_bindgen_id_193590 {
fn clone(&self) -> Self { *self }
}
-pub type nsStyleUnion = _bindgen_ty_bindgen_id_183849;
+pub type nsStyleUnion = _bindgen_ty_bindgen_id_193590;
/**
* Class that hold a single size specification used by the style
* system. The size specification consists of two parts -- a number
@@ -8188,6 +8212,18 @@ fn bindgen_test_layout_nsStyleDisplay() {
assert_eq!(::std::mem::size_of::<nsStyleDisplay>() , 424usize);
assert_eq!(::std::mem::align_of::<nsStyleDisplay>() , 8usize);
}
+/**
+ * A class for holding strong references to handle-managed objects.
+ *
+ * This is intended for use with objects like RestyleManagerHandle,
+ * where the handle type is not a pointer but which can still have
+ * ->AddRef() and ->Release() called on it.
+ */
+#[repr(C)]
+#[derive(Debug)]
+pub struct HandleRefPtr<T> {
+ pub mHandle: T,
+}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsILanguageAtomService {
@@ -9042,7 +9078,7 @@ fn bindgen_test_layout_imgRequestProxy() {
assert_eq!(::std::mem::align_of::<imgRequestProxy>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_193205 {
+pub struct bindgen_vtable__bindgen_id_202634 {
}
/**
* An interface for observing changes to image state, as reported by
@@ -9059,7 +9095,7 @@ pub struct bindgen_vtable__bindgen_id_193205 {
#[repr(C)]
#[derive(Debug)]
pub struct IProgressObserver {
- pub vtable_: *const bindgen_vtable__bindgen_id_193205,
+ pub vtable_: *const bindgen_vtable__bindgen_id_202634,
pub _base: u64,
}
#[test]
@@ -9081,7 +9117,7 @@ pub struct nsISupportsPriority_COMTypeInfo<T, U> {
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsISupportsPriority__bindgen_ty_bindgen_id_193281 {
+pub enum nsISupportsPriority__bindgen_ty_bindgen_id_202710 {
PRIORITY_HIGHEST = -20,
PRIORITY_HIGH = -10,
PRIORITY_NORMAL = 0,
@@ -9516,7 +9552,7 @@ fn bindgen_test_layout_nsCSSValueFloatColor() {
#[derive(Debug)]
pub struct nsCSSValue {
pub mUnit: nsCSSUnit,
- pub mValue: nsCSSValue__bindgen_ty_bindgen_id_196276,
+ pub mValue: nsCSSValue__bindgen_ty_bindgen_id_205705,
}
#[repr(C)]
#[derive(Debug)]
@@ -9532,7 +9568,7 @@ fn bindgen_test_layout_nsCSSValue_Array() {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsCSSValue__bindgen_ty_bindgen_id_196276 {
+pub struct nsCSSValue__bindgen_ty_bindgen_id_205705 {
pub mInt: __BindgenUnionField<i32>,
pub mFloat: __BindgenUnionField<f32>,
pub mString: __BindgenUnionField<*mut nsStringBuffer>,
@@ -9557,13 +9593,13 @@ pub struct nsCSSValue__bindgen_ty_bindgen_id_196276 {
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsCSSValue__bindgen_ty_bindgen_id_196276() {
- assert_eq!(::std::mem::size_of::<nsCSSValue__bindgen_ty_bindgen_id_196276>()
+fn bindgen_test_layout_nsCSSValue__bindgen_ty_bindgen_id_205705() {
+ assert_eq!(::std::mem::size_of::<nsCSSValue__bindgen_ty_bindgen_id_205705>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsCSSValue__bindgen_ty_bindgen_id_196276>()
+ assert_eq!(::std::mem::align_of::<nsCSSValue__bindgen_ty_bindgen_id_205705>()
, 8usize);
}
-impl Clone for nsCSSValue__bindgen_ty_bindgen_id_196276 {
+impl Clone for nsCSSValue__bindgen_ty_bindgen_id_205705 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -9584,12 +9620,12 @@ fn bindgen_test_layout_nsCSSValueGradientStop() {
assert_eq!(::std::mem::align_of::<nsCSSValueGradientStop>() , 8usize);
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_196484 {
+pub struct bindgen_vtable__bindgen_id_205913 {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct CounterStyle {
- pub vtable_: *const bindgen_vtable__bindgen_id_196484,
+ pub vtable_: *const bindgen_vtable__bindgen_id_205913,
pub mStyle: i32,
}
#[test]
@@ -9789,25 +9825,25 @@ pub struct nsStyleImage {
pub mCachedBIData: UniquePtr<CachedBorderImageData,
DefaultDelete<CachedBorderImageData>>,
pub mType: nsStyleImageType,
- pub __bindgen_anon_1: nsStyleImage__bindgen_ty_bindgen_id_198452,
+ pub __bindgen_anon_1: nsStyleImage__bindgen_ty_bindgen_id_207881,
pub mCropRect: UniquePtr<nsStyleSides, DefaultDelete<nsStyleSides>>,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleImage__bindgen_ty_bindgen_id_198452 {
+pub struct nsStyleImage__bindgen_ty_bindgen_id_207881 {
pub mImage: __BindgenUnionField<*mut imgRequestProxy>,
pub mGradient: __BindgenUnionField<*mut nsStyleGradient>,
pub mElementId: __BindgenUnionField<*mut u16>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleImage__bindgen_ty_bindgen_id_198452() {
- assert_eq!(::std::mem::size_of::<nsStyleImage__bindgen_ty_bindgen_id_198452>()
+fn bindgen_test_layout_nsStyleImage__bindgen_ty_bindgen_id_207881() {
+ assert_eq!(::std::mem::size_of::<nsStyleImage__bindgen_ty_bindgen_id_207881>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleImage__bindgen_ty_bindgen_id_198452>()
+ assert_eq!(::std::mem::align_of::<nsStyleImage__bindgen_ty_bindgen_id_207881>()
, 8usize);
}
-impl Clone for nsStyleImage__bindgen_ty_bindgen_id_198452 {
+impl Clone for nsStyleImage__bindgen_ty_bindgen_id_207881 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -9858,7 +9894,7 @@ pub struct nsStyleImageLayers {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsStyleImageLayers__bindgen_ty_bindgen_id_198505 {
+pub enum nsStyleImageLayers__bindgen_ty_bindgen_id_207934 {
shorthand = 0,
color = 1,
image = 2,
@@ -10048,15 +10084,51 @@ pub struct nsStyleBorder {
pub mBorderImageRepeatV: u8,
pub mFloatEdge: StyleFloatEdge,
pub mBoxDecorationBreak: StyleBoxDecorationBreak,
+ pub mBorderStyle: [u8; 4usize],
+ pub __bindgen_anon_1: nsStyleBorder__bindgen_ty_bindgen_id_208608,
pub mComputedBorder: nsMargin,
pub mBorder: nsMargin,
- pub mBorderStyle: [u8; 4usize],
- pub mBorderColor: [nscolor; 4usize],
pub mTwipsPerPixel: nscoord,
}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsStyleBorder__bindgen_ty_bindgen_id_208608 {
+ pub __bindgen_anon_1: __BindgenUnionField<nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609>,
+ pub mBorderColor: __BindgenUnionField<[StyleComplexColor; 4usize]>,
+ pub bindgen_union_field: [u32; 8usize],
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609 {
+ pub mBorderTopColor: StyleComplexColor,
+ pub mBorderRightColor: StyleComplexColor,
+ pub mBorderBottomColor: StyleComplexColor,
+ pub mBorderLeftColor: StyleComplexColor,
+}
+#[test]
+fn bindgen_test_layout_nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609() {
+ assert_eq!(::std::mem::size_of::<nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609>()
+ , 32usize);
+ assert_eq!(::std::mem::align_of::<nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609>()
+ , 4usize);
+}
+impl Clone for
+ nsStyleBorder__bindgen_ty_bindgen_id_208608__bindgen_ty_bindgen_id_208609 {
+ fn clone(&self) -> Self { *self }
+}
+#[test]
+fn bindgen_test_layout_nsStyleBorder__bindgen_ty_bindgen_id_208608() {
+ assert_eq!(::std::mem::size_of::<nsStyleBorder__bindgen_ty_bindgen_id_208608>()
+ , 32usize);
+ assert_eq!(::std::mem::align_of::<nsStyleBorder__bindgen_ty_bindgen_id_208608>()
+ , 4usize);
+}
+impl Clone for nsStyleBorder__bindgen_ty_bindgen_id_208608 {
+ fn clone(&self) -> Self { *self }
+}
#[test]
fn bindgen_test_layout_nsStyleBorder() {
- assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 296usize);
+ assert_eq!(::std::mem::size_of::<nsStyleBorder>() , 312usize);
assert_eq!(::std::mem::align_of::<nsStyleBorder>() , 8usize);
}
#[repr(C)]
@@ -10065,9 +10137,9 @@ pub struct nsStyleOutline {
pub mOutlineRadius: nsStyleCorners,
pub mOutlineWidth: nsStyleCoord,
pub mOutlineOffset: nscoord,
- pub mActualOutlineWidth: nscoord,
- pub mOutlineColor: nscolor,
+ pub mOutlineColor: StyleComplexColor,
pub mOutlineStyle: u8,
+ pub mActualOutlineWidth: nscoord,
pub mTwipsPerPixel: nscoord,
}
#[test]
@@ -10253,11 +10325,11 @@ fn bindgen_test_layout_nsStyleTextOverflow() {
pub struct nsStyleTextReset {
pub mTextOverflow: nsStyleTextOverflow,
pub mTextDecorationLine: u8,
+ pub mTextDecorationStyle: u8,
pub mUnicodeBidi: u8,
pub mInitialLetterSink: nscoord,
pub mInitialLetterSize: f32,
- pub mTextDecorationStyle: u8,
- pub mTextDecorationColor: nscolor,
+ pub mTextDecorationColor: StyleComplexColor,
}
#[test]
fn bindgen_test_layout_nsStyleTextReset() {
@@ -10358,7 +10430,7 @@ impl Clone for nsStyleImageOrientation {
#[derive(Debug, Copy)]
pub struct nsTimingFunction {
pub mType: nsTimingFunction_Type,
- pub __bindgen_anon_1: nsTimingFunction__bindgen_ty_bindgen_id_200258,
+ pub __bindgen_anon_1: nsTimingFunction__bindgen_ty_bindgen_id_209586,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -10377,56 +10449,56 @@ pub enum nsTimingFunction_Type {
pub enum nsTimingFunction_Keyword { Implicit = 0, Explicit = 1, }
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_200258 {
- pub mFunc: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259>,
- pub __bindgen_anon_1: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270>,
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_209586 {
+ pub mFunc: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587>,
+ pub __bindgen_anon_1: __BindgenUnionField<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598>,
pub bindgen_union_field: [u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259 {
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587 {
pub mX1: f32,
pub mY1: f32,
pub mX2: f32,
pub mY2: f32,
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587>()
, 16usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587>()
, 4usize);
}
impl Clone for
- nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200259
+ nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209587
{
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270 {
+pub struct nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598 {
pub mSteps: u32,
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598>()
, 4usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598>()
, 4usize);
}
impl Clone for
- nsTimingFunction__bindgen_ty_bindgen_id_200258__bindgen_ty_bindgen_id_200270
+ nsTimingFunction__bindgen_ty_bindgen_id_209586__bindgen_ty_bindgen_id_209598
{
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_200258() {
- assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258>()
+fn bindgen_test_layout_nsTimingFunction__bindgen_ty_bindgen_id_209586() {
+ assert_eq!(::std::mem::size_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586>()
, 16usize);
- assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_200258>()
+ assert_eq!(::std::mem::align_of::<nsTimingFunction__bindgen_ty_bindgen_id_209586>()
, 4usize);
}
-impl Clone for nsTimingFunction__bindgen_ty_bindgen_id_200258 {
+impl Clone for nsTimingFunction__bindgen_ty_bindgen_id_209586 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10487,13 +10559,13 @@ fn bindgen_test_layout_StyleBasicShape() {
#[repr(C)]
#[derive(Debug)]
pub struct StyleShapeSource<ReferenceBox> {
- pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_bindgen_id_200641<ReferenceBox>,
+ pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_bindgen_id_209969<ReferenceBox>,
pub mType: StyleShapeSourceType,
pub mReferenceBox: ReferenceBox,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct StyleShapeSource__bindgen_ty_bindgen_id_200641<ReferenceBox> {
+pub struct StyleShapeSource__bindgen_ty_bindgen_id_209969<ReferenceBox> {
pub mBasicShape: __BindgenUnionField<*mut StyleBasicShape>,
pub mURL: __BindgenUnionField<*mut FragmentOrURL>,
pub bindgen_union_field: u64,
@@ -10545,24 +10617,24 @@ pub enum nsStyleContentType {
#[derive(Debug)]
pub struct nsStyleContentData {
pub mType: nsStyleContentType,
- pub mContent: nsStyleContentData__bindgen_ty_bindgen_id_200725,
+ pub mContent: nsStyleContentData__bindgen_ty_bindgen_id_210053,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleContentData__bindgen_ty_bindgen_id_200725 {
+pub struct nsStyleContentData__bindgen_ty_bindgen_id_210053 {
pub mString: __BindgenUnionField<*mut u16>,
pub mImage: __BindgenUnionField<*mut imgRequestProxy>,
pub mCounters: __BindgenUnionField<*mut nsCSSValue_Array>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleContentData__bindgen_ty_bindgen_id_200725() {
- assert_eq!(::std::mem::size_of::<nsStyleContentData__bindgen_ty_bindgen_id_200725>()
+fn bindgen_test_layout_nsStyleContentData__bindgen_ty_bindgen_id_210053() {
+ assert_eq!(::std::mem::size_of::<nsStyleContentData__bindgen_ty_bindgen_id_210053>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleContentData__bindgen_ty_bindgen_id_200725>()
+ assert_eq!(::std::mem::align_of::<nsStyleContentData__bindgen_ty_bindgen_id_210053>()
, 8usize);
}
-impl Clone for nsStyleContentData__bindgen_ty_bindgen_id_200725 {
+impl Clone for nsStyleContentData__bindgen_ty_bindgen_id_210053 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10629,12 +10701,11 @@ pub struct nsStyleUserInterface {
pub mUserFocus: StyleUserFocus,
pub mPointerEvents: u8,
pub mCursor: u8,
- pub mCursorArrayLength: u32,
- pub mCursorArray: *mut nsCursorImage,
+ pub mCursorImages: nsTArray<nsCursorImage>,
}
#[test]
fn bindgen_test_layout_nsStyleUserInterface() {
- assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 24usize);
+ assert_eq!(::std::mem::size_of::<nsStyleUserInterface>() , 16usize);
assert_eq!(::std::mem::align_of::<nsStyleUserInterface>() , 8usize);
}
#[repr(C)]
@@ -10659,10 +10730,9 @@ pub struct nsStyleColumn {
pub mColumnCount: u32,
pub mColumnWidth: nsStyleCoord,
pub mColumnGap: nsStyleCoord,
- pub mColumnRuleColor: nscolor,
+ pub mColumnRuleColor: StyleComplexColor,
pub mColumnRuleStyle: u8,
pub mColumnFill: u8,
- pub mColumnRuleColorIsForeground: bool,
pub mColumnRuleWidth: nscoord,
pub mTwipsPerPixel: nscoord,
}
@@ -10672,7 +10742,7 @@ extern "C" {
}
#[test]
fn bindgen_test_layout_nsStyleColumn() {
- assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 56usize);
+ assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 64usize);
assert_eq!(::std::mem::align_of::<nsStyleColumn>() , 8usize);
}
#[repr(u32)]
@@ -10687,25 +10757,25 @@ pub enum nsStyleSVGPaintType {
#[repr(C)]
#[derive(Debug)]
pub struct nsStyleSVGPaint {
- pub mPaint: nsStyleSVGPaint__bindgen_ty_bindgen_id_201122,
+ pub mPaint: nsStyleSVGPaint__bindgen_ty_bindgen_id_210438,
pub mType: nsStyleSVGPaintType,
pub mFallbackColor: nscolor,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleSVGPaint__bindgen_ty_bindgen_id_201122 {
+pub struct nsStyleSVGPaint__bindgen_ty_bindgen_id_210438 {
pub mColor: __BindgenUnionField<nscolor>,
pub mPaintServer: __BindgenUnionField<*mut FragmentOrURL>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleSVGPaint__bindgen_ty_bindgen_id_201122() {
- assert_eq!(::std::mem::size_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_201122>()
+fn bindgen_test_layout_nsStyleSVGPaint__bindgen_ty_bindgen_id_210438() {
+ assert_eq!(::std::mem::size_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_210438>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_201122>()
+ assert_eq!(::std::mem::align_of::<nsStyleSVGPaint__bindgen_ty_bindgen_id_210438>()
, 8usize);
}
-impl Clone for nsStyleSVGPaint__bindgen_ty_bindgen_id_201122 {
+impl Clone for nsStyleSVGPaint__bindgen_ty_bindgen_id_210438 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -10740,7 +10810,7 @@ pub struct nsStyleSVG {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum nsStyleSVG__bindgen_ty_bindgen_id_201299 {
+pub enum nsStyleSVG__bindgen_ty_bindgen_id_210615 {
FILL_OPACITY_SOURCE_MASK = 3,
STROKE_OPACITY_SOURCE_MASK = 12,
STROKE_DASHARRAY_CONTEXT = 16,
@@ -10759,23 +10829,23 @@ fn bindgen_test_layout_nsStyleSVG() {
pub struct nsStyleFilter {
pub mType: i32,
pub mFilterParameter: nsStyleCoord,
- pub __bindgen_anon_1: nsStyleFilter__bindgen_ty_bindgen_id_201365,
+ pub __bindgen_anon_1: nsStyleFilter__bindgen_ty_bindgen_id_210681,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct nsStyleFilter__bindgen_ty_bindgen_id_201365 {
+pub struct nsStyleFilter__bindgen_ty_bindgen_id_210681 {
pub mURL: __BindgenUnionField<*mut FragmentOrURL>,
pub mDropShadow: __BindgenUnionField<*mut nsCSSShadowArray>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout_nsStyleFilter__bindgen_ty_bindgen_id_201365() {
- assert_eq!(::std::mem::size_of::<nsStyleFilter__bindgen_ty_bindgen_id_201365>()
+fn bindgen_test_layout_nsStyleFilter__bindgen_ty_bindgen_id_210681() {
+ assert_eq!(::std::mem::size_of::<nsStyleFilter__bindgen_ty_bindgen_id_210681>()
, 8usize);
- assert_eq!(::std::mem::align_of::<nsStyleFilter__bindgen_ty_bindgen_id_201365>()
+ assert_eq!(::std::mem::align_of::<nsStyleFilter__bindgen_ty_bindgen_id_210681>()
, 8usize);
}
-impl Clone for nsStyleFilter__bindgen_ty_bindgen_id_201365 {
+impl Clone for nsStyleFilter__bindgen_ty_bindgen_id_210681 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/components/style/gecko_bindings/sugar/mod.rs b/components/style/gecko_bindings/sugar/mod.rs
index a451d67a06d..eb4460c63bc 100644
--- a/components/style/gecko_bindings/sugar/mod.rs
+++ b/components/style/gecko_bindings/sugar/mod.rs
@@ -2,8 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+mod ns_com_ptr;
mod ns_css_shadow_array;
mod ns_style_auto_array;
pub mod ns_style_coord;
mod ns_t_array;
pub mod ownership;
+mod style_complex_color;
diff --git a/components/style/gecko_bindings/sugar/ns_com_ptr.rs b/components/style/gecko_bindings/sugar/ns_com_ptr.rs
new file mode 100644
index 00000000000..a7056320a5a
--- /dev/null
+++ b/components/style/gecko_bindings/sugar/ns_com_ptr.rs
@@ -0,0 +1,18 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use gecko_bindings::structs::nsCOMPtr;
+
+impl<T> nsCOMPtr<T> {
+ #[cfg(debug_assertions)]
+ #[inline]
+ pub fn raw(&self) -> *mut T {
+ self.mRawPtr
+ }
+
+ #[cfg(not(debug_assertions))]
+ #[inline]
+ pub fn raw(&self) -> *mut T {
+ self._base.mRawPtr as *mut _
+ }
+}
diff --git a/components/style/gecko_bindings/sugar/ns_t_array.rs b/components/style/gecko_bindings/sugar/ns_t_array.rs
index 901638d1b1f..c7b824a11dc 100644
--- a/components/style/gecko_bindings/sugar/ns_t_array.rs
+++ b/components/style/gecko_bindings/sugar/ns_t_array.rs
@@ -6,7 +6,6 @@ use gecko_bindings::bindings;
use gecko_bindings::structs::{nsTArray, nsTArrayHeader};
use std::mem;
use std::ops::{Deref, DerefMut};
-use std::os::raw::c_void;
use std::slice;
impl<T> Deref for nsTArray<T> {
diff --git a/components/style/gecko_bindings/sugar/style_complex_color.rs b/components/style/gecko_bindings/sugar/style_complex_color.rs
new file mode 100644
index 00000000000..288d395b1ac
--- /dev/null
+++ b/components/style/gecko_bindings/sugar/style_complex_color.rs
@@ -0,0 +1,47 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use cssparser::Color;
+use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
+use gecko_bindings::structs::{nscolor, StyleComplexColor};
+
+impl From<nscolor> for StyleComplexColor {
+ fn from(other: nscolor) -> Self {
+ StyleComplexColor {
+ mColor: other,
+ mForegroundRatio: 0,
+ }
+ }
+}
+
+impl StyleComplexColor {
+ pub fn current_color() -> Self {
+ StyleComplexColor {
+ mColor: 0,
+ mForegroundRatio: 255,
+ }
+ }
+}
+
+impl From<Color> for StyleComplexColor {
+ fn from(other: Color) -> Self {
+ match other {
+ Color::RGBA(rgba) => convert_rgba_to_nscolor(&rgba).into(),
+ Color::CurrentColor => StyleComplexColor::current_color(),
+ }
+ }
+}
+
+impl From<StyleComplexColor> for Color {
+ fn from(other: StyleComplexColor) -> Self {
+ if other.mForegroundRatio == 0 {
+ Color::RGBA(convert_nscolor_to_rgba(other.mColor))
+ } else if other.mForegroundRatio == 255 {
+ Color::CurrentColor
+ } else {
+ // FIXME #13546 handle interpolation values
+ Color::CurrentColor
+ }
+ }
+}
diff --git a/components/style/gecko_string_cache/atom_macro.rs b/components/style/gecko_string_cache/atom_macro.rs
index 4d4d6378fe1..98297a6b63b 100644
--- a/components/style/gecko_string_cache/atom_macro.rs
+++ b/components/style/gecko_string_cache/atom_macro.rs
@@ -3,21 +3,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Autogenerated file, DO NOT EDIT DIRECTLY */
-use gecko_bindings::structs::nsIAtom;
+use gecko_bindings::structs::nsIAtom;
use string_cache::Atom;
pub enum nsICSSPseudoElement {}
pub enum nsICSSAnonBoxPseudo {}
-
- #[inline(always)] pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {
- unsafe { Atom::from_static(ptr) }
- }
+#[inline(always)]
+pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {
+ unsafe { Atom::from_static(ptr) }
+}
- cfg_if! {
+cfg_if! {
if #[cfg(not(target_env = "msvc"))] {
extern {
#[link_name = "_ZN9nsGkAtoms6_emptyE"]
@@ -1726,6 +1726,8 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_onpopuphidden: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms13onpopuphidingE"]
pub static nsGkAtoms_onpopuphiding: *mut nsIAtom;
+ #[link_name = "_ZN9nsGkAtoms17onpopuppositionedE"]
+ pub static nsGkAtoms_onpopuppositioned: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms14onpopupshowingE"]
pub static nsGkAtoms_onpopupshowing: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms12onpopupshownE"]
@@ -4316,10 +4318,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms28scrollbar_thumb_proportionalE"]
pub static nsGkAtoms_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "_ZN9nsGkAtoms15images_in_menusE"]
- pub static nsGkAtoms_images_in_menus: *mut nsIAtom;
- #[link_name = "_ZN9nsGkAtoms17images_in_buttonsE"]
- pub static nsGkAtoms_images_in_buttons: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms18overlay_scrollbarsE"]
pub static nsGkAtoms_overlay_scrollbars: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms21windows_default_themeE"]
@@ -4370,10 +4368,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms__moz_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms33_moz_scrollbar_thumb_proportionalE"]
pub static nsGkAtoms__moz_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "_ZN9nsGkAtoms20_moz_images_in_menusE"]
- pub static nsGkAtoms__moz_images_in_menus: *mut nsIAtom;
- #[link_name = "_ZN9nsGkAtoms22_moz_images_in_buttonsE"]
- pub static nsGkAtoms__moz_images_in_buttons: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms23_moz_overlay_scrollbarsE"]
pub static nsGkAtoms__moz_overlay_scrollbars: *mut nsIAtom;
#[link_name = "_ZN9nsGkAtoms26_moz_windows_default_themeE"]
@@ -6647,6 +6641,8 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_onpopuphidden: *mut nsIAtom;
#[link_name = "?onpopuphiding@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onpopuphiding: *mut nsIAtom;
+ #[link_name = "?onpopuppositioned@nsGkAtoms@@2PEAVnsIAtom@@EA"]
+ pub static nsGkAtoms_onpopuppositioned: *mut nsIAtom;
#[link_name = "?onpopupshowing@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_onpopupshowing: *mut nsIAtom;
#[link_name = "?onpopupshown@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@@ -9237,10 +9233,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "?scrollbar_thumb_proportional@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "?images_in_menus@nsGkAtoms@@2PEAVnsIAtom@@EA"]
- pub static nsGkAtoms_images_in_menus: *mut nsIAtom;
- #[link_name = "?images_in_buttons@nsGkAtoms@@2PEAVnsIAtom@@EA"]
- pub static nsGkAtoms_images_in_buttons: *mut nsIAtom;
#[link_name = "?overlay_scrollbars@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms_overlay_scrollbars: *mut nsIAtom;
#[link_name = "?windows_default_theme@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@@ -9291,10 +9283,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms__moz_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "?_moz_scrollbar_thumb_proportional@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms__moz_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "?_moz_images_in_menus@nsGkAtoms@@2PEAVnsIAtom@@EA"]
- pub static nsGkAtoms__moz_images_in_menus: *mut nsIAtom;
- #[link_name = "?_moz_images_in_buttons@nsGkAtoms@@2PEAVnsIAtom@@EA"]
- pub static nsGkAtoms__moz_images_in_buttons: *mut nsIAtom;
#[link_name = "?_moz_overlay_scrollbars@nsGkAtoms@@2PEAVnsIAtom@@EA"]
pub static nsGkAtoms__moz_overlay_scrollbars: *mut nsIAtom;
#[link_name = "?_moz_windows_default_theme@nsGkAtoms@@2PEAVnsIAtom@@EA"]
@@ -11568,6 +11556,8 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_onpopuphidden: *mut nsIAtom;
#[link_name = "\x01?onpopuphiding@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onpopuphiding: *mut nsIAtom;
+ #[link_name = "\x01?onpopuppositioned@nsGkAtoms@@2PAVnsIAtom@@A"]
+ pub static nsGkAtoms_onpopuppositioned: *mut nsIAtom;
#[link_name = "\x01?onpopupshowing@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_onpopupshowing: *mut nsIAtom;
#[link_name = "\x01?onpopupshown@nsGkAtoms@@2PAVnsIAtom@@A"]
@@ -14158,10 +14148,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "\x01?scrollbar_thumb_proportional@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "\x01?images_in_menus@nsGkAtoms@@2PAVnsIAtom@@A"]
- pub static nsGkAtoms_images_in_menus: *mut nsIAtom;
- #[link_name = "\x01?images_in_buttons@nsGkAtoms@@2PAVnsIAtom@@A"]
- pub static nsGkAtoms_images_in_buttons: *mut nsIAtom;
#[link_name = "\x01?overlay_scrollbars@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms_overlay_scrollbars: *mut nsIAtom;
#[link_name = "\x01?windows_default_theme@nsGkAtoms@@2PAVnsIAtom@@A"]
@@ -14212,10 +14198,6 @@ pub enum nsICSSAnonBoxPseudo {}
pub static nsGkAtoms__moz_scrollbar_end_forward: *mut nsIAtom;
#[link_name = "\x01?_moz_scrollbar_thumb_proportional@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms__moz_scrollbar_thumb_proportional: *mut nsIAtom;
- #[link_name = "\x01?_moz_images_in_menus@nsGkAtoms@@2PAVnsIAtom@@A"]
- pub static nsGkAtoms__moz_images_in_menus: *mut nsIAtom;
- #[link_name = "\x01?_moz_images_in_buttons@nsGkAtoms@@2PAVnsIAtom@@A"]
- pub static nsGkAtoms__moz_images_in_buttons: *mut nsIAtom;
#[link_name = "\x01?_moz_overlay_scrollbars@nsGkAtoms@@2PAVnsIAtom@@A"]
pub static nsGkAtoms__moz_overlay_scrollbars: *mut nsIAtom;
#[link_name = "\x01?_moz_windows_default_theme@nsGkAtoms@@2PAVnsIAtom@@A"]
@@ -15639,6 +15621,7 @@ macro_rules! atom {
("onpointerlockerror") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpointerlockerror as *mut _) };
("onpopuphidden") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpopuphidden as *mut _) };
("onpopuphiding") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpopuphiding as *mut _) };
+("onpopuppositioned") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpopuppositioned as *mut _) };
("onpopupshowing") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpopupshowing as *mut _) };
("onpopupshown") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onpopupshown as *mut _) };
("onposter") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_onposter as *mut _) };
@@ -16934,8 +16917,6 @@ macro_rules! atom {
("scrollbar-end-backward") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_scrollbar_end_backward as *mut _) };
("scrollbar-end-forward") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_scrollbar_end_forward as *mut _) };
("scrollbar-thumb-proportional") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_scrollbar_thumb_proportional as *mut _) };
-("images-in-menus") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_images_in_menus as *mut _) };
-("images-in-buttons") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_images_in_buttons as *mut _) };
("overlay-scrollbars") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_overlay_scrollbars as *mut _) };
("windows-default-theme") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_windows_default_theme as *mut _) };
("mac-graphite-theme") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_mac_graphite_theme as *mut _) };
@@ -16961,8 +16942,6 @@ macro_rules! atom {
("-moz-scrollbar-end-backward") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_scrollbar_end_backward as *mut _) };
("-moz-scrollbar-end-forward") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_scrollbar_end_forward as *mut _) };
("-moz-scrollbar-thumb-proportional") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_scrollbar_thumb_proportional as *mut _) };
-("-moz-images-in-menus") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_images_in_menus as *mut _) };
-("-moz-images-in-buttons") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_images_in_buttons as *mut _) };
("-moz-overlay-scrollbars") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_overlay_scrollbars as *mut _) };
("-moz-windows-default-theme") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_windows_default_theme as *mut _) };
("-moz-mac-graphite-theme") => { $crate::string_cache::atom_macro::unsafe_atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_mac_graphite_theme as *mut _) };
diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs
index 0bcd58f9bc6..baecd440a0f 100644
--- a/components/style/gecko_string_cache/mod.rs
+++ b/components/style/gecko_string_cache/mod.rs
@@ -22,7 +22,7 @@ use std::ops::Deref;
use std::slice;
#[macro_use]
-#[allow(improper_ctypes, safe_extern_statics)]
+#[allow(improper_ctypes, non_camel_case_types)]
pub mod atom_macro;
#[macro_use]
pub mod namespace;
diff --git a/components/style/lib.rs b/components/style/lib.rs
index 157aee86a67..51ee0e122e5 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -61,6 +61,7 @@ extern crate num_integer;
extern crate num_traits;
#[cfg(feature = "gecko")] extern crate num_cpus;
extern crate ordered_float;
+extern crate parking_lot;
extern crate quickersort;
extern crate rand;
extern crate rustc_serialize;
@@ -80,6 +81,7 @@ extern crate util;
#[macro_use] pub mod string_cache;
pub mod animation;
+pub mod atomic_refcell;
pub mod attr;
pub mod bezier;
pub mod cache;
diff --git a/components/style/matching.rs b/components/style/matching.rs
index 8a9a12eaa72..24e67352fbe 100644
--- a/components/style/matching.rs
+++ b/components/style/matching.rs
@@ -11,7 +11,7 @@ use arc_ptr_eq;
use cache::{LRUCache, SimpleHashCache};
use cascade_info::CascadeInfo;
use context::{SharedStyleContext, StyleContext};
-use data::PrivateStyleData;
+use data::PersistentStyleData;
use dom::{NodeInfo, TElement, TNode, TRestyleDamage, UnsafeNode};
use properties::{ComputedValues, PropertyDeclarationBlock, cascade};
use properties::longhands::display::computed_value as display;
@@ -874,19 +874,9 @@ pub trait MatchMethods : TNode {
-> RestyleResult
where Ctx: StyleContext<'a>
{
- // Get our parent's style. This must be unsafe so that we don't touch the parent's
- // borrow flags.
- //
- // FIXME(pcwalton): Isolate this unsafety into the `wrapper` module to allow
- // enforced safe, race-free access to the parent style.
- let parent_style = match parent {
- Some(parent_node) => {
- let parent_style = (*parent_node.borrow_data_unchecked().unwrap()).style.as_ref().unwrap();
- Some(parent_style)
- }
- None => None,
- };
-
+ // Get our parent's style.
+ let parent_node_data = parent.as_ref().and_then(|x| x.borrow_data());
+ let parent_style = parent_node_data.as_ref().map(|x| x.style.as_ref().unwrap());
// In the case we're styling a text node, we don't need to compute the
// restyle damage, since it's a subset of the restyle damage of the
@@ -945,7 +935,7 @@ pub trait MatchMethods : TNode {
fn compute_damage_and_cascade_pseudos<'a, Ctx>(&self,
final_style: Arc<ComputedValues>,
- data: &mut PrivateStyleData,
+ data: &mut PersistentStyleData,
context: &Ctx,
applicable_declarations: &ApplicableDeclarations,
mut applicable_declarations_cache: &mut ApplicableDeclarationsCache)
diff --git a/components/style/parallel.rs b/components/style/parallel.rs
index ba904866710..b6ae6d49d66 100644
--- a/components/style/parallel.rs
+++ b/components/style/parallel.rs
@@ -161,9 +161,7 @@ fn bottom_up_dom<N, C>(root: OpaqueNode,
Some(parent) => parent,
};
- let parent_data = unsafe {
- &*parent.borrow_data_unchecked().unwrap()
- };
+ let parent_data = parent.borrow_data().unwrap();
if parent_data
.parallel
diff --git a/components/style/properties/data.py b/components/style/properties/data.py
index 1d2902ace70..2c9990ed7bc 100644
--- a/components/style/properties/data.py
+++ b/components/style/properties/data.py
@@ -185,9 +185,9 @@ class PropertiesData(object):
def active_style_structs(self):
return [s for s in self.style_structs if s.additional_methods or s.longhands]
- def declare_longhand(self, name, products="gecko servo", **kwargs):
+ def declare_longhand(self, name, products="gecko servo", disable_when_testing=False, **kwargs):
products = products.split()
- if self.product not in products and not self.testing:
+ if self.product not in products and not (self.testing and not disable_when_testing):
return
longhand = Longhand(self.current_style_struct, name, **kwargs)
@@ -200,9 +200,10 @@ class PropertiesData(object):
return longhand
- def declare_shorthand(self, name, sub_properties, products="gecko servo", *args, **kwargs):
+ def declare_shorthand(self, name, sub_properties, products="gecko servo",
+ disable_when_testing=False, *args, **kwargs):
products = products.split()
- if self.product not in products and not self.testing:
+ if self.product not in products and not (self.testing and not disable_when_testing):
return
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index f4a507dfb7a..99f6c0cdda3 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -195,20 +195,20 @@ pub struct ${style_struct.gecko_struct_name} {
</%def>
<%!
-def is_border_style_masked(ffi_name):
- return ffi_name.split("[")[0] in ["mBorderStyle", "mOutlineStyle", "mTextDecorationStyle"]
-
-def get_gecko_property(ffi_name):
- if is_border_style_masked(ffi_name):
- return "(self.gecko.%s & (structs::BORDER_STYLE_MASK as u8))" % ffi_name
- return "self.gecko.%s" % ffi_name
+def get_gecko_property(ffi_name, self_param = "self"):
+ if "mBorderColor" in ffi_name:
+ return ffi_name.replace("mBorderColor",
+ "unsafe { *%s.gecko.__bindgen_anon_1.mBorderColor.as_ref() }"
+ % self_param)
+ return "%s.gecko.%s" % (self_param, ffi_name)
def set_gecko_property(ffi_name, expr):
- if is_border_style_masked(ffi_name):
- return "self.gecko.%s &= !(structs::BORDER_STYLE_MASK as u8);" % ffi_name + \
- "self.gecko.%s |= %s as u8;" % (ffi_name, expr)
- elif ffi_name == "__LIST_STYLE_TYPE__":
+ if ffi_name == "__LIST_STYLE_TYPE__":
return "unsafe { Gecko_SetListStyleType(&mut self.gecko, %s as u32); }" % expr
+ if "mBorderColor" in ffi_name:
+ ffi_name = ffi_name.replace("mBorderColor",
+ "*self.gecko.__bindgen_anon_1.mBorderColor.as_mut()")
+ return "unsafe { %s = %s };" % (ffi_name, expr)
return "self.gecko.%s = %s;" % (ffi_name, expr)
%>
@@ -240,71 +240,41 @@ def set_gecko_property(ffi_name, expr):
}
</%def>
-<%def name="clear_color_flags(color_flags_ffi_name)">
- % if color_flags_ffi_name:
- self.gecko.${color_flags_ffi_name} &= !(structs::BORDER_COLOR_SPECIAL as u8);
- % endif
-</%def>
-
-<%def name="set_current_color_flag(color_flags_ffi_name)">
- % if color_flags_ffi_name:
- self.gecko.${color_flags_ffi_name} |= structs::BORDER_COLOR_FOREGROUND as u8;
- % else:
- // FIXME(heycam): This is a Gecko property that doesn't store currentColor
- // as a computed value. These are currently handled by converting
- // currentColor to the current value of the color property at computed
- // value time, but we don't have access to the Color struct here.
- // In the longer term, Gecko should store currentColor as a computed
- // value, so that we don't need to do this:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=760345
- warn!("stylo: mishandling currentColor");
- % endif
-</%def>
-
-<%def name="get_current_color_flag_from(field)">
- (${field} & (structs::BORDER_COLOR_FOREGROUND as u8)) != 0
-</%def>
-
-<%def name="impl_color_setter(ident, gecko_ffi_name, color_flags_ffi_name=None)">
+<%def name="impl_color_setter(ident, gecko_ffi_name, complex_color=True)">
#[allow(unreachable_code)]
#[allow(non_snake_case)]
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
- use cssparser::Color;
- ${clear_color_flags(color_flags_ffi_name)}
- let result = match v {
- Color::CurrentColor => {
- ${set_current_color_flag(color_flags_ffi_name)}
- 0
- },
- Color::RGBA(rgba) => convert_rgba_to_nscolor(&rgba),
- };
+ % if complex_color:
+ let result = v.into();
+ % else:
+ use cssparser::Color;
+ let result = match v {
+ Color::RGBA(rgba) => convert_rgba_to_nscolor(&rgba),
+ // FIXME #13547
+ Color::CurrentColor => 0,
+ };
+ % endif
${set_gecko_property(gecko_ffi_name, "result")}
}
</%def>
-<%def name="impl_color_copy(ident, gecko_ffi_name, color_flags_ffi_name=None)">
+<%def name="impl_color_copy(ident, gecko_ffi_name, complex_color=True)">
#[allow(non_snake_case)]
pub fn copy_${ident}_from(&mut self, other: &Self) {
- % if color_flags_ffi_name:
- ${clear_color_flags(color_flags_ffi_name)}
- if ${get_current_color_flag_from("other.gecko." + color_flags_ffi_name)} {
- ${set_current_color_flag(color_flags_ffi_name)}
- }
- % endif
- self.gecko.${gecko_ffi_name} = other.gecko.${gecko_ffi_name}
+ let color = ${get_gecko_property(gecko_ffi_name, self_param = "other")};
+ ${set_gecko_property(gecko_ffi_name, "color")};
}
</%def>
-<%def name="impl_color_clone(ident, gecko_ffi_name, color_flags_ffi_name=None)">
+<%def name="impl_color_clone(ident, gecko_ffi_name, complex_color=True)">
#[allow(non_snake_case)]
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
- use cssparser::Color;
- % if color_flags_ffi_name:
- if ${get_current_color_flag_from("self.gecko." + color_flags_ffi_name)} {
- return Color::CurrentColor
- }
+ % if complex_color:
+ ${get_gecko_property(gecko_ffi_name)}.into()
+ % else:
+ use cssparser::Color;
+ Color::RGBA(convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)}))
% endif
- Color::RGBA(convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)}))
}
</%def>
@@ -324,11 +294,11 @@ def set_gecko_property(ffi_name, expr):
% endif
</%def>
-<%def name="impl_color(ident, gecko_ffi_name, color_flags_ffi_name=None, need_clone=False)">
-<%call expr="impl_color_setter(ident, gecko_ffi_name, color_flags_ffi_name)"></%call>
-<%call expr="impl_color_copy(ident, gecko_ffi_name, color_flags_ffi_name)"></%call>
+<%def name="impl_color(ident, gecko_ffi_name, need_clone=False, complex_color=True)">
+<%call expr="impl_color_setter(ident, gecko_ffi_name, complex_color)"></%call>
+<%call expr="impl_color_copy(ident, gecko_ffi_name, complex_color)"></%call>
% if need_clone:
- <%call expr="impl_color_clone(ident, gecko_ffi_name, color_flags_ffi_name)"></%call>
+ <%call expr="impl_color_clone(ident, gecko_ffi_name, complex_color)"></%call>
% endif
</%def>
@@ -645,8 +615,7 @@ fn static_assert() {
<% impl_keyword("border_%s_style" % side.ident, "mBorderStyle[%s]" % side.index, border_style_keyword,
need_clone=True) %>
- <% impl_color("border_%s_color" % side.ident, "mBorderColor[%s]" % side.index,
- color_flags_ffi_name="mBorderStyle[%s]" % side.index, need_clone=True) %>
+ <% impl_color("border_%s_color" % side.ident, "(mBorderColor)[%s]" % side.index, need_clone=True) %>
<% impl_app_units("border_%s_width" % side.ident, "mComputedBorder.%s" % side.ident, need_clone=True,
round_to_pixels=True) %>
@@ -752,7 +721,7 @@ fn static_assert() {
<% impl_keyword("outline_style", "mOutlineStyle", border_style_keyword, need_clone=True) %>
- <% impl_color("outline_color", "mOutlineColor", color_flags_ffi_name="mOutlineStyle", need_clone=True) %>
+ <% impl_color("outline_color", "mOutlineColor", need_clone=True) %>
<% impl_app_units("outline_width", "mActualOutlineWidth", need_clone=True,
round_to_pixels=True) %>
@@ -1118,7 +1087,6 @@ fn static_assert() {
use gecko_bindings::structs::nsStyleImageLayers_Size_DimensionType;
use gecko_bindings::structs::{nsStyleCoord_CalcValue, nsStyleImageLayers_Size};
use properties::longhands::background_size::single_value::computed_value::T;
- use values::computed::LengthOrPercentageOrAuto;
let mut width = nsStyleCoord_CalcValue::new();
let mut height = nsStyleCoord_CalcValue::new();
@@ -1366,7 +1334,7 @@ fn static_assert() {
skip_longhands="${skip_background_longhands}"
skip_additionals="*">
- <% impl_color("background_color", "mBackgroundColor", need_clone=True) %>
+ <% impl_color("background_color", "mBackgroundColor", need_clone=True, complex_color=False) %>
<% impl_common_image_layer_properties("background") %>
@@ -1443,8 +1411,24 @@ fn static_assert() {
</%self:impl_trait>
+<%self:impl_trait style_struct_name="InheritedTable"
+ skip_longhands="border-spacing">
+
+ pub fn set_border_spacing(&mut self, v: longhands::border_spacing::computed_value::T) {
+ self.gecko.mBorderSpacingCol = v.horizontal.0;
+ self.gecko.mBorderSpacingRow = v.vertical.0;
+ }
+
+ pub fn copy_border_spacing_from(&mut self, other: &Self) {
+ self.gecko.mBorderSpacingCol = other.gecko.mBorderSpacingCol;
+ self.gecko.mBorderSpacingRow = other.gecko.mBorderSpacingRow;
+ }
+
+</%self:impl_trait>
+
+
<%self:impl_trait style_struct_name="InheritedText"
- skip_longhands="text-align text-shadow line-height word-spacing">
+ skip_longhands="text-align text-shadow line-height letter-spacing word-spacing">
<% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left " +
"-moz-right match-parent") %>
@@ -1523,6 +1507,15 @@ fn static_assert() {
<%call expr="impl_coord_copy('line_height', 'mLineHeight')"></%call>
+ pub fn set_letter_spacing(&mut self, v: longhands::letter_spacing::computed_value::T) {
+ match v.0 {
+ Some(au) => self.gecko.mLetterSpacing.set_value(CoordDataValue::Coord(au.0)),
+ None => self.gecko.mLetterSpacing.set_value(CoordDataValue::Normal)
+ }
+ }
+
+ <%call expr="impl_coord_copy('letter_spacing', 'mLetterSpacing')"></%call>
+
pub fn set_word_spacing(&mut self, v: longhands::word_spacing::computed_value::T) {
use values::computed::LengthOrPercentage::*;
@@ -1545,8 +1538,7 @@ fn static_assert() {
skip_longhands="text-decoration-color text-decoration-line"
skip_additionals="*">
- ${impl_color("text_decoration_color", "mTextDecorationColor",
- color_flags_ffi_name="mTextDecorationStyle", need_clone=True)}
+ ${impl_color("text_decoration_color", "mTextDecorationColor", need_clone=True)}
pub fn set_text_decoration_line(&mut self, v: longhands::text_decoration_line::computed_value::T) {
let mut bits: u8 = 0;
@@ -1590,11 +1582,11 @@ clip-path
skip_longhands="${skip_svg_longhands}"
skip_additionals="*">
- <% impl_color("flood_color", "mFloodColor") %>
+ <% impl_color("flood_color", "mFloodColor", complex_color=False) %>
- <% impl_color("lighting_color", "mLightingColor") %>
+ <% impl_color("lighting_color", "mLightingColor", complex_color=False) %>
- <% impl_color("stop_color", "mStopColor") %>
+ <% impl_color("stop_color", "mStopColor", complex_color=False) %>
<% impl_common_image_layer_properties("mask") %>
diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs
index 3c3f5e9ae9f..becbe5ee300 100644
--- a/components/style/properties/longhand/box.mako.rs
+++ b/components/style/properties/longhand/box.mako.rs
@@ -920,7 +920,7 @@ ${helpers.single_keyword("-moz-appearance",
animatable=False)}
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding
-<%helpers:longhand name="-moz-binding" products="gecko" animatable="False">
+<%helpers:longhand name="-moz-binding" products="gecko" animatable="False" disable_when_testing="True">
use cssparser::{CssStringWriter, ToCss};
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
use std::fmt::{self, Write};
diff --git a/components/style/properties/longhand/inherited_table.mako.rs b/components/style/properties/longhand/inherited_table.mako.rs
index e72533bb7b3..18e6bd76e93 100644
--- a/components/style/properties/longhand/inherited_table.mako.rs
+++ b/components/style/properties/longhand/inherited_table.mako.rs
@@ -16,7 +16,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
extra_gecko_values="right left top-outside bottom-outside",
animatable=False)}
-<%helpers:longhand name="border-spacing" products="servo" animatable="False">
+<%helpers:longhand name="border-spacing" animatable="False">
use app_units::Au;
use values::LocalToCss;
use values::HasViewportPercentage;
diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs
index b2f856059bb..4536b89d050 100644
--- a/components/style/properties/longhand/inherited_text.mako.rs
+++ b/components/style/properties/longhand/inherited_text.mako.rs
@@ -208,7 +208,7 @@
</%helpers:longhand>
// FIXME: This prop should be animatable.
-<%helpers:longhand name="letter-spacing" products="servo" animatable="False">
+<%helpers:longhand name="letter-spacing" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;
@@ -385,8 +385,7 @@ ${helpers.single_keyword("overflow-wrap",
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
${helpers.single_keyword("word-break",
- "normal break-all",
- extra_gecko_values="keep-all",
+ "normal break-all keep-all",
gecko_constant_prefix="NS_STYLE_WORDBREAK",
animatable=False)}
diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs
index 2d0321ad7e0..cc9aadf4e02 100644
--- a/components/style/properties/longhand/svg.mako.rs
+++ b/components/style/properties/longhand/svg.mako.rs
@@ -94,10 +94,9 @@ ${helpers.single_keyword("mask-repeat",
<%helpers:longhand name="mask-position" products="gecko" animatable="True">
use properties::longhands::background_position;
- pub mod computed_value {
- pub type T = ::properties::longhands::background_position::computed_value::T;
- }
- pub type SpecifiedValue = background_position::SpecifiedValue;
+ pub use ::properties::longhands::background_position::SpecifiedValue;
+ pub use ::properties::longhands::background_position::single_value as single_value;
+ pub use ::properties::longhands::background_position::computed_value as computed_value;
#[inline]
pub fn get_initial_value() -> computed_value::T {
@@ -127,10 +126,9 @@ ${helpers.single_keyword("mask-origin",
<%helpers:longhand name="mask-size" products="gecko" animatable="True">
use properties::longhands::background_size;
- pub mod computed_value {
- pub type T = ::properties::longhands::background_size::computed_value::T;
- }
- pub type SpecifiedValue = background_size::SpecifiedValue;
+ pub use ::properties::longhands::background_size::SpecifiedValue;
+ pub use ::properties::longhands::background_size::single_value as single_value;
+ pub use ::properties::longhands::background_size::computed_value as computed_value;
#[inline]
pub fn get_initial_value() -> computed_value::T {
diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs
index 2a886999ef0..bb65836915a 100644
--- a/components/style/properties/longhand/text.mako.rs
+++ b/components/style/properties/longhand/text.mako.rs
@@ -21,7 +21,8 @@ ${helpers.single_keyword("unicode-bidi",
// FIXME: This prop should be animatable.
<%helpers:longhand name="${'text-decoration' if product == 'servo' else 'text-decoration-line'}"
custom_cascade="${product == 'servo'}"
- animatable="False">
+ animatable="False"
+ disable_when_testing="True">
use cssparser::ToCss;
use std::fmt;
use values::computed::ComputedValueAsSpecified;
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index e891b051ee3..e55d3d1c06d 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -130,6 +130,7 @@ pub mod shorthands {
<%include file="/shorthand/inherited_text.mako.rs" />
<%include file="/shorthand/list.mako.rs" />
<%include file="/shorthand/margin.mako.rs" />
+ <%include file="/shorthand/mask.mako.rs" />
<%include file="/shorthand/outline.mako.rs" />
<%include file="/shorthand/padding.mako.rs" />
<%include file="/shorthand/position.mako.rs" />
diff --git a/components/style/properties/shorthand/background.mako.rs b/components/style/properties/shorthand/background.mako.rs
index f507af9ec56..2537a71c29f 100644
--- a/components/style/properties/shorthand/background.mako.rs
+++ b/components/style/properties/shorthand/background.mako.rs
@@ -11,6 +11,20 @@
use properties::longhands::{background_color, background_position, background_repeat, background_attachment};
use properties::longhands::{background_image, background_size, background_origin, background_clip};
+ impl From<background_origin::single_value::SpecifiedValue> for background_clip::single_value::SpecifiedValue {
+ fn from(origin: background_origin::single_value::SpecifiedValue) ->
+ background_clip::single_value::SpecifiedValue {
+ match origin {
+ background_origin::single_value::SpecifiedValue::content_box =>
+ background_clip::single_value::SpecifiedValue::content_box,
+ background_origin::single_value::SpecifiedValue::padding_box =>
+ background_clip::single_value::SpecifiedValue::padding_box,
+ background_origin::single_value::SpecifiedValue::border_box =>
+ background_clip::single_value::SpecifiedValue::border_box,
+ }
+ }
+ }
+
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
let mut background_color = None;
@@ -56,6 +70,11 @@
% endfor
break
}
+ if clip.is_none() {
+ if let Some(origin) = origin {
+ clip = Some(background_clip::single_value::SpecifiedValue::from(origin));
+ }
+ }
let mut any = false;
% for name in "image position repeat size attachment origin clip".split():
any = any || ${name}.is_some();
@@ -199,14 +218,6 @@
}
}
},
- (Some(origin), _) => {
- try!(write!(dest, " "));
- try!(origin.to_css(dest));
- },
- (_, Some(clip)) => {
- try!(write!(dest, " "));
- try!(clip.to_css(dest));
- },
_ => {}
};
}
diff --git a/components/style/properties/shorthand/mask.mako.rs b/components/style/properties/shorthand/mask.mako.rs
new file mode 100644
index 00000000000..67e1386f6d6
--- /dev/null
+++ b/components/style/properties/shorthand/mask.mako.rs
@@ -0,0 +1,205 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+<%namespace name="helpers" file="/helpers.mako.rs" />
+
+<%helpers:shorthand name="mask" products="gecko"
+ sub_properties="mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position
+ mask-size mask-image">
+ use properties::longhands::{mask_mode, mask_repeat, mask_clip, mask_origin, mask_composite, mask_position};
+ use properties::longhands::{mask_size, mask_image};
+
+ impl From<mask_origin::single_value::SpecifiedValue> for mask_clip::single_value::SpecifiedValue {
+ fn from(origin: mask_origin::single_value::SpecifiedValue) -> mask_clip::single_value::SpecifiedValue {
+ match origin {
+ mask_origin::single_value::SpecifiedValue::content_box =>
+ mask_clip::single_value::SpecifiedValue::content_box,
+ mask_origin::single_value::SpecifiedValue::padding_box =>
+ mask_clip::single_value::SpecifiedValue::padding_box,
+ mask_origin::single_value::SpecifiedValue::border_box =>
+ mask_clip::single_value::SpecifiedValue::border_box,
+ }
+ }
+ }
+
+ pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
+ % for name in "image mode position size repeat origin clip composite".split():
+ let mut mask_${name} = mask_${name}::SpecifiedValue(Vec::new());
+ % endfor
+
+ try!(input.parse_comma_separated(|input| {
+ % for name in "image mode position size repeat origin clip composite".split():
+ let mut ${name} = None;
+ % endfor
+ loop {
+ if image.is_none() {
+ if let Ok(value) = input.try(|input| mask_image::single_value
+ ::parse(context, input)) {
+ image = Some(value);
+
+ // Parse mask mode, if applicable.
+ mode = input.try(|input| mask_mode::single_value::parse(context, input)).ok();
+
+ continue
+ }
+ }
+ if position.is_none() {
+ if let Ok(value) = input.try(|input| mask_position::single_value
+ ::parse(context, input)) {
+ position = Some(value);
+
+ // Parse mask size, if applicable.
+ size = input.try(|input| {
+ try!(input.expect_delim('/'));
+ mask_size::single_value::parse(context, input)
+ }).ok();
+
+ continue
+ }
+ }
+ % for name in "repeat origin clip composite".split():
+ if ${name}.is_none() {
+ if let Ok(value) = input.try(|input| mask_${name}::single_value
+ ::parse(context, input)) {
+ ${name} = Some(value);
+ continue
+ }
+ }
+ % endfor
+ break
+ }
+ if clip.is_none() {
+ if let Some(origin) = origin {
+ clip = Some(mask_clip::single_value::SpecifiedValue::from(origin));
+ }
+ }
+ let mut any = false;
+ % for name in "image mode position size repeat origin clip composite".split():
+ any = any || ${name}.is_some();
+ % endfor
+ if any {
+ % for name in "image mode position size repeat origin clip composite".split():
+ if let Some(m_${name}) = ${name} {
+ mask_${name}.0.push(m_${name});
+ } else {
+ mask_${name}.0.push(mask_${name}::single_value
+ ::get_initial_specified_value());
+ }
+ % endfor
+ Ok(())
+ } else {
+ Err(())
+ }
+ }));
+
+ Ok(Longhands {
+ % for name in "image mode position size repeat origin clip composite".split():
+ mask_${name}: Some(mask_${name}),
+ % endfor
+ })
+ }
+
+ impl<'a> LonghandsToSerialize<'a> {
+ fn to_css_declared<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
+ // mako doesn't like ampersands following `<`
+ fn extract_value<T>(x: &DeclaredValue<T>) -> Option< &T> {
+ match *x {
+ DeclaredValue::Value(ref val) => Some(val),
+ _ => None,
+ }
+ }
+ use std::cmp;
+ let mut len = 0;
+ % for name in "image mode position size repeat origin clip composite".split():
+ len = cmp::max(len, extract_value(self.mask_${name}).map(|i| i.0.len())
+ .unwrap_or(0));
+ % endfor
+
+ // There should be at least one declared value
+ if len == 0 {
+ return dest.write_str("")
+ }
+
+ for i in 0..len {
+ % for name in "image mode position size repeat origin clip composite".split():
+ let ${name} = if let DeclaredValue::Value(ref arr) = *self.mask_${name} {
+ arr.0.get(i % arr.0.len())
+ } else {
+ None
+ };
+ % endfor
+
+ if let Some(image) = image {
+ try!(image.to_css(dest));
+ } else {
+ try!(write!(dest, "none"));
+ }
+
+ try!(write!(dest, " "));
+
+ if let Some(mode) = mode {
+ try!(mode.to_css(dest));
+ } else {
+ try!(write!(dest, "match-source"));
+ }
+
+ try!(write!(dest, " "));
+
+ try!(position.unwrap_or(&mask_position::single_value
+ ::get_initial_specified_value())
+ .to_css(dest));
+
+ if let Some(size) = size {
+ try!(write!(dest, " / "));
+ try!(size.to_css(dest));
+ }
+
+ try!(write!(dest, " "));
+
+ if let Some(repeat) = repeat {
+ try!(repeat.to_css(dest));
+ } else {
+ try!(write!(dest, "repeat"));
+ }
+
+ match (origin, clip) {
+ (Some(origin), Some(clip)) => {
+ use properties::longhands::mask_origin::single_value::computed_value::T as Origin;
+ use properties::longhands::mask_clip::single_value::computed_value::T as Clip;
+
+ try!(write!(dest, " "));
+
+ match (origin, clip) {
+ (&Origin::padding_box, &Clip::padding_box) => {
+ try!(origin.to_css(dest));
+ },
+ (&Origin::border_box, &Clip::border_box) => {
+ try!(origin.to_css(dest));
+ },
+ (&Origin::content_box, &Clip::content_box) => {
+ try!(origin.to_css(dest));
+ },
+ _ => {
+ try!(origin.to_css(dest));
+ try!(write!(dest, " "));
+ try!(clip.to_css(dest));
+ }
+ }
+ },
+ _ => {}
+ };
+
+ try!(write!(dest, " "));
+
+ if let Some(composite) = composite {
+ try!(composite.to_css(dest));
+ } else {
+ try!(write!(dest, "add"));
+ }
+ }
+
+ Ok(())
+ }
+ }
+</%helpers:shorthand>
diff --git a/components/style/properties/shorthand/text.mako.rs b/components/style/properties/shorthand/text.mako.rs
index d09e00b6ba4..0fc8ffec85e 100644
--- a/components/style/properties/shorthand/text.mako.rs
+++ b/components/style/properties/shorthand/text.mako.rs
@@ -8,7 +8,8 @@
sub_properties="text-decoration-color
text-decoration-line
text-decoration-style"
- products="gecko">
+ products="gecko"
+ disable_when_testing="True">
use cssparser::Color as CSSParserColor;
use properties::longhands::{text_decoration_color, text_decoration_line, text_decoration_style};
use values::specified::CSSColor;
diff --git a/components/util/lib.rs b/components/util/lib.rs
index 6513f61a940..11b6afbbc8e 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -44,3 +44,13 @@ pub fn servo_version() -> String {
None => format!("Servo {}", cargo_version),
}
}
+
+pub fn clamp<T: Ord>(lo: T, mid: T, hi: T) -> T {
+ if mid < lo {
+ lo
+ } else if mid > hi {
+ hi
+ } else {
+ mid
+ }
+}
diff --git a/components/util/opts.rs b/components/util/opts.rs
index aef7b3a84eb..8cc67c1d217 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -217,6 +217,10 @@ pub struct Opts {
// don't skip any backtraces on panic
pub full_backtraces: bool,
+ /// True to use OS native signposting facilities. This makes profiling events (script activity,
+ /// reflow, compositing, etc.) appear in Instruments.app on macOS.
+ pub signpost: bool,
+
/// Print the version and exit.
pub is_printing_version: bool,
}
@@ -322,6 +326,10 @@ pub struct DebugOptions {
/// useful when modifying the shaders, to ensure they all compile
/// after each change is made.
pub precache_shaders: bool,
+
+ /// True to use OS native signposting facilities. This makes profiling events (script activity,
+ /// reflow, compositing, etc.) appear in Instruments.app on macOS.
+ pub signpost: bool,
}
@@ -361,6 +369,7 @@ impl DebugOptions {
"msaa" => debug_options.use_msaa = true,
"full-backtraces" => debug_options.full_backtraces = true,
"precache-shaders" => debug_options.precache_shaders = true,
+ "signpost" => debug_options.signpost = true,
"" => {},
_ => return Err(option)
};
@@ -411,6 +420,7 @@ pub fn print_debug_usage(app: &str) -> ! {
print_option("full-backtraces", "Print full backtraces for all errors");
print_option("wr-debug", "Display webrender tile borders. Must be used with -w option.");
print_option("precache-shaders", "Compile all shaders during init. Must be used with -w option.");
+ print_option("signpost", "Emit native OS signposts for profile events (currently macOS only)");
println!("");
@@ -540,7 +550,7 @@ pub fn default_opts() -> Opts {
exit_after_load: false,
no_native_titlebar: false,
enable_vsync: true,
- use_webrender: false,
+ use_webrender: true,
webrender_stats: false,
use_msaa: false,
render_api: DEFAULT_RENDER_API,
@@ -549,6 +559,7 @@ pub fn default_opts() -> Opts {
is_printing_version: false,
webrender_debug: false,
precache_shaders: false,
+ signpost: false,
}
}
@@ -556,7 +567,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
let (app_name, args) = args.split_first().unwrap();
let mut opts = Options::new();
- opts.optflag("c", "cpu", "CPU painting (default)");
+ opts.optflag("c", "cpu", "CPU painting");
opts.optflag("g", "gpu", "GPU painting");
opts.optopt("o", "output", "Output file", "output.png");
opts.optopt("s", "size", "Size of tiles", "512");
@@ -790,8 +801,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
opt_match.opt_present("b") ||
!PREFS.get("shell.native-titlebar.enabled").as_boolean().unwrap();
- let use_webrender =
- PREFS.get("gfx.webrender.enabled").as_boolean().unwrap() || opt_match.opt_present("w");
+ let use_webrender = !opt_match.opt_present("c");
let render_api = match opt_match.opt_str("G") {
Some(ref ga) if ga == "gl" => RenderApi::GL,
@@ -861,6 +871,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
is_printing_version: is_printing_version,
webrender_debug: debug_options.webrender_debug,
precache_shaders: debug_options.precache_shaders,
+ signpost: debug_options.signpost,
};
set_defaults(opts);