Skip to content

Commit

Permalink
Bug 1515041 - Update webrender to commit 14df2e43424ebc38044158f716c7…
Browse files Browse the repository at this point in the history
…69d26e35b161 (WR PR #3429). r=kats

servo/webrender#3429

Differential Revision: https://phabricator.services.mozilla.com/D14853

--HG--
extra : moz-landing-system : lando
  • Loading branch information
WR Updater Bot committed Dec 18, 2018
1 parent 48eec30 commit c53e9a7
Show file tree
Hide file tree
Showing 10 changed files with 539 additions and 257 deletions.
2 changes: 1 addition & 1 deletion gfx/webrender_bindings/revision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
112669978e1c7970145f47e3b28127538715a2e5
14df2e43424ebc38044158f716c769d26e35b161
39 changes: 16 additions & 23 deletions gfx/wr/webrender/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use gpu_types::{PrimitiveInstanceData, RasterizationSpace, GlyphInstance};
use gpu_types::{PrimitiveHeader, PrimitiveHeaderIndex, TransformPaletteId, TransformPalette};
use internal_types::{FastHashMap, SavedTargetIndex, TextureSource};
use picture::{Picture3DContext, PictureCompositeMode, PicturePrimitive, PictureSurface};
use prim_store::{DeferredResolve, PrimitiveTemplateKind};
use prim_store::{EdgeAaSegmentMask, PrimitiveInstanceKind};
use prim_store::{DeferredResolve, EdgeAaSegmentMask, PrimitiveInstanceKind};
use prim_store::{VisibleGradientTile, PrimitiveInstance, PrimitiveOpacity, SegmentInstanceIndex};
use prim_store::{BrushSegment, ClipMaskKind, ClipTaskIndex};
use prim_store::image::ImageSource;
Expand Down Expand Up @@ -604,8 +603,9 @@ impl AlphaBatchBuilder {
);
}
PrimitiveInstanceKind::NormalBorder { data_handle, ref cache_handles, .. } => {
let prim_data = &ctx.resources.prim_data_store[data_handle];
let prim_cache_address = gpu_cache.get_address(&prim_data.gpu_cache_handle);
let prim_data = &ctx.resources.normal_border_data_store[data_handle];
let common_data = &prim_data.common;
let prim_cache_address = gpu_cache.get_address(&common_data.gpu_cache_handle);
let cache_handles = &ctx.scratch.border_cache_handles[*cache_handles];
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let mut segment_data: SmallVec<[SegmentInstanceData; 8]> = SmallVec::new();
Expand All @@ -626,7 +626,7 @@ impl AlphaBatchBuilder {
);
}

let non_segmented_blend_mode = if !prim_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_instance.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
Expand Down Expand Up @@ -660,13 +660,10 @@ impl AlphaBatchBuilder {
batch_params.prim_user_data,
);

let template = match prim_data.kind {
PrimitiveTemplateKind::NormalBorder { ref template, .. } => template,
_ => unreachable!()
};
let border_data = &prim_data.kind;
self.add_segmented_prim_to_batch(
Some(template.brush_segments.as_slice()),
prim_data.opacity,
Some(border_data.brush_segments.as_slice()),
common_data.opacity,
&batch_params,
specified_blend_mode,
non_segmented_blend_mode,
Expand Down Expand Up @@ -1387,16 +1384,12 @@ impl AlphaBatchBuilder {
}
}
PrimitiveInstanceKind::ImageBorder { data_handle, .. } => {
let prim_data = &ctx.resources.prim_data_store[data_handle];
let (request, brush_segments) = match &prim_data.kind {
PrimitiveTemplateKind::ImageBorder { request, brush_segments, .. } => {
(request, brush_segments)
}
_ => unreachable!()
};
let prim_data = &ctx.resources.image_border_data_store[data_handle];
let common_data = &prim_data.common;
let border_data = &prim_data.kind;

let cache_item = resolve_image(
*request,
border_data.request,
ctx.resource_cache,
gpu_cache,
deferred_resolves,
Expand All @@ -1406,9 +1399,9 @@ impl AlphaBatchBuilder {
}

let textures = BatchTextures::color(cache_item.texture_id);
let prim_cache_address = gpu_cache.get_address(&prim_data.gpu_cache_handle);
let prim_cache_address = gpu_cache.get_address(&common_data.gpu_cache_handle);
let specified_blend_mode = BlendMode::PremultipliedAlpha;
let non_segmented_blend_mode = if !prim_data.opacity.is_opaque ||
let non_segmented_blend_mode = if !common_data.opacity.is_opaque ||
prim_instance.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
Expand Down Expand Up @@ -1444,8 +1437,8 @@ impl AlphaBatchBuilder {
);

self.add_segmented_prim_to_batch(
Some(brush_segments.as_slice()),
prim_data.opacity,
Some(border_data.brush_segments.as_slice()),
common_data.opacity,
&batch_params,
specified_blend_mode,
non_segmented_blend_mode,
Expand Down
22 changes: 12 additions & 10 deletions gfx/wr/webrender/src/border.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

use api::{BorderRadius, BorderSide, BorderStyle, ColorF, ColorU, DeviceRect, DeviceSize};
use api::{LayoutSideOffsets, LayoutSizeAu, LayoutPrimitiveInfo, LayoutToDeviceScale};
use api::{DeviceVector2D, DevicePoint, LayoutRect, LayoutSize, NormalBorder, DeviceIntSize};
use api::{DeviceVector2D, DevicePoint, LayoutRect, LayoutSize, DeviceIntSize};
use api::{AuHelpers, LayoutPoint, RepeatMode, TexelRect};
use api::NormalBorder as ApiNormalBorder;
use ellipse::Ellipse;
use euclid::vec2;
use display_list_flattener::DisplayListFlattener;
use gpu_types::{BorderInstance, BorderSegment, BrushFlags};
use prim_store::{BorderSegmentInfo, BrushSegment, NinePatchDescriptor};
use prim_store::{EdgeAaSegmentMask, ScrollNodeAndClipChain, PrimitiveKeyKind};
use prim_store::{EdgeAaSegmentMask, ScrollNodeAndClipChain};
use prim_store::borders::NormalBorderPrim;
use util::{lerp, RectHelpers};

// Using 2048 as the maximum radius in device space before which we
Expand Down Expand Up @@ -129,8 +131,8 @@ impl NormalBorderAu {
}
}

impl From<NormalBorder> for NormalBorderAu {
fn from(border: NormalBorder) -> Self {
impl From<ApiNormalBorder> for NormalBorderAu {
fn from(border: ApiNormalBorder) -> Self {
NormalBorderAu {
left: border.left.into(),
right: border.right.into(),
Expand All @@ -142,9 +144,9 @@ impl From<NormalBorder> for NormalBorderAu {
}
}

impl From<NormalBorderAu> for NormalBorder {
impl From<NormalBorderAu> for ApiNormalBorder {
fn from(border: NormalBorderAu) -> Self {
NormalBorder {
ApiNormalBorder {
left: border.left.into(),
right: border.right.into(),
top: border.top.into(),
Expand Down Expand Up @@ -218,7 +220,7 @@ impl<'a> DisplayListFlattener<'a> {
pub fn add_normal_border(
&mut self,
info: &LayoutPrimitiveInfo,
border: &NormalBorder,
border: &ApiNormalBorder,
widths: LayoutSideOffsets,
clip_and_scroll: ScrollNodeAndClipChain,
) {
Expand All @@ -229,7 +231,7 @@ impl<'a> DisplayListFlattener<'a> {
clip_and_scroll,
info,
Vec::new(),
PrimitiveKeyKind::NormalBorder {
NormalBorderPrim {
border: border.into(),
widths: widths.to_au(),
},
Expand Down Expand Up @@ -650,7 +652,7 @@ fn get_edge_info(
/// cache keys for a given CSS border.
pub fn create_border_segments(
size: LayoutSize,
border: &NormalBorder,
border: &ApiNormalBorder,
widths: &LayoutSideOffsets,
border_segments: &mut Vec<BorderSegmentInfo>,
brush_segments: &mut Vec<BrushSegment>,
Expand Down Expand Up @@ -1096,7 +1098,7 @@ fn add_edge_segment(
pub fn build_border_instances(
cache_key: &BorderSegmentCacheKey,
cache_size: DeviceIntSize,
border: &NormalBorder,
border: &ApiNormalBorder,
scale: LayoutToDeviceScale,
) -> Vec<BorderInstance> {
let mut instances = Vec::new();
Expand Down
18 changes: 16 additions & 2 deletions gfx/wr/webrender/src/display_list_flattener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use prim_store::{PrimitiveInstance, PrimitiveKeyKind, PictureCompositeKey};
use prim_store::{PrimitiveKey, PrimitiveSceneData, PrimitiveInstanceKind, NinePatchDescriptor};
use prim_store::{PrimitiveStore, PrimitiveStoreStats, LineDecorationCacheKey};
use prim_store::{ScrollNodeAndClipChain, PictureIndex, register_prim_chase_id, get_line_decoration_sizes};
use prim_store::borders::{ImageBorder, NormalBorderPrim};
use prim_store::gradient::{GradientStopKey, LinearGradient, RadialGradient, RadialGradientParams};
use prim_store::image::{Image, YuvImage};
use prim_store::text_run::TextRun;
Expand Down Expand Up @@ -1824,6 +1825,9 @@ impl<'a> DisplayListFlattener<'a> {
ShadowItem::Image(ref pending_image) => {
self.add_shadow_prim(&pending_shadow, pending_image, &mut prims)
}
ShadowItem::NormalBorder(ref pending_border) => {
self.add_shadow_prim(&pending_shadow, pending_border, &mut prims)
}
ShadowItem::Primitive(ref pending_primitive) => {
self.add_shadow_prim(&pending_shadow, pending_primitive, &mut prims)
}
Expand Down Expand Up @@ -1903,6 +1907,9 @@ impl<'a> DisplayListFlattener<'a> {
ShadowItem::Image(pending_image) => {
self.add_shadow_prim_to_draw_list(pending_image)
},
ShadowItem::NormalBorder(pending_border) => {
self.add_shadow_prim_to_draw_list(pending_border)
}
ShadowItem::Primitive(pending_primitive) => {
self.add_shadow_prim_to_draw_list(pending_primitive)
},
Expand Down Expand Up @@ -2115,7 +2122,7 @@ impl<'a> DisplayListFlattener<'a> {

match border.source {
NinePatchBorderSource::Image(image_key) => {
let prim = PrimitiveKeyKind::ImageBorder {
let prim = ImageBorder {
request: ImageRequest {
key: image_key,
rendering: ImageRendering::Auto,
Expand All @@ -2124,7 +2131,7 @@ impl<'a> DisplayListFlattener<'a> {
nine_patch,
};

self.add_primitive(
self.add_nonshadowable_primitive(
clip_and_scroll,
info,
Vec::new(),
Expand Down Expand Up @@ -2676,6 +2683,7 @@ pub struct PendingShadow {
pub enum ShadowItem {
Shadow(PendingShadow),
Image(PendingPrimitive<Image>),
NormalBorder(PendingPrimitive<NormalBorderPrim>),
Primitive(PendingPrimitive<PrimitiveKeyKind>),
TextRun(PendingPrimitive<TextRun>),
}
Expand All @@ -2686,6 +2694,12 @@ impl From<PendingPrimitive<Image>> for ShadowItem {
}
}

impl From<PendingPrimitive<NormalBorderPrim>> for ShadowItem {
fn from(border: PendingPrimitive<NormalBorderPrim>) -> Self {
ShadowItem::NormalBorder(border)
}
}

impl From<PendingPrimitive<PrimitiveKeyKind>> for ShadowItem {
fn from(container: PendingPrimitive<PrimitiveKeyKind>) -> Self {
ShadowItem::Primitive(container)
Expand Down
8 changes: 6 additions & 2 deletions gfx/wr/webrender/src/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,18 +1393,22 @@ impl PrimitiveList {
let prim_data = match prim_instance.kind {
PrimitiveInstanceKind::Picture { data_handle, .. } |
PrimitiveInstanceKind::LineDecoration { data_handle, .. } |
PrimitiveInstanceKind::NormalBorder { data_handle, .. } |
PrimitiveInstanceKind::ImageBorder { data_handle, .. } |
PrimitiveInstanceKind::Rectangle { data_handle, .. } |
PrimitiveInstanceKind::Clear { data_handle, .. } => {
&resources.prim_interner[data_handle]
}
PrimitiveInstanceKind::Image { data_handle, .. } => {
&resources.image_interner[data_handle]
}
PrimitiveInstanceKind::ImageBorder { data_handle, .. } => {
&resources.image_border_interner[data_handle]
}
PrimitiveInstanceKind::LinearGradient { data_handle, .. } => {
&resources.linear_grad_interner[data_handle]
}
PrimitiveInstanceKind::NormalBorder { data_handle, .. } => {
&resources.normal_border_interner[data_handle]
}
PrimitiveInstanceKind::RadialGradient { data_handle, ..} => {
&resources.radial_grad_interner[data_handle]
}
Expand Down
Loading

0 comments on commit c53e9a7

Please sign in to comment.