servo: Merge #12224 - Remove some stuff from util (from nox:die-util-die); r=Ms2ger

Source-Repo: https://github.com/servo/servo
Source-Revision: 3b0dadda529a5ba45a8a0dc394187f43a66e7c1f

--HG--
rename : servo/components/util/print_tree.rs => servo/components/gfx_traits/print_tree.rs
rename : servo/components/util/workqueue.rs => servo/components/style/workqueue.rs
This commit is contained in:
Anthony Ramine 2016-07-04 12:57:00 -07:00
Родитель da092febcb
Коммит cc183b15a7
40 изменённых файлов: 120 добавлений и 184 удалений

Просмотреть файл

@ -19,7 +19,6 @@ use std::borrow::ToOwned;
use std::mem;
use util::opts;
use util::thread::spawn_named;
use util::vec::byte_swap;
use webrender_traits;
impl<'a> CanvasPaintThread<'a> {

Просмотреть файл

@ -2,7 +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/. */
use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasPixelData, CanvasData, FromLayoutMsg};
use canvas_traits::{CanvasCommonMsg, CanvasData, CanvasMsg, CanvasPixelData};
use canvas_traits::{FromLayoutMsg, byte_swap};
use euclid::size::Size2D;
use gleam::gl;
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
@ -10,7 +11,6 @@ use offscreen_gl_context::{ColorAttachmentType, GLContext, GLLimits, GLContextAt
use std::borrow::ToOwned;
use std::sync::mpsc::channel;
use util::thread::spawn_named;
use util::vec::byte_swap;
use webrender_traits;
enum WebGLPaintTaskData {

Просмотреть файл

@ -539,3 +539,16 @@ impl ToAzColor for RGBA {
self.alpha as AzFloat)
}
}
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
pub fn byte_swap(data: &mut [u8]) {
let length = data.len();
// FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
let mut i = 0;
while i < length {
let r = data[i + 2];
data[i + 2] = data[i + 0];
data[i + 0] = r;
i += 4;
}
}

Просмотреть файл

@ -14,6 +14,7 @@ use euclid::rect::TypedRect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use euclid::{Matrix4D, Point2D, Rect, Size2D};
use gfx_traits::print_tree::PrintTree;
use gfx_traits::{ChromeToPaintMsg, PaintRequest, ScrollPolicy, StackingContextId};
use gfx_traits::{color, Epoch, FrameTreeId, FragmentType, LayerId, LayerKind, LayerProperties};
use gleam::gl;
@ -51,7 +52,6 @@ use url::Url;
use util::geometry::{PagePx, ScreenPx, ViewportPx};
use util::opts;
use util::prefs::PREFS;
use util::print_tree::PrintTree;
use webrender;
use webrender_traits::{self, ScrollEventPhase};
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};

Просмотреть файл

@ -23,6 +23,7 @@ use euclid::rect::TypedRect;
use euclid::side_offsets::SideOffsets2D;
use euclid::{Matrix2D, Matrix4D, Point2D, Rect, Size2D};
use fnv::FnvHasher;
use gfx_traits::print_tree::PrintTree;
use gfx_traits::{LayerId, ScrollPolicy, StackingContextId};
use ipc_channel::ipc::IpcSharedMemory;
use msg::constellation_msg::PipelineId;
@ -45,7 +46,6 @@ use style_traits::cursor::Cursor;
use text::TextRun;
use text::glyph::ByteIndex;
use util::geometry::{self, MAX_RECT, ScreenPx};
use util::print_tree::PrintTree;
use webrender_traits::{self, WebGLContextId};
pub use style::dom::OpaqueNode;

Просмотреть файл

@ -23,6 +23,7 @@ extern crate serde;
pub mod color;
mod paint_listener;
pub mod print_tree;
pub use paint_listener::PaintListener;
use azure::azure_hl::Color;

Просмотреть файл

@ -44,6 +44,7 @@ use flow_ref::FlowRef;
use fragment::SpecificFragmentInfo;
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER, Overflow};
use gfx::display_list::{ClippingRegion, StackingContext};
use gfx_traits::print_tree::PrintTree;
use gfx_traits::{LayerId, StackingContextId};
use layout_debug;
use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none};
@ -62,7 +63,6 @@ use style::servo::SharedStyleContext;
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use util::geometry::MAX_RECT;
use util::print_tree::PrintTree;
/// The number of screens of data we're allowed to generate display lists for in each direction.
const DISPLAY_PORT_SIZE_FACTOR: i32 = 8;

Просмотреть файл

@ -35,6 +35,7 @@ use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use flow_ref::{self, FlowRef, WeakFlowRef};
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
use gfx::display_list::{ClippingRegion, StackingContext};
use gfx_traits::print_tree::PrintTree;
use gfx_traits::{LayerId, LayerType, StackingContextId};
use inline::InlineFlow;
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
@ -61,7 +62,6 @@ use table_colgroup::TableColGroupFlow;
use table_row::TableRowFlow;
use table_rowgroup::TableRowGroupFlow;
use table_wrapper::TableWrapperFlow;
use util::print_tree::PrintTree;
/// Virtual methods that make up a float context.
///

Просмотреть файл

@ -21,6 +21,7 @@ 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;
use range::{Range, RangeIndex};
@ -41,7 +42,6 @@ use style::values::computed::LengthOrPercentage;
use text;
use unicode_bidi;
use util;
use util::print_tree::PrintTree;
// From gfxFontConstants.h in Firefox
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;

Просмотреть файл

@ -17,6 +17,7 @@ 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;
use std::sync::Arc;
@ -25,7 +26,6 @@ use style::logical_geometry::LogicalSize;
use style::properties::{ComputedValues, ServoComputedValues};
use style::servo::SharedStyleContext;
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use util::print_tree::PrintTree;
pub struct MulticolFlow {
pub block_flow: BlockFlow,

Просмотреть файл

@ -17,10 +17,10 @@ use std::sync::atomic::{AtomicIsize, Ordering};
use style::dom::UnsafeNode;
use style::parallel::run_queue_with_custom_work_data_type;
use style::parallel::{CHUNK_SIZE, WorkQueueData};
use style::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
use traversal::AssignBSizes;
use traversal::{AssignISizes, BubbleISizes};
use util::opts;
use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
pub use style::parallel::traverse_dom;

Просмотреть файл

@ -18,6 +18,7 @@ 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};
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
@ -33,7 +34,6 @@ use style::values::computed::LengthOrPercentageOrAuto;
use table_row::TableRowFlow;
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
use table_wrapper::TableLayout;
use util::print_tree::PrintTree;
/// A table flow corresponded to the table's internal table fragment under a table wrapper flow.
/// The properties `position`, `float`, and `margin-*` are used on the table wrapper fragment,

Просмотреть файл

@ -15,12 +15,12 @@ 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;
use style::logical_geometry::LogicalSize;
use style::properties::ServoComputedValues;
use style::servo::SharedStyleContext;
use util::print_tree::PrintTree;
/// A table formatting context.
pub struct TableCaptionFlow {

Просмотреть файл

@ -16,6 +16,7 @@ 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;
use script_layout_interface::restyle_damage::REFLOW;
@ -28,7 +29,6 @@ use style::properties::{ComputedValues, ServoComputedValues};
use style::servo::SharedStyleContext;
use table::InternalTable;
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
use util::print_tree::PrintTree;
/// A table formatting context.
#[derive(RustcEncodable)]

Просмотреть файл

@ -17,6 +17,7 @@ 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;
use rustc_serialize::{Encodable, Encoder};
@ -31,7 +32,6 @@ use style::servo::SharedStyleContext;
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
use table_cell::{CollapsedBordersForCell, TableCellFlow};
use util::print_tree::PrintTree;
/// A single row of a table.
pub struct TableRowFlow {

Просмотреть файл

@ -15,6 +15,7 @@ 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};
use std::fmt;
@ -26,7 +27,6 @@ use style::properties::{ComputedValues, ServoComputedValues};
use style::servo::SharedStyleContext;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
use table_row;
use util::print_tree::PrintTree;
/// A table formatting context.
pub struct TableRowGroupFlow {

Просмотреть файл

@ -24,6 +24,7 @@ use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, Opaqu
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};
use std::fmt;
@ -37,7 +38,6 @@ use style::values::CSSFloat;
use style::values::computed::LengthOrPercentageOrAuto;
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
use table_row;
use util::print_tree::PrintTree;
#[derive(Copy, Clone, RustcEncodable, Debug)]
pub enum TableLayout {

Просмотреть файл

@ -110,13 +110,13 @@ use style::refcell::RefCell;
use style::selector_matching::USER_OR_USER_AGENT_STYLESHEETS;
use style::servo::{Animation, LocalStyleContextCreationInfo, SharedStyleContext, Stylesheet, Stylist};
use style::stylesheets::CSSRuleIteratorExt;
use style::workqueue::WorkQueue;
use url::Url;
use util::geometry::MAX_RECT;
use util::ipc::OptionalIpcSender;
use util::opts;
use util::thread;
use util::thread_state;
use util::workqueue::WorkQueue;
/// The number of screens we have to traverse before we decide to generate new display lists.
const DISPLAY_PORT_THRESHOLD_SIZE_FACTOR: i32 = 4;

Просмотреть файл

@ -3,8 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas_traits::{Canvas2dMsg, CanvasCommonMsg, CanvasMsg};
use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle};
use canvas_traits::{FillOrStrokeStyle, FillRule, LinearGradientStyle, RadialGradientStyle, RepetitionStyle};
use canvas_traits::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
use canvas_traits::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
use canvas_traits::{RadialGradientStyle, RepetitionStyle, byte_swap};
use cssparser::Color as CSSColor;
use cssparser::{Parser, RGBA};
use dom::bindings::cell::DOMRefCell;
@ -46,7 +47,6 @@ use std::str::FromStr;
use std::{cmp, fmt};
use unpremultiplytable::UNPREMULTIPLY_TABLE;
use url::Url;
use util::vec::byte_swap;
#[must_root]
#[derive(JSTraceable, Clone, HeapSizeOf)]

Просмотреть файл

@ -75,7 +75,6 @@ use selectors::matching::{DeclarationBlock, ElementFlags, matches};
use selectors::matching::{HAS_SLOW_SELECTOR, HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR_LATER_SIBLINGS};
use selectors::matching::{common_style_affecting_attributes, rare_style_affecting_attributes};
use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str};
use smallvec::VecLike;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::cell::{Cell, Ref};
@ -91,6 +90,7 @@ use style::properties::DeclaredValue;
use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::sink::Push;
use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA, LengthOrPercentage};
@ -275,7 +275,7 @@ pub trait LayoutElementHelpers {
#[allow(unsafe_code)]
unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>;
#[allow(unsafe_code)]
unsafe fn get_colspan(self) -> u32;
#[allow(unsafe_code)]
@ -308,7 +308,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[allow(unsafe_code)]
unsafe fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>
{
#[inline]
fn from_declaration(rule: PropertyDeclaration) -> DeclarationBlock<Vec<PropertyDeclaration>> {

Просмотреть файл

@ -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/. */
use canvas_traits::{CanvasCommonMsg, CanvasMsg};
use canvas_traits::{CanvasCommonMsg, CanvasMsg, byte_swap};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
@ -40,7 +40,6 @@ use net_traits::image_cache_thread::ImageResponse;
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
use util::vec::byte_swap;
use webrender_traits::WebGLError::*;
use webrender_traits::{WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLParameter};

Просмотреть файл

@ -49,7 +49,6 @@ use script_layout_interface::{HTMLCanvasData, LayoutNodeType, TrustedNodeAddress
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
use selectors::matching::{DeclarationBlock, ElementFlags};
use selectors::parser::{AttrSelector, NamespaceConstraint};
use smallvec::VecLike;
use std::marker::PhantomData;
use std::mem::{transmute, transmute_copy};
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
@ -63,6 +62,7 @@ use style::refcell::{Ref, RefCell, RefMut};
use style::restyle_hints::ElementSnapshot;
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::servo::{PrivateStyleData, SharedStyleContext};
use style::sink::Push;
use url::Url;
use util::str::is_whitespace;
@ -360,7 +360,7 @@ pub struct ServoLayoutElement<'le> {
impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> {
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>
{
unsafe {
self.element.synthesize_presentational_hints_for_legacy_attributes(hints);
@ -995,5 +995,5 @@ impl <'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
impl<'le> PresentationalHintsSynthetizer for ServoThreadSafeLayoutElement<'le> {
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _hints: &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> {}
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>> {}
}

8
servo/components/servo/Cargo.lock сгенерированный
Просмотреть файл

@ -2231,15 +2231,19 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2457,14 +2461,11 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2472,7 +2473,6 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xdg 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

Просмотреть файл

@ -22,6 +22,7 @@ servo = ["serde", "serde/nightly", "serde_macros", "heapsize", "heapsize_plugin"
app_units = "0.2.5"
bitflags = "0.7"
cssparser = "0.5.5"
deque = "0.3.1"
encoding = "0.2"
euclid = "0.7.1"
fnv = "1.0"
@ -29,9 +30,11 @@ gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true}
heapsize = {version = "0.3.0", optional = true}
heapsize_plugin = {version = "0.1.2", optional = true}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
matches = "0.1"
num-traits = "0.1.32"
rand = "0.3"
rustc-serialize = "0.3"
selectors = "0.6"
serde = {version = "0.7.11", optional = true}
@ -43,5 +46,8 @@ time = "0.1"
url = "1.0.0"
util = {path = "../util"}
[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2"
[build-dependencies]
walkdir = "0.1"

Просмотреть файл

@ -15,7 +15,7 @@ use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS
use selector_impl::{ElementExt, SelectorImplExt};
use selectors::Element;
use selectors::matching::DeclarationBlock;
use smallvec::VecLike;
use sink::Push;
use std::ops::BitOr;
use std::sync::Arc;
use string_cache::{Atom, Namespace};
@ -194,7 +194,7 @@ pub trait TDocument : Sized + Copy + Clone {
pub trait PresentationalHintsSynthetizer {
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>;
}
pub trait TElement : Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer {

Просмотреть файл

@ -40,6 +40,7 @@ extern crate bitflags;
extern crate core;
#[macro_use]
extern crate cssparser;
extern crate deque;
extern crate encoding;
extern crate euclid;
extern crate fnv;
@ -49,12 +50,14 @@ extern crate gecko_bindings;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate lazy_static;
extern crate libc;
#[macro_use]
extern crate log;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate matches;
extern crate num_traits;
extern crate rand;
extern crate rustc_serialize;
extern crate selectors;
#[cfg(feature = "servo")] extern crate serde;
@ -88,12 +91,14 @@ pub mod selector_impl;
pub mod selector_matching;
pub mod sequential;
pub mod servo;
pub mod sink;
pub mod stylesheets;
pub mod traversal;
#[macro_use]
#[allow(non_camel_case_types)]
pub mod values;
pub mod viewport;
pub mod workqueue;
/// The CSS properties supported by the style system.
// Generated from the properties.mako.rs template by build.rs

Просмотреть файл

@ -17,6 +17,7 @@ use selectors::Element;
use selectors::bloom::BloomFilter;
use selectors::matching::{CommonStyleAffectingAttributeMode, CommonStyleAffectingAttributes};
use selectors::matching::{common_style_affecting_attributes, rare_style_affecting_attributes};
use sink::ForgetfulSink;
use smallvec::SmallVec;
use std::collections::HashMap;
use std::hash::{BuildHasherDefault, Hash, Hasher};
@ -26,7 +27,6 @@ use string_cache::{Atom, Namespace};
use util::arc_ptr_eq;
use util::cache::{LRUCache, SimpleHashCache};
use util::opts;
use util::vec::ForgetfulSink;
fn create_common_style_affecting_attributes_from_element<E: TElement>(element: &E)
-> CommonStyleAffectingAttributes {

Просмотреть файл

@ -12,7 +12,7 @@ use dom::{OpaqueNode, TNode, UnsafeNode};
use std::mem;
use std::sync::atomic::Ordering;
use traversal::DomTraversalContext;
use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
use workqueue::{WorkQueue, WorkUnit, WorkerProxy};
#[allow(dead_code)]
fn static_assertion(node: UnsafeNode) {

Просмотреть файл

@ -18,6 +18,7 @@ use selectors::bloom::BloomFilter;
use selectors::matching::DeclarationBlock as GenericDeclarationBlock;
use selectors::matching::{Rule, SelectorMap};
use selectors::parser::SelectorImpl;
use sink::Push;
use smallvec::VecLike;
use std::collections::HashMap;
use std::hash::BuildHasherDefault;
@ -389,7 +390,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
applicable_declarations: &mut V)
-> bool
where E: Element<Impl=Impl> + PresentationalHintsSynthetizer,
V: VecLike<DeclarationBlock> {
V: Push<DeclarationBlock> + VecLike<DeclarationBlock> {
assert!(!self.is_device_dirty);
assert!(style_attribute.is_none() || pseudo_element.is_none(),
"Style attributes do not apply to pseudo-elements");
@ -430,7 +431,8 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
// Step 4: Normal style attributes.
style_attribute.map(|sa| {
shareable = false;
applicable_declarations.push(
Push::push(
applicable_declarations,
GenericDeclarationBlock::from_declarations(sa.normal.clone()))
});
@ -443,7 +445,8 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
// Step 6: `!important` style attributes.
style_attribute.map(|sa| {
shareable = false;
applicable_declarations.push(
Push::push(
applicable_declarations,
GenericDeclarationBlock::from_declarations(sa.important.clone()))
});

Просмотреть файл

@ -0,0 +1,40 @@
/* 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 smallvec::{Array, SmallVec};
use std::marker::PhantomData;
pub trait Push<T> {
fn push(&mut self, value: T);
}
impl<T> Push<T> for Vec<T> {
fn push(&mut self, value: T) {
Vec::push(self, value);
}
}
impl<A: Array> Push<A::Item> for SmallVec<A> {
fn push(&mut self, value: A::Item) {
SmallVec::push(self, value);
}
}
pub struct ForgetfulSink<T>(bool, PhantomData<T>);
impl<T> ForgetfulSink<T> {
pub fn new() -> Self {
ForgetfulSink(true, PhantomData)
}
pub fn is_empty(&self) -> bool {
self.0
}
}
impl<T> Push<T> for ForgetfulSink<T> {
fn push(&mut self, _value: T) {
self.0 = false;
}
}

Просмотреть файл

@ -7,6 +7,8 @@
//! Data associated with queues is simply a pair of unsigned integers. It is expected that a
//! higher-level API on top of this could allow safe fork-join parallelism.
#![allow(unsafe_code)]
#[cfg(windows)]
extern crate kernel32;
@ -16,8 +18,8 @@ use libc::usleep;
use rand::{Rng, XorShiftRng, weak_rng};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
use thread::spawn_named;
use thread_state;
use util::thread::spawn_named;
use util::thread_state;
/// A unit of work.
///

Просмотреть файл

@ -17,13 +17,11 @@ servo = ["serde", "serde_macros", "backtrace", "ipc-channel", "app_units/plugins
app_units = "0.2.5"
backtrace = {version = "0.2.1", optional = true}
bitflags = "0.7"
deque = "0.3.1"
euclid = "0.7.1"
getopts = "0.2.11"
heapsize = "0.3.0"
ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
num_cpus = "0.2.2"
num-traits = "0.1.32"
@ -31,11 +29,7 @@ rand = "0.3"
rustc-serialize = "0.3"
serde = {version = "0.7.11", optional = true}
serde_macros = {version = "0.7.11", optional = true}
smallvec = "0.1"
url = "1.0.0"
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies]
xdg = "2.0"
[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2"

Просмотреть файл

@ -1,33 +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/. */
use std::io::{self, Write};
use std::mem;
use std::mem::size_of;
use std::slice;
fn hexdump_slice(buf: &[u8]) {
let mut stderr = io::stderr();
stderr.write_all(b" ").unwrap();
for (i, &v) in buf.iter().enumerate() {
let output = format!("{:02X} ", v);
stderr.write_all(output.as_bytes()).unwrap();
match i % 16 {
15 => { stderr.write_all(b"\n ").unwrap(); },
7 => { stderr.write_all(b" ").unwrap(); },
_ => ()
}
stderr.flush().unwrap();
}
stderr.write_all(b"\n").unwrap();
}
pub fn hexdump<T>(obj: &T) {
unsafe {
let buf: *const u8 = mem::transmute(obj);
debug!("dumping at {:p}", buf);
let from_buf = slice::from_raw_parts(buf, size_of::<T>());
hexdump_slice(from_buf);
}
}

Просмотреть файл

@ -14,20 +14,17 @@
extern crate app_units;
#[cfg(feature = "servo")] extern crate backtrace;
#[allow(unused_extern_crates)] #[macro_use] extern crate bitflags;
extern crate deque;
extern crate euclid;
extern crate getopts;
#[macro_use] extern crate heapsize;
#[cfg(feature = "servo")] extern crate ipc_channel;
#[allow(unused_extern_crates)] #[macro_use] extern crate lazy_static;
extern crate libc;
#[macro_use] extern crate log;
extern crate num_cpus;
extern crate num_traits;
extern crate rand;
extern crate rustc_serialize;
#[cfg(feature = "servo")] extern crate serde;
extern crate smallvec;
extern crate url;
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
extern crate xdg;
@ -36,20 +33,16 @@ use std::sync::Arc;
pub mod basedir;
pub mod cache;
#[allow(unsafe_code)] pub mod debug_utils;
pub mod geometry;
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
#[allow(unsafe_code)] pub mod opts;
#[cfg(feature = "servo")] pub mod panicking;
pub mod prefs;
#[cfg(feature = "servo")] pub mod print_tree;
pub mod resource_files;
pub mod str;
pub mod thread;
pub mod thread_state;
pub mod tid;
pub mod vec;
#[allow(unsafe_code)] pub mod workqueue;
#[cfg(feature = "servo")]
#[allow(unsafe_code)]

Просмотреть файл

@ -1,87 +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/. */
use std::marker::PhantomData;
use std::ops;
use super::smallvec::VecLike;
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
pub fn byte_swap(data: &mut [u8]) {
let length = data.len();
// FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
let mut i = 0;
while i < length {
let r = data[i + 2];
data[i + 2] = data[i + 0];
data[i + 0] = r;
i += 4;
}
}
/// A `VecLike` that only tracks whether or not something was ever pushed to it.
pub struct ForgetfulSink<T> {
empty: bool,
_data: PhantomData<T>,
}
impl<T> ForgetfulSink<T> {
pub fn new() -> ForgetfulSink<T> {
ForgetfulSink {
empty: true,
_data: PhantomData,
}
}
pub fn is_empty(&self) -> bool {
self.empty
}
}
impl<T> ops::Deref for ForgetfulSink<T> {
type Target = [T];
fn deref(&self) -> &[T] {
unreachable!()
}
}
impl<T> ops::DerefMut for ForgetfulSink<T> {
fn deref_mut(&mut self) -> &mut [T] {
unreachable!()
}
}
macro_rules! impl_index {
($index_type: ty, $output_type: ty) => {
impl<T> ops::Index<$index_type> for ForgetfulSink<T> {
type Output = $output_type;
fn index(&self, _index: $index_type) -> &$output_type {
unreachable!()
}
}
impl<T> ops::IndexMut<$index_type> for ForgetfulSink<T> {
fn index_mut(&mut self, _index: $index_type) -> &mut $output_type {
unreachable!()
}
}
}
}
impl_index!(usize, T);
impl_index!(ops::Range<usize>, [T]);
impl_index!(ops::RangeFrom<usize>, [T]);
impl_index!(ops::RangeTo<usize>, [T]);
impl_index!(ops::RangeFull, [T]);
impl<T> VecLike<T> for ForgetfulSink<T> {
#[inline]
fn len(&self) -> usize {
unreachable!()
}
#[inline]
fn push(&mut self, _value: T) {
self.empty = false;
}
}

8
servo/ports/cef/Cargo.lock сгенерированный
Просмотреть файл

@ -2116,15 +2116,19 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2326,14 +2330,11 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2341,7 +2342,6 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xdg 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

8
servo/ports/geckolib/Cargo.lock сгенерированный
Просмотреть файл

@ -450,16 +450,20 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -562,14 +566,11 @@ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.4 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -577,7 +578,6 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xdg 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

Просмотреть файл

@ -14,9 +14,9 @@ use std::sync::{Arc, RwLock};
use style::dom::OpaqueNode;
use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::workqueue::WorkQueue;
use util::geometry::ViewportPx;
use util::thread_state;
use util::workqueue::WorkQueue;
pub struct PerDocumentStyleData {
/// Rule processor.

Просмотреть файл

@ -50,6 +50,7 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
use style::refcell::{Ref, RefCell, RefMut};
use style::restyle_hints::ElementSnapshot;
use style::selector_impl::ElementExt;
use style::sink::Push;
#[allow(unused_imports)] // Used in commented-out code.
use url::Url;
@ -377,7 +378,7 @@ impl<'le> TElement for GeckoElement<'le> {
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _hints: &mut V)
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>
where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>>
{
// FIXME(bholley) - Need to implement this.
}