mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
layout: Reformat some long lines and fix some whitespace issues.
This commit is contained in:
parent
af8fcdf073
commit
757e2cf4e5
4 changed files with 52 additions and 25 deletions
|
@ -529,7 +529,10 @@ impl<'a> GlyphStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used when a character index has no associated glyph---for example, a ligature continuation.
|
// used when a character index has no associated glyph---for example, a ligature continuation.
|
||||||
pub fn add_nonglyph_for_char_index(&mut self, i: CharIndex, cluster_start: bool, ligature_start: bool) {
|
pub fn add_nonglyph_for_char_index(&mut self,
|
||||||
|
i: CharIndex,
|
||||||
|
cluster_start: bool,
|
||||||
|
ligature_start: bool) {
|
||||||
assert!(i < self.char_len());
|
assert!(i < self.char_len());
|
||||||
|
|
||||||
let entry = GlyphEntry::complex(cluster_start, ligature_start, 0);
|
let entry = GlyphEntry::complex(cluster_start, ligature_start, 0);
|
||||||
|
@ -691,8 +694,10 @@ impl<'a> GlyphIterator<'a> {
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
|
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
|
||||||
match self.glyph_range.as_mut().unwrap().next() {
|
match self.glyph_range.as_mut().unwrap().next() {
|
||||||
Some(j) => Some((self.char_index,
|
Some(j) => {
|
||||||
GlyphInfo::Detail(self.store, self.char_index, j.get() as u16 /* ??? */))),
|
Some((self.char_index,
|
||||||
|
GlyphInfo::Detail(self.store, self.char_index, j.get() as u16 /* ??? */)))
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
// No more glyphs for current character. Try to get another.
|
// No more glyphs for current character. Try to get another.
|
||||||
self.glyph_range = None;
|
self.glyph_range = None;
|
||||||
|
|
|
@ -204,9 +204,8 @@ impl<'a> LayoutContext<'a> {
|
||||||
}
|
}
|
||||||
// Not yet requested, async mode - request image from the cache
|
// Not yet requested, async mode - request image from the cache
|
||||||
(ImageState::NotRequested, false) => {
|
(ImageState::NotRequested, false) => {
|
||||||
self.shared.image_cache_task.request_image(url,
|
self.shared.image_cache_task
|
||||||
self.shared.image_cache_sender.clone(),
|
.request_image(url, self.shared.image_cache_sender.clone(), None);
|
||||||
None);
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
// Image has been requested, is still pending. Return no image
|
// Image has been requested, is still pending. Return no image
|
||||||
|
@ -218,3 +217,4 @@ impl<'a> LayoutContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1024,6 +1024,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
&clip);
|
&clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.is_scanned_text_fragment() {
|
if !self.is_scanned_text_fragment() {
|
||||||
self.build_display_list_for_box_shadow_if_applicable(&*self.style,
|
self.build_display_list_for_box_shadow_if_applicable(&*self.style,
|
||||||
display_list,
|
display_list,
|
||||||
|
@ -2107,3 +2108,4 @@ pub enum StackingContextCreationMode {
|
||||||
OuterScrollWrapper,
|
OuterScrollWrapper,
|
||||||
InnerScrollWrapper,
|
InnerScrollWrapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@ use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAI
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use opaque_node::OpaqueNodeMethods;
|
use opaque_node::OpaqueNodeMethods;
|
||||||
use parallel::{self, WorkQueueData};
|
use parallel::{self, WorkQueueData};
|
||||||
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request, MarginPadding, Side};
|
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
|
||||||
use query::{MarginRetrievingFragmentBorderBoxIterator, PositionProperty, PositionRetrievingFragmentBorderBoxIterator};
|
use query::{MarginPadding, MarginRetrievingFragmentBorderBoxIterator, PositionProperty};
|
||||||
|
use query::{PositionRetrievingFragmentBorderBoxIterator, Side};
|
||||||
use sequential;
|
use sequential;
|
||||||
use wrapper::LayoutNode;
|
use wrapper::LayoutNode;
|
||||||
|
|
||||||
|
@ -244,7 +245,9 @@ impl LayoutTaskFactory for LayoutTask {
|
||||||
mem_profiler_chan: mem::ProfilerChan,
|
mem_profiler_chan: mem::ProfilerChan,
|
||||||
shutdown_chan: Sender<()>) {
|
shutdown_chan: Sender<()>) {
|
||||||
let ConstellationChan(con_chan) = constellation_chan.clone();
|
let ConstellationChan(con_chan) = constellation_chan.clone();
|
||||||
spawn_named_with_send_on_failure(format!("LayoutTask {:?}", id), task_state::LAYOUT, move || {
|
spawn_named_with_send_on_failure(format!("LayoutTask {:?}", id),
|
||||||
|
task_state::LAYOUT,
|
||||||
|
move || {
|
||||||
{ // Ensures layout task is destroyed before we send shutdown message
|
{ // Ensures layout task is destroyed before we send shutdown message
|
||||||
let sender = chan.sender();
|
let sender = chan.sender();
|
||||||
let layout_chan = LayoutChan(sender);
|
let layout_chan = LayoutChan(sender);
|
||||||
|
@ -561,7 +564,11 @@ impl LayoutTask {
|
||||||
self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data)
|
self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data)
|
||||||
}
|
}
|
||||||
Msg::LoadStylesheet(url, mq, pending, link_element) => {
|
Msg::LoadStylesheet(url, mq, pending, link_element) => {
|
||||||
self.handle_load_stylesheet(url, mq, pending, link_element, possibly_locked_rw_data)
|
self.handle_load_stylesheet(url,
|
||||||
|
mq,
|
||||||
|
pending,
|
||||||
|
link_element,
|
||||||
|
possibly_locked_rw_data)
|
||||||
}
|
}
|
||||||
Msg::SetQuirksMode => self.handle_set_quirks_mode(possibly_locked_rw_data),
|
Msg::SetQuirksMode => self.handle_set_quirks_mode(possibly_locked_rw_data),
|
||||||
Msg::GetRPC(response_chan) => {
|
Msg::GetRPC(response_chan) => {
|
||||||
|
@ -734,7 +741,9 @@ impl LayoutTask {
|
||||||
Origin::Author);
|
Origin::Author);
|
||||||
|
|
||||||
//TODO: mark critical subresources as blocking load as well (#5974)
|
//TODO: mark critical subresources as blocking load as well (#5974)
|
||||||
self.script_chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id, url, responder)).unwrap();
|
self.script_chan.send(ConstellationControlMsg::StylesheetLoadComplete(self.id,
|
||||||
|
url,
|
||||||
|
responder)).unwrap();
|
||||||
|
|
||||||
self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data);
|
self.handle_add_stylesheet(sheet, mq, possibly_locked_rw_data);
|
||||||
}
|
}
|
||||||
|
@ -923,19 +932,22 @@ impl LayoutTask {
|
||||||
atom!("padding-right") => (MarginPadding::Padding, Side::Right),
|
atom!("padding-right") => (MarginPadding::Padding, Side::Right),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
|
let requested_node: OpaqueNode =
|
||||||
|
OpaqueNodeMethods::from_script_node(requested_node);
|
||||||
let mut iterator =
|
let mut iterator =
|
||||||
MarginRetrievingFragmentBorderBoxIterator::new(requested_node,
|
MarginRetrievingFragmentBorderBoxIterator::new(requested_node,
|
||||||
side,
|
side,
|
||||||
margin_padding,
|
margin_padding,
|
||||||
style.writing_mode);
|
style.writing_mode);
|
||||||
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root,
|
||||||
|
&mut iterator);
|
||||||
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string());
|
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string());
|
||||||
},
|
},
|
||||||
|
|
||||||
atom!("bottom") | atom!("top") | atom!("right") |
|
atom!("bottom") | atom!("top") | atom!("right") |
|
||||||
atom!("left") | atom!("width") | atom!("height")
|
atom!("left") | atom!("width") | atom!("height")
|
||||||
if applies && positioned && style.get_box().display != display::computed_value::T::none => {
|
if applies && positioned && style.get_box().display !=
|
||||||
|
display::computed_value::T::none => {
|
||||||
let layout_data = layout_node.borrow_layout_data();
|
let layout_data = layout_node.borrow_layout_data();
|
||||||
let position = layout_data.as_ref().map(|layout_data| {
|
let position = layout_data.as_ref().map(|layout_data| {
|
||||||
match layout_data.data.flow_construction_result {
|
match layout_data.data.flow_construction_result {
|
||||||
|
@ -954,17 +966,20 @@ impl LayoutTask {
|
||||||
atom!("height") => PositionProperty::Height,
|
atom!("height") => PositionProperty::Height,
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node);
|
let requested_node: OpaqueNode =
|
||||||
|
OpaqueNodeMethods::from_script_node(requested_node);
|
||||||
let mut iterator =
|
let mut iterator =
|
||||||
PositionRetrievingFragmentBorderBoxIterator::new(requested_node,
|
PositionRetrievingFragmentBorderBoxIterator::new(requested_node,
|
||||||
property,
|
property,
|
||||||
position);
|
position);
|
||||||
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator);
|
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root,
|
||||||
|
&mut iterator);
|
||||||
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string());
|
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string());
|
||||||
},
|
},
|
||||||
// FIXME: implement used value computation for line-height
|
// FIXME: implement used value computation for line-height
|
||||||
property => {
|
property => {
|
||||||
rw_data.resolved_style_response = style.computed_value_to_string(property.as_slice());
|
rw_data.resolved_style_response =
|
||||||
|
style.computed_value_to_string(property.as_slice());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1193,8 +1208,13 @@ impl LayoutTask {
|
||||||
process_content_boxes_request(node, &mut root_flow, &mut rw_data),
|
process_content_boxes_request(node, &mut root_flow, &mut rw_data),
|
||||||
ReflowQueryType::NodeGeometryQuery(node) =>
|
ReflowQueryType::NodeGeometryQuery(node) =>
|
||||||
self.process_node_geometry_request(node, &mut root_flow, &mut rw_data),
|
self.process_node_geometry_request(node, &mut root_flow, &mut rw_data),
|
||||||
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) =>
|
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
|
||||||
self.process_resolved_style_request(node, pseudo, property, &mut root_flow, &mut rw_data),
|
self.process_resolved_style_request(node,
|
||||||
|
pseudo,
|
||||||
|
property,
|
||||||
|
&mut root_flow,
|
||||||
|
&mut rw_data)
|
||||||
|
}
|
||||||
ReflowQueryType::OffsetParentQuery(node) =>
|
ReflowQueryType::OffsetParentQuery(node) =>
|
||||||
self.process_offset_parent_query(node, &mut root_flow, &mut rw_data),
|
self.process_offset_parent_query(node, &mut root_flow, &mut rw_data),
|
||||||
ReflowQueryType::NoQuery => {}
|
ReflowQueryType::NoQuery => {}
|
||||||
|
@ -1312,16 +1332,16 @@ impl LayoutTask {
|
||||||
self.profiler_metadata(),
|
self.profiler_metadata(),
|
||||||
self.time_profiler_chan.clone(),
|
self.time_profiler_chan.clone(),
|
||||||
|| {
|
|| {
|
||||||
if opts::get().nonincremental_layout || flow_ref::deref_mut(&mut root_flow)
|
if opts::get().nonincremental_layout ||
|
||||||
.compute_layout_damage()
|
flow_ref::deref_mut(&mut root_flow).compute_layout_damage()
|
||||||
.contains(REFLOW_ENTIRE_DOCUMENT) {
|
.contains(REFLOW_ENTIRE_DOCUMENT) {
|
||||||
flow_ref::deref_mut(&mut root_flow).reflow_entire_document()
|
flow_ref::deref_mut(&mut root_flow).reflow_entire_document()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verification of the flow tree, which ensures that all nodes were either marked as leaves
|
// Verification of the flow tree, which ensures that all nodes were either marked as
|
||||||
// or as non-leaves. This becomes a no-op in release builds. (It is inconsequential to
|
// leaves or as non-leaves. This becomes a no-op in release builds. (It is
|
||||||
// memory safety but is a useful debugging tool.)
|
// inconsequential to memory safety but is a useful debugging tool.)
|
||||||
self.verify_flow_tree(&mut root_flow);
|
self.verify_flow_tree(&mut root_flow);
|
||||||
|
|
||||||
if opts::get().trace_layout {
|
if opts::get().trace_layout {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue