Skip to content

Commit

Permalink
Rename contents to context in AbsolutelyPositionedBox
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jun 15, 2020
1 parent 264b434 commit b66dd66
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion components/layout_2020/flow/inline.rs
Expand Up @@ -294,7 +294,7 @@ impl InlineFormattingContext {
InlineLevelBox::TextRun(run) => run.layout(layout_context, &mut ifc),
InlineLevelBox::Atomic(a) => layout_atomic(layout_context, &mut ifc, a),
InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => {
let style = AtomicRef::map(box_.borrow(), |box_| &box_.contents.style);
let style = AtomicRef::map(box_.borrow(), |box_| &box_.context.style);
let initial_start_corner =
match Display::from(style.get_box().original_display) {
Display::GeneratingBox(DisplayGeneratingBox::OutsideInside {
Expand Down
2 changes: 1 addition & 1 deletion components/layout_2020/flow/mod.rs
Expand Up @@ -326,7 +326,7 @@ impl BlockLevelBox {
positioning_context.push(hoisted_box);
Fragment::AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment {
hoisted_fragment,
position: box_.borrow().contents.style.clone_position(),
position: box_.borrow().context.style.clone_position(),
})
},
BlockLevelBox::OutOfFlowFloatBox(_box_) => {
Expand Down
20 changes: 10 additions & 10 deletions components/layout_2020/positioned.rs
Expand Up @@ -22,7 +22,7 @@ use style::Zero;

#[derive(Debug, Serialize)]
pub(crate) struct AbsolutelyPositionedBox {
pub contents: IndependentFormattingContext,
pub context: IndependentFormattingContext,
}

pub(crate) struct PositioningContext {
Expand Down Expand Up @@ -84,7 +84,7 @@ impl AbsolutelyPositionedBox {
!node_info.style.inline_box_offsets_are_both_non_auto(),
);
Self {
contents: IndependentFormattingContext::construct(
context: IndependentFormattingContext::construct(
context,
node_info,
display_inside,
Expand Down Expand Up @@ -124,7 +124,7 @@ impl AbsolutelyPositionedBox {

let box_offsets = {
let box_ = self_.borrow();
let box_offsets = box_.contents.style.box_offsets(containing_block);
let box_offsets = box_.context.style.box_offsets(containing_block);
Vec2 {
inline: absolute_box_offsets(
initial_start_corner.inline,
Expand Down Expand Up @@ -288,7 +288,7 @@ impl PositioningContext {
let position = box_
.absolutely_positioned_box
.borrow()
.contents
.context
.style
.clone_position();
match position {
Expand Down Expand Up @@ -417,12 +417,12 @@ impl HoistedAbsolutelyPositionedBox {
let cbis = containing_block.size.inline;
let cbbs = containing_block.size.block;
let absolutely_positioned_box = self.absolutely_positioned_box.borrow_mut();
let style = &absolutely_positioned_box.contents.style;
let style = &absolutely_positioned_box.context.style;
let pbm = style.padding_border_margin(&containing_block.into());

let size;
let replaced_used_size;
match absolutely_positioned_box.contents.as_replaced() {
match absolutely_positioned_box.context.as_replaced() {
Ok(replaced) => {
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
Expand Down Expand Up @@ -474,11 +474,11 @@ impl HoistedAbsolutelyPositionedBox {
|positioning_context| {
let size;
let fragments;
match absolutely_positioned_box.contents.as_replaced() {
match absolutely_positioned_box.context.as_replaced() {
Ok(replaced) => {
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
let style = &absolutely_positioned_box.contents.style;
let style = &absolutely_positioned_box.context.style;
size = replaced_used_size.unwrap();
fragments = replaced.make_fragments(style, size.clone());
},
Expand All @@ -495,7 +495,7 @@ impl HoistedAbsolutelyPositionedBox {
pbm.padding_border_sums.inline -
margin.inline_sum();
absolutely_positioned_box
.contents
.context
.content_sizes
.shrink_to_fit(available_size)
});
Expand Down Expand Up @@ -550,7 +550,7 @@ impl HoistedAbsolutelyPositionedBox {
};

BoxFragment::new(
absolutely_positioned_box.contents.tag,
absolutely_positioned_box.context.tag,
style.clone(),
fragments,
content_rect,
Expand Down

0 comments on commit b66dd66

Please sign in to comment.