mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #28880 - wusyong:fix-footer, r=delan
Fix absolute descendents being replaced when retreiving root <!-- Please describe your changes on the following line: --> The cause of #16410 is because calling `try_get_layout_root` will replace its `abs_descendants` even itself isn't absolute positioned. So I pushed them instead if the root isn't absolute. Also add a few docs and comments to help understand how block size of absolute flow is being calculated. --- <!-- 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 #16410 (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes: Reduced testcase from the issue. ```html <style> html { min-height: 100%; position: relative; } div { position: absolute; bottom: 0; width: 100%; height: 25px; border: 1px solid black; } </style> <div> </div> ``` <!-- 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. -->
This commit is contained in:
commit
c8d9aad3e3
6 changed files with 43 additions and 15 deletions
|
@ -44,7 +44,7 @@ use layout::context::RegisteredPainter;
|
|||
use layout::context::RegisteredPainters;
|
||||
use layout::display_list::items::WebRenderImageInfo;
|
||||
use layout::display_list::{IndexableText, ToLayout};
|
||||
use layout::flow::{Flow, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use layout::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use layout::flow_ref::FlowRef;
|
||||
use layout::incremental::{RelayoutMode, SpecialRestyleDamage};
|
||||
use layout::layout_debug;
|
||||
|
@ -950,11 +950,20 @@ impl LayoutThread {
|
|||
let mut flow = match result {
|
||||
ConstructionResult::Flow(mut flow, abs_descendants) => {
|
||||
// Note: Assuming that the root has display 'static' (as per
|
||||
// CSS Section 9.3.1). Otherwise, if it were absolutely
|
||||
// positioned, it would return a reference to itself in
|
||||
// `abs_descendants` and would lead to a circular reference.
|
||||
// Set Root as CB for any remaining absolute descendants.
|
||||
flow.set_absolute_descendants(abs_descendants);
|
||||
// CSS Section 9.3.1). If it was absolutely positioned,
|
||||
// it would return a reference to itself in `abs_descendants`
|
||||
// and would lead to a circular reference. Otherwise, we
|
||||
// set Root as CB and push remaining absolute descendants.
|
||||
if flow
|
||||
.base()
|
||||
.flags
|
||||
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
{
|
||||
flow.set_absolute_descendants(abs_descendants);
|
||||
} else {
|
||||
flow.push_absolute_descendants(abs_descendants);
|
||||
}
|
||||
|
||||
flow
|
||||
},
|
||||
_ => return None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue