mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
rustfmt
This commit is contained in:
parent
644addd159
commit
f1b10393c2
10 changed files with 67 additions and 48 deletions
|
@ -42,8 +42,8 @@ use std::rc::Rc;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
|
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
|
||||||
use time::{now, precise_time_ns, precise_time_s};
|
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::units::{DeviceIntPoint, DeviceIntSize, DevicePoint, LayoutVector2D};
|
||||||
|
use webrender_api::{self, HitTestFlags, HitTestResult, ScrollLocation};
|
||||||
use webvr_traits::WebVRMainThreadHeartbeat;
|
use webvr_traits::WebVRMainThreadHeartbeat;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -843,8 +843,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
self.pending_scroll_zoom_events.push(ScrollZoomEvent {
|
self.pending_scroll_zoom_events.push(ScrollZoomEvent {
|
||||||
magnification: magnification,
|
magnification: magnification,
|
||||||
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
|
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
|
||||||
&scroll_delta.to_untyped()),
|
&scroll_delta.to_untyped(),
|
||||||
),
|
)),
|
||||||
cursor: cursor,
|
cursor: cursor,
|
||||||
event_count: 1,
|
event_count: 1,
|
||||||
});
|
});
|
||||||
|
@ -932,8 +932,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
*last_combined_event = Some(ScrollZoomEvent {
|
*last_combined_event = Some(ScrollZoomEvent {
|
||||||
magnification: scroll_event.magnification,
|
magnification: scroll_event.magnification,
|
||||||
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
|
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
|
||||||
&this_delta.to_untyped()),
|
&this_delta.to_untyped(),
|
||||||
),
|
)),
|
||||||
cursor: this_cursor,
|
cursor: this_cursor,
|
||||||
event_count: 1,
|
event_count: 1,
|
||||||
})
|
})
|
||||||
|
@ -1165,9 +1165,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
let mut pipeline_epochs = HashMap::new();
|
let mut pipeline_epochs = HashMap::new();
|
||||||
for (id, _) in &self.pipeline_details {
|
for (id, _) in &self.pipeline_details {
|
||||||
let webrender_pipeline_id = id.to_webrender();
|
let webrender_pipeline_id = id.to_webrender();
|
||||||
if let Some(webrender_api::Epoch(epoch)) =
|
if let Some(webrender_api::Epoch(epoch)) = self
|
||||||
self.webrender.current_epoch(self.webrender_document,
|
.webrender
|
||||||
webrender_pipeline_id)
|
.current_epoch(self.webrender_document, webrender_pipeline_id)
|
||||||
{
|
{
|
||||||
let epoch = Epoch(epoch);
|
let epoch = Epoch(epoch);
|
||||||
pipeline_epochs.insert(*id, epoch);
|
pipeline_epochs.insert(*id, epoch);
|
||||||
|
@ -1267,11 +1267,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
#[cfg(feature = "gl")]
|
#[cfg(feature = "gl")]
|
||||||
CompositeTarget::Window => gl::RenderTargetInfo::default(),
|
CompositeTarget::Window => gl::RenderTargetInfo::default(),
|
||||||
#[cfg(feature = "gl")]
|
#[cfg(feature = "gl")]
|
||||||
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => {
|
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => gl::initialize_png(
|
||||||
gl::initialize_png(&*self.window.gl(),
|
&*self.window.gl(),
|
||||||
FramebufferUintLength::new(width.get()),
|
FramebufferUintLength::new(width.get()),
|
||||||
FramebufferUintLength::new(height.get()))
|
FramebufferUintLength::new(height.get()),
|
||||||
},
|
),
|
||||||
#[cfg(not(feature = "gl"))]
|
#[cfg(not(feature = "gl"))]
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
|
@ -1304,8 +1304,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
// For each pending paint metrics pipeline id
|
// For each pending paint metrics pipeline id
|
||||||
for (id, pending_epoch) in &self.pending_paint_metrics {
|
for (id, pending_epoch) in &self.pending_paint_metrics {
|
||||||
// we get the last painted frame id from webrender
|
// we get the last painted frame id from webrender
|
||||||
if let Some(webrender_api::Epoch(epoch)) =
|
if let Some(webrender_api::Epoch(epoch)) = self
|
||||||
self.webrender.current_epoch(self.webrender_document, id.to_webrender())
|
.webrender
|
||||||
|
.current_epoch(self.webrender_document, id.to_webrender())
|
||||||
{
|
{
|
||||||
// and check if it is the one the layout thread is expecting,
|
// and check if it is the one the layout thread is expecting,
|
||||||
let epoch = Epoch(epoch);
|
let epoch = Epoch(epoch);
|
||||||
|
@ -1332,10 +1333,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
CompositeTarget::Window => None,
|
CompositeTarget::Window => None,
|
||||||
#[cfg(feature = "gl")]
|
#[cfg(feature = "gl")]
|
||||||
CompositeTarget::WindowAndPng => {
|
CompositeTarget::WindowAndPng => {
|
||||||
let img = gl::draw_img(&*self.window.gl(),
|
let img = gl::draw_img(
|
||||||
rt_info,
|
&*self.window.gl(),
|
||||||
FramebufferUintLength::new(width.get()),
|
rt_info,
|
||||||
FramebufferUintLength::new(height.get()));
|
FramebufferUintLength::new(width.get()),
|
||||||
|
FramebufferUintLength::new(height.get()),
|
||||||
|
);
|
||||||
Some(Image {
|
Some(Image {
|
||||||
width: img.width(),
|
width: img.width(),
|
||||||
height: img.height(),
|
height: img.height(),
|
||||||
|
@ -1354,10 +1357,12 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||||
|| match self.output_file.as_ref() {
|
|| match self.output_file.as_ref() {
|
||||||
Some(path) => match File::create(path) {
|
Some(path) => match File::create(path) {
|
||||||
Ok(mut file) => {
|
Ok(mut file) => {
|
||||||
let img = gl::draw_img(gl,
|
let img = gl::draw_img(
|
||||||
rt_info,
|
gl,
|
||||||
FramebufferUintLength::new(width.get()),
|
rt_info,
|
||||||
FramebufferUintLength::new(height.get()));
|
FramebufferUintLength::new(width.get()),
|
||||||
|
FramebufferUintLength::new(height.get()),
|
||||||
|
);
|
||||||
let dynamic_image = DynamicImage::ImageRgb8(img);
|
let dynamic_image = DynamicImage::ImageRgb8(img);
|
||||||
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG)
|
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,8 @@ use profile_traits::time;
|
||||||
use script_traits::{AnimationState, ConstellationMsg, EventResult};
|
use script_traits::{AnimationState, ConstellationMsg, EventResult};
|
||||||
use std::fmt::{Debug, Error, Formatter};
|
use std::fmt::{Debug, Error, Formatter};
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
|
|
||||||
use webrender_api;
|
use webrender_api;
|
||||||
|
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
|
||||||
use webvr_traits::WebVRMainThreadHeartbeat;
|
use webvr_traits::WebVRMainThreadHeartbeat;
|
||||||
|
|
||||||
/// Sends messages to the compositor.
|
/// Sends messages to the compositor.
|
||||||
|
|
|
@ -19,9 +19,9 @@ use std::fmt::{Debug, Error, Formatter};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use style_traits::DevicePixel;
|
use style_traits::DevicePixel;
|
||||||
use webrender_api::ScrollLocation;
|
|
||||||
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
|
||||||
use webrender_api::units::DevicePoint;
|
use webrender_api::units::DevicePoint;
|
||||||
|
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||||
|
use webrender_api::ScrollLocation;
|
||||||
use webvr::VRServiceManager;
|
use webvr::VRServiceManager;
|
||||||
use webvr_traits::WebVRMainThreadHeartbeat;
|
use webvr_traits::WebVRMainThreadHeartbeat;
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,10 @@ use style::values::specified::ui::CursorKind;
|
||||||
use style::values::{Either, RGBA};
|
use style::values::{Either, RGBA};
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use webrender_api::units::{LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
|
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::{ColorU, ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LineStyle};
|
||||||
use webrender_api::{NinePatchBorder, NinePatchBorderSource, NormalBorder};
|
use webrender_api::{NinePatchBorder, NinePatchBorderSource, NormalBorder};
|
||||||
use webrender_api::{ScrollSensitivity, StickyOffsetBounds};
|
use webrender_api::{ScrollSensitivity, StickyOffsetBounds};
|
||||||
use webrender_api::{self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF};
|
|
||||||
|
|
||||||
static THREAD_TINT_COLORS: [ColorF; 8] = [
|
static THREAD_TINT_COLORS: [ColorF; 8] = [
|
||||||
ColorF {
|
ColorF {
|
||||||
|
|
|
@ -13,7 +13,9 @@ use msg::constellation_msg::PipelineId;
|
||||||
use webrender_api::units::LayoutPoint;
|
use webrender_api::units::LayoutPoint;
|
||||||
use webrender_api::{self, ClipId, CommonItemProperties, DisplayItem as WrDisplayItem};
|
use webrender_api::{self, ClipId, CommonItemProperties, DisplayItem as WrDisplayItem};
|
||||||
use webrender_api::{DisplayListBuilder, PropertyBinding, PushStackingContextDisplayItem};
|
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 {
|
pub trait WebRenderDisplayListConverter {
|
||||||
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
|
fn convert_to_webrender(&mut self, pipeline_id: PipelineId) -> DisplayListBuilder;
|
||||||
|
@ -144,26 +146,30 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
},
|
},
|
||||||
DisplayItem::PushTextShadow(ref mut item) => {
|
DisplayItem::PushTextShadow(ref mut item) => {
|
||||||
let common = build_common_item_properties(&item.base, state);
|
let common = build_common_item_properties(&item.base, state);
|
||||||
builder.push_shadow(&SpaceAndClipInfo {
|
builder.push_shadow(
|
||||||
spatial_id: common.spatial_id,
|
&SpaceAndClipInfo {
|
||||||
clip_id: common.clip_id,
|
spatial_id: common.spatial_id,
|
||||||
},
|
clip_id: common.clip_id,
|
||||||
item.shadow,
|
},
|
||||||
true);
|
item.shadow,
|
||||||
|
true,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::PopAllTextShadows(_) => {
|
DisplayItem::PopAllTextShadows(_) => {
|
||||||
builder.push_item(&WrDisplayItem::PopAllShadows);
|
builder.push_item(&WrDisplayItem::PopAllShadows);
|
||||||
},
|
},
|
||||||
DisplayItem::Iframe(ref mut item) => {
|
DisplayItem::Iframe(ref mut item) => {
|
||||||
let common = build_common_item_properties(&item.base, state);
|
let common = build_common_item_properties(&item.base, state);
|
||||||
builder.push_iframe(item.base.bounds,
|
builder.push_iframe(
|
||||||
common.clip_rect,
|
item.base.bounds,
|
||||||
&SpaceAndClipInfo {
|
common.clip_rect,
|
||||||
spatial_id: common.spatial_id,
|
&SpaceAndClipInfo {
|
||||||
clip_id: common.clip_id,
|
spatial_id: common.spatial_id,
|
||||||
},
|
clip_id: common.clip_id,
|
||||||
item.iframe.to_webrender(),
|
},
|
||||||
true);
|
item.iframe.to_webrender(),
|
||||||
|
true,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
DisplayItem::PushStackingContext(ref mut item) => {
|
DisplayItem::PushStackingContext(ref mut item) => {
|
||||||
let stacking_context = &item.stacking_context;
|
let stacking_context = &item.stacking_context;
|
||||||
|
@ -296,8 +302,10 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_common_item_properties(base: &BaseDisplayItem, state: &ClipScrollState)
|
fn build_common_item_properties(
|
||||||
-> CommonItemProperties {
|
base: &BaseDisplayItem,
|
||||||
|
state: &ClipScrollState,
|
||||||
|
) -> CommonItemProperties {
|
||||||
let tag = match base.metadata.pointing {
|
let tag = match base.metadata.pointing {
|
||||||
Some(cursor) => Some((base.metadata.node.0 as u64, cursor)),
|
Some(cursor) => Some((base.metadata.node.0 as u64, cursor)),
|
||||||
None => None,
|
None => None,
|
||||||
|
|
|
@ -65,8 +65,8 @@ use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size, Ve
|
||||||
use style::values::generics::box_::{Perspective, VerticalAlignKeyword};
|
use style::values::generics::box_::{Perspective, VerticalAlignKeyword};
|
||||||
use style::values::generics::transform;
|
use style::values::generics::transform;
|
||||||
use style::Zero;
|
use style::Zero;
|
||||||
use webrender_api::units::LayoutTransform;
|
|
||||||
use webrender_api;
|
use webrender_api;
|
||||||
|
use webrender_api::units::LayoutTransform;
|
||||||
|
|
||||||
// From gfxFontConstants.h in Firefox.
|
// From gfxFontConstants.h in Firefox.
|
||||||
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
|
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
//! Implements sequential traversals over the DOM and flow trees.
|
//! Implements sequential traversals over the DOM and flow trees.
|
||||||
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
|
||||||
use crate::display_list::items::{self, CommonDisplayItem, DisplayItem, DisplayListSection};
|
use crate::display_list::items::{self, CommonDisplayItem, DisplayItem, DisplayListSection};
|
||||||
|
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||||
use crate::floats::SpeculatedFloatPlacement;
|
use crate::floats::SpeculatedFloatPlacement;
|
||||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||||
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};
|
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};
|
||||||
|
|
|
@ -307,7 +307,10 @@ where
|
||||||
// Cast from `DeviceIndependentPixel` to `DevicePixel`
|
// Cast from `DeviceIndependentPixel` to `DevicePixel`
|
||||||
let device_pixel_ratio = coordinates.hidpi_factor.get();
|
let device_pixel_ratio = coordinates.hidpi_factor.get();
|
||||||
let window_size = TypedSize2D::from_untyped(
|
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(
|
webrender::Renderer::new(
|
||||||
window.gl(),
|
window.gl(),
|
||||||
|
|
|
@ -371,6 +371,10 @@ def check_lock(file_name, contents):
|
||||||
source = "crates.io"
|
source = "crates.io"
|
||||||
packages_by_name.setdefault(package["name"], []).append((package["version"], source))
|
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():
|
for (name, packages) in packages_by_name.iteritems():
|
||||||
has_duplicates = len(packages) > 1
|
has_duplicates = len(packages) > 1
|
||||||
duplicates_allowed = name in exceptions
|
duplicates_allowed = name in exceptions
|
||||||
|
|
|
@ -46,7 +46,6 @@ packages = [
|
||||||
"rand_core",
|
"rand_core",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
"unicase",
|
"unicase",
|
||||||
"ws",
|
|
||||||
]
|
]
|
||||||
# Files that are ignored for all tidy and lint checks.
|
# Files that are ignored for all tidy and lint checks.
|
||||||
files = [
|
files = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue