mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
class -> strucT
This commit is contained in:
parent
7c122a660e
commit
8dc5398ad6
12 changed files with 18 additions and 20 deletions
|
@ -64,7 +64,7 @@ fn join_layout(scope: NodeScope, layout: Layout) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Document {
|
struct Document {
|
||||||
let root: Node;
|
let root: Node;
|
||||||
let css_rules: arc<Stylesheet>;
|
let css_rules: arc<Stylesheet>;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Content<S:Sink send copy> {
|
struct Content<S:Sink send copy> {
|
||||||
let sink: S;
|
let sink: S;
|
||||||
let layout: Layout;
|
let layout: Layout;
|
||||||
let from_master: comm::Port<ControlMsg>;
|
let from_master: comm::Port<ControlMsg>;
|
||||||
|
|
|
@ -24,7 +24,7 @@ enum NodeKind {
|
||||||
Text(~str)
|
Text(~str)
|
||||||
}
|
}
|
||||||
|
|
||||||
class ElementData {
|
struct ElementData {
|
||||||
let tag_name: ~str;
|
let tag_name: ~str;
|
||||||
let kind: ~ElementKind;
|
let kind: ~ElementKind;
|
||||||
let attrs: DVec<~Attr>;
|
let attrs: DVec<~Attr>;
|
||||||
|
@ -48,7 +48,7 @@ class ElementData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Attr {
|
struct Attr {
|
||||||
let name: ~str;
|
let name: ~str;
|
||||||
let value: ~str;
|
let value: ~str;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ type ScopeData<T:send,A> = {
|
||||||
mut first_dirty: Handle<T,A>
|
mut first_dirty: Handle<T,A>
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScopeResource<T:send,A> {
|
struct ScopeResource<T:send,A> {
|
||||||
let d : ScopeData<T,A>;
|
let d : ScopeData<T,A>;
|
||||||
new(-d : ScopeData<T,A>) {
|
new(-d : ScopeData<T,A>) {
|
||||||
self.d = d;
|
self.d = d;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import image_cache_task::{ImageCacheTask, image_cache_task, ImageCacheTaskClient
|
||||||
|
|
||||||
import pipes::{port, chan};
|
import pipes::{port, chan};
|
||||||
|
|
||||||
class Engine<S:Sink send copy> {
|
struct Engine<S:Sink send copy> {
|
||||||
let sink: S;
|
let sink: S;
|
||||||
|
|
||||||
let renderer: Renderer;
|
let renderer: Renderer;
|
||||||
|
|
|
@ -29,7 +29,7 @@ enum BoxKind {
|
||||||
TextBoxKind(@TextBox)
|
TextBoxKind(@TextBox)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Appearance {
|
struct Appearance {
|
||||||
let mut background_image: option<ImageHolder>;
|
let mut background_image: option<ImageHolder>;
|
||||||
let mut background_color: Color;
|
let mut background_color: Color;
|
||||||
let mut width: Unit;
|
let mut width: Unit;
|
||||||
|
@ -62,7 +62,7 @@ class Appearance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Box {
|
struct Box {
|
||||||
let tree: tree::Tree<@Box>;
|
let tree: tree::Tree<@Box>;
|
||||||
let node: Node;
|
let node: Node;
|
||||||
let kind: BoxKind;
|
let kind: BoxKind;
|
||||||
|
@ -78,10 +78,10 @@ class Box {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc="A class to store image data. The image will be loaded once,
|
#[doc="A struct to store image data. The image will be loaded once,
|
||||||
the first time it is requested, and an arc will be stored. Clones of
|
the first time it is requested, and an arc will be stored. Clones of
|
||||||
this arc are given out on demand."]
|
this arc are given out on demand."]
|
||||||
class ImageHolder {
|
struct ImageHolder {
|
||||||
// Invariant: at least one of url and image is not none, except
|
// Invariant: at least one of url and image is not none, except
|
||||||
// occasionally while get_image is being called
|
// occasionally while get_image is being called
|
||||||
let mut url : option<url>;
|
let mut url : option<url>;
|
||||||
|
|
|
@ -55,7 +55,7 @@ fn create_resource_task_with_loaders(+loaders: ~[(~str, LoaderTaskFactory)]) ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ResourceManager {
|
struct ResourceManager {
|
||||||
let from_client: Port<ControlMsg>;
|
let from_client: Port<ControlMsg>;
|
||||||
/// Per-scheme resource loaders
|
/// Per-scheme resource loaders
|
||||||
let loaders: ~[(~str, LoaderTaskFactory)];
|
let loaders: ~[(~str, LoaderTaskFactory)];
|
||||||
|
|
|
@ -7,13 +7,11 @@ import ptr::{ null, addr_of };
|
||||||
import native_font::NativeFont;
|
import native_font::NativeFont;
|
||||||
import font_library::FontLibrary;
|
import font_library::FontLibrary;
|
||||||
|
|
||||||
// FIXME (rust 2708): convert this to a class
|
|
||||||
|
|
||||||
#[doc = "
|
#[doc = "
|
||||||
A font handle. Layout can use this to calculate glyph metrics
|
A font handle. Layout can use this to calculate glyph metrics
|
||||||
and the renderer can use it to render text.
|
and the renderer can use it to render text.
|
||||||
"]
|
"]
|
||||||
class Font {
|
struct Font {
|
||||||
let fontbuf: @~[u8];
|
let fontbuf: @~[u8];
|
||||||
let native_font: NativeFont;
|
let native_font: NativeFont;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ export FontLibrary, native;
|
||||||
import font::{Font, test_font_bin};
|
import font::{Font, test_font_bin};
|
||||||
import result::{result, ok, err};
|
import result::{result, ok, err};
|
||||||
|
|
||||||
class FontLibrary {
|
struct FontLibrary {
|
||||||
let native_lib: native::NativeFontLibrary;
|
let native_lib: native::NativeFontLibrary;
|
||||||
|
|
||||||
new() {
|
new() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import geom::point::Point2D;
|
||||||
type GlyphIndex = uint;
|
type GlyphIndex = uint;
|
||||||
|
|
||||||
#[doc="The position of a glyph on the screen."]
|
#[doc="The position of a glyph on the screen."]
|
||||||
class GlyphPos {
|
struct GlyphPos {
|
||||||
let advance: Point2D<au>;
|
let advance: Point2D<au>;
|
||||||
let offset: Point2D<au>;
|
let offset: Point2D<au>;
|
||||||
new(advance: Point2D<au>, offset: Point2D<au>) {
|
new(advance: Point2D<au>, offset: Point2D<au>) {
|
||||||
|
@ -17,7 +17,7 @@ class GlyphPos {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc="A single glyph."]
|
#[doc="A single glyph."]
|
||||||
class Glyph {
|
struct Glyph {
|
||||||
let index: GlyphIndex;
|
let index: GlyphIndex;
|
||||||
let pos: GlyphPos;
|
let pos: GlyphPos;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import freetype::bindgen::{
|
||||||
FT_Set_Char_Size
|
FT_Set_Char_Size
|
||||||
};
|
};
|
||||||
|
|
||||||
class FreeTypeNativeFont/& {
|
struct FreeTypeNativeFont/& {
|
||||||
let face: FT_Face;
|
let face: FT_Face;
|
||||||
|
|
||||||
new(face: FT_Face) {
|
new(face: FT_Face) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import cocoa::cg::cg::{
|
||||||
CGFontRelease
|
CGFontRelease
|
||||||
};
|
};
|
||||||
|
|
||||||
class QuartzNativeFont/& {
|
struct QuartzNativeFont/& {
|
||||||
let fontprov: CGDataProviderRef;
|
let fontprov: CGDataProviderRef;
|
||||||
let cgfont: CGFontRef;
|
let cgfont: CGFontRef;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import glyph::Glyph;
|
||||||
import shaper::shape_text;
|
import shaper::shape_text;
|
||||||
|
|
||||||
#[doc="A single, unbroken line of text."]
|
#[doc="A single, unbroken line of text."]
|
||||||
class TextRun {
|
struct TextRun {
|
||||||
let glyphs: ~[Glyph];
|
let glyphs: ~[Glyph];
|
||||||
|
|
||||||
new(font: Font, text: ~str) {
|
new(font: Font, text: ~str) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue