Fix making an iframe visible when it was initially set to display:none.

When an iframe is created with display:none it sets the root layer to be
zero width and height. When updating the rect of the iframe from layout
send the entire rect rather than just the new origin, which handles the case
where the iframe has been made visible and now has a non-zero rect.
This commit is contained in:
Glenn Watson 2015-02-25 13:46:02 +10:00
parent cbc4b9520e
commit f68386f0fa
7 changed files with 48 additions and 14 deletions

View file

@ -315,9 +315,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
chan.send(Some(self.window.native_metadata())).unwrap();
}
(Msg::SetLayerOrigin(pipeline_id, layer_id, origin),
(Msg::SetLayerRect(pipeline_id, layer_id, rect),
ShutdownState::NotShuttingDown) => {
self.set_layer_origin(pipeline_id, layer_id, origin);
self.set_layer_rect(pipeline_id, layer_id, &rect);
}
(Msg::AssignPaintedBuffers(pipeline_id, epoch, replies), ShutdownState::NotShuttingDown) => {
@ -721,15 +721,15 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.composition_request = CompositionRequest::CompositeOnScrollTimeout(timestamp);
}
fn set_layer_origin(&mut self,
pipeline_id: PipelineId,
layer_id: LayerId,
new_origin: Point2D<f32>) {
fn set_layer_rect(&mut self,
pipeline_id: PipelineId,
layer_id: LayerId,
new_rect: &Rect<f32>) {
match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
Some(ref layer) => {
layer.bounds.borrow_mut().origin = Point2D::from_untyped(&new_origin)
*layer.bounds.borrow_mut() = Rect::from_untyped(new_rect)
}
None => panic!("Compositor received SetLayerOrigin for nonexistent \
None => panic!("Compositor received SetLayerRect for nonexistent \
layer: {:?}", pipeline_id),
};

View file

@ -188,8 +188,8 @@ pub enum Msg {
/// Tells the compositor to create a descendant layer for a pipeline if necessary (i.e. if no
/// layer with that ID exists).
CreateOrUpdateDescendantLayer(LayerProperties),
/// Alerts the compositor that the specified layer's origin has changed.
SetLayerOrigin(PipelineId, LayerId, Point2D<f32>),
/// Alerts the compositor that the specified layer's rect has changed.
SetLayerRect(PipelineId, LayerId, Rect<f32>),
/// Scroll a page in a window
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>),
/// Requests that the compositor assign the painted buffers to the given layers.
@ -231,7 +231,7 @@ impl Debug for Msg {
Msg::GetGraphicsMetadata(..) => write!(f, "GetGraphicsMetadata"),
Msg::CreateOrUpdateBaseLayer(..) => write!(f, "CreateOrUpdateBaseLayer"),
Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"),
Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"),
Msg::SetLayerRect(..) => write!(f, "SetLayerRect"),
Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"),
Msg::AssignPaintedBuffers(..) => write!(f, "AssignPaintedBuffers"),
Msg::ChangeReadyState(..) => write!(f, "ChangeReadyState"),

View file

@ -681,10 +681,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
initial_viewport: rect.size * ScaleFactor(1.0),
device_pixel_ratio: device_pixel_ratio,
})).unwrap();
compositor_proxy.send(CompositorMsg::SetLayerOrigin(
compositor_proxy.send(CompositorMsg::SetLayerRect(
pipeline.id,
LayerId::null(),
rect.to_untyped().origin));
rect.to_untyped()));
} else {
already_sent.insert(pipeline.id);
}

View file

@ -104,7 +104,7 @@ impl CompositorEventListener for NullCompositor {
Msg::CreateOrUpdateBaseLayer(..) |
Msg::CreateOrUpdateDescendantLayer(..) |
Msg::SetLayerOrigin(..) |
Msg::SetLayerRect(..) |
Msg::AssignPaintedBuffers(..) |
Msg::ChangeReadyState(..) |
Msg::ChangePaintState(..) |