зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #16337 - layout: Fix intrinsic inline size calculating of inline blocks (from stshine:inline-block-intrinsic); r=notriddle
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. --> Source-Repo: https://github.com/servo/servo Source-Revision: bbf292b12010509867dd594055162fa776f0de41 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 8b3b2d553362744657cd90a62668633a810ec661
This commit is contained in:
Родитель
fcbd8c5f38
Коммит
0353a290f8
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче