mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
auto merge of #5121 : glennw/servo/transparent-hover, r=mbrubeck
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.
This commit is contained in:
commit
ac4a690e8f
2 changed files with 12 additions and 12 deletions
|
@ -28,6 +28,7 @@ use azure::azure_hl::{Color};
|
||||||
|
|
||||||
use collections::dlist::{self, DList};
|
use collections::dlist::{self, DList};
|
||||||
use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D};
|
use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D};
|
||||||
|
use geom::approxeq::ApproxEq;
|
||||||
use geom::num::Zero;
|
use geom::num::Zero;
|
||||||
use libc::uintptr_t;
|
use libc::uintptr_t;
|
||||||
use paint_task::PaintLayer;
|
use paint_task::PaintLayer;
|
||||||
|
@ -912,8 +913,10 @@ impl DisplayItem {
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
DisplayItem::SolidColorClass(ref solid_color) => {
|
DisplayItem::SolidColorClass(ref solid_color) => {
|
||||||
|
if !solid_color.color.a.approx_eq(&0.0) {
|
||||||
paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color)
|
paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DisplayItem::TextClass(ref text) => {
|
DisplayItem::TextClass(ref text) => {
|
||||||
debug!("Drawing text at {:?}.", text.base.bounds);
|
debug!("Drawing text at {:?}.", text.base.bounds);
|
||||||
|
|
|
@ -21,7 +21,6 @@ use list_item::ListItemFlow;
|
||||||
use model;
|
use model;
|
||||||
use util::{OpaqueNodeMethods, ToGfxColor};
|
use util::{OpaqueNodeMethods, ToGfxColor};
|
||||||
|
|
||||||
use geom::approxeq::ApproxEq;
|
|
||||||
use geom::{Point2D, Rect, Size2D, SideOffsets2D};
|
use geom::{Point2D, Rect, Size2D, SideOffsets2D};
|
||||||
use gfx::color;
|
use gfx::color;
|
||||||
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem};
|
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem};
|
||||||
|
@ -291,7 +290,6 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
// inefficient. What we really want is something like "nearest ancestor element that
|
// inefficient. What we really want is something like "nearest ancestor element that
|
||||||
// doesn't have a fragment".
|
// doesn't have a fragment".
|
||||||
let background_color = style.resolve_color(style.get_background().background_color);
|
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 {
|
display_list.push(DisplayItem::SolidColorClass(box SolidColorDisplayItem {
|
||||||
base: BaseDisplayItem::new(*absolute_bounds,
|
base: BaseDisplayItem::new(*absolute_bounds,
|
||||||
DisplayItemMetadata::new(self.node,
|
DisplayItemMetadata::new(self.node,
|
||||||
|
@ -300,7 +298,6 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
clip.clone()),
|
clip.clone()),
|
||||||
color: background_color.to_gfx_color(),
|
color: background_color.to_gfx_color(),
|
||||||
}), level);
|
}), level);
|
||||||
}
|
|
||||||
|
|
||||||
// The background image is painted on top of the background color.
|
// The background image is painted on top of the background color.
|
||||||
// Implements background image, per spec:
|
// Implements background image, per spec:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue