/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[path = "common/boilerplate.rs"] mod boilerplate;
usecrate::boilerplate::{Example, HandyDandyRectBuilder}; use webrender::api::*; use webrender::render_api::*; use webrender::api::units::*;
// This example uses the push_iframe API to nest a second pipeline's displaylist // inside the root pipeline's display list. When it works, a green square is // shown. If it fails, a red square is shown.
struct App {}
impl Example for App { fn render(
&mutself,
api: &mut RenderApi,
builder: &mut DisplayListBuilder,
_txn: &mut Transaction,
_device_size: DeviceIntSize,
pipeline_id: PipelineId,
document_id: DocumentId,
) { // All the sub_* things are for the nested pipeline let sub_size = DeviceIntSize::new(100, 100); let sub_bounds = (0, 0).to(sub_size.width as i32, sub_size.height as i32);
// And this is for the root pipeline
builder.push_simple_stacking_context(
sub_bounds.min,
space_and_clip.spatial_id,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
);
// red rect under the iframe: if this is visible, things have gone wrong
builder.push_rect(
&CommonItemProperties::new(sub_bounds, space_and_clip),
sub_bounds,
ColorF::new(1.0, 0.0, 0.0, 1.0)
);
builder.push_iframe(sub_bounds, sub_bounds, &space_and_clip, sub_pipeline_id, false);
builder.pop_stacking_context();
builder.pop_reference_frame();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.