@@ -1370,47 +1370,34 @@ impl Renderer {
13701370 /// is active, otherwise 0 should be passed here.
13711371 pub fn render (
13721372 & mut self ,
1373+ doc_id : DocumentId ,
13731374 device_size : DeviceIntSize ,
13741375 buffer_age : usize ,
13751376 ) -> Result < RenderResults , Vec < RendererError > > {
13761377 self . device_size = Some ( device_size) ;
13771378
1378- // TODO(gw): We want to make the active document that is
1379- // being rendered configurable via the public
1380- // API in future. For now, just select the last
1381- // added document as the active one to render
1382- // (Gecko only ever creates a single document
1383- // per renderer right now).
1384- let doc_id = self . active_documents . keys ( ) . last ( ) . cloned ( ) ;
1385-
1386- let result = match doc_id {
1387- Some ( doc_id) => {
1388- // Remove the doc from the map to appease the borrow checker
1389- let mut doc = self . active_documents
1390- . remove ( & doc_id)
1391- . unwrap ( ) ;
1392-
1393- let size = if !device_size. is_empty ( ) {
1394- Some ( device_size)
1395- } else {
1396- None
1397- } ;
1379+ let result = {
1380+ // Remove the doc from the map to appease the borrow checker
1381+ let mut doc = self . active_documents
1382+ . remove ( & doc_id)
1383+ . unwrap ( ) ;
13981384
1399- let result = self . render_impl (
1400- doc_id,
1401- & mut doc,
1402- size,
1403- buffer_age,
1404- ) ;
1385+ let size = if !device_size. is_empty ( ) {
1386+ Some ( device_size)
1387+ } else {
1388+ None
1389+ } ;
14051390
1406- self . active_documents . insert ( doc_id, doc) ;
1391+ let result = self . render_impl (
1392+ doc_id,
1393+ & mut doc,
1394+ size,
1395+ buffer_age,
1396+ ) ;
14071397
1408- result
1409- }
1410- None => {
1411- self . last_time = zeitstempel:: now ( ) ;
1412- Ok ( RenderResults :: default ( ) )
1413- }
1398+ self . active_documents . insert ( doc_id, doc) ;
1399+
1400+ result
14141401 } ;
14151402
14161403 drain_filter (
0 commit comments