This repository was archived by the owner on Jul 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,10 @@ impl<'self> CompleteStyle<'self> {
175
175
strip ( self . inner . float ( ) )
176
176
}
177
177
178
+ pub fn clear ( & self ) -> CSSClear {
179
+ strip ( self . inner . clear ( ) )
180
+ }
181
+
178
182
// CSS 2.1, Section 10 - Visual formatting model details
179
183
180
184
pub fn width ( & self ) -> CSSWidth {
Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ impl<'self> ComputedStyle<'self> {
95
95
convert_net_float_value ( self . inner . float ( ) )
96
96
}
97
97
98
+ pub fn clear ( & self ) -> CSSValue < CSSClear > {
99
+ convert_net_clear_value ( self . inner . clear ( ) )
100
+ }
101
+
98
102
// CSS 2.1, Section 10 - Visual formatting model details
99
103
100
104
pub fn width ( & self ) -> CSSValue < CSSWidth > {
@@ -266,6 +270,16 @@ fn convert_net_float_value(value: n::v::CssFloatValue) -> CSSValue<CSSFloat> {
266
270
}
267
271
}
268
272
273
+ fn convert_net_clear_value ( value : n:: v:: CssClearValue ) -> CSSValue < CSSClear > {
274
+ match value {
275
+ n:: v:: CssClearInherit => Inherit ,
276
+ n:: v:: CssClearNone => Specified ( CSSClearNone ) ,
277
+ n:: v:: CssClearLeft => Specified ( CSSClearLeft ) ,
278
+ n:: v:: CssClearRight => Specified ( CSSClearRight ) ,
279
+ n:: v:: CssClearBoth => Specified ( CSSClearBoth )
280
+ }
281
+ }
282
+
269
283
fn convert_net_position_value ( value : n:: v:: CssPositionValue ) -> CSSValue < CSSPosition > {
270
284
match value {
271
285
n:: v:: CssPositionInherit => Inherit ,
Original file line number Diff line number Diff line change @@ -266,6 +266,14 @@ fn test_float() {
266
266
}
267
267
}
268
268
269
+ #[test]
270
+ fn test_clear() {
271
+ let style = " div { clear: both; } ";
272
+ do single_div_test(style) |computed| {
273
+ assert!(computed.clear() == Specified(CSSClearBoth));
274
+ }
275
+ }
276
+
269
277
#[test]
270
278
fn test_position() {
271
279
let style = " div { position: static ; } ";
Original file line number Diff line number Diff line change @@ -136,6 +136,14 @@ pub enum CSSFloat {
136
136
CSSFloatNone
137
137
}
138
138
139
+ #[ deriving( Eq ) ]
140
+ pub enum CSSClear {
141
+ CSSClearLeft ,
142
+ CSSClearRight ,
143
+ CSSClearBoth ,
144
+ CSSClearNone
145
+ }
146
+
139
147
#[ deriving( Eq ) ]
140
148
pub enum CSSDirection {
141
149
CSSDirectionLtr ,
You can’t perform that action at this time.
0 commit comments