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

Commit

Permalink
Add border-style
Browse files Browse the repository at this point in the history
  • Loading branch information
sammykim committed Aug 21, 2013
1 parent a55ab9e commit 5b4daf3
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
18 changes: 18 additions & 0 deletions ll.rs
Expand Up @@ -301,6 +301,20 @@ pub mod properties {
pub static CSS_COLOR_INHERIT: css_color_e = 0x0;
pub static CSS_COLOR_COLOR: css_color_e = 0x1;

pub type css_border_style_e = c_enum;

pub static CSS_BORDER_STYLE_INHERIT: css_border_style_e = 0x0;
pub static CSS_BORDER_STYLE_NONE: css_border_style_e = 0x1;
pub static CSS_BORDER_STYLE_HIDDEN: css_border_style_e = 0x2;
pub static CSS_BORDER_STYLE_DOTTED: css_border_style_e = 0x3;
pub static CSS_BORDER_STYLE_DASHED: css_border_style_e = 0x4;
pub static CSS_BORDER_STYLE_SOLID: css_border_style_e = 0x5;
pub static CSS_BORDER_STYLE_DOUBLE: css_border_style_e = 0x6;
pub static CSS_BORDER_STYLE_GROOVE: css_border_style_e = 0x7;
pub static CSS_BORDER_STYLE_RIDGE: css_border_style_e = 0x8;
pub static CSS_BORDER_STYLE_INSET: css_border_style_e = 0x9;
pub static CSS_BORDER_STYLE_OUTSET: css_border_style_e = 0xa;

pub type css_border_width_e = c_enum;

pub static CSS_BORDER_WIDTH_INHERIT: css_border_width_e = 0x0;
Expand Down Expand Up @@ -600,6 +614,10 @@ pub mod computed {

pub fn css_computed_color(style: *css_computed_style, color: *mut css_color) -> uint8_t;
pub fn css_computed_background_color(style: *css_computed_style, color: *mut css_color) -> uint8_t;
pub fn css_computed_border_top_style(style: *css_computed_style) -> uint8_t;
pub fn css_computed_border_right_style(style: *css_computed_style) -> uint8_t;
pub fn css_computed_border_bottom_style(style: *css_computed_style) -> uint8_t;
pub fn css_computed_border_left_style(style: *css_computed_style) -> uint8_t;
pub fn css_computed_border_top_width(style: *css_computed_style, length: *mut css_fixed, unit: *mut css_unit) -> uint8_t;
pub fn css_computed_border_right_width(style: *css_computed_style, length: *mut css_fixed, unit: *mut css_unit) -> uint8_t;
pub fn css_computed_border_bottom_width(style: *css_computed_style, length: *mut css_fixed, unit: *mut css_unit) -> uint8_t;
Expand Down
67 changes: 66 additions & 1 deletion netsurfcss.rc
Expand Up @@ -1107,7 +1107,7 @@ pub mod computed {
use properties::CssPropFontSize;
use hint::CssHint;
use select::CssSelectResults;
use values::{CssColorValue, CssMarginValue, CssPaddingValue, CssBorderWidthValue, CssDisplayValue};
use values::{CssColorValue, CssMarginValue, CssPaddingValue, CssBorderStyleValue, CssBorderWidthValue, CssDisplayValue};
use values::{CssFloatValue, CssClearValue, CssPositionValue, CssWidthValue, CssHeightValue, CssFontFamilyValue};
use values::{CssFontSizeValue, CssFontStyleValue, CssFontWeightValue, CssTextAlignValue, CssTextDecorationValue};
use values::{CssLineHeightValue, CssVerticalAlignValue};
Expand Down Expand Up @@ -1143,6 +1143,38 @@ pub mod computed {
CssColorValue::new(type_, color)
}

pub fn border_top_style(&self) -> CssBorderStyleValue {
let mut length = 0;
let type_ = unsafe { css_computed_border_top_style(self.computed_style) };
let type_ = type_ as css_border_style_e;

CssBorderStyleValue::new(type_)
}

pub fn border_right_style(&self) -> CssBorderStyleValue {
let mut length = 0;
let type_ = unsafe { css_computed_border_right_style(self.computed_style) };
let type_ = type_ as css_border_style_e;

CssBorderStyleValue::new(type_)
}

pub fn border_bottom_style(&self) -> CssBorderStyleValue {
let mut length = 0;
let type_ = unsafe { css_computed_border_bottom_style(self.computed_style) };
let type_ = type_ as css_border_style_e;

CssBorderStyleValue::new(type_)
}

pub fn border_left_style(&self) -> CssBorderStyleValue {
let mut length = 0;
let type_ = unsafe { css_computed_border_left_style(self.computed_style) };
let type_ = type_ as css_border_style_e;

CssBorderStyleValue::new(type_)
}

pub fn border_top_width(&self) -> CssBorderWidthValue {
let mut length = 0;
let mut unit = 0;
Expand Down Expand Up @@ -1530,6 +1562,39 @@ mod values {
}
}

pub enum CssBorderStyleValue {
CssBorderStyleInherit,
CssBorderStyleNone,
CssBorderStyleHidden,
CssBorderStyleDotted,
CssBorderStyleDashed,
CssBorderStyleSolid,
CssBorderStyleDouble,
CssBorderStyleGroove,
CssBorderStyleRidge,
CssBorderStyleInset,
CssBorderStyleOutset
}

impl CssBorderStyleValue {
pub fn new(type_: css_border_style_e) -> CssBorderStyleValue {
match type_ {
CSS_BORDER_STYLE_INHERIT => CssBorderStyleInherit,
CSS_BORDER_STYLE_NONE => CssBorderStyleNone,
CSS_BORDER_STYLE_HIDDEN => CssBorderStyleHidden,
CSS_BORDER_STYLE_DOTTED => CssBorderStyleDotted,
CSS_BORDER_STYLE_DASHED => CssBorderStyleDashed,
CSS_BORDER_STYLE_SOLID => CssBorderStyleSolid,
CSS_BORDER_STYLE_DOUBLE => CssBorderStyleDouble,
CSS_BORDER_STYLE_GROOVE => CssBorderStyleGroove,
CSS_BORDER_STYLE_RIDGE => CssBorderStyleRidge,
CSS_BORDER_STYLE_INSET => CssBorderStyleInset,
CSS_BORDER_STYLE_OUTSET => CssBorderStyleOutset,
_ => unimpl("border style")
}
}
}

pub enum CssBorderWidthValue {
CssBorderWidthInherit,
CssBorderWidthThin,
Expand Down

0 comments on commit 5b4daf3

Please sign in to comment.