mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.
This commit is contained in:
parent
cf616b90a2
commit
16c7060bc8
153 changed files with 2095 additions and 1298 deletions
|
@ -27,7 +27,7 @@ pub struct BufferMap {
|
|||
}
|
||||
|
||||
/// A key with which to store buffers. It is based on the size of the buffer.
|
||||
#[deriving(Eq)]
|
||||
#[deriving(Eq, Copy)]
|
||||
struct BufferKey([uint, ..2]);
|
||||
|
||||
impl Hash for BufferKey {
|
||||
|
|
|
@ -42,7 +42,7 @@ use std::slice::Items;
|
|||
use style::ComputedValues;
|
||||
use style::computed_values::border_style;
|
||||
use style::computed_values::cursor;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
|
||||
// layout to use.
|
||||
|
@ -61,7 +61,7 @@ pub static BOX_SHADOW_INFLATION_FACTOR: i32 = 3;
|
|||
/// Because the script task's GC does not trace layout, node data cannot be safely stored in layout
|
||||
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
|
||||
/// locality reasons. Using `OpaqueNode` enforces this invariant.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
pub struct OpaqueNode(pub uintptr_t);
|
||||
|
||||
impl OpaqueNode {
|
||||
|
@ -628,7 +628,7 @@ impl ClippingRegion {
|
|||
/// Metadata attached to each display item. This is useful for performing auxiliary tasks with
|
||||
/// the display list involving hit testing: finding the originating DOM node and determining the
|
||||
/// cursor to use when the element is hovered over.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct DisplayItemMetadata {
|
||||
/// The DOM node from which this display item originated.
|
||||
pub node: OpaqueNode,
|
||||
|
@ -739,7 +739,7 @@ pub struct BorderDisplayItem {
|
|||
/// Information about the border radii.
|
||||
///
|
||||
/// TODO(pcwalton): Elliptical radii.
|
||||
#[deriving(Clone, Default, PartialEq, Show)]
|
||||
#[deriving(Clone, Default, PartialEq, Show, Copy)]
|
||||
pub struct BorderRadii<T> {
|
||||
pub top_left: T,
|
||||
pub top_right: T,
|
||||
|
|
|
@ -9,7 +9,7 @@ use display_list::{DisplayItem, DisplayList, StackingContext};
|
|||
use collections::dlist::DList;
|
||||
use geom::rect::Rect;
|
||||
use servo_util::geometry::{mod, Au};
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Transforms a display list to produce a visually-equivalent, but cheaper-to-paint, one.
|
||||
pub struct DisplayListOptimizer {
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
use geom::{Point2D, Rect, Size2D};
|
||||
use std::mem;
|
||||
use std::string;
|
||||
use std::slice;
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
use servo_util::cache::{Cache, HashCache};
|
||||
use servo_util::smallvec::{SmallVec, SmallVec8};
|
||||
use style::computed_values::{font_variant, font_weight};
|
||||
use style::style_structs::Font as FontStyle;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use collections::hash::Hash;
|
||||
use platform::font_context::FontContextHandle;
|
||||
|
@ -56,11 +56,10 @@ pub trait FontTableTagConversions {
|
|||
impl FontTableTagConversions for FontTableTag {
|
||||
fn tag_to_str(&self) -> String {
|
||||
unsafe {
|
||||
let reversed = string::raw::from_buf_len(mem::transmute(self), 4);
|
||||
return String::from_chars([reversed.as_slice().char_at(3),
|
||||
reversed.as_slice().char_at(2),
|
||||
reversed.as_slice().char_at(1),
|
||||
reversed.as_slice().char_at(0)]);
|
||||
let pointer = mem::transmute::<&u32, *const u8>(self);
|
||||
let mut bytes = slice::from_raw_buf(&pointer, 4).to_vec();
|
||||
bytes.reverse();
|
||||
String::from_utf8_unchecked(bytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +100,7 @@ pub struct Font {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
#[deriving(Copy)]
|
||||
flags ShapingFlags: u8 {
|
||||
#[doc="Set if the text is entirely whitespace."]
|
||||
const IS_WHITESPACE_SHAPING_FLAG = 0x01,
|
||||
|
@ -110,7 +110,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
/// Various options that control text shaping.
|
||||
#[deriving(Clone, Eq, PartialEq, Hash)]
|
||||
#[deriving(Clone, Eq, PartialEq, Hash, Copy)]
|
||||
pub struct ShapingOptions {
|
||||
/// Spacing to add between each letter. Corresponds to the CSS 2.1 `letter-spacing` property.
|
||||
/// NB: You will probably want to set the `IGNORE_LIGATURES_SHAPING_FLAG` if this is non-null.
|
||||
|
|
|
@ -10,7 +10,7 @@ use platform::font_context::FontContextHandle;
|
|||
|
||||
use collections::str::Str;
|
||||
use std::collections::HashMap;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
use font_template::{FontTemplate, FontTemplateDescriptor};
|
||||
use platform::font_template::FontTemplateData;
|
||||
use servo_net::resource_task::{ResourceTask, load_whole_resource};
|
||||
|
|
|
@ -19,7 +19,7 @@ use servo_util::arc_ptr_eq;
|
|||
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use azure::AzFloat;
|
||||
use azure::azure_hl::BackendType;
|
||||
|
|
|
@ -7,14 +7,14 @@ use platform::font_context::FontContextHandle;
|
|||
use platform::font::FontHandle;
|
||||
use platform::font_template::FontTemplateData;
|
||||
|
||||
use sync::{Arc, Weak};
|
||||
use std::sync::{Arc, Weak};
|
||||
use font::FontHandleMethods;
|
||||
|
||||
/// Describes how to select a font from a given family.
|
||||
/// This is very basic at the moment and needs to be
|
||||
/// expanded or refactored when we support more of the
|
||||
/// font styling parameters.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct FontTemplateDescriptor {
|
||||
pub weight: font_weight::T,
|
||||
pub italic: bool,
|
||||
|
|
|
@ -29,7 +29,6 @@ extern crate "net" as servo_net;
|
|||
extern crate "util" as servo_util;
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate style;
|
||||
extern crate sync;
|
||||
extern crate time;
|
||||
extern crate url;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ use std::mem;
|
|||
use std::num::{Float, FloatMath};
|
||||
use std::ptr;
|
||||
use style::computed_values::border_style;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
use text::TextRun;
|
||||
use text::glyph::CharIndex;
|
||||
|
||||
|
@ -52,6 +52,7 @@ pub struct PaintContext<'a> {
|
|||
pub transient_clip: Option<ClippingRegion>,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum Direction {
|
||||
Top,
|
||||
Left,
|
||||
|
@ -59,6 +60,7 @@ enum Direction {
|
|||
Bottom
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum DashSize {
|
||||
DottedBorder = 1,
|
||||
DashedBorder = 3
|
||||
|
|
|
@ -35,7 +35,7 @@ use servo_util::time::{TimeProfilerChan, TimeProfilerCategory, profile};
|
|||
use std::comm::{Receiver, Sender, channel};
|
||||
use std::mem;
|
||||
use std::task::TaskBuilder;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Information about a hardware graphics layer that layout sends to the painting task.
|
||||
#[deriving(Clone)]
|
||||
|
|
|
@ -30,7 +30,7 @@ use std::num::Float;
|
|||
use std::ptr;
|
||||
use std::string;
|
||||
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn float_to_fixed_ft(f: f64) -> i32 {
|
||||
float_to_fixed(6, f)
|
||||
|
|
|
@ -29,7 +29,7 @@ use core_text::font_descriptor::{kCTFontDefaultOrientation};
|
|||
|
||||
use std::num::Float;
|
||||
use std::ptr;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct FontTable {
|
||||
data: CFData,
|
||||
|
@ -100,15 +100,15 @@ impl FontHandleMethods for FontHandle {
|
|||
let normalized = self.ctfont.all_traits().normalized_weight();
|
||||
// 0.0 to 9.0
|
||||
let normalized = (normalized + 1.0) / 2.0 * 9.0;
|
||||
if normalized < 1.0 { return font_weight::Weight100; }
|
||||
if normalized < 2.0 { return font_weight::Weight200; }
|
||||
if normalized < 3.0 { return font_weight::Weight300; }
|
||||
if normalized < 4.0 { return font_weight::Weight400; }
|
||||
if normalized < 5.0 { return font_weight::Weight500; }
|
||||
if normalized < 6.0 { return font_weight::Weight600; }
|
||||
if normalized < 7.0 { return font_weight::Weight700; }
|
||||
if normalized < 8.0 { return font_weight::Weight800; }
|
||||
return font_weight::Weight900;
|
||||
if normalized < 1.0 { return font_weight::T::Weight100; }
|
||||
if normalized < 2.0 { return font_weight::T::Weight200; }
|
||||
if normalized < 3.0 { return font_weight::T::Weight300; }
|
||||
if normalized < 4.0 { return font_weight::T::Weight400; }
|
||||
if normalized < 5.0 { return font_weight::T::Weight500; }
|
||||
if normalized < 6.0 { return font_weight::T::Weight600; }
|
||||
if normalized < 7.0 { return font_weight::T::Weight700; }
|
||||
if normalized < 8.0 { return font_weight::T::Weight800; }
|
||||
return font_weight::T::Weight900;
|
||||
}
|
||||
|
||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||
|
@ -179,7 +179,7 @@ impl FontHandleMethods for FontHandle {
|
|||
average_advance: average_advance,
|
||||
line_gap: Au::from_frac_px(line_gap),
|
||||
};
|
||||
debug!("Font metrics (@{:f} pt): {}", self.ctfont.pt_size() as f64, metrics);
|
||||
debug!("Font metrics (@{} pt): {}", self.ctfont.pt_size() as f64, metrics);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ pub struct FontContextHandle {
|
|||
ctx: ()
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
impl FontContextHandle {
|
||||
// this is a placeholder until NSFontManager or whatever is bound in here.
|
||||
pub fn new() -> FontContextHandle {
|
||||
|
|
|
@ -22,7 +22,7 @@ use geom::point::Point2D;
|
|||
/// In the uncommon case (multiple glyphs per unicode character, large glyph index/advance, or
|
||||
/// glyph offsets), we pack the glyph count into GlyphEntry, and store the other glyph information
|
||||
/// in DetailedGlyphStore.
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Show, Copy)]
|
||||
struct GlyphEntry {
|
||||
value: u32,
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ impl GlyphEntry {
|
|||
pub type GlyphId = u32;
|
||||
|
||||
// TODO: unify with bit flags?
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(PartialEq, Copy)]
|
||||
pub enum BreakType {
|
||||
None,
|
||||
Normal,
|
||||
|
@ -251,7 +251,7 @@ impl GlyphEntry {
|
|||
|
||||
// Stores data for a detailed glyph, in the case that several glyphs
|
||||
// correspond to one character, or the glyph's data couldn't be packed.
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Show, Copy)]
|
||||
struct DetailedGlyph {
|
||||
id: GlyphId,
|
||||
// glyph's advance, in the text's direction (RTL or RTL)
|
||||
|
@ -270,7 +270,7 @@ impl DetailedGlyph {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Clone, Eq, Show)]
|
||||
#[deriving(PartialEq, Clone, Eq, Show, Copy)]
|
||||
struct DetailedGlyphRecord {
|
||||
// source string offset/GlyphEntry offset in the TextRun
|
||||
entry_offset: CharIndex,
|
||||
|
@ -411,6 +411,7 @@ impl<'a> DetailedGlyphStore {
|
|||
|
||||
// This struct is used by GlyphStore clients to provide new glyph data.
|
||||
// It should be allocated on the stack and passed by reference to GlyphStore.
|
||||
#[deriving(Copy)]
|
||||
pub struct GlyphData {
|
||||
id: GlyphId,
|
||||
advance: Au,
|
||||
|
@ -443,6 +444,7 @@ impl GlyphData {
|
|||
// through glyphs (either for a particular TextRun offset, or all glyphs).
|
||||
// Rather than eagerly assembling and copying glyph data, it only retrieves
|
||||
// values as they are needed from the GlyphStore, using provided offsets.
|
||||
#[deriving(Copy)]
|
||||
pub enum GlyphInfo<'a> {
|
||||
Simple(&'a GlyphStore, CharIndex),
|
||||
Detail(&'a GlyphStore, CharIndex, u16),
|
||||
|
|
|
@ -503,7 +503,7 @@ impl Shaper {
|
|||
// space (U+00A0) left in the text after the white space processing rules have been
|
||||
// applied. The effect of the property on other word-separator characters is undefined."
|
||||
// We elect to only space the two required code points.
|
||||
if character == ' ' || character == '\u00a0' {
|
||||
if character == ' ' || character == '\u{a0}' {
|
||||
advance = advance + options.word_spacing
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use servo_util::geometry::Au;
|
|||
use servo_util::range::Range;
|
||||
use servo_util::vec::{Comparator, FullBinarySearchMethods};
|
||||
use std::slice::Items;
|
||||
use sync::Arc;
|
||||
use std::sync::Arc;
|
||||
use text::glyph::{CharIndex, GlyphStore};
|
||||
|
||||
/// A single "paragraph" of text in one font size and style.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use text::glyph::CharIndex;
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(PartialEq, Eq, Copy)]
|
||||
pub enum CompressionMode {
|
||||
CompressNone,
|
||||
CompressWhitespace,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue