diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2015-03-03 09:15:11 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-03-03 09:15:11 +1000 |
commit | 0817f9ad44d76cf3e98505dd654272c6701d85e3 (patch) | |
tree | f92a0f9848af5053f7db7979feeae7f2b07e911c | |
parent | 93d1f40a96df69eb9d38890df96c621e180d78cc (diff) | |
download | servo-0817f9ad44d76cf3e98505dd654272c6701d85e3.tar.gz servo-0817f9ad44d76cf3e98505dd654272c6701d85e3.zip |
Fix hover state on elements with transparent background colours.
Move culling of transparent display items to paint task rather than display list builder, so that hit testing detects mouse over on transparent background elements.
-rw-r--r-- | components/gfx/display_list/mod.rs | 5 | ||||
-rw-r--r-- | components/layout/display_list_builder.rs | 19 |
2 files changed, 12 insertions, 12 deletions
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 7ad745a1ae9..9ba4d93e9e9 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -28,6 +28,7 @@ use azure::azure_hl::{Color}; use collections::dlist::{self, DList}; use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D}; +use geom::approxeq::ApproxEq; use geom::num::Zero; use libc::uintptr_t; use paint_task::PaintLayer; @@ -912,7 +913,9 @@ impl DisplayItem { match *self { DisplayItem::SolidColorClass(ref solid_color) => { - paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color) + if !solid_color.color.a.approx_eq(&0.0) { + paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color) + } } DisplayItem::TextClass(ref text) => { diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 25a292e2780..039dbc9c376 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -21,7 +21,6 @@ use list_item::ListItemFlow; use model; use util::{OpaqueNodeMethods, ToGfxColor}; -use geom::approxeq::ApproxEq; use geom::{Point2D, Rect, Size2D, SideOffsets2D}; use gfx::color; use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem}; @@ -291,16 +290,14 @@ impl FragmentDisplayListBuilding for Fragment { // inefficient. What we really want is something like "nearest ancestor element that // doesn't have a fragment". let background_color = style.resolve_color(style.get_background().background_color); - if !background_color.alpha.approx_eq(&0.0) { - display_list.push(DisplayItem::SolidColorClass(box SolidColorDisplayItem { - base: BaseDisplayItem::new(*absolute_bounds, - DisplayItemMetadata::new(self.node, - style, - Cursor::DefaultCursor), - clip.clone()), - color: background_color.to_gfx_color(), - }), level); - } + display_list.push(DisplayItem::SolidColorClass(box SolidColorDisplayItem { + base: BaseDisplayItem::new(*absolute_bounds, + DisplayItemMetadata::new(self.node, + style, + Cursor::DefaultCursor), + clip.clone()), + color: background_color.to_gfx_color(), + }), level); // The background image is painted on top of the background color. // Implements background image, per spec: |