aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-02-08 20:03:17 +0100
committerMs2ger <ms2ger@gmail.com>2015-02-08 20:03:27 +0100
commit7c6b03abfeaf97950ee6a9ff8316a9277a5cf069 (patch)
tree743327332930fd9d525c4609022f9798467a395c /components/layout
parenta819b0b1b609d94e2b7d5a352f1c0d8592874a3c (diff)
downloadservo-7c6b03abfeaf97950ee6a9ff8316a9277a5cf069.tar.gz
servo-7c6b03abfeaf97950ee6a9ff8316a9277a5cf069.zip
Opt-in rather than opt-out to unsafe blocks in layout.
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/context.rs2
-rw-r--r--components/layout/css/matching.rs2
-rw-r--r--components/layout/css/node_style.rs1
-rw-r--r--components/layout/flow.rs3
-rw-r--r--components/layout/flow_ref.rs2
-rw-r--r--components/layout/layout_debug.rs1
-rw-r--r--components/layout/layout_task.rs2
-rw-r--r--components/layout/lib.rs1
-rw-r--r--components/layout/parallel.rs2
-rw-r--r--components/layout/traversal.rs2
-rw-r--r--components/layout/util.rs2
-rw-r--r--components/layout/wrapper.rs2
12 files changed, 22 insertions, 0 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs
index 29a96358ff5..96925bbc55a 100644
--- a/components/layout/context.rs
+++ b/components/layout/context.rs
@@ -4,6 +4,8 @@
//! Data needed by the layout task.
+#![allow(unsafe_blocks)]
+
use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
use geom::{Rect, Size2D};
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 6a491eabd79..bc096e7728d 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -4,6 +4,8 @@
//! High-level interface to CSS selector matching.
+#![allow(unsafe_blocks)]
+
use css::node_style::StyledNode;
use incremental::{self, RestyleDamage};
use util::{LayoutDataAccess, LayoutDataWrapper};
diff --git a/components/layout/css/node_style.rs b/components/layout/css/node_style.rs
index a153447f7a3..946ac11a5e7 100644
--- a/components/layout/css/node_style.rs
+++ b/components/layout/css/node_style.rs
@@ -23,6 +23,7 @@ pub trait StyledNode {
impl<'ln> StyledNode for ThreadSafeLayoutNode<'ln> {
#[inline]
+ #[allow(unsafe_blocks)]
fn style<'a>(&'a self) -> &'a Arc<ComputedValues> {
unsafe {
let layout_data_ref = self.borrow_layout_data();
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 9ca0446b9c4..cb1658879cd 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -294,6 +294,7 @@ pub trait Flow: fmt::Show + Sync {
}
/// Returns a layer ID for the given fragment.
+ #[allow(unsafe_blocks)]
fn layer_id(&self, fragment_id: uint) -> LayerId {
unsafe {
let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self);
@@ -310,6 +311,7 @@ pub trait Flow: fmt::Show + Sync {
// Base access
#[inline(always)]
+#[allow(unsafe_blocks)]
pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this);
@@ -323,6 +325,7 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
}
#[inline(always)]
+#[allow(unsafe_blocks)]
pub fn mut_base<'a, T: ?Sized + Flow>(this: &'a mut T) -> &'a mut BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a mut T, &'a raw::TraitObject>(&this);
diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs
index 85d40b6b493..83243df2c8d 100644
--- a/components/layout/flow_ref.rs
+++ b/components/layout/flow_ref.rs
@@ -6,6 +6,8 @@
//!
//! Eventually, with dynamically sized types in Rust, much of this code will be superfluous.
+#![allow(unsafe_blocks)]
+
use flow::Flow;
use flow;
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index 5fc606b8705..a3a11a3d085 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -95,6 +95,7 @@ impl Drop for Scope {
/// Generate a unique ID. This is used for items such as Fragment
/// which are often reallocated but represent essentially the
/// same data.
+#[allow(unsafe_blocks)]
pub fn generate_unique_debug_id() -> u16 {
unsafe { DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16 }
}
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index cd2328df866..c0aa1f6fdb9 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -5,6 +5,8 @@
//! The layout task. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
+#![allow(unsafe_blocks)]
+
use css::node_style::StyledNode;
use construct::ConstructionResult;
use context::{SharedLayoutContext, SharedLayoutContextWrapper};
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index 17812c262c2..df523fb6915 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -4,6 +4,7 @@
#![feature(thread_local, unsafe_destructor, box_syntax, plugin, int_uint)]
+#![deny(unsafe_blocks)]
#![deny(unused_imports)]
#![deny(unused_variables)]
#![allow(unrooted_must_root)]
diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs
index 05eb9168a04..5483a12594e 100644
--- a/components/layout/parallel.rs
+++ b/components/layout/parallel.rs
@@ -6,6 +6,8 @@
//!
//! This code is highly unsafe. Keep this file small and easy to audit.
+#![allow(unsafe_blocks)]
+
use context::{LayoutContext, SharedLayoutContextWrapper, SharedLayoutContext};
use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal};
use flow;
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 6d695ad4a48..c31d4dcde1a 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -4,6 +4,8 @@
//! Traversals over the DOM and flow trees, running the layout computations.
+#![allow(unsafe_blocks)]
+
use css::node_style::StyledNode;
use css::matching::{ApplicableDeclarations, MatchMethods, StyleSharingResult};
use construct::FlowConstructor;
diff --git a/components/layout/util.rs b/components/layout/util.rs
index 270c796781e..a733a8634ce 100644
--- a/components/layout/util.rs
+++ b/components/layout/util.rs
@@ -2,6 +2,8 @@
* 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(unsafe_blocks)]
+
use construct::ConstructionResult;
use incremental::RestyleDamage;
use parallel::DomParallelInfo;
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index baaf848c68c..6f7d1059264 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -30,6 +30,8 @@
//! o Instead of `html_element_in_html_document()`, use
//! `html_element_in_html_document_for_layout()`.
+#![allow(unsafe_blocks)]
+
use canvas::canvas_paint_task::CanvasMsg;
use context::SharedLayoutContext;
use css::node_style::StyledNode;