@@ -734,7 +734,7 @@ where
734734 top_level_browsing_context_id : TopLevelBrowsingContextId ,
735735 parent_pipeline_id : Option < PipelineId > ,
736736 opener : Option < BrowsingContextId > ,
737- initial_window_size : Option < TypedSize2D < f32 , CSSPixel > > ,
737+ initial_window_size : TypedSize2D < f32 , CSSPixel > ,
738738 // TODO: we have to provide ownership of the LoadData
739739 // here, because it will be send on an ipc channel,
740740 // and ipc channels take onership of their data.
@@ -889,6 +889,7 @@ where
889889 top_level_id : TopLevelBrowsingContextId ,
890890 pipeline_id : PipelineId ,
891891 parent_pipeline_id : Option < PipelineId > ,
892+ size : TypedSize2D < f32 , CSSPixel > ,
892893 is_private : bool ,
893894 is_visible : bool ,
894895 ) {
@@ -898,6 +899,7 @@ where
898899 top_level_id,
899900 pipeline_id,
900901 parent_pipeline_id,
902+ size,
901903 is_private,
902904 is_visible,
903905 ) ;
@@ -1599,14 +1601,22 @@ where
15991601 EmbedderMsg :: Panic ( reason, backtrace) ,
16001602 ) ) ;
16011603
1602- let browsing_context = self . browsing_contexts . get ( & browsing_context_id) ;
1603- let window_size = browsing_context. and_then ( |ctx| ctx. size ) ;
1604- let pipeline_id = browsing_context. map ( |ctx| ctx. pipeline_id ) ;
1605- let is_visible = browsing_context. map ( |ctx| ctx. is_visible ) ;
1604+ // The none branch should be unreachable.
1605+ let browsing_context = match self . browsing_contexts . get ( & browsing_context_id) {
1606+ Some ( context) => context,
1607+ None => return ,
1608+ } ;
1609+ let window_size = browsing_context. size ;
1610+ let pipeline_id = browsing_context. pipeline_id ;
1611+ let is_visible = browsing_context. is_visible ;
16061612
1607- let pipeline = pipeline_id. and_then ( |id| self . pipelines . get ( & id) ) ;
1608- let pipeline_url = pipeline. map ( |pipeline| pipeline. url . clone ( ) ) ;
1609- let opener = pipeline. and_then ( |pipeline| pipeline. opener ) ;
1613+ // the none branch should be unreachable.
1614+ let pipeline = match self . pipelines . get ( & pipeline_id) {
1615+ Some ( p) => p,
1616+ None => return ,
1617+ } ;
1618+ let pipeline_url = pipeline. url . clone ( ) ;
1619+ let opener = pipeline. opener ;
16101620
16111621 self . close_browsing_context_children (
16121622 browsing_context_id,
@@ -1616,10 +1626,8 @@ where
16161626
16171627 let failure_url = ServoUrl :: parse ( "about:failure" ) . expect ( "infallible" ) ;
16181628
1619- if let Some ( pipeline_url) = pipeline_url {
1620- if pipeline_url == failure_url {
1621- return error ! ( "about:failure failed" ) ;
1622- }
1629+ if pipeline_url == failure_url {
1630+ return error ! ( "about:failure failed" ) ;
16231631 }
16241632
16251633 warn ! ( "creating replacement pipeline for about:failure" ) ;
@@ -1638,7 +1646,7 @@ where
16381646 load_data. clone ( ) ,
16391647 sandbox,
16401648 is_private,
1641- is_visible. unwrap_or ( true ) ,
1649+ is_visible,
16421650 ) ;
16431651 self . add_pending_change ( SessionHistoryChange {
16441652 top_level_browsing_context_id : top_level_browsing_context_id,
@@ -1737,7 +1745,7 @@ where
17371745 top_level_browsing_context_id,
17381746 None ,
17391747 None ,
1740- Some ( window_size) ,
1748+ window_size,
17411749 load_data. clone ( ) ,
17421750 sandbox,
17431751 is_private,
@@ -3275,6 +3283,7 @@ where
32753283 change. top_level_browsing_context_id ,
32763284 change. new_pipeline_id ,
32773285 new_context_info. parent_pipeline_id ,
3286+ self . window_size . initial_viewport , //XXXjdm is this valid?
32783287 new_context_info. is_private ,
32793288 new_context_info. is_visible ,
32803289 ) ;
@@ -3612,44 +3621,41 @@ where
36123621 }
36133622
36143623 // Check the visible rectangle for this pipeline. If the constellation has received a
3615- // size for the pipeline, then its painting should be up to date. If the constellation
3616- // *hasn't* received a size, it could be that the layer was hidden by script before the
3617- // compositor discovered it, so we just don't check the layer.
3618- if let Some ( size) = browsing_context. size {
3619- // If the rectangle for this pipeline is zero sized, it will
3620- // never be painted. In this case, don't query the layout
3621- // thread as it won't contribute to the final output image.
3622- if size == TypedSize2D :: zero ( ) {
3623- continue ;
3624- }
3624+ // size for the pipeline, then its painting should be up to date.
3625+ //
3626+ // If the rectangle for this pipeline is zero sized, it will
3627+ // never be painted. In this case, don't query the layout
3628+ // thread as it won't contribute to the final output image.
3629+ if browsing_context. size == TypedSize2D :: zero ( ) {
3630+ continue ;
3631+ }
36253632
3626- // Get the epoch that the compositor has drawn for this pipeline.
3627- let compositor_epoch = pipeline_states. get ( & browsing_context. pipeline_id ) ;
3628- match compositor_epoch {
3629- Some ( compositor_epoch) => {
3630- // Synchronously query the layout thread to see if the current
3631- // epoch matches what the compositor has drawn. If they match
3632- // (and script is idle) then this pipeline won't change again
3633- // and can be considered stable.
3634- let message = LayoutControlMsg :: GetCurrentEpoch ( epoch_sender. clone ( ) ) ;
3635- if let Err ( e) = pipeline. layout_chan . send ( message) {
3636- warn ! ( "Failed to send GetCurrentEpoch ({})." , e) ;
3637- }
3638- match epoch_receiver. recv ( ) {
3639- Err ( e) => warn ! ( "Failed to receive current epoch ({})." , e) ,
3640- Ok ( layout_thread_epoch) => {
3641- if layout_thread_epoch != * compositor_epoch {
3642- return ReadyToSave :: EpochMismatch ;
3643- }
3644- } ,
3645- }
3646- } ,
3647- None => {
3648- // The compositor doesn't know about this pipeline yet.
3649- // Assume it hasn't rendered yet.
3650- return ReadyToSave :: PipelineUnknown ;
3651- } ,
3652- }
3633+ // Get the epoch that the compositor has drawn for this pipeline.
3634+ let compositor_epoch = pipeline_states. get ( & browsing_context. pipeline_id ) ;
3635+ match compositor_epoch {
3636+ Some ( compositor_epoch) => {
3637+ // Synchronously query the layout thread to see if the current
3638+ // epoch matches what the compositor has drawn. If they match
3639+ // (and script is idle) then this pipeline won't change again
3640+ // and can be considered stable.
3641+ let message = LayoutControlMsg :: GetCurrentEpoch ( epoch_sender. clone ( ) ) ;
3642+ if let Err ( e) = pipeline. layout_chan . send ( message) {
3643+ warn ! ( "Failed to send GetCurrentEpoch ({})." , e) ;
3644+ }
3645+ match epoch_receiver. recv ( ) {
3646+ Err ( e) => warn ! ( "Failed to receive current epoch ({})." , e) ,
3647+ Ok ( layout_thread_epoch) => {
3648+ if layout_thread_epoch != * compositor_epoch {
3649+ return ReadyToSave :: EpochMismatch ;
3650+ }
3651+ } ,
3652+ }
3653+ } ,
3654+ None => {
3655+ // The compositor doesn't know about this pipeline yet.
3656+ // Assume it hasn't rendered yet.
3657+ return ReadyToSave :: PipelineUnknown ;
3658+ } ,
36533659 }
36543660 }
36553661
@@ -3715,7 +3721,7 @@ where
37153721 browsing_context_id : BrowsingContextId ,
37163722 ) {
37173723 if let Some ( browsing_context) = self . browsing_contexts . get_mut ( & browsing_context_id) {
3718- browsing_context. size = Some ( new_size. initial_viewport ) ;
3724+ browsing_context. size = new_size. initial_viewport ;
37193725 // Send Resize (or ResizeInactive) messages to each pipeline in the frame tree.
37203726 let pipeline_id = browsing_context. pipeline_id ;
37213727 let pipeline = match self . pipelines . get ( & pipeline_id) {
@@ -4001,7 +4007,6 @@ where
40014007 . map ( |pipeline| {
40024008 let mut frame_tree = SendableFrameTree {
40034009 pipeline : pipeline. to_sendable ( ) ,
4004- size : browsing_context. size ,
40054010 children : vec ! [ ] ,
40064011 } ;
40074012
0 commit comments