mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #26477 - mrobinson:layout-2020-get-computed-value, r=jdm
Add support for getComputedStyle() to layout_2020 These changes add support for `getComputedStyle()` to layout_2020. --- <!-- 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 <!-- 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
aa9f16ce45
188 changed files with 16312 additions and 15198 deletions
|
@ -237,7 +237,7 @@ impl FragmentTreeRoot {
|
|||
))
|
||||
}
|
||||
|
||||
fn find<T>(
|
||||
pub(crate) fn find<T>(
|
||||
&self,
|
||||
mut process_func: impl FnMut(&Fragment, &PhysicalRect<Length>) -> Option<T>,
|
||||
) -> Option<T> {
|
||||
|
@ -251,16 +251,18 @@ impl FragmentTreeRoot {
|
|||
pub fn get_content_box_for_node(&self, requested_node: OpaqueNode) -> Rect<Au> {
|
||||
let mut bounding_box = PhysicalRect::zero();
|
||||
self.find(|fragment, containing_block| {
|
||||
if fragment.tag() != Some(requested_node) {
|
||||
return None::<()>;
|
||||
}
|
||||
|
||||
let fragment_relative_rect = match fragment {
|
||||
Fragment::Box(fragment) if fragment.tag == requested_node => fragment
|
||||
Fragment::Box(fragment) => fragment
|
||||
.border_rect()
|
||||
.to_physical(fragment.style.writing_mode, &containing_block),
|
||||
Fragment::AbsoluteOrFixedPositioned(_) => PhysicalRect::zero(),
|
||||
Fragment::Text(fragment) if fragment.tag == requested_node => fragment
|
||||
Fragment::Text(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.parent_style.writing_mode, &containing_block),
|
||||
Fragment::Box(_) |
|
||||
Fragment::Text(_) |
|
||||
Fragment::AbsoluteOrFixedPositioned(_) |
|
||||
Fragment::Image(_) |
|
||||
Fragment::Anonymous(_) => return None,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue