This commit is contained in:
Josh Matthews 2019-06-13 18:20:05 -04:00
parent 644addd159
commit f1b10393c2
10 changed files with 67 additions and 48 deletions

View file

@ -42,8 +42,8 @@ use std::rc::Rc;
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use time::{now, precise_time_ns, precise_time_s};
use webrender_api::{self, HitTestFlags, HitTestResult, ScrollLocation};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DevicePoint, LayoutVector2D};
use webrender_api::{self, HitTestFlags, HitTestResult, ScrollLocation};
use webvr_traits::WebVRMainThreadHeartbeat;
#[derive(Debug, PartialEq)]
@ -843,8 +843,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
self.pending_scroll_zoom_events.push(ScrollZoomEvent {
magnification: magnification,
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&scroll_delta.to_untyped()),
),
&scroll_delta.to_untyped(),
)),
cursor: cursor,
event_count: 1,
});
@ -932,8 +932,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
*last_combined_event = Some(ScrollZoomEvent {
magnification: scroll_event.magnification,
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&this_delta.to_untyped()),
),
&this_delta.to_untyped(),
)),
cursor: this_cursor,
event_count: 1,
})
@ -1165,9 +1165,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let mut pipeline_epochs = HashMap::new();
for (id, _) in &self.pipeline_details {
let webrender_pipeline_id = id.to_webrender();
if let Some(webrender_api::Epoch(epoch)) =
self.webrender.current_epoch(self.webrender_document,
webrender_pipeline_id)
if let Some(webrender_api::Epoch(epoch)) = self
.webrender
.current_epoch(self.webrender_document, webrender_pipeline_id)
{
let epoch = Epoch(epoch);
pipeline_epochs.insert(*id, epoch);
@ -1267,11 +1267,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
#[cfg(feature = "gl")]
CompositeTarget::Window => gl::RenderTargetInfo::default(),
#[cfg(feature = "gl")]
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => {
gl::initialize_png(&*self.window.gl(),
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()))
},
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => gl::initialize_png(
&*self.window.gl(),
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
),
#[cfg(not(feature = "gl"))]
_ => (),
};
@ -1304,8 +1304,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
// For each pending paint metrics pipeline id
for (id, pending_epoch) in &self.pending_paint_metrics {
// we get the last painted frame id from webrender
if let Some(webrender_api::Epoch(epoch)) =
self.webrender.current_epoch(self.webrender_document, id.to_webrender())
if let Some(webrender_api::Epoch(epoch)) = self
.webrender
.current_epoch(self.webrender_document, id.to_webrender())
{
// and check if it is the one the layout thread is expecting,
let epoch = Epoch(epoch);
@ -1332,10 +1333,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
CompositeTarget::Window => None,
#[cfg(feature = "gl")]
CompositeTarget::WindowAndPng => {
let img = gl::draw_img(&*self.window.gl(),
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()));
let img = gl::draw_img(
&*self.window.gl(),
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
);
Some(Image {
width: img.width(),
height: img.height(),
@ -1354,10 +1357,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|| match self.output_file.as_ref() {
Some(path) => match File::create(path) {
Ok(mut file) => {
let img = gl::draw_img(gl,
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()));
let img = gl::draw_img(
gl,
rt_info,
FramebufferUintLength::new(width.get()),
FramebufferUintLength::new(height.get()),
);
let dynamic_image = DynamicImage::ImageRgb8(img);
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG)
{

View file

@ -17,8 +17,8 @@ use profile_traits::time;
use script_traits::{AnimationState, ConstellationMsg, EventResult};
use std::fmt::{Debug, Error, Formatter};
use style_traits::viewport::ViewportConstraints;
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webrender_api;
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webvr_traits::WebVRMainThreadHeartbeat;
/// Sends messages to the compositor.

View file

@ -19,9 +19,9 @@ use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc;
use std::time::Duration;
use style_traits::DevicePixel;
use webrender_api::ScrollLocation;
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use webrender_api::units::DevicePoint;
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use webrender_api::ScrollLocation;
use webvr::VRServiceManager;
use webvr_traits::WebVRMainThreadHeartbeat;

View file

@ -65,10 +65,10 @@ use style::values::specified::ui::CursorKind;
use style::values::{Either, RGBA};
use style_traits::ToCss;
use webrender_api::units::{LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF};
use webrender_api::{ColorU, ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LineStyle};
use webrender_api::{NinePatchBorder, NinePatchBorderSource, NormalBorder};
use webrender_api::{ScrollSensitivity, StickyOffsetBounds};
use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF};
static THREAD_TINT_COLORS: [ColorF; 8] = [
ColorF {

View file

@ -13,7 +13,9 @@ use msg::constellation_msg::PipelineId;
use webrender_api::units::LayoutPoint;
use webrender_api::{self, ClipId, CommonItemProperties, DisplayItem as WrDisplayItem};
use webrender_api::{DisplayListBuilder, PropertyBinding, PushStackingContextDisplayItem};
use webrender_api::{RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext};
use webrender_api::{
RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId, StackingContext,
};
pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
@ -144,26 +146,30 @@ impl WebRenderDisplayItemConverter for DisplayItem {
},
DisplayItem::PushTextShadow(ref mut item) => {
let common = build_common_item_properties(&item.base, state);
builder.push_shadow(&SpaceAndClipInfo {
spatial_id: common.spatial_id,
clip_id: common.clip_id,
},
item.shadow,
true);
builder.push_shadow(
&SpaceAndClipInfo {
spatial_id: common.spatial_id,
clip_id: common.clip_id,
},
item.shadow,
true,
);
},
DisplayItem::PopAllTextShadows(_) => {
builder.push_item(&WrDisplayItem::PopAllShadows);
},
DisplayItem::Iframe(ref mut item) => {
let common = build_common_item_properties(&item.base, state);
builder.push_iframe(item.base.bounds,
common.clip_rect,
&SpaceAndClipInfo {
spatial_id: common.spatial_id,
clip_id: common.clip_id,
},
item.iframe.to_webrender(),
true);
builder.push_iframe(
item.base.bounds,
common.clip_rect,
&SpaceAndClipInfo {
spatial_id: common.spatial_id,
clip_id: common.clip_id,
},
item.iframe.to_webrender(),
true,
);
},
DisplayItem::PushStackingContext(ref mut item) => {
let stacking_context = &item.stacking_context;
@ -296,8 +302,10 @@ impl WebRenderDisplayItemConverter for DisplayItem {
}
}
fn build_common_item_properties(base: &BaseDisplayItem, state: &ClipScrollState)
-> CommonItemProperties {
fn build_common_item_properties(
base: &BaseDisplayItem,
state: &ClipScrollState,
) -> CommonItemProperties {
let tag = match base.metadata.pointing {
Some(cursor) => Some((base.metadata.node.0 as u64, cursor)),
None => None,

View file

@ -65,8 +65,8 @@ use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size, Ve
use style::values::generics::box_::{Perspective, VerticalAlignKeyword};
use style::values::generics::transform;
use style::Zero;
use webrender_api::units::LayoutTransform;
use webrender_api;
use webrender_api::units::LayoutTransform;
// From gfxFontConstants.h in Firefox.
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;

View file

@ -5,8 +5,8 @@
//! Implements sequential traversals over the DOM and flow trees.
use crate::context::LayoutContext;
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
use crate::display_list::items::{self, CommonDisplayItem, DisplayItem, DisplayListSection};
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
use crate::floats::SpeculatedFloatPlacement;
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};

View file

@ -307,7 +307,10 @@ where
// Cast from `DeviceIndependentPixel` to `DevicePixel`
let device_pixel_ratio = coordinates.hidpi_factor.get();
let window_size = TypedSize2D::from_untyped(
&(opts.initial_window_size.to_f32() / device_pixel_ratio).to_i32().to_untyped());
&(opts.initial_window_size.to_f32() / device_pixel_ratio)
.to_i32()
.to_untyped(),
);
webrender::Renderer::new(
window.gl(),

View file

@ -371,6 +371,10 @@ def check_lock(file_name, contents):
source = "crates.io"
packages_by_name.setdefault(package["name"], []).append((package["version"], source))
for name in exceptions:
if name not in packages_by_name:
yield (1, "duplicates are allowed for `{}` but it is not a dependency".format(name))
for (name, packages) in packages_by_name.iteritems():
has_duplicates = len(packages) > 1
duplicates_allowed = name in exceptions

View file

@ -46,7 +46,6 @@ packages = [
"rand_core",
"scopeguard",
"unicase",
"ws",
]
# Files that are ignored for all tidy and lint checks.
files = [