Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rivet/runtime/windows/src/chromium/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ impl View {
}
}

/// The parent of a live view of the loaded build, when its parent pointer holds a view of the
/// browser module: an object whose first word points into the module. `None` for a root, an
/// unreadable place or a build that records no bounds offset.
pub(crate) unsafe fn parent_of(view: usize) -> Option<usize> {
let offset = View::parent_offset(crate::builds::get().layout.view_bounds_offset)?;
if !crate::chromium::memory::readable(view.checked_add(offset)?, 8) {
return None;
}
let parent = View::at(view).parent_address(offset);
let image = crate::chromium::image::recorded()?;
let table = crate::chromium::memory::read_word(parent)?;
(table > image.base && table < image.base + image.size).then_some(parent)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
5 changes: 5 additions & 0 deletions rivet/runtime/windows/src/features/frame_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,11 @@ pub unsafe fn relayout(window: HWND) -> bool {
let layout_immediately: unsafe extern "system" fn(*mut c_void) =
std::mem::transmute(base + bv().layout_immediately);
layout_immediately(view as *mut c_void);
// The non-client view above the frame view gives the client view the bounds the frame
// view leaves it, so a new appbar width moves the page only when it lays out too.
if let Some(parent) = crate::chromium::view::parent_of(view) {
layout_immediately(parent as *mut c_void);
}
true
}
None => false,
Expand Down
Loading