@@ -1254,47 +1254,34 @@ impl Renderer {
1254
1254
/// is active, otherwise 0 should be passed here.
1255
1255
pub fn render (
1256
1256
& mut self ,
1257
+ doc_id : DocumentId ,
1257
1258
device_size : DeviceIntSize ,
1258
1259
buffer_age : usize ,
1259
1260
) -> Result < RenderResults , Vec < RendererError > > {
1260
1261
self . device_size = Some ( device_size) ;
1261
1262
1262
- // TODO(gw): We want to make the active document that is
1263
- // being rendered configurable via the public
1264
- // API in future. For now, just select the last
1265
- // added document as the active one to render
1266
- // (Gecko only ever creates a single document
1267
- // per renderer right now).
1268
- let doc_id = self . active_documents . keys ( ) . last ( ) . cloned ( ) ;
1269
-
1270
- let result = match doc_id {
1271
- Some ( doc_id) => {
1272
- // Remove the doc from the map to appease the borrow checker
1273
- let mut doc = self . active_documents
1274
- . remove ( & doc_id)
1275
- . unwrap ( ) ;
1276
-
1277
- let size = if !device_size. is_empty ( ) {
1278
- Some ( device_size)
1279
- } else {
1280
- None
1281
- } ;
1263
+ let result = {
1264
+ // Remove the doc from the map to appease the borrow checker
1265
+ let mut doc = self . active_documents
1266
+ . remove ( & doc_id)
1267
+ . unwrap ( ) ;
1282
1268
1283
- let result = self . render_impl (
1284
- doc_id,
1285
- & mut doc,
1286
- size,
1287
- buffer_age,
1288
- ) ;
1269
+ let size = if !device_size. is_empty ( ) {
1270
+ Some ( device_size)
1271
+ } else {
1272
+ None
1273
+ } ;
1289
1274
1290
- self . active_documents . insert ( doc_id, doc) ;
1275
+ let result = self . render_impl (
1276
+ doc_id,
1277
+ & mut doc,
1278
+ size,
1279
+ buffer_age,
1280
+ ) ;
1291
1281
1292
- result
1293
- }
1294
- None => {
1295
- self . last_time = precise_time_ns ( ) ;
1296
- Ok ( RenderResults :: default ( ) )
1297
- }
1282
+ self . active_documents . insert ( doc_id, doc) ;
1283
+
1284
+ result
1298
1285
} ;
1299
1286
1300
1287
drain_filter (
0 commit comments