servo/components/gfx
bors-servo f29ddb4b5d Auto merge of #7577 - bjwbell:borders_pixel_rounding_bug, r=mbrubeck
gfx: Fix bug with 1px width borders disappearing

In to_nearest_azure_rect when rounding to pixel coordinates, maintain
the invariant of rect non-overlap (if before rounding two rects don't overlap).

The previous code rounded the rect top left corner to the nearest pixel with
the size rounded to the nearest pixel multiple which can violate the
non-overlap condition, e.g.
10px×9.60px at (0px,6.6px) & 10px×9.60px at (0px,16.2px)
would round to
10px×10.0px at (0px,7.0px) & 10px×10.0px at (0px,16.0px), which overlap.

Instead round each corner to the nearest pixel.

For rects that dont need to satify the non-overlap condition and with
width or height between 0.5px and 1px, rounding each rect corner to the
nearest pixel can yield an empty rect e.g.
10px×0.6px at 0px,28.56px -> 10px×0px at 0px,29px.

For this scenario a new function to_nearest_non_empty_azure_rect
rounds the rect top left corner to the nearest pixel and the rect size
to the nearest pixel multiple. It's possible for non-overlapping rects
after this rounding to overlap.

This should fix https://github.com/servo/servo/issues/7184 "rounding ...borders not to be visible", without breaking https://github.com/servo/servo/issues/7152 "Underlines less than 1px high sometimes invisible".

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7577)
<!-- Reviewable:end -->
2015-09-09 13:30:41 -06:00
..
display_list Layerize StackingContexts that are on top of layers 2015-09-09 09:13:14 -07:00
platform Implement get_table_for_tag on FreeType 2015-09-03 13:35:44 -07:00
text Fix match_refs and let_returns in layout, address review changes 2015-09-04 18:30:46 +05:30
Cargo.toml servo: Update ipc-channel to pick up bincode support. 2015-08-08 09:43:53 -07:00
filters.rs sort all uses 2015-08-20 20:47:12 +08:00
font.rs Auto merge of #7523 - eefriedman:unnecessary-unsafe, r=SimonSapin 2015-09-09 00:05:17 -06:00
font_cache_task.rs Fix up some unnecessary uses of unsafe. 2015-09-02 15:50:17 -07:00
font_context.rs make test-tidy check that = have space after them 2015-09-01 07:18:19 -04:00
font_template.rs Upgrade to rustc 1.4.0-dev (cb9323ec0 2015-09-01) 2015-09-02 09:22:17 +02:00
lib.rs Implement get_table_for_tag on FreeType 2015-09-03 13:35:44 -07:00
paint_context.rs gfx: Fix bug with 1px width borders disappearing 2015-09-09 03:20:52 -07:00
paint_task.rs Have PaintLayers own StackingContexts instead of the opposite 2015-09-04 15:07:09 -07:00