aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/fragments.rs
Commit message (Collapse)AuthorAgeFilesLines
* Layout 2020: Move all Fragment code to the `fragment_tree` directoryMartin Robinson2023-06-041-646/+0
| | | | | | | | This is a simple code organization change with no behavior change with the idea of making Layout 2020 easier to understand by new folks to the project. The idea is that we will have a cleaner separation between the different parts of layout ie one directory for the fragment tree and one (currently multiple) directory for the box tree.
* Do not hoist floated fragmentsMartin Robinson2023-06-031-38/+20
| | | | | | | | | | | | | | | | | | | | | Instead of hoisting floated fragments to be siblings of the fragment created by their containing block formatting context, keep them in "normal" fragment tree position and adjust their positioning to be relative to the containing block. This means that float fragments follow the existing invariants of the fragment tree and properly handle hit testing, painting order, and relative positioning. The tradeoff here is more complexity tracking the containing block offsets from the block formatting context (including handling collapsed margins), but less complexity dealing with hoisting / shared ownership in addition to the correctness benefits. Some tests are failing now because this change revealed some additional shortcomings with clearing block formatting context content size past the end of their contained floats. This will be fixed in a followup change. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Place floats in layout 2020, but don't flow text around the floats yet.Patrick Walton2023-06-031-11/+42
| | | | | | | | | | | | | | | This commit puts floats behind the `layout.floats.enabled` pref, because of the following issues and unimplemented features: * Inline formatting contexts don't take floats into account, so text doesn't flow around the floats yet. * Non-floated block formatting contexts don't take floats into account, so BFCs can overlap floats. * Block formatting contexts that contain floats don't expand vertically to contain all the floats. That is, floats can stick out the bottom of BFCs, contra spec.
* Better implement getComputedStyle() for positioned insetsMartin Robinson2023-05-091-16/+151
| | | | | | | | The specification dictates quite quite idiosyncratic return values when querying insets of positioned elements via getComputedStyle(). These depend on whether or not the elements size was overconstrained. This change adds a better implementation of that in preparation for returning proper values for position: sticky.
* Detect body elements during layoutMartin Robinson2023-05-041-93/+25
| | | | | | | | | | | | | | | | | During layout it is often useful, for various specification reasons, to know if an element is the `<body>` element of an `<html>` element root. There are a couple places where a brittle heuristic is used to detect `<body>` elements. This information is going to be even more important to properly handle `<html>` elements that inherit their overflow property from their `<body>` children. Implementing this properly requires updating the DOM wrapper interface. This check does reach up to the parent of thread-safe nodes, but this is essentially the same kind of operation that `parent_style()` does, so is ostensibly safe. This change should not change any behavior and is just a preparation step for properly handle `<body>` overflow.
* Rework CB management during stacking context tree constructionMartin Robinson2023-05-031-15/+11
| | | | | | | | | | Manage containing blocks and WebRender SpaceAndClip during stacking context tree constuction using the ContainingBlockInfo data structure. This will allow us to reuse this data structure whenever we traverse the fragment tree. In addition, StackingContextBuilder is no longer necessary at all. This change also fixes some bugs where fixed position fragments were not placed in the correct spatial node. Unfortunately, these fixes are difficult to test because of #29659.
* Add support for <iframe> elements for Layout 2020Martin Robinson2023-04-041-1/+29
| | | | | | This change adds support for the <iframe> element to Layout 2020. In addition, certain aspects of the implementation are made the same between both layout systems.
* refactor(layout_2020): add `depth` parameter to the closure passed to ↵yvt2021-06-161-10/+13
| | | | `FragmentTree::find`
* Create HoistedSharedFragmentManish Goregaokar2020-07-271-1/+2
|
* layout_2020: Tag fragments with their pseudo content typeMartin Robinson2020-06-061-4/+42
| | | | | This will allow us to answer queries and properly handle animations in the future for fragments generated for pseudo content.
* layout_2020: Add initial support for getComputedStyleMartin Robinson2020-05-111-0/+10
| | | | | | | This implementation is more-or-less on par with the one from layout_2013 and in some cases better. There are still some cases where we don't return the correct "resolved value," but this is enough to test animations and transitions.
* layout_2020: Use ArcRefCell to track hoisted fragmentsMartin Robinson2020-03-271-27/+7
| | | | | | | | | | | This avoids the use of lookup tables for containing blocks when constructing the stacking context tree. This seems to catch some laid-out hoisted fragments that were otherwise dropped in the previous design. The changes cause one new test to pass and one to fail. Visual examination of the failing tests reveals that it's a progression (list markers are appearing when they were previously not rendered).
* Auto merge of #26037 - mrobinson:arcrefcell-fragment-tree, r=SimonSapinbors-servo2020-03-261-6/+47
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | layout_2020: Use ArcRefCell in the fragment tree This will allow mutability which is useful for things like animations. <!-- Please describe your changes on the following line: --> --- <!-- 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 - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they should not change behavior. <!-- 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. -->
| * layout_2020: Use ArcRefCell in the fragment treeMartin Robinson2020-03-251-6/+47
| | | | | | | | This will allow mutability which is useful for things like animations.
* | Auto merge of #25888 - ferjm:text.decoration.2020, r=noxbors-servo2020-03-231-1/+28
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Partial text decoration support for layout 2020 - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25166 - [X] There are tests for these changes
| * | Propagate text decoration where neededFernando Jiménez Moreno2020-03-231-18/+1
| | |
| * | Do not use buggy text_decorations_in_effectFernando Jiménez Moreno2020-03-231-0/+20
| | |
| * | Store required font metrics on TextFragmentFernando Jiménez Moreno2020-03-231-1/+25
| |/
* / layout_2020: Use the containing block more when calculating scrolling overflowMartin Robinson2020-03-231-12/+19
|/ | | | | | When calculating scrolling overflow calculation we cannot currently use the actual containing block in all cases. This change increases the amount that we do use the containing block.
* layout_2020: Fix a documentation commentMartin Robinson2020-03-191-1/+3
| | | | I inadvertently failed to complete this doc comment.
* layout_2020: Paint hoisted positioned fragments in tree orderMartin Robinson2020-03-111-5/+42
| | | | | | | | | | | | | | | | | | | Instead of painting hoisted position fragments in the order to which they are hoisted, paint them in tree order and properly incorporate them into the stacking context. We do this by creating a placeholder fragment in the original tree position of hoisted fragments. The ghost fragment contains an atomic id which links back to the hoisted fragment in the containing block. While building the stacking context, we keep track of containing blocks and their children. When encountering a placeholder fragment we look at the containing block's hoisted children in order to properly paint the hoisted fragment. One notable design modification in this change is that hoisted fragments no longer need an AnonymousFragment as their parent. Instead they are now direct children of the fragment that establishes their containing block.
* Minor improvements to layout_debug and associated codeFernando Jiménez Moreno2020-02-211-46/+13
|
* Add fragment debug idFernando Jiménez Moreno2020-02-211-3/+50
|
* Add layout debugger support to layout_2020Fernando Jiménez Moreno2020-02-211-1/+39
|
* Add support for overflow:scroll and overflow:hidden to layout_2020Martin Robinson2020-01-311-21/+83
| | | | | This adds clipping and interactive scrolling support, but scrolling from script is still not functional.
* Use euclid data types for physical structs in layout_2020Martin Robinson2020-01-231-11/+11
| | | | | This removes a bit of duplication and allows layout_2020 to benefit from a much richer set of utilities.
* Add initial support for scrollable overflow in layout_2020Martin Robinson2020-01-211-0/+68
| | | | | This still isn't totally correct and non-root scrolling is not handled at all, but the root frame now scrolls.
* Allow dumping the fragment tree in layout_2020Martin Robinson2020-01-131-3/+67
| | | | This is done when the dump-flow-tree debug option is passed.
* Store an OpaqueNode in boxes and fragmentsAnthony Ramine2019-12-131-0/+3
|
* Implement `text-align` (except `justify`)Simon Sapin2019-12-071-1/+12
|
* Rename content_rect to rect in TextFragment and ImageFragmentSimon Sapin2019-12-071-2/+2
| | | | Since they don’t have padding etc.
* Use the WritingMode bitflags from StyloSimon Sapin2019-12-071-3/+3
|
* Start supporting images in layout 2020Anthony Ramine2019-12-011-1/+8
|
* Start implementing text in layout 2020Anthony Ramine2019-11-251-5/+9
|
* Import victor's layout system 🍷Anthony Ramine2019-09-111-3/+12
|
* Import files from VictorSimon Sapin2019-09-111-0/+116
https://github.com/SimonSapin/victor/tree/fdb11f3e87f6d2d59170d10169fa6deb94e53b94