Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 6eba2da

Browse files
committed
Language changes.
1 parent 0d2d600 commit 6eba2da

File tree

8 files changed

+119
-118
lines changed

8 files changed

+119
-118
lines changed

color.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use float::round;
2-
use libc::types::os::arch::c95::c_double;
3-
use cmp::Eq;
1+
use core::float::round;
2+
use core::libc::types::os::arch::c95::c_double;
3+
use core::cmp::Eq;
44

55
#[deriving_eq]
66
pub struct Color {
@@ -49,7 +49,7 @@ pub fn hsl(h : float, s : float, l : float) -> Color {
4949
}
5050
5151
impl Color {
52-
fn print() -> ~str {
52+
fn print(&self) -> ~str {
5353
fmt!("rgba(%u,%u,%u,%f)", self.red as uint, self.green as uint,
5454
self.blue as uint, self.alpha)
5555
}

complete.rs

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use color::Color;
12
use select::SelectResults;
23
use computed::ComputedStyle;
34
use n::h::CssHintLength;
@@ -70,90 +71,90 @@ pub impl CompleteSelectResults {
7071
}
7172

7273
pub struct CompleteStyle {
73-
inner: ComputedStyle
74+
inner: ComputedStyle<'self>
7475
}
7576

76-
impl CompleteStyle {
77+
impl CompleteStyle<'self> {
7778

7879
// CSS 2.1, Section 8 - Box model
7980

80-
pub fn margin_top() -> CSSMargin {
81+
pub fn margin_top(&self) -> CSSMargin {
8182
strip(self.inner.margin_top())
8283
}
8384

84-
pub fn margin_right() -> CSSMargin {
85+
pub fn margin_right(&self) -> CSSMargin {
8586
strip(self.inner.margin_right())
8687
}
8788

88-
pub fn margin_bottom() -> CSSMargin {
89+
pub fn margin_bottom(&self) -> CSSMargin {
8990
strip(self.inner.margin_bottom())
9091
}
9192

92-
pub fn margin_left() -> CSSMargin {
93+
pub fn margin_left(&self) -> CSSMargin {
9394
strip(self.inner.margin_left())
9495
}
9596

96-
pub fn border_top_width() -> CSSBorderWidth {
97+
pub fn border_top_width(&self) -> CSSBorderWidth {
9798
strip(self.inner.border_top_width())
9899
}
99100

100-
pub fn border_right_width() -> CSSBorderWidth {
101+
pub fn border_right_width(&self) -> CSSBorderWidth {
101102
strip(self.inner.border_right_width())
102103
}
103104

104-
pub fn border_bottom_width() -> CSSBorderWidth {
105+
pub fn border_bottom_width(&self) -> CSSBorderWidth {
105106
strip(self.inner.border_bottom_width())
106107
}
107108

108-
pub fn border_left_width() -> CSSBorderWidth {
109+
pub fn border_left_width(&self) -> CSSBorderWidth {
109110
strip(self.inner.border_left_width())
110111
}
111112

112-
pub fn border_top_color() -> Color {
113+
pub fn border_top_color(&self) -> Color {
113114
strip(self.inner.border_top_color())
114115
}
115116

116-
pub fn border_top_color() -> Color {
117+
pub fn border_top_color(&self) -> Color {
117118
strip(self.inner.border_top_color())
118119
}
119120

120-
pub fn border_right_color() -> Color {
121+
pub fn border_right_color(&self) -> Color {
121122
strip(self.inner.border_right_color())
122123
}
123124

124-
pub fn border_bottom_color() -> Color {
125+
pub fn border_bottom_color(&self) -> Color {
125126
strip(self.inner.border_bottom_color())
126127
}
127128

128-
pub fn border_left_color() -> Color {
129+
pub fn border_left_color(&self) -> Color {
129130
strip(self.inner.border_left_color())
130131
}
131132

132133
// CSS 2.1, Section 9 - Visual formatting model
133134

134-
pub fn display(root: bool) -> CSSDisplay {
135+
pub fn display(&self, root: bool) -> CSSDisplay {
135136
strip(self.inner.display(root))
136137
}
137138

138-
pub fn position() -> CSSPosition {
139+
pub fn position(&self) -> CSSPosition {
139140
strip(self.inner.position())
140141
}
141142

142-
pub fn float() -> CSSFloat {
143+
pub fn float(&self) -> CSSFloat {
143144
strip(self.inner.float())
144145
}
145146

146147
// CSS 2.1, Section 10 - Visual formatting model details
147148

148-
pub fn width() -> CSSWidth {
149+
pub fn width(&self) -> CSSWidth {
149150
strip(self.inner.width())
150151
}
151152

152-
pub fn height() -> CSSHeight {
153+
pub fn height(&self) -> CSSHeight {
153154
strip(self.inner.height())
154155
}
155156

156-
pub fn line_height() -> CSSLineHeight {
157+
pub fn line_height(&self) -> CSSLineHeight {
157158
strip(self.inner.line_height())
158159
}
159160

@@ -165,35 +166,35 @@ impl CompleteStyle {
165166

166167
// CSS 2.1, Section 14 - Colors and Backgrounds
167168

168-
pub fn background_color() -> Color {
169+
pub fn background_color(&self) -> Color {
169170
strip(self.inner.background_color())
170171
}
171172

172-
pub fn color() -> Color {
173+
pub fn color(&self) -> Color {
173174
strip(self.inner.color())
174175
}
175176

176177
// CSS 2.1, Section 15 - Fonts
177178

178-
pub fn font_family() -> ~[CSSFontFamily] {
179+
pub fn font_family(&self) -> ~[CSSFontFamily] {
179180
strip(self.inner.font_family())
180181
}
181182

182-
pub fn font_style() -> CSSFontStyle {
183+
pub fn font_style(&self) -> CSSFontStyle {
183184
strip(self.inner.font_style())
184185
}
185186

186-
pub fn font_weight() -> CSSFontWeight {
187+
pub fn font_weight(&self) -> CSSFontWeight {
187188
strip(self.inner.font_weight())
188189
}
189190

190-
pub fn font_size() -> CSSFontSize {
191+
pub fn font_size(&self) -> CSSFontSize {
191192
strip(self.inner.font_size())
192193
}
193194

194195
// CSS 2.1, Section 16 - Text
195196

196-
pub fn text_align() -> CSSTextAlign {
197+
pub fn text_align(&self) -> CSSTextAlign {
197198
strip(self.inner.text_align())
198199
}
199200

computed.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,95 @@
11
use color::{Color, rgba};
22
use units::{Length, Px, Em, Pt};
33
use netsurfcss::util::css_fixed_to_float;
4-
use either::{Either, Left, Right};
4+
use core::either::{Either, Left, Right};
55
use n;
66
use values::*;
77

88
pub struct ComputedStyle {
9-
inner: n::c::CssComputedStyle
9+
inner: n::c::CssComputedStyle<'self>
1010
}
1111

12-
impl ComputedStyle {
12+
pub impl<'self> ComputedStyle<'self> {
1313

1414
// CSS 2.1, Section 8 - Box model
1515

16-
pub fn margin_top() -> CSSValue<CSSMargin> {
16+
pub fn margin_top(&self) -> CSSValue<CSSMargin> {
1717
convert_net_margin(self.inner.margin_top())
1818
}
1919

20-
pub fn margin_right() -> CSSValue<CSSMargin> {
20+
pub fn margin_right(&self) -> CSSValue<CSSMargin> {
2121
convert_net_margin(self.inner.margin_right())
2222
}
2323

24-
pub fn margin_bottom() -> CSSValue<CSSMargin> {
24+
pub fn margin_bottom(&self) -> CSSValue<CSSMargin> {
2525
convert_net_margin(self.inner.margin_bottom())
2626
}
2727

28-
pub fn margin_left() -> CSSValue<CSSMargin> {
28+
pub fn margin_left(&self) -> CSSValue<CSSMargin> {
2929
convert_net_margin(self.inner.margin_left())
3030
}
3131

32-
pub fn border_top_width() -> CSSValue<CSSBorderWidth> {
32+
pub fn border_top_width(&self) -> CSSValue<CSSBorderWidth> {
3333
convert_net_border_width(self.inner.border_top_width())
3434
}
3535

36-
pub fn border_right_width() -> CSSValue<CSSBorderWidth> {
36+
pub fn border_right_width(&self) -> CSSValue<CSSBorderWidth> {
3737
convert_net_border_width(self.inner.border_right_width())
3838
}
3939

40-
pub fn border_bottom_width() -> CSSValue<CSSBorderWidth> {
40+
pub fn border_bottom_width(&self) -> CSSValue<CSSBorderWidth> {
4141
convert_net_border_width(self.inner.border_bottom_width())
4242
}
4343

44-
pub fn border_left_width() -> CSSValue<CSSBorderWidth> {
44+
pub fn border_left_width(&self) -> CSSValue<CSSBorderWidth> {
4545
convert_net_border_width(self.inner.border_left_width())
4646
}
4747

48-
pub fn border_top_color() -> CSSValue<Color> {
48+
pub fn border_top_color(&self) -> CSSValue<Color> {
4949
convert_net_color_value(self.inner.border_top_color())
5050
}
5151

52-
pub fn border_top_color() -> CSSValue<Color> {
52+
pub fn border_top_color(&self) -> CSSValue<Color> {
5353
convert_net_color_value(self.inner.border_top_color())
5454
}
5555

56-
pub fn border_right_color() -> CSSValue<Color> {
56+
pub fn border_right_color(&self) -> CSSValue<Color> {
5757
convert_net_color_value(self.inner.border_right_color())
5858
}
5959

60-
pub fn border_bottom_color() -> CSSValue<Color> {
60+
pub fn border_bottom_color(&self) -> CSSValue<Color> {
6161
convert_net_color_value(self.inner.border_bottom_color())
6262
}
6363

64-
pub fn border_left_color() -> CSSValue<Color> {
64+
pub fn border_left_color(&self) -> CSSValue<Color> {
6565
convert_net_color_value(self.inner.border_left_color())
6666
}
6767

6868
// CSS 2.1, Section 9 - Visual formatting model
6969

70-
pub fn display(root: bool) -> CSSValue<CSSDisplay> {
70+
pub fn display(&self, root: bool) -> CSSValue<CSSDisplay> {
7171
convert_net_display_value(self.inner.display(root))
7272
}
7373

74-
pub fn position() -> CSSValue<CSSPosition> {
74+
pub fn position(&self) -> CSSValue<CSSPosition> {
7575
convert_net_position_value(self.inner.position())
7676
}
7777

78-
pub fn float() -> CSSValue<CSSFloat> {
78+
pub fn float(&self) -> CSSValue<CSSFloat> {
7979
convert_net_float_value(self.inner.float())
8080
}
8181

8282
// CSS 2.1, Section 10 - Visual formatting model details
8383

84-
pub fn width() -> CSSValue<CSSWidth> {
84+
pub fn width(&self) -> CSSValue<CSSWidth> {
8585
convert_net_width_value(self.inner.width())
8686
}
8787

88-
pub fn height() -> CSSValue<CSSHeight> {
88+
pub fn height(&self) -> CSSValue<CSSHeight> {
8989
convert_net_height_value(self.inner.height())
9090
}
9191

92-
pub fn line_height() -> CSSValue<CSSLineHeight> {
92+
pub fn line_height(&self) -> CSSValue<CSSLineHeight> {
9393
convert_net_line_height_value(self.inner.line_height())
9494
}
9595

@@ -101,35 +101,35 @@ impl ComputedStyle {
101101

102102
// CSS 2.1, Section 14 - Colors and Backgrounds
103103

104-
pub fn background_color() -> CSSValue<Color> {
104+
pub fn background_color(&self) -> CSSValue<Color> {
105105
convert_net_color_value(self.inner.background_color())
106106
}
107107

108-
pub fn color() -> CSSValue<Color> {
108+
pub fn color(&self) -> CSSValue<Color> {
109109
convert_net_color_value(self.inner.color())
110110
}
111111

112112
// CSS 2.1, Section 15 - Fonts
113113

114-
pub fn font_family() -> CSSValue<~[CSSFontFamily]> {
114+
pub fn font_family(&self) -> CSSValue<~[CSSFontFamily]> {
115115
convert_net_font_family_value(self.inner.font_family())
116116
}
117117

118-
pub fn font_style() -> CSSValue<CSSFontStyle> {
118+
pub fn font_style(&self) -> CSSValue<CSSFontStyle> {
119119
convert_net_font_style_value(self.inner.font_style())
120120
}
121121

122-
pub fn font_weight() -> CSSValue<CSSFontWeight> {
122+
pub fn font_weight(&self) -> CSSValue<CSSFontWeight> {
123123
convert_net_font_weight_value(self.inner.font_weight())
124124
}
125125

126-
pub fn font_size() -> CSSValue<CSSFontSize> {
126+
pub fn font_size(&self) -> CSSValue<CSSFontSize> {
127127
convert_net_font_size_value(self.inner.font_size())
128128
}
129129

130130
// CSS 2.1, Section 16 - Text
131131

132-
pub fn text_align() -> CSSValue<CSSTextAlign> {
132+
pub fn text_align(&self) -> CSSValue<CSSTextAlign> {
133133
convert_net_text_align_value(self.inner.text_align())
134134
}
135135

css.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod parser;
3838
mod test;
3939

4040
// Shortcuts to the netsurfcss types
41-
mod n {
41+
pub mod n {
4242
pub mod ll {
4343
pub use p = netsurfcss::ll::properties;
4444
pub use s = netsurfcss::ll::select;

parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Constructs a list of css style rules from a token stream
66
// are not as expected
77

88
use util::DataStream;
9-
use std::cell::Cell;
9+
use core::cell::Cell;
1010
use netsurfcss::stylesheet::{CssStylesheet, CssStylesheetParams, CssStylesheetParamsVersion1, css_stylesheet_create};
1111
use netsurfcss::types::CssLevel21;
1212
use netsurfcss::CssResult;

0 commit comments

Comments
 (0)