mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #16360 - glennw:update-wr-borders, r=jdm
Update WR (gradients, batching, text run, border changes). - Tidy and optimize the batching code. - Support tiling / repeat for linear and radial gradients. - Fix some edge cases of subpixel text AA. - Add clip mask support to border shaders. - Optimization to text run creation on CPU. - Handle more box-shadow clipping cases. - Fix a panic that could occur when window size is 0. - Clip / scroll API improvements. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16360) <!-- Reviewable:end -->
This commit is contained in:
commit
43bd0cae0d
4 changed files with 42 additions and 38 deletions
|
@ -39,7 +39,7 @@ use style_traits::viewport::ViewportConstraints;
|
|||
use time::{precise_time_ns, precise_time_s};
|
||||
use touch::{TouchHandler, TouchAction};
|
||||
use webrender;
|
||||
use webrender_traits::{self, LayoutPoint, ScrollEventPhase, ScrollLayerId, ScrollLocation};
|
||||
use webrender_traits::{self, LayoutPoint, ScrollEventPhase, ClipId, ScrollLocation};
|
||||
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -797,8 +797,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
pipeline_id: PipelineId,
|
||||
scroll_root_id: ScrollRootId,
|
||||
point: Point2D<f32>) {
|
||||
let id = ScrollLayerId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender());
|
||||
self.webrender_api.scroll_layer_with_id(LayoutPoint::from_untyped(&point), id);
|
||||
let id = ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender());
|
||||
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id);
|
||||
}
|
||||
|
||||
fn handle_window_message(&mut self, event: WindowEvent) {
|
||||
|
@ -1389,7 +1389,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
fn send_viewport_rects(&self) {
|
||||
let mut stacking_context_scroll_states_per_pipeline = HashMap::new();
|
||||
for scroll_layer_state in self.webrender_api.get_scroll_layer_state() {
|
||||
for scroll_layer_state in self.webrender_api.get_scroll_node_state() {
|
||||
let external_id = match scroll_layer_state.id.external_id() {
|
||||
Some(id) => id,
|
||||
None => continue,
|
||||
|
|
|
@ -985,8 +985,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
})
|
||||
}
|
||||
|
||||
let center = Point2D::new(absolute_bounds.origin.x + absolute_bounds.size.width / 2,
|
||||
absolute_bounds.origin.y + absolute_bounds.size.height / 2);
|
||||
let center = Point2D::new(absolute_bounds.size.width / 2,
|
||||
absolute_bounds.size.height / 2);
|
||||
|
||||
Some(display_list::Gradient {
|
||||
start_point: center - delta,
|
||||
|
|
|
@ -16,7 +16,7 @@ use msg::constellation_msg::PipelineId;
|
|||
use style::computed_values::{image_rendering, mix_blend_mode};
|
||||
use style::computed_values::filter::{self, Filter};
|
||||
use style::values::computed::BorderStyle;
|
||||
use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform, ScrollLayerId};
|
||||
use webrender_traits::{self, DisplayListBuilder, ExtendMode, LayoutTransform, ClipId};
|
||||
|
||||
pub trait WebRenderDisplayListConverter {
|
||||
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder;
|
||||
|
@ -374,7 +374,11 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
end_point,
|
||||
item.gradient.stops.clone(),
|
||||
ExtendMode::Clamp);
|
||||
builder.push_gradient(rect, clip, gradient);
|
||||
builder.push_gradient(rect,
|
||||
clip,
|
||||
gradient,
|
||||
rect.size,
|
||||
webrender_traits::LayoutSize::zero());
|
||||
}
|
||||
DisplayItem::Line(..) => {
|
||||
println!("TODO DisplayItem::Line");
|
||||
|
@ -421,7 +425,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
}
|
||||
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
||||
DisplayItem::PushScrollRoot(ref item) => {
|
||||
let our_id = ScrollLayerId::new(item.scroll_root.id.0 as u64, builder.pipeline_id);
|
||||
let our_id = ClipId::new(item.scroll_root.id.0 as u64, builder.pipeline_id);
|
||||
let clip = item.scroll_root.clip.to_clip_region(builder);
|
||||
let content_rect = item.scroll_root.content_rect.to_rectf();
|
||||
let webrender_id = builder.define_clip(content_rect, clip, Some(our_id));
|
||||
|
@ -432,15 +436,15 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
}
|
||||
}
|
||||
trait WebRenderScrollRootIdConverter {
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId;
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ClipId;
|
||||
}
|
||||
|
||||
impl WebRenderScrollRootIdConverter for ScrollRootId {
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ScrollLayerId {
|
||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ClipId {
|
||||
if *self == ScrollRootId::root() {
|
||||
ScrollLayerId::root_scroll_layer(pipeline_id)
|
||||
ClipId::root_scroll_node(pipeline_id)
|
||||
} else {
|
||||
ScrollLayerId::new(self.0 as u64, pipeline_id)
|
||||
ClipId::new(self.0 as u64, pipeline_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue