mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #12330 - stshine:flexitem, r=pcwalton
Implement flexible box layout for row container <!-- Please describe your changes on the following line: --> This pull requests implements basic flexible box layout for row container. It has implemented most basic flexbox features, including grow, shrink, multi-line, *reverse properties, and alignment under `justify-content`, `align-items`, `align-self`, `align-content`. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @pcwalton <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12330) <!-- Reviewable:end -->
This commit is contained in:
commit
15947f8f73
200 changed files with 623 additions and 700 deletions
|
@ -23,7 +23,7 @@ use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT};
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
#[cfg(debug_assertions)]
|
||||
use layout_debug;
|
||||
use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified};
|
||||
use model::{self, Direction, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||
|
@ -39,7 +39,7 @@ use std::fmt;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use style::arc_ptr_eq;
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{border_collapse, clear, color, display, mix_blend_mode};
|
||||
use style::computed_values::{border_collapse, box_sizing, clear, color, display, mix_blend_mode};
|
||||
use style::computed_values::{overflow_wrap, overflow_x, position, text_decoration};
|
||||
use style::computed_values::{transform_style, vertical_align, white_space, word_break, z_index};
|
||||
use style::dom::TRestyleDamage;
|
||||
|
@ -1109,6 +1109,20 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the border width in given direction if this fragment has property
|
||||
/// 'box-sizing: border-box'. The `border_padding` field should have been initialized.
|
||||
pub fn box_sizing_boundary(&self, direction: Direction) -> Au {
|
||||
match (self.style().get_position().box_sizing, direction) {
|
||||
(box_sizing::T::border_box, Direction::Inline) => {
|
||||
self.border_padding.inline_start_end()
|
||||
}
|
||||
(box_sizing::T::border_box, Direction::Block) => {
|
||||
self.border_padding.block_start_end()
|
||||
}
|
||||
_ => Au(0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the margins in the inline direction from the containing block inline-size and the
|
||||
/// style. After this call, the inline direction of the `margin` field will be correct.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue