Replace unsafe_blocks by unsafe_code.

This commit is contained in:
Manish Goregaokar 2015-03-19 07:40:22 +05:30 committed by Ms2ger
parent 4eb26065ac
commit 3479d3fa7f
53 changed files with 151 additions and 57 deletions

View file

@ -25,7 +25,7 @@
//!
//! http://dev.w3.org/csswg/css-sizing/
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use context::LayoutContext;
use css::node_style::StyledNode;

View file

@ -11,7 +11,7 @@
//! maybe it's an absolute or fixed position thing that hasn't found its containing block yet.
//! Construction items bubble up the tree from children to parents until they find their homes.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;

View file

@ -4,7 +4,7 @@
//! Data needed by the layout task.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};

View file

@ -4,7 +4,7 @@
//! High-level interface to CSS selector matching.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use context::SharedLayoutContext;
use css::node_style::StyledNode;

View file

@ -23,7 +23,7 @@ pub trait StyledNode {
impl<'ln> StyledNode for ThreadSafeLayoutNode<'ln> {
#[inline]
#[allow(unsafe_blocks)]
#[allow(unsafe_code)]
fn style<'a>(&'a self) -> &'a Arc<ComputedValues> {
unsafe {
let layout_data_ref = self.borrow_layout_data();

View file

@ -2,7 +2,7 @@
* 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)]
#![allow(unsafe_code)]
use construct::{ConstructionItem, ConstructionResult};
use incremental::RestyleDamage;

View file

@ -8,7 +8,7 @@
//! list building, as the actual painting does not happen here—only deciding *what* we're going to
//! paint.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use azure::azure_hl::Color;
use block::BlockFlow;

View file

@ -310,7 +310,7 @@ pub trait Flow: fmt::Debug + Sync {
}
/// Returns a layer ID for the given fragment.
#[allow(unsafe_blocks)]
#[allow(unsafe_code)]
fn layer_id(&self, fragment_id: uint) -> LayerId {
unsafe {
let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self);
@ -330,7 +330,7 @@ pub trait Flow: fmt::Debug + Sync {
// Base access
#[inline(always)]
#[allow(unsafe_blocks)]
#[allow(unsafe_code)]
pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow {
unsafe {
let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this);
@ -344,7 +344,7 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
}
#[inline(always)]
#[allow(unsafe_blocks)]
#[allow(unsafe_code)]
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);
@ -832,7 +832,9 @@ pub struct BaseFlow {
pub flags: FlowFlags,
}
#[allow(unsafe_code)]
unsafe impl Send for BaseFlow {}
#[allow(unsafe_code)]
unsafe impl Sync for BaseFlow {}
impl fmt::Debug for BaseFlow {
@ -982,10 +984,12 @@ impl BaseFlow {
self.children.iter_mut()
}
#[allow(unsafe_code)]
pub unsafe fn strong_ref_count<'a>(&'a self) -> &'a AtomicUsize {
&self.strong_ref_count
}
#[allow(unsafe_code)]
pub unsafe fn weak_ref_count<'a>(&'a self) -> &'a AtomicUsize {
&self.weak_ref_count
}
@ -1355,6 +1359,7 @@ impl ContainingBlockLink {
self.link = Some(link.downgrade())
}
#[allow(unsafe_code)]
pub unsafe fn get<'a>(&'a mut self) -> &'a mut Option<WeakFlowRef> {
&mut self.link
}

View file

@ -31,6 +31,7 @@ impl FlowList {
/// Provide a mutable reference to the front element, or None if the list is empty
#[inline]
#[allow(unsafe_code)]
pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
self.flows.front_mut().map(|head| &mut **head)
}
@ -43,6 +44,7 @@ impl FlowList {
/// Provide a mutable reference to the back element, or None if the list is empty
#[inline]
#[allow(unsafe_code)]
pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
self.flows.back_mut().map(|tail| &mut **tail)
}

View file

@ -8,7 +8,7 @@
//! be superfluous. This design is largely duplicating logic of Arc<T> and
//! Weak<T>; please see comments there for details.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use flow::Flow;
use flow;

View file

@ -4,7 +4,7 @@
//! The `Fragment` type, which represents the leaves of the layout tree.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use canvas::canvas_paint_task::CanvasMsg;
use css::node_style::StyledNode;
@ -118,7 +118,9 @@ pub struct Fragment {
pub debug_id: u16,
}
#[allow(unsafe_code)]
unsafe impl Send for Fragment {}
#[allow(unsafe_code)]
unsafe impl Sync for Fragment {}
impl Encodable for Fragment {

View file

@ -2,7 +2,7 @@
* 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/. */
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use css::node_style::StyledNode;
use context::LayoutContext;

View file

@ -6,6 +6,7 @@
//! that can be viewed by an external tool to make layout debugging easier.
#![macro_use]
#![allow(unsafe_code)] // thread_local!() defines an unsafe function on Android
use flow_ref::FlowRef;
use flow;
@ -95,7 +96,6 @@ 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 }
}

View file

@ -5,7 +5,7 @@
//! The layout task. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use construct::ConstructionResult;
use context::{SharedLayoutContext, SharedLayoutContextWrapper};

View file

@ -17,7 +17,7 @@
#![feature(unsafe_destructor)]
#![feature(unsafe_no_drop_flag)]
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
#![allow(unrooted_must_root)]
#![plugin(string_cache_plugin)]

View file

@ -5,7 +5,7 @@
//! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a
//! block and an extra inline fragment for the marker.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;

View file

@ -4,7 +4,7 @@
//! Borders, padding, and margins.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use fragment::Fragment;

View file

@ -2,7 +2,7 @@
* 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)]
#![allow(unsafe_code)]
use gfx::display_list::OpaqueNode;
use libc::{c_void, uintptr_t};

View file

@ -6,7 +6,7 @@
//!
//! This code is highly unsafe. Keep this file small and easy to audit.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use context::{LayoutContext, SharedLayoutContextWrapper, SharedLayoutContext};
use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal};

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::{self, BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
use block::{ISizeConstraintInput, ISizeConstraintSolution};

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::BlockFlow;
use context::LayoutContext;

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag};
use context::LayoutContext;

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use context::LayoutContext;
use css::node_style::StyledNode;

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::BlockFlow;
use block::ISizeAndMarginsComputer;

View file

@ -4,7 +4,7 @@
//! CSS table formatting contexts.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::{BlockFlow, ISizeAndMarginsComputer};
use context::LayoutContext;

View file

@ -11,7 +11,7 @@
//!
//! Hereafter this document is referred to as INTRINSIC.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use block::{BlockFlow, BlockNonReplaced, FloatNonReplaced, ISizeAndMarginsComputer};
use block::{MarginsMayCollapseFlag};

View file

@ -4,7 +4,7 @@
//! Text layout.
#![deny(unsafe_blocks)]
#![deny(unsafe_code)]
use fragment::{Fragment, SpecificFragmentInfo, ScannedTextFragmentInfo};
use inline::InlineFragments;

View file

@ -4,7 +4,7 @@
//! Traversals over the DOM and flow trees, running the layout computations.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use css::node_style::StyledNode;
use css::matching::{ApplicableDeclarations, MatchMethods, StyleSharingResult};

View file

@ -30,7 +30,7 @@
//! o Instead of `html_element_in_html_document()`, use
//! `html_element_in_html_document_for_layout()`.
#![allow(unsafe_blocks)]
#![allow(unsafe_code)]
use canvas::canvas_paint_task::CanvasMsg;
use context::SharedLayoutContext;