Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRender border #1276
Render border #1276
Conversation
highfive
commented
Nov 18, 2013
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @kmcallister (or someone else) soon. |
| let mut stroke_opts = StrokeOptions(0 as AzFloat, 10 as AzFloat); | ||
| let mut dash: [AzFloat, ..2] = [0 as AzFloat, 0 as AzFloat]; | ||
| //let mut start = Point2D(0.0 as f32,0.0 as f32); | ||
| //let mut end = Point2D(0.0 as f32,0.0 as f32); |
This comment has been minimized.
This comment has been minimized.
| dash[0] = border_width * 3 as AzFloat; | ||
| dash[1] = border_width * 3 as AzFloat; | ||
| stroke_opts.mDashPattern = vec::raw::to_ptr(dash); | ||
| stroke_opts.mDashLength = dash.len() as size_t; |
This comment has been minimized.
This comment has been minimized.
pcwalton
Nov 18, 2013
Contributor
Can you change this to:
let border_width = match direction {
Top => border.top,
Left => border.left,
...
};
stroke_opts.line_width = border_width;
dash[0] = border_width * 3 as AzFloat;
dash[1] = border_width * 3 as AzFloat;
stroke_opts.mDashPattern = vec::raw::to_ptr(dash);
stroke_opts.mDashLength = dash.len() as size_t;
Just to avoid duplicating the stroke option setting code.
| let left_top = Point2D(rect.origin.x, rect.origin.y); | ||
| let right_top = Point2D(rect.origin.x + rect.size.width, rect.origin.y); | ||
| let left_bottom = Point2D(rect.origin.x, rect.origin.y + rect.size.height); | ||
| let right_bottom = Point2D(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); |
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn draw_solid_border_segment(&self, direction: Direction, bounds: &Rect<Au>, border: SideOffsets2D<f32>, color: Color) { | ||
| let rect = bounds.to_azure_rect(); | ||
| let draw_opts = DrawOptions(1 as AzFloat,0 as uint16_t); |
This comment has been minimized.
This comment has been minimized.
pcwalton
Nov 18, 2013
Contributor
nit: fix indentation.
Also I'd write this as:
let draw_opts = DrawOptions(1.0, 0);
| //let mut start = Point2D(0.0 as f32,0.0 as f32); | ||
| //let mut end = Point2D(0.0 as f32,0.0 as f32); | ||
|
|
||
| stroke_opts.set_cap_style(AZ_CAP_BUTT as u8); |
This comment has been minimized.
This comment has been minimized.
| let rect = bounds.to_azure_rect(); | ||
| let draw_opts = DrawOptions(1 as AzFloat, 0 as uint16_t); | ||
| let mut stroke_opts = StrokeOptions(0 as AzFloat, 10 as AzFloat); | ||
| let mut dash: [AzFloat, ..2] = [0 as AzFloat, 0 as AzFloat]; |
This comment has been minimized.
This comment has been minimized.
| self.draw_border_segment(Top, bounds, border, color, style); | ||
| self.draw_border_segment(Right, bounds, border, color, style); | ||
| self.draw_border_segment(Bottom, bounds, border, color, style); | ||
| self.draw_border_segment(Left, bounds, border, color, style); |
This comment has been minimized.
This comment has been minimized.
| fn apply_border_style(style: border_style::T, border_width: AzFloat, dash: &mut [AzFloat], stroke_opts: &mut StrokeOptions){ | ||
| match style{ | ||
| fn draw_border_segment(&self, direction: Direction, bounds: &Rect<Au>, border: SideOffsets2D<f32>, color: SideOffsets2D<Color>, style: SideOffsets2D<border_style::T>) { | ||
| //let mut color_select = color.top; |
This comment has been minimized.
This comment has been minimized.
| Left => {(style.left, color.left)} | ||
| Right => {(style.right, color.right)} | ||
| Bottom => {(style.bottom, color.bottom)} | ||
| }; |
This comment has been minimized.
This comment has been minimized.
pcwalton
Nov 18, 2013
Contributor
nit: fix indentation.
Also this can be written as:
let (style_select, color_select) = match direction {
Top => (style.top, color.top),
Left => (style.left, color.left),
...
};
(i.e. without the {})
| path_builder.line_to(right_bottom + Point2D(-border.right, -border.bottom)); | ||
| path_builder.line_to(right_bottom); | ||
| } | ||
| } |
This comment has been minimized.
This comment has been minimized.
| } | ||
| }; | ||
|
|
||
| self.draw_target.stroke_line(start, |
This comment has been minimized.
This comment has been minimized.
Implemented a border which was the solid type. Because of not support css pseudo element(:before, :after), content in css property and base64, So we couldn't test Acid2(http://www.webstandards.org/files/acid2/test.html).
|
Looks like a rebase is required before we can retry merging. |
|
Ok, I will be a rebase, Thank you, jdm! |
|
Nice work, Hyunjune! °¨»çÇÕ´Ï´Ù
|
|
@brson nice mojibake :)
|
|
We rebased them again. |
|
Rebased in #1322. |
Implemented a border which was the solid type. Because of not support css pseudo element(:before, :after), content in css property and base64, So we couldn't test Acid2(http://www.webstandards.org/files/acid2/test.html). Rebase of #1276.
hyunjunekim commentedNov 18, 2013
Implemented a border which was the solid type.
Because of not support css pseudo element(:before, :after), content in css property and base64, So we couldn't test Acid2(http://www.webstandards.org/files/acid2/test.html).