mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: GC unused box methods
This commit is contained in:
parent
a2e91d242b
commit
42cc04684f
1 changed files with 2 additions and 45 deletions
|
@ -334,10 +334,7 @@ impl Box {
|
||||||
self.padding.set(padding)
|
self.padding.set(padding)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_padding_length(&self,
|
fn compute_padding_length(&self, padding: LengthOrPercentage, content_box_width: Au) -> Au {
|
||||||
padding: LengthOrPercentage,
|
|
||||||
content_box_width: Au)
|
|
||||||
-> Au {
|
|
||||||
specified(padding, content_box_width)
|
specified(padding, content_box_width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,46 +351,6 @@ impl Box {
|
||||||
top + bottom
|
top + bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The box formed by the content edge as defined in CSS 2.1 § 8.1. Coordinates are relative to
|
|
||||||
/// the owning flow.
|
|
||||||
pub fn content_box(&self) -> Rect<Au> {
|
|
||||||
let position = self.position.get();
|
|
||||||
let origin = Point2D(position.origin.x + self.border.get().left + self.padding.get().left,
|
|
||||||
position.origin.y);
|
|
||||||
let noncontent_width = self.border.get().left + self.padding.get().left +
|
|
||||||
self.border.get().right + self.padding.get().right;
|
|
||||||
let size = Size2D(position.size.width - noncontent_width, position.size.height);
|
|
||||||
Rect(origin, size)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The box formed by the border edge as defined in CSS 2.1 § 8.1. Coordinates are relative to
|
|
||||||
/// the owning flow.
|
|
||||||
pub fn border_box(&self) -> Rect<Au> {
|
|
||||||
// TODO: Actually compute the content box, padding, and border.
|
|
||||||
self.content_box()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The box formed by the margin edge as defined in CSS 2.1 § 8.1. Coordinates are relative to
|
|
||||||
/// the owning flow.
|
|
||||||
pub fn margin_box(&self) -> Rect<Au> {
|
|
||||||
// TODO: Actually compute the content_box, padding, border, and margin.
|
|
||||||
self.content_box()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the nearest ancestor-or-self `Element` to the DOM node that this box represents.
|
|
||||||
///
|
|
||||||
/// If there is no ancestor-or-self `Element` node, fails.
|
|
||||||
pub fn nearest_ancestor_element(&self) -> AbstractNode<LayoutView> {
|
|
||||||
let mut node = self.node;
|
|
||||||
while !node.is_element() {
|
|
||||||
match node.parent_node() {
|
|
||||||
None => fail!("no nearest element?!"),
|
|
||||||
Some(parent) => node = parent,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
node
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Always inline for SCCP.
|
/// Always inline for SCCP.
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): Just replace with the clear type from the style module for speed?
|
/// FIXME(pcwalton): Just replace with the clear type from the style module for speed?
|
||||||
|
@ -415,7 +372,7 @@ impl Box {
|
||||||
pub fn font_style(&self) -> FontStyle {
|
pub fn font_style(&self) -> FontStyle {
|
||||||
let my_style = self.style();
|
let my_style = self.style();
|
||||||
|
|
||||||
debug!("(font style) start: {:?}", self.nearest_ancestor_element().type_id());
|
debug!("(font style) start");
|
||||||
|
|
||||||
// FIXME: Too much allocation here.
|
// FIXME: Too much allocation here.
|
||||||
let font_families = do my_style.Font.font_family.map |family| {
|
let font_families = do my_style.Font.font_family.map |family| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue