mirror of
https://github.com/servo/servo.git
synced 2025-06-19 06:38:59 +01:00
initial implement for inline background
This commit is contained in:
parent
32bf796efc
commit
25a3da6180
4 changed files with 124 additions and 7 deletions
|
@ -23,7 +23,7 @@
|
|||
use css::node_style::StyledNode;
|
||||
use layout::block::BlockFlow;
|
||||
use layout::box_::{Box, GenericBox, IframeBox, IframeBoxInfo, ImageBox, ImageBoxInfo};
|
||||
use layout::box_::{UnscannedTextBox, UnscannedTextBoxInfo};
|
||||
use layout::box_::{UnscannedTextBox, UnscannedTextBoxInfo, InlineInfo, InlineParentInfo};
|
||||
use layout::context::LayoutContext;
|
||||
use layout::float_context::FloatType;
|
||||
use layout::flow::{BaseFlow, Flow, MutableFlowUtils};
|
||||
|
@ -39,6 +39,7 @@ use style::computed_values::{display, float};
|
|||
|
||||
use std::cell::RefCell;
|
||||
use std::util;
|
||||
use std::num::Zero;
|
||||
|
||||
/// The results of flow construction for a DOM node.
|
||||
pub enum ConstructionResult {
|
||||
|
@ -415,7 +416,44 @@ impl<'fc> FlowConstructor<'fc> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(pcwalton): Add in our own borders/padding/margins if necessary.
|
||||
match opt_box_accumulator {
|
||||
Some(ref mut boxes) => {
|
||||
let parent_box = self.build_box_for_node(node);
|
||||
let font_style = parent_box.font_style();
|
||||
let font_group = self.layout_context.font_ctx.get_resolved_font_for_style(&font_style);
|
||||
let (font_ascent,font_descent) = font_group.borrow().with_mut( |fg| {
|
||||
fg.fonts[0].borrow().with_mut( |font| {
|
||||
(font.metrics.ascent,font.metrics.descent)
|
||||
})
|
||||
});
|
||||
|
||||
for box_ in boxes.mut_iter() {
|
||||
if box_.inline_info.with( |data| data.is_none() ) {
|
||||
box_.inline_info.set(Some(InlineInfo::new()));
|
||||
}
|
||||
|
||||
box_.inline_info.with_mut( |info| {
|
||||
match info {
|
||||
&Some(ref mut info) => {
|
||||
// TODO(ksh8281) compute margin,border,padding
|
||||
info.parent_info.push(
|
||||
InlineParentInfo {
|
||||
padding: Zero::zero(),
|
||||
border: Zero::zero(),
|
||||
margin: Zero::zero(),
|
||||
style: parent_box.style.clone(),
|
||||
font_ascent: font_ascent,
|
||||
font_descent: font_descent,
|
||||
});
|
||||
},
|
||||
&None => {}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
|
||||
// Finally, make a new construction result.
|
||||
if opt_inline_block_splits.len() > 0 || opt_box_accumulator.len() > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue