From 3f9db09163ab2ac76574a727899e5465f0f68e83 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Tue, 16 Oct 2012 16:15:20 -0700 Subject: [PATCH] Add RenderBox::margin_box() --- src/servo/layout/box.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/servo/layout/box.rs b/src/servo/layout/box.rs index e41bb7cc95d..ea48566d3d9 100644 --- a/src/servo/layout/box.rs +++ b/src/servo/layout/box.rs @@ -115,6 +115,7 @@ trait RenderBoxMethods { pure fn requires_inline_spacers() -> bool; pure fn content_box() -> Rect; pure fn border_box() -> Rect; + pure fn margin_box() -> Rect; fn split_to_width(@self, &LayoutContext, au, starts_line: bool) -> SplitBoxResult; fn get_min_width(&LayoutContext) -> au; @@ -360,6 +361,12 @@ impl RenderBox : RenderBoxMethods { self.content_box() } + /* The box fromed by the margin edge, as defined in CSS 2.1 Section 8.1. + Coordinates are relative to the owning flow. */ + pure fn margin_box() -> Rect { + // TODO: actually compute content_box + padding + border + margin + self.content_box() + } // TODO: implement this, generating spacer fn create_inline_spacer_for_side(_ctx: &LayoutContext, _side: InlineSpacerSide) -> Option<@RenderBox> {