Skip to content
Permalink
Browse files

WebRender units are no longer reexported.

  • Loading branch information...
pcwalton authored and jdm committed Jun 4, 2019
1 parent 357fc03 commit 2f9c9cefdb74713593c47eec2002c5dd5416848b
@@ -941,7 +941,7 @@ impl<'a> CanvasData<'a> {
let size = self.drawtarget.get_size();

let descriptor = webrender_api::ImageDescriptor {
size: webrender_api::DeviceIntSize::new(size.width, size.height),
size: webrender_api::units::DeviceIntSize::new(size.width, size.height),
stride: None,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
@@ -159,7 +159,7 @@ impl webrender::OutputImageHandler for OutputHandler {
fn lock(
&mut self,
id: webrender_api::PipelineId,
) -> Option<(u32, webrender_api::FramebufferIntSize)> {
) -> Option<(u32, webrender_api::units::FramebufferIntSize)> {
// Insert a fence in the WR command queue
let gl_sync = self
.webrender_gl
@@ -172,7 +172,7 @@ impl webrender::OutputImageHandler for OutputHandler {
self.lock_channel.1.recv().unwrap().map(|(tex_id, size)| {
(
tex_id,
webrender_api::FramebufferIntSize::new(size.width, size.height),
webrender_api::units::FramebufferIntSize::new(size.width, size.height),
)
})
}
@@ -643,7 +643,7 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> {
/// Helper function to create a `webrender_api::ImageDescriptor`.
fn image_descriptor(size: Size2D<i32>, alpha: bool) -> webrender_api::ImageDescriptor {
webrender_api::ImageDescriptor {
size: webrender_api::DeviceIntSize::new(size.width, size.height),
size: webrender_api::units::DeviceIntSize::new(size.width, size.height),
stride: None,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
@@ -42,10 +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, DeviceIntPoint, DevicePoint, FramebufferIntSize, HitTestFlags, HitTestResult,
};
use webrender_api::{LayoutVector2D, ScrollLocation};
use webrender_api::{self, HitTestFlags, HitTestResult, ScrollLocation};
use webrender_api::units::{DeviceIntPoint, DevicePoint, FramebufferIntSize, LayoutVector2D};
use webvr_traits::WebVRMainThreadHeartbeat;

#[derive(Debug, PartialEq)]
@@ -724,7 +722,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let dppx = self.page_zoom * self.hidpi_factor();
let scaled_point = (point / dppx).to_untyped();

let world_cursor = webrender_api::WorldPoint::from_untyped(&scaled_point);
let world_cursor = webrender_api::units::WorldPoint::from_untyped(&scaled_point);
self.webrender_api.hit_test(
self.webrender_document,
None,
@@ -844,8 +842,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let cursor = TypedPoint2D::new(-1, -1); // Make sure this hits the base layer.
self.pending_scroll_zoom_events.push(ScrollZoomEvent {
magnification: magnification,
scroll_location: ScrollLocation::Delta(
webrender_api::LayoutVector2D::from_untyped(&scroll_delta.to_untyped()),
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&scroll_delta.to_untyped()),
),
cursor: cursor,
event_count: 1,
@@ -933,8 +931,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
last_combined_event @ &mut None => {
*last_combined_event = Some(ScrollZoomEvent {
magnification: scroll_event.magnification,
scroll_location: ScrollLocation::Delta(
webrender_api::LayoutVector2D::from_untyped(&this_delta.to_untyped()),
scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped(
&this_delta.to_untyped()),
),
cursor: this_cursor,
event_count: 1,
@@ -966,15 +964,14 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
let scaled_delta = (TypedVector2D::from_untyped(&delta.to_untyped()) /
self.scale)
.to_untyped();
let calculated_delta =
webrender_api::LayoutVector2D::from_untyped(&scaled_delta);
let calculated_delta = LayoutVector2D::from_untyped(&scaled_delta);
ScrollLocation::Delta(calculated_delta)
},
// Leave ScrollLocation unchanged if it is Start or End location.
sl @ ScrollLocation::Start | sl @ ScrollLocation::End => sl,
};
let cursor = (combined_event.cursor.to_f32() / self.scale).to_untyped();
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
let cursor = webrender_api::units::WorldPoint::from_untyped(&cursor);
let mut txn = webrender_api::Transaction::new();
txn.scroll(scroll_location, cursor);
if combined_event.magnification != 1.0 {
@@ -17,7 +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::{self, DeviceIntPoint, DeviceIntSize};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webrender_api;
use webvr_traits::WebVRMainThreadHeartbeat;

/// Sends messages to the compositor.
@@ -19,10 +19,9 @@ use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc;
use std::time::Duration;
use style_traits::DevicePixel;
use webrender_api::{
DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint, FramebufferIntRect,
FramebufferIntSize, ScrollLocation,
};
use webrender_api::ScrollLocation;
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePoint};
use webrender_api::units::{FramebufferIntRect, FramebufferIntSize};
use webvr::VRServiceManager;
use webvr_traits::WebVRMainThreadHeartbeat;

@@ -19,7 +19,7 @@ use keyboard_types::KeyboardEvent;
use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId};
use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter};
use webrender_api::{DeviceIntPoint, DeviceIntSize};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};

/// A cursor for the window. This is different from a CSS cursor (see
/// `CursorKind`) in that it has no `Auto` value.
@@ -8,7 +8,7 @@ extern crate malloc_size_of_derive;
use app_units::{Au, MAX_AU, MIN_AU};
use euclid::{Length, Point2D, Rect, Size2D};
use std::f32;
use webrender_api::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};
use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize};

// Units for use with euclid::length and euclid::scale_factor.

@@ -12,8 +12,8 @@ use style::values::computed::{BorderCornerRadius, BorderImageWidth};
use style::values::computed::{BorderImageSideWidth, NonNegativeLengthOrNumber};
use style::values::generics::rect::Rect as StyleRect;
use style::values::generics::NonNegative;
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF};
use webrender_api::{LayoutSideOffsets, LayoutSize, NormalBorder};
use webrender_api::units::{LayoutSideOffsets, LayoutSize};
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder};

/// Computes a border radius size against the containing size.
///
@@ -64,12 +64,11 @@ use style::values::generics::image::{GradientKind, PaintWorklet};
use style::values::specified::ui::CursorKind;
use style::values::{Either, RGBA};
use style_traits::ToCss;
use webrender_api::{
self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ColorU,
ExternalScrollId, FilterOp, GlyphInstance, ImageRendering, LayoutRect, LayoutSize,
LayoutTransform, LayoutVector2D, LineStyle, NinePatchBorder, NinePatchBorderSource,
NormalBorder, ScrollSensitivity, StickyOffsetBounds,
};
use webrender_api::units::{LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
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 {
@@ -114,23 +114,23 @@ impl ToLayout for RGBA {
}

impl ToLayout for Point2D<Au> {
type Type = wr::LayoutPoint;
type Type = wr::units::LayoutPoint;
fn to_layout(&self) -> Self::Type {
wr::LayoutPoint::new(self.x.to_f32_px(), self.y.to_f32_px())
wr::units::LayoutPoint::new(self.x.to_f32_px(), self.y.to_f32_px())
}
}

impl ToLayout for Rect<Au> {
type Type = wr::LayoutRect;
type Type = wr::units::LayoutRect;
fn to_layout(&self) -> Self::Type {
wr::LayoutRect::new(self.origin.to_layout(), self.size.to_layout())
wr::units::LayoutRect::new(self.origin.to_layout(), self.size.to_layout())
}
}

impl ToLayout for SideOffsets2D<Au> {
type Type = wr::LayoutSideOffsets;
type Type = wr::units::LayoutSideOffsets;
fn to_layout(&self) -> Self::Type {
wr::LayoutSideOffsets::new(
wr::units::LayoutSideOffsets::new(
self.top.to_f32_px(),
self.right.to_f32_px(),
self.bottom.to_f32_px(),
@@ -140,16 +140,16 @@ impl ToLayout for SideOffsets2D<Au> {
}

impl ToLayout for Size2D<Au> {
type Type = wr::LayoutSize;
type Type = wr::units::LayoutSize;
fn to_layout(&self) -> Self::Type {
wr::LayoutSize::new(self.width.to_f32_px(), self.height.to_f32_px())
wr::units::LayoutSize::new(self.width.to_f32_px(), self.height.to_f32_px())
}
}

impl ToLayout for Vector2D<Au> {
type Type = wr::LayoutVector2D;
type Type = wr::units::LayoutVector2D;
fn to_layout(&self) -> Self::Type {
wr::LayoutVector2D::new(self.x.to_f32_px(), self.y.to_f32_px())
wr::units::LayoutVector2D::new(self.x.to_f32_px(), self.y.to_f32_px())
}
}

@@ -24,12 +24,10 @@ use std::f32;
use std::fmt;
use style::computed_values::_servo_top_layer::T as InTopLayer;
use webrender_api as wr;
use webrender_api::{BorderRadius, ClipMode};
use webrender_api::{ComplexClipRegion, ExternalScrollId, FilterOp};
use webrender_api::{GlyphInstance, GradientStop, ImageKey, LayoutPoint};
use webrender_api::{LayoutRect, LayoutSize, LayoutTransform};
use webrender_api::{MixBlendMode, ScrollSensitivity, Shadow};
use webrender_api::{StickyOffsetBounds, TransformStyle};
use webrender_api::units::{LayoutPoint, LayoutRect, LayoutSize, LayoutTransform, LayoutVector2D};
use webrender_api::{BorderRadius, ClipMode, ComplexClipRegion, ExternalScrollId, FilterOp};
use webrender_api::{GlyphInstance, GradientStop, ImageKey, MixBlendMode, ScrollSensitivity};
use webrender_api::{Shadow, StickyOffsetBounds, TransformStyle};

pub use style::dom::OpaqueNode;

@@ -10,10 +10,9 @@
use crate::display_list::items::{ClipScrollNode, ClipScrollNodeType};
use crate::display_list::items::{DisplayItem, DisplayList, StackingContextType};
use msg::constellation_msg::PipelineId;
use webrender_api::{
self, ClipId, DisplayListBuilder, RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId,
};
use webrender_api::{LayoutPoint, PropertyBinding, SpecificDisplayItem};
use webrender_api::units::LayoutPoint;
use webrender_api::{self, ClipId, DisplayListBuilder, RasterSpace, ReferenceFrameKind};
use webrender_api::{SpaceAndClipInfo, SpatialId, SpecificDisplayItem};

pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder;
@@ -306,7 +305,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
sticky_data.margins,
sticky_data.vertical_offset_bounds,
sticky_data.horizontal_offset_bounds,
webrender_api::LayoutVector2D::zero(),
webrender_api::units::LayoutVector2D::zero(),
);

state.spatial_ids[item.node_index.to_index()] = Some(id);
@@ -65,7 +65,7 @@ use style::properties::ComputedValues;
use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::LengthPercentageOrAuto;
use webrender_api::LayoutTransform;
use webrender_api::units::LayoutTransform;

/// This marker trait indicates that a type is a struct with `#[repr(C)]` whose first field
/// is of type `BaseFlow` or some type that also implements this trait.
@@ -65,7 +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::{self, LayoutTransform};
use webrender_api::units::LayoutTransform;
use webrender_api;

// From gfxFontConstants.h in Firefox.
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
@@ -17,7 +17,7 @@ use app_units::Au;
use euclid::{Point2D, Vector2D};
use servo_config::opts;
use style::servo::restyle_damage::ServoRestyleDamage;
use webrender_api::LayoutPoint;
use webrender_api::units::LayoutPoint;

pub fn resolve_generated_content(root: &mut dyn Flow, layout_context: &LayoutContext) {
ResolveGeneratedContent::new(&layout_context).traverse(root, 0);
@@ -833,7 +833,7 @@ impl LayoutThread {
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
let mut txn = webrender_api::Transaction::new();
txn.scroll_node_with_id(
webrender_api::LayoutPoint::from_untyped(&point),
webrender_api::units::LayoutPoint::from_untyped(&point),
state.scroll_id,
webrender_api::ScrollClamping::ToContentBounds,
);
@@ -1247,7 +1247,7 @@ impl LayoutThread {
epoch.next();
self.epoch.set(epoch);

let viewport_size = webrender_api::LayoutSize::from_untyped(&viewport_size);
let viewport_size = webrender_api::units::LayoutSize::from_untyped(&viewport_size);

// Observe notifications about rendered frames if needed right before
// sending the display list to WebRender in order to set time related
@@ -1669,7 +1669,8 @@ impl LayoutThread {
// particular pipeline, so we need to tell WebRender about that.
flags.insert(webrender_api::HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT);

let client_point = webrender_api::WorldPoint::from_untyped(&client_point);
let client_point =
webrender_api::units::WorldPoint::from_untyped(&client_point);
let results = self.webrender_api.hit_test(
self.webrender_document,
Some(self.id.to_webrender()),
@@ -17,6 +17,7 @@ use std::io;
use std::mem;
use std::sync::{Arc, Mutex};
use std::thread;
use webrender_api::units::DeviceIntSize;

///
/// TODO(gw): Remaining work on image cache:
@@ -72,7 +73,7 @@ fn set_webrender_image_key(webrender_api: &webrender_api::RenderApi, image: &mut
},
};
let descriptor = webrender_api::ImageDescriptor {
size: webrender_api::DeviceIntSize::new(image.width as i32, image.height as i32),
size: DeviceIntSize::new(image.width as i32, image.height as i32),
stride: None,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
@@ -16,7 +16,7 @@ use euclid::TypedSize2D;
use profile_traits::ipc;
use script_traits::ScriptMsg;
use style_traits::CSSPixel;
use webrender_api::DeviceIntSize;
use webrender_api::units::DeviceIntSize;

#[dom_struct]
pub struct Screen {
@@ -132,7 +132,8 @@ use style::str::HTML_SPACE_CHARACTERS;
use style::stylesheets::CssRuleType;
use style_traits::{CSSPixel, DevicePixel, ParsingMode};
use url::Position;
use webrender_api::{DeviceIntPoint, DeviceIntSize, DocumentId, ExternalScrollId, RenderApiSender};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
use webrender_api::{DocumentId, ExternalScrollId, RenderApiSender};
use webvr_traits::WebVRMsg;

/// Current state of the window object
@@ -58,9 +58,8 @@ use std::sync::Arc;
use std::time::Duration;
use style_traits::CSSPixel;
use style_traits::SpeculativePainter;
use webrender_api::{
DeviceIntSize, DevicePixel, DocumentId, ExternalScrollId, ImageKey, RenderApiSender,
};
use webrender_api::units::{DeviceIntSize, DevicePixel};
use webrender_api::{DocumentId, ExternalScrollId, ImageKey, RenderApiSender};
use webvr_traits::{WebVREvent, WebVRMsg};

pub use crate::script_msg::{
@@ -28,7 +28,7 @@ use servo_url::ServoUrl;
use std::fmt;
use style_traits::viewport::ViewportConstraints;
use style_traits::CSSPixel;
use webrender_api::{DeviceIntPoint, DeviceIntSize};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};

/// A particular iframe's size, associated with a browsing context.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
@@ -36,7 +36,7 @@ extern crate to_shmem_derive;
#[cfg(feature = "servo")]
extern crate webrender_api;
#[cfg(feature = "servo")]
pub use webrender_api::DevicePixel;
pub use webrender_api::units::DevicePixel;

use cssparser::{CowRcStr, Token};
use selectors::parser::SelectorParseErrorKind;

0 comments on commit 2f9c9ce

Please sign in to comment.
You can’t perform that action at this time.