mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove get_
prefix on getters
Part of #6224 I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`
This commit is contained in:
parent
c63fc4dc13
commit
435e551753
21 changed files with 62 additions and 70 deletions
|
@ -885,7 +885,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
let url = Url::parse(&url_string).unwrap();
|
let url = Url::parse(&url_string).unwrap();
|
||||||
self.window.set_page_url(url.clone());
|
self.window.set_page_url(url.clone());
|
||||||
let msg = match self.scene.root {
|
let msg = match self.scene.root {
|
||||||
Some(ref layer) => ConstellationMsg::LoadUrl(layer.get_pipeline_id(), LoadData::new(url)),
|
Some(ref layer) => ConstellationMsg::LoadUrl(layer.pipeline_id(), LoadData::new(url)),
|
||||||
None => ConstellationMsg::InitLoadUrl(url)
|
None => ConstellationMsg::InitLoadUrl(url)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
let mut results: HashMap<PipelineId, Vec<PaintRequest>> = HashMap::new();
|
let mut results: HashMap<PipelineId, Vec<PaintRequest>> = HashMap::new();
|
||||||
|
|
||||||
for (layer, mut layer_requests) in requests.into_iter() {
|
for (layer, mut layer_requests) in requests.into_iter() {
|
||||||
let pipeline_id = layer.get_pipeline_id();
|
let pipeline_id = layer.pipeline_id();
|
||||||
let current_epoch = self.pipeline_details.get(&pipeline_id).unwrap().current_epoch;
|
let current_epoch = self.pipeline_details.get(&pipeline_id).unwrap().current_epoch;
|
||||||
layer.extra_data.borrow_mut().requested_epoch = current_epoch;
|
layer.extra_data.borrow_mut().requested_epoch = current_epoch;
|
||||||
let vec = match results.entry(pipeline_id) {
|
let vec = match results.entry(pipeline_id) {
|
||||||
|
@ -1151,7 +1151,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
Vec<Box<LayerBuffer>>)>) {
|
Vec<Box<LayerBuffer>>)>) {
|
||||||
for (layer, buffers) in unused_buffers.into_iter() {
|
for (layer, buffers) in unused_buffers.into_iter() {
|
||||||
if !buffers.is_empty() {
|
if !buffers.is_empty() {
|
||||||
let pipeline = self.get_pipeline(layer.get_pipeline_id());
|
let pipeline = self.get_pipeline(layer.pipeline_id());
|
||||||
let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
|
let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
if layer.extra_data.borrow().id == LayerId::null() {
|
if layer.extra_data.borrow().id == LayerId::null() {
|
||||||
let layer_rect = Rect(-layer.extra_data.borrow().scroll_offset.to_untyped(),
|
let layer_rect = Rect(-layer.extra_data.borrow().scroll_offset.to_untyped(),
|
||||||
layer.bounds.borrow().size.to_untyped());
|
layer.bounds.borrow().size.to_untyped());
|
||||||
let pipeline = self.get_pipeline(layer.get_pipeline_id());
|
let pipeline = self.get_pipeline(layer.pipeline_id());
|
||||||
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
||||||
chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
|
chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ pub trait CompositorLayer {
|
||||||
fn wants_scroll_events(&self) -> WantsScrollEventsFlag;
|
fn wants_scroll_events(&self) -> WantsScrollEventsFlag;
|
||||||
|
|
||||||
/// Return the pipeline id associated with this layer.
|
/// Return the pipeline id associated with this layer.
|
||||||
fn get_pipeline_id(&self) -> PipelineId;
|
fn pipeline_id(&self) -> PipelineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Clone)]
|
#[derive(Copy, PartialEq, Clone)]
|
||||||
|
@ -225,7 +225,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
|
|
||||||
let unused_buffers = self.collect_unused_buffers();
|
let unused_buffers = self.collect_unused_buffers();
|
||||||
if !unused_buffers.is_empty() { // send back unused buffers
|
if !unused_buffers.is_empty() { // send back unused buffers
|
||||||
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
|
let pipeline = compositor.get_pipeline(self.pipeline_id());
|
||||||
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers));
|
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
buffer.mark_wont_leak()
|
buffer.mark_wont_leak()
|
||||||
}
|
}
|
||||||
|
|
||||||
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
|
let pipeline = compositor.get_pipeline(self.pipeline_id());
|
||||||
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(buffers));
|
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(buffers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
MouseUpEvent(button, event_point),
|
MouseUpEvent(button, event_point),
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
|
let pipeline = compositor.get_pipeline(self.pipeline_id());
|
||||||
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
||||||
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
|
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
cursor: TypedPoint2D<LayerPixel, f32>)
|
cursor: TypedPoint2D<LayerPixel, f32>)
|
||||||
where Window: WindowMethods {
|
where Window: WindowMethods {
|
||||||
let message = MouseMoveEvent(cursor.to_untyped());
|
let message = MouseMoveEvent(cursor.to_untyped());
|
||||||
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
|
let pipeline = compositor.get_pipeline(self.pipeline_id());
|
||||||
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
let ScriptControlChan(ref chan) = pipeline.script_chan;
|
||||||
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
|
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
||||||
self.extra_data.borrow().wants_scroll_events
|
self.extra_data.borrow().wants_scroll_events
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pipeline_id(&self) -> PipelineId {
|
fn pipeline_id(&self) -> PipelineId {
|
||||||
self.extra_data.borrow().pipeline_id
|
self.extra_data.borrow().pipeline_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
|
||||||
|
|
||||||
/// Implementation of the abstract `PaintListener` interface.
|
/// Implementation of the abstract `PaintListener` interface.
|
||||||
impl PaintListener for Box<CompositorProxy+'static+Send> {
|
impl PaintListener for Box<CompositorProxy+'static+Send> {
|
||||||
fn get_graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata> {
|
fn graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata> {
|
||||||
let (chan, port) = channel();
|
let (chan, port) = channel();
|
||||||
self.send(Msg::GetGraphicsMetadata(chan));
|
self.send(Msg::GetGraphicsMetadata(chan));
|
||||||
// If the compositor is shutting down when a paint task
|
// If the compositor is shutting down when a paint task
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl ActorRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get start stamp when registry was started
|
/// Get start stamp when registry was started
|
||||||
pub fn get_start_stamp(&self) -> PreciseTime {
|
pub fn start_stamp(&self) -> PreciseTime {
|
||||||
self.start_stamp.clone()
|
self.start_stamp.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ impl NetworkEventActor {
|
||||||
self.response.body = body.clone();
|
self.response.body = body.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_event_actor(&self) -> EventActor {
|
pub fn event_actor(&self) -> EventActor {
|
||||||
// TODO: Send the correct values for startedDateTime, isXHR, private
|
// TODO: Send the correct values for startedDateTime, isXHR, private
|
||||||
EventActor {
|
EventActor {
|
||||||
actor: self.name(),
|
actor: self.name(),
|
||||||
|
@ -150,7 +150,7 @@ impl NetworkEventActor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_response_start(&self) -> ResponseStartMsg {
|
pub fn response_start(&self) -> ResponseStartMsg {
|
||||||
// TODO: Send the correct values for all these fields.
|
// TODO: Send the correct values for all these fields.
|
||||||
// This is a fake message.
|
// This is a fake message.
|
||||||
ResponseStartMsg {
|
ResponseStartMsg {
|
||||||
|
|
|
@ -264,7 +264,7 @@ impl Actor for TimelineActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
let emitter = Emitter::new(self.name(), registry.get_shareable(),
|
let emitter = Emitter::new(self.name(), registry.get_shareable(),
|
||||||
registry.get_start_stamp(),
|
registry.start_stamp(),
|
||||||
stream.try_clone().unwrap(),
|
stream.try_clone().unwrap(),
|
||||||
self.memory_actor.borrow().clone(),
|
self.memory_actor.borrow().clone(),
|
||||||
self.framerate_actor.borrow().clone());
|
self.framerate_actor.borrow().clone());
|
||||||
|
@ -273,8 +273,7 @@ impl Actor for TimelineActor {
|
||||||
|
|
||||||
let msg = StartReply {
|
let msg = StartReply {
|
||||||
from: self.name(),
|
from: self.name(),
|
||||||
value: HighResolutionStamp::new(registry.get_start_stamp(),
|
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
|
||||||
PreciseTime::now()),
|
|
||||||
};
|
};
|
||||||
stream.write_json_packet(&msg);
|
stream.write_json_packet(&msg);
|
||||||
true
|
true
|
||||||
|
@ -283,8 +282,7 @@ impl Actor for TimelineActor {
|
||||||
"stop" => {
|
"stop" => {
|
||||||
let msg = StopReply {
|
let msg = StopReply {
|
||||||
from: self.name(),
|
from: self.name(),
|
||||||
value: HighResolutionStamp::new(registry.get_start_stamp(),
|
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
|
||||||
PreciseTime::now()),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
stream.write_json_packet(&msg);
|
stream.write_json_packet(&msg);
|
||||||
|
|
|
@ -309,7 +309,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
||||||
let msg = NetworkEventMsg {
|
let msg = NetworkEventMsg {
|
||||||
from: console_actor_name,
|
from: console_actor_name,
|
||||||
__type__: "networkEvent".to_string(),
|
__type__: "networkEvent".to_string(),
|
||||||
eventActor: actor.get_event_actor(),
|
eventActor: actor.event_actor(),
|
||||||
};
|
};
|
||||||
for stream in connections.iter_mut() {
|
for stream in connections.iter_mut() {
|
||||||
stream.write_json_packet(&msg);
|
stream.write_json_packet(&msg);
|
||||||
|
@ -324,7 +324,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
||||||
from: netevent_actor_name,
|
from: netevent_actor_name,
|
||||||
__type__: "networkEventUpdate".to_string(),
|
__type__: "networkEventUpdate".to_string(),
|
||||||
updateType: "responseStart".to_string(),
|
updateType: "responseStart".to_string(),
|
||||||
response: actor.get_response_start()
|
response: actor.response_start()
|
||||||
};
|
};
|
||||||
|
|
||||||
for stream in connections.iter_mut() {
|
for stream in connections.iter_mut() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ use platform::font_template::FontTemplateData;
|
||||||
pub trait FontHandleMethods {
|
pub trait FontHandleMethods {
|
||||||
fn new_from_template(fctx: &FontContextHandle, template: Arc<FontTemplateData>, pt_size: Option<Au>)
|
fn new_from_template(fctx: &FontContextHandle, template: Arc<FontTemplateData>, pt_size: Option<Au>)
|
||||||
-> Result<Self,()>;
|
-> Result<Self,()>;
|
||||||
fn get_template(&self) -> Arc<FontTemplateData>;
|
fn template(&self) -> Arc<FontTemplateData>;
|
||||||
fn family_name(&self) -> String;
|
fn family_name(&self) -> String;
|
||||||
fn face_name(&self) -> String;
|
fn face_name(&self) -> String;
|
||||||
fn is_italic(&self) -> bool;
|
fn is_italic(&self) -> bool;
|
||||||
|
@ -41,7 +41,7 @@ pub trait FontHandleMethods {
|
||||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId>;
|
fn glyph_index(&self, codepoint: char) -> Option<GlyphId>;
|
||||||
fn glyph_h_advance(&self, GlyphId) -> Option<FractionalPixel>;
|
fn glyph_h_advance(&self, GlyphId) -> Option<FractionalPixel>;
|
||||||
fn glyph_h_kerning(&self, GlyphId, GlyphId) -> FractionalPixel;
|
fn glyph_h_kerning(&self, GlyphId, GlyphId) -> FractionalPixel;
|
||||||
fn get_metrics(&self) -> FontMetrics;
|
fn metrics(&self) -> FontMetrics;
|
||||||
fn get_table_for_tag(&self, FontTableTag) -> Option<FontTable>;
|
fn get_table_for_tag(&self, FontTableTag) -> Option<FontTable>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl FontContext {
|
||||||
Some(actual_pt_size));
|
Some(actual_pt_size));
|
||||||
|
|
||||||
handle.map(|handle| {
|
handle.map(|handle| {
|
||||||
let metrics = handle.get_metrics();
|
let metrics = handle.metrics();
|
||||||
|
|
||||||
Font {
|
Font {
|
||||||
handle: handle,
|
handle: handle,
|
||||||
|
@ -314,4 +314,3 @@ impl borrow::Borrow<usize> for LayoutFontGroupCacheKey {
|
||||||
&self.address
|
&self.address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ enum DashSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PaintContext<'a> {
|
impl<'a> PaintContext<'a> {
|
||||||
pub fn get_draw_target(&self) -> &DrawTarget {
|
pub fn draw_target(&self) -> &DrawTarget {
|
||||||
&self.draw_target
|
&self.draw_target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,10 +675,10 @@ impl<'a> PaintContext<'a> {
|
||||||
self.draw_border_path(&rect, direction, border, radius, color);
|
self.draw_border_path(&rect, direction, border, radius, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_scaled_bounds(&self,
|
fn compute_scaled_bounds(&self,
|
||||||
bounds: &Rect<Au>,
|
bounds: &Rect<Au>,
|
||||||
border: &SideOffsets2D<f32>,
|
border: &SideOffsets2D<f32>,
|
||||||
shrink_factor: f32) -> Rect<f32> {
|
shrink_factor: f32) -> Rect<f32> {
|
||||||
let rect = bounds.to_nearest_azure_rect();
|
let rect = bounds.to_nearest_azure_rect();
|
||||||
let scaled_border = SideOffsets2D::new(shrink_factor * border.top,
|
let scaled_border = SideOffsets2D::new(shrink_factor * border.top,
|
||||||
shrink_factor * border.right,
|
shrink_factor * border.right,
|
||||||
|
@ -709,7 +709,7 @@ impl<'a> PaintContext<'a> {
|
||||||
(1.0/3.0) * border.right,
|
(1.0/3.0) * border.right,
|
||||||
(1.0/3.0) * border.bottom,
|
(1.0/3.0) * border.bottom,
|
||||||
(1.0/3.0) * border.left);
|
(1.0/3.0) * border.left);
|
||||||
let inner_scaled_bounds = self.get_scaled_bounds(bounds, border, 2.0/3.0);
|
let inner_scaled_bounds = self.compute_scaled_bounds(bounds, border, 2.0/3.0);
|
||||||
// draw the outer portion of the double border.
|
// draw the outer portion of the double border.
|
||||||
self.draw_solid_border_segment(direction, bounds, &scaled_border, radius, color);
|
self.draw_solid_border_segment(direction, bounds, &scaled_border, radius, color);
|
||||||
// draw the inner portion of the double border.
|
// draw the inner portion of the double border.
|
||||||
|
@ -724,9 +724,9 @@ impl<'a> PaintContext<'a> {
|
||||||
color: Color,
|
color: Color,
|
||||||
style: border_style::T) {
|
style: border_style::T) {
|
||||||
// original bounds as a Rect<f32>, with no scaling.
|
// original bounds as a Rect<f32>, with no scaling.
|
||||||
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
let original_bounds = self.compute_scaled_bounds(bounds, border, 0.0);
|
||||||
// shrink the bounds by 1/2 of the border, leaving the innermost 1/2 of the border
|
// shrink the bounds by 1/2 of the border, leaving the innermost 1/2 of the border
|
||||||
let inner_scaled_bounds = self.get_scaled_bounds(bounds, border, 0.5);
|
let inner_scaled_bounds = self.compute_scaled_bounds(bounds, border, 0.5);
|
||||||
let scaled_border = SideOffsets2D::new(0.5 * border.top,
|
let scaled_border = SideOffsets2D::new(0.5 * border.top,
|
||||||
0.5 * border.right,
|
0.5 * border.right,
|
||||||
0.5 * border.bottom,
|
0.5 * border.bottom,
|
||||||
|
@ -779,7 +779,7 @@ impl<'a> PaintContext<'a> {
|
||||||
_ => panic!("invalid border style")
|
_ => panic!("invalid border style")
|
||||||
};
|
};
|
||||||
// original bounds as a Rect<f32>
|
// original bounds as a Rect<f32>
|
||||||
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
let original_bounds = self.compute_scaled_bounds(bounds, border, 0.0);
|
||||||
|
|
||||||
// You can't scale black color (i.e. 'scaled = 0 * scale', equals black).
|
// You can't scale black color (i.e. 'scaled = 0 * scale', equals black).
|
||||||
let mut scaled_color = color::black();
|
let mut scaled_color = color::black();
|
||||||
|
@ -1419,4 +1419,3 @@ impl TemporaryDrawTarget {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,9 +177,9 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
|
||||||
// Ensures that the paint task and graphics context are destroyed before the
|
// Ensures that the paint task and graphics context are destroyed before the
|
||||||
// shutdown message.
|
// shutdown message.
|
||||||
let mut compositor = compositor;
|
let mut compositor = compositor;
|
||||||
let native_graphics_context = compositor.get_graphics_metadata().map(
|
let native_graphics_context = compositor.graphics_metadata().map(
|
||||||
|md| NativePaintingGraphicsContext::from_metadata(&md));
|
|md| NativePaintingGraphicsContext::from_metadata(&md));
|
||||||
let worker_threads = WorkerThreadProxy::spawn(compositor.get_graphics_metadata(),
|
let worker_threads = WorkerThreadProxy::spawn(compositor.graphics_metadata(),
|
||||||
font_cache_task,
|
font_cache_task,
|
||||||
time_profiler_chan.clone());
|
time_profiler_chan.clone());
|
||||||
|
|
||||||
|
@ -724,4 +724,3 @@ pub static THREAD_TINT_COLORS: [Color; 8] = [
|
||||||
Color { r: 255.0/255.0, g: 249.0/255.0, b: 201.0/255.0, a: 0.7 },
|
Color { r: 255.0/255.0, g: 249.0/255.0, b: 201.0/255.0, a: 0.7 },
|
||||||
Color { r: 137.0/255.0, g: 196.0/255.0, b: 78.0/255.0, a: 0.7 },
|
Color { r: 137.0/255.0, g: 196.0/255.0, b: 78.0/255.0, a: 0.7 },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn get_template(&self) -> Arc<FontTemplateData> {
|
fn template(&self) -> Arc<FontTemplateData> {
|
||||||
self.font_data.clone()
|
self.font_data.clone()
|
||||||
}
|
}
|
||||||
fn family_name(&self) -> String {
|
fn family_name(&self) -> String {
|
||||||
|
@ -204,9 +204,9 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_metrics(&self) -> FontMetrics {
|
fn metrics(&self) -> FontMetrics {
|
||||||
/* TODO(Issue #76): complete me */
|
/* TODO(Issue #76): complete me */
|
||||||
let face = self.get_face_rec();
|
let face = self.face_rec_mut();
|
||||||
|
|
||||||
let underline_size = self.font_units_to_au(face.underline_thickness as f64);
|
let underline_size = self.font_units_to_au(face.underline_thickness as f64);
|
||||||
let underline_offset = self.font_units_to_au(face.underline_position as f64);
|
let underline_offset = self.font_units_to_au(face.underline_position as f64);
|
||||||
|
@ -276,14 +276,14 @@ impl<'a> FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_face_rec(&'a self) -> &'a mut FT_FaceRec {
|
fn face_rec_mut(&'a self) -> &'a mut FT_FaceRec {
|
||||||
unsafe {
|
unsafe {
|
||||||
&mut (*self.face)
|
&mut (*self.face)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn font_units_to_au(&self, value: f64) -> Au {
|
fn font_units_to_au(&self, value: f64) -> Au {
|
||||||
let face = self.get_face_rec();
|
let face = self.face_rec_mut();
|
||||||
|
|
||||||
// face.size is a *c_void in the bindings, presumably to avoid
|
// face.size is a *c_void in the bindings, presumably to avoid
|
||||||
// recursive structural types
|
// recursive structural types
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_template(&self) -> Arc<FontTemplateData> {
|
fn template(&self) -> Arc<FontTemplateData> {
|
||||||
self.font_data.clone()
|
self.font_data.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
Some(advance as FractionalPixel)
|
Some(advance as FractionalPixel)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_metrics(&self) -> FontMetrics {
|
fn metrics(&self) -> FontMetrics {
|
||||||
let bounding_rect: CGRect = self.ctfont.bounding_box();
|
let bounding_rect: CGRect = self.ctfont.bounding_box();
|
||||||
let ascent = self.ctfont.ascent() as f64;
|
let ascent = self.ctfont.ascent() as f64;
|
||||||
let descent = self.ctfont.descent() as f64;
|
let descent = self.ctfont.descent() as f64;
|
||||||
|
@ -203,4 +203,3 @@ impl FontHandleMethods for FontHandle {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl<'a> TextRun {
|
||||||
let run = TextRun {
|
let run = TextRun {
|
||||||
text: Arc::new(text),
|
text: Arc::new(text),
|
||||||
font_metrics: font.metrics.clone(),
|
font_metrics: font.metrics.clone(),
|
||||||
font_template: font.handle.get_template(),
|
font_template: font.handle.template(),
|
||||||
actual_pt_size: font.actual_pt_size,
|
actual_pt_size: font.actual_pt_size,
|
||||||
glyphs: Arc::new(glyphs),
|
glyphs: Arc::new(glyphs),
|
||||||
};
|
};
|
||||||
|
|
|
@ -297,7 +297,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
HTMLElementTypeId::HTMLObjectElement))) => {
|
HTMLElementTypeId::HTMLObjectElement))) => {
|
||||||
let image_info = box ImageFragmentInfo::new(node,
|
let image_info = box ImageFragmentInfo::new(node,
|
||||||
node.get_object_data(),
|
node.object_data(),
|
||||||
&self.layout_context);
|
&self.layout_context);
|
||||||
SpecificFragmentInfo::Image(image_info)
|
SpecificFragmentInfo::Image(image_info)
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1254,7 @@ impl<'a> FlowConstructor<'a> {
|
||||||
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
||||||
let style = (*node.get_style(&layout_data)).clone();
|
let style = (*node.get_style(&layout_data)).clone();
|
||||||
let damage = layout_data.data.restyle_damage;
|
let damage = layout_data.data.restyle_damage;
|
||||||
match node.get_construction_result(layout_data) {
|
match node.construction_result_mut(layout_data) {
|
||||||
&mut ConstructionResult::None => true,
|
&mut ConstructionResult::None => true,
|
||||||
&mut ConstructionResult::Flow(ref mut flow, _) => {
|
&mut ConstructionResult::Flow(ref mut flow, _) => {
|
||||||
// The node's flow is of the same type and has the same set of children and can
|
// The node's flow is of the same type and has the same set of children and can
|
||||||
|
@ -1474,7 +1474,7 @@ trait NodeUtils {
|
||||||
/// Returns true if this node doesn't render its kids and false otherwise.
|
/// Returns true if this node doesn't render its kids and false otherwise.
|
||||||
fn is_replaced_content(&self) -> bool;
|
fn is_replaced_content(&self) -> bool;
|
||||||
|
|
||||||
fn get_construction_result<'a>(self, layout_data: &'a mut LayoutDataWrapper)
|
fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper)
|
||||||
-> &'a mut ConstructionResult;
|
-> &'a mut ConstructionResult;
|
||||||
|
|
||||||
/// Sets the construction result of a flow.
|
/// Sets the construction result of a flow.
|
||||||
|
@ -1505,7 +1505,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_construction_result<'a>(self, layout_data: &'a mut LayoutDataWrapper) -> &'a mut ConstructionResult {
|
fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper) -> &'a mut ConstructionResult {
|
||||||
match self.get_pseudo_element_type() {
|
match self.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before(_) => &mut layout_data.data.before_flow_construction_result,
|
PseudoElementType::Before(_) => &mut layout_data.data.before_flow_construction_result,
|
||||||
PseudoElementType::After (_) => &mut layout_data.data.after_flow_construction_result,
|
PseudoElementType::After (_) => &mut layout_data.data.after_flow_construction_result,
|
||||||
|
@ -1518,7 +1518,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
|
||||||
let mut layout_data_ref = self.mutate_layout_data();
|
let mut layout_data_ref = self.mutate_layout_data();
|
||||||
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
||||||
|
|
||||||
let dst = self.get_construction_result(layout_data);
|
let dst = self.construction_result_mut(layout_data);
|
||||||
|
|
||||||
*dst = result;
|
*dst = result;
|
||||||
}
|
}
|
||||||
|
@ -1528,7 +1528,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
|
||||||
let mut layout_data_ref = self.mutate_layout_data();
|
let mut layout_data_ref = self.mutate_layout_data();
|
||||||
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
||||||
|
|
||||||
self.get_construction_result(layout_data).swap_out()
|
self.construction_result_mut(layout_data).swap_out()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1541,7 +1541,7 @@ trait ObjectElement<'a> {
|
||||||
fn has_object_data(&self) -> bool;
|
fn has_object_data(&self) -> bool;
|
||||||
|
|
||||||
/// Returns the "data" attribute value parsed as a URL
|
/// Returns the "data" attribute value parsed as a URL
|
||||||
fn get_object_data(&self) -> Option<Url>;
|
fn object_data(&self) -> Option<Url>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
|
impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
|
||||||
|
@ -1557,7 +1557,7 @@ impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_object_data(&self) -> Option<Url> {
|
fn object_data(&self) -> Option<Url> {
|
||||||
match self.get_type_and_data() {
|
match self.get_type_and_data() {
|
||||||
(None, Some(uri)) if is_image_data(uri) => Url::parse(uri).ok(),
|
(None, Some(uri)) if is_image_data(uri) => Url::parse(uri).ok(),
|
||||||
_ => None
|
_ => None
|
||||||
|
@ -1632,4 +1632,3 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut LinkedList<Fragment>) {
|
||||||
drop(this.pop_back());
|
drop(this.pop_back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,9 +294,9 @@ impl CanvasFragmentInfo {
|
||||||
pub fn new(node: &ThreadSafeLayoutNode) -> CanvasFragmentInfo {
|
pub fn new(node: &ThreadSafeLayoutNode) -> CanvasFragmentInfo {
|
||||||
CanvasFragmentInfo {
|
CanvasFragmentInfo {
|
||||||
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node,
|
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node,
|
||||||
Some(Au::from_px(node.get_canvas_width() as i32)),
|
Some(Au::from_px(node.canvas_width() as i32)),
|
||||||
Some(Au::from_px(node.get_canvas_height() as i32))),
|
Some(Au::from_px(node.canvas_height() as i32))),
|
||||||
renderer: node.get_renderer().map(|rec| Arc::new(Mutex::new(rec))),
|
renderer: node.renderer().map(|rec| Arc::new(Mutex::new(rec))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2208,4 +2208,3 @@ impl<'a> InlineStyleIterator<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ pub trait TLayoutNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
|
fn renderer(&self) -> Option<Sender<CanvasMsg>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
|
@ -131,7 +131,7 @@ pub trait TLayoutNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_canvas_width(&self) -> u32 {
|
fn canvas_width(&self) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
|
@ -139,7 +139,7 @@ pub trait TLayoutNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_canvas_height(&self) -> u32 {
|
fn canvas_height(&self) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
|
|
|
@ -77,7 +77,7 @@ pub struct LayerProperties {
|
||||||
/// The interface used by the painter to acquire draw targets for each paint frame and
|
/// The interface used by the painter to acquire draw targets for each paint frame and
|
||||||
/// submit them to be drawn to the display.
|
/// submit them to be drawn to the display.
|
||||||
pub trait PaintListener {
|
pub trait PaintListener {
|
||||||
fn get_graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata>;
|
fn graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata>;
|
||||||
|
|
||||||
/// Informs the compositor of the layers for the given pipeline. The compositor responds by
|
/// Informs the compositor of the layers for the given pipeline. The compositor responds by
|
||||||
/// creating and/or destroying paint layers as necessary.
|
/// creating and/or destroying paint layers as necessary.
|
||||||
|
|
|
@ -263,7 +263,7 @@ impl CORSCache for CORSCacheSender {
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// let task = CORSCacheTask::new();
|
/// let task = CORSCacheTask::new();
|
||||||
/// let builder = TaskBuilder::new().named("XHRTask");
|
/// let builder = TaskBuilder::new().named("XHRTask");
|
||||||
/// let mut sender = task.get_sender();
|
/// let mut sender = task.sender();
|
||||||
/// builder.spawn(move || { task.run() });
|
/// builder.spawn(move || { task.run() });
|
||||||
/// sender.insert(CORSCacheEntry::new(/* parameters here */));
|
/// sender.insert(CORSCacheEntry::new(/* parameters here */));
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -284,7 +284,7 @@ impl CORSCacheTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provides a sender to the cache task
|
/// Provides a sender to the cache task
|
||||||
pub fn get_sender(&self) -> CORSCacheSender {
|
pub fn sender(&self) -> CORSCacheSender {
|
||||||
self.sender.clone()
|
self.sender.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ use std::sync::mpsc::channel;
|
||||||
|
|
||||||
pub trait ClipboardProvider {
|
pub trait ClipboardProvider {
|
||||||
// blocking method to get the clipboard contents
|
// blocking method to get the clipboard contents
|
||||||
fn get_clipboard_contents(&mut self) -> String;
|
fn clipboard_contents(&mut self) -> String;
|
||||||
// blocking method to set the clipboard contents
|
// blocking method to set the clipboard contents
|
||||||
fn set_clipboard_contents(&mut self, &str);
|
fn set_clipboard_contents(&mut self, &str);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClipboardProvider for ConstellationChan {
|
impl ClipboardProvider for ConstellationChan {
|
||||||
fn get_clipboard_contents(&mut self) -> String {
|
fn clipboard_contents(&mut self) -> String {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
||||||
rx.recv().unwrap()
|
rx.recv().unwrap()
|
||||||
|
@ -39,7 +39,7 @@ impl DummyClipboardContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClipboardProvider for DummyClipboardContext {
|
impl ClipboardProvider for DummyClipboardContext {
|
||||||
fn get_clipboard_contents(&mut self) -> String {
|
fn clipboard_contents(&mut self) -> String {
|
||||||
self.content.clone()
|
self.content.clone()
|
||||||
}
|
}
|
||||||
fn set_clipboard_contents(&mut self, s: &str) {
|
fn set_clipboard_contents(&mut self, s: &str) {
|
||||||
|
|
|
@ -315,7 +315,7 @@ impl<T: ClipboardProvider> TextInput<T> {
|
||||||
KeyReaction::Nothing
|
KeyReaction::Nothing
|
||||||
},
|
},
|
||||||
Key::V if is_control_key(mods) => {
|
Key::V if is_control_key(mods) => {
|
||||||
let contents = self.clipboard_provider.get_clipboard_contents();
|
let contents = self.clipboard_provider.clipboard_contents();
|
||||||
self.insert_string(&contents);
|
self.insert_string(&contents);
|
||||||
KeyReaction::DispatchInput
|
KeyReaction::DispatchInput
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue