mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #16337 - stshine:inline-block-intrinsic, r=notriddle
layout: Fix intrinsic inline size calculating of inline blocks When calculating intrinsic inline sizes of an inline block, take its nested inline parents into account. --- <!-- 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] These changes fix #7636 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/16337) <!-- Reviewable:end -->
This commit is contained in:
commit
bbf292b120
4 changed files with 74 additions and 24 deletions
|
@ -1547,31 +1547,29 @@ impl Fragment {
|
|||
}
|
||||
};
|
||||
|
||||
// Take borders and padding for parent inline fragments into account, if necessary.
|
||||
if self.is_primary_fragment() {
|
||||
let writing_mode = self.style.writing_mode;
|
||||
if let Some(ref context) = self.inline_context {
|
||||
for node in &context.nodes {
|
||||
let mut border_width = node.style.logical_border_width();
|
||||
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
|
||||
let mut margin = model::specified_margin_from_style(&*node.style, writing_mode);
|
||||
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_start = Au(0);
|
||||
padding.inline_start = Au(0);
|
||||
margin.inline_start = Au(0);
|
||||
}
|
||||
if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_end = Au(0);
|
||||
padding.inline_end = Au(0);
|
||||
margin.inline_end = Au(0);
|
||||
}
|
||||
|
||||
result.surrounding_size =
|
||||
result.surrounding_size +
|
||||
border_width.inline_start_end() +
|
||||
padding.inline_start_end() +
|
||||
margin.inline_start_end();
|
||||
// Take borders and padding for parent inline fragments into account.
|
||||
let writing_mode = self.style.writing_mode;
|
||||
if let Some(ref context) = self.inline_context {
|
||||
for node in &context.nodes {
|
||||
let mut border_width = node.style.logical_border_width();
|
||||
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
|
||||
let mut margin = model::specified_margin_from_style(&*node.style, writing_mode);
|
||||
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_start = Au(0);
|
||||
padding.inline_start = Au(0);
|
||||
margin.inline_start = Au(0);
|
||||
}
|
||||
if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_end = Au(0);
|
||||
padding.inline_end = Au(0);
|
||||
margin.inline_end = Au(0);
|
||||
}
|
||||
|
||||
result.surrounding_size =
|
||||
result.surrounding_size +
|
||||
border_width.inline_start_end() +
|
||||
padding.inline_start_end() +
|
||||
margin.inline_start_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue