Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Embedded pages: clicks land under the pointer while Chrome's debugger bar shows (#241)

Victor76752571767c
diff --git a/Packages/CraCore/Sources/CraCore/PageViewInsets.swift b/Packages/CraCore/Sources/CraCore/PageViewInsets.swift
new file mode 100644
index 0000000..21f6adc
--- /dev/null
+++ b/Packages/CraCore/Sources/CraCore/PageViewInsets.swift
@@ -0,0 +1,46 @@
+import CoreGraphics
+
+/// How far Chromium keeps a page's input view (WebContentsViewCocoa) inside its Chrome window
+/// from each edge. Usually zero: the page fills the window. A bar that Chromium's views draw above
+/// the page, like the "<extension> started debugging this browser" infobar that `chrome.debugger`
+/// shows, pushes it down. EmbeddedPages moves the view into a pane card, and the card laid it over
+/// the whole web area while the compositor still drew the page below the bar, so every click
+/// landed one bar-height low (GitHub #241).
+public struct PageViewInsets: Equatable, Sendable {
+ public var top: CGFloat
+ public var left: CGFloat
+ public var bottom: CGFloat
+ public var right: CGFloat
+
+ public static let zero = PageViewInsets(top: 0, left: 0, bottom: 0, right: 0)
+
+ public init(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) {
+ self.top = top
+ self.left = left
+ self.bottom = bottom
+ self.right = right
+ }
+
+ /// Read back from the frame Chromium gave the view. `NativeViewHostMac::ShowWidget` passes the
+ /// contents' rect from the Chrome window's top left with the window's client height, and
+ /// `WebContentsNSViewBridge::SetBounds` sets it in whatever superview the view has, flipped
+ /// against that height unless the superview is flipped. Nil when the frame doesn't fit the
+ /// client area, so it can't be Chromium's layout. Chromium's rects are whole points: it cuts
+ /// the window's size down to whole points (`gfx::Rect` from an `NSRect`), and so does this.
+ public init?(chromiumFrame frame: CGRect, superviewFlipped: Bool, clientSize: CGSize) {
+ let clientSize = CGSize(width: clientSize.width.rounded(.down), height: clientSize.height.rounded(.down))
+ guard frame.width > 0, frame.height > 0, clientSize.width > 0, clientSize.height > 0 else { return nil }
+ let top = superviewFlipped ? frame.minY : clientSize.height - frame.maxY
+ let edges = [top, frame.minX, clientSize.height - top - frame.height, clientSize.width - frame.maxX]
+ guard edges.allSatisfy({ $0 > -1 }) else { return nil }
+ let whole = edges.map { max(0, $0.rounded()) }
+ self.init(top: whole[0], left: whole[1], bottom: whole[2], right: whole[3])
+ }
+
+ /// The view's frame in `bounds`, the rect the page's compositor fills, with these insets.
+ public func frame(in bounds: CGRect, flipped: Bool) -> CGRect {
+ let width = max(0, bounds.width - left - right)
+ let height = max(0, bounds.height - top - bottom)
+ return CGRect(x: bounds.minX + left, y: bounds.minY + (flipped ? top : bottom), width: width, height: height)
+ }
+}
diff --git a/Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift b/Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift
new file mode 100644
index 0000000..d2eccae
--- /dev/null
+++ b/Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift
@@ -0,0 +1,54 @@
+import CoreGraphics
+import CraCore
+import Testing
+
+/// The page's input view keeps the place Chromium gave it below a views-side bar, wherever Cra
+/// lays it out (GitHub #241).
+struct PageViewInsetsTests {
+ /// The debugger infobar, 40 pt, above a page in a 1000×700 Chrome window: Chromium sets the
+ /// view to (0, 0, 1000, 660) in an unflipped superview and (0, 40, 1000, 660) in a flipped one.
+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/241"))
+ func readsTheBarAboveThePageInEitherSuperview() {
+ let client = CGSize(width: 1000, height: 700)
+ let bar = PageViewInsets(top: 40, left: 0, bottom: 0, right: 0)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 0, width: 1000, height: 660), superviewFlipped: false, clientSize: client) == bar)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 40, width: 1000, height: 660), superviewFlipped: true, clientSize: client) == bar)
+ }
+
+ /// The card's web area is the size the page's compositor fills, not always the Chrome window's
+ /// (a frozen card while panes animate): the view stays under the bar, not one bar-height low.
+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/241"))
+ func placesTheViewBelowTheBarInTheCard() {
+ let bar = PageViewInsets(top: 40, left: 0, bottom: 0, right: 0)
+ let area = CGRect(x: 0, y: 0, width: 800, height: 600)
+ #expect(bar.frame(in: area, flipped: false) == CGRect(x: 0, y: 0, width: 800, height: 560))
+ #expect(bar.frame(in: area, flipped: true) == CGRect(x: 0, y: 40, width: 800, height: 560))
+ #expect(PageViewInsets.zero.frame(in: area, flipped: false) == area)
+ }
+
+ /// Reading back what was placed gives the same insets, on every edge.
+ @Test func roundTrips() {
+ let insets = PageViewInsets(top: 36, left: 12, bottom: 8, right: 300)
+ let client = CGSize(width: 1200, height: 800)
+ for flipped in [false, true] {
+ let placed = insets.frame(in: CGRect(origin: .zero, size: client), flipped: flipped)
+ #expect(PageViewInsets(chromiumFrame: placed, superviewFlipped: flipped, clientSize: client) == insets)
+ }
+ }
+
+ /// A page filling its window has none, also when the window's height isn't whole points.
+ @Test func aFullPageHasNone() {
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 0, width: 1000, height: 700), superviewFlipped: false,
+ clientSize: CGSize(width: 1000.5, height: 700.75)) == .zero)
+ }
+
+ /// Frames that aren't Chromium's layout of this window are ignored: bigger than the client
+ /// area, outside it, or empty (CEF's 10 pt window before the first layout).
+ @Test func ignoresFramesThatDoNotFit() {
+ let client = CGSize(width: 1000, height: 700)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 0, width: 1000, height: 800), superviewFlipped: false, clientSize: client) == nil)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: -20, y: 0, width: 500, height: 700), superviewFlipped: false, clientSize: client) == nil)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 0, width: 0, height: 0), superviewFlipped: false, clientSize: client) == nil)
+ #expect(PageViewInsets(chromiumFrame: CGRect(x: 0, y: 0, width: 10, height: 10), superviewFlipped: false, clientSize: .zero) == nil)
+ }
+}
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swift
index 177c287..e4c81f8 100644
--- a/Sources/Cra/App/AppDelegate.swift
+++ b/Sources/Cra/App/AppDelegate.swift
@@ -841,6 +841,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
for item in comps?.queryItems ?? [] { if let v = item.value { dict[item.name] = v } }
if let js = dict["devtoolsjs"] { main.debugRunInDevTools(js) }
if dict["embedDump"] != nil { NSLog("%@", main.embeddedPagesDump()); return }
+ if dict["pageInsets"] != nil { CraLog.note(main.pageInsetsReadout()); return }
// Tests that leave the pointer alone: scroll=dy,steps,x,y scrolls the scroll view at a
// point of the main window (from its top left); swipe=dx,steps plays a space swipe.
if let g = dict["scroll"]?.split(separator: ",").compactMap({ Double($0) }), g.count == 4, let w = main.window {
diff --git a/Sources/Cra/UI/ShellView.swift b/Sources/Cra/UI/ShellView.swift
index 2a734bc..c9aefc1 100644
--- a/Sources/Cra/UI/ShellView.swift
+++ b/Sources/Cra/UI/ShellView.swift
@@ -749,7 +749,7 @@ final class ShellView: NSView {
if let focus, showDev {
for v in [devToolsHost, devToolsDivider, devToolsHandle] where v.superview !== focus { v.removeFromSuperview(); focus.addSubview(v) }
focus.webArea.frame = NSRect(x: 0, y: 0, width: fb.width - devW, height: bodyH)
- for sub in focus.webArea.subviews where sub.frame != focus.webArea.bounds { sub.frame = focus.frozenWebBounds ?? focus.webArea.bounds }
+ EmbeddedPages.place(focus.webArea.subviews, in: focus.frozenWebBounds ?? focus.webArea.bounds)
}
// A frontend-docked DevTools paints its own split; the shell's dock chrome stays hidden.
devToolsHost.isHidden = !showDev || selfDock
diff --git a/Sources/Cra/UI/SplitView/PaneCardView.swift b/Sources/Cra/UI/SplitView/PaneCardView.swift
index 869afac..1aca67a 100644
--- a/Sources/Cra/UI/SplitView/PaneCardView.swift
+++ b/Sources/Cra/UI/SplitView/PaneCardView.swift
@@ -204,7 +204,7 @@ final class PaneCardView: NSView {
elsewhereView.layer?.cornerRadius = pageBackground.layer?.cornerRadius ?? 0
elsewhereView.layer?.maskedCorners = pageBackground.layer?.maskedCorners ?? []
let wb = frozenWebBounds ?? webArea.bounds
- for sub in webArea.subviews where sub.frame != wb { sub.frame = wb }
+ EmbeddedPages.place(webArea.subviews, in: wb)
ring.frame = b
}
diff --git a/Sources/Cra/UI/Windows/EmbeddedPages.swift b/Sources/Cra/UI/Windows/EmbeddedPages.swift
index 4502027..4ce190c 100644
--- a/Sources/Cra/UI/Windows/EmbeddedPages.swift
+++ b/Sources/Cra/UI/Windows/EmbeddedPages.swift
@@ -44,19 +44,73 @@ enum EmbeddedPages {
/// What moves, by Chrome window, wherever the views are now (any window's card, or none
/// while the tab is hidden), so a tab moving to another Cra window still finds its page.
/// Chromium draws the page with the window's compositor, whose layers live in
- /// ViewsCompositorSuperview; WebContentsViewCocoa on top of it only takes input. Both move,
- /// in that order.
+ /// ViewsCompositorSuperview; WebContentsViewCocoa on top of it only takes input. Between them
+ /// Cra's ChromeBarClicks takes what lands on a bar Chromium draws around the page. All three
+ /// move, in that order, the compositor first and the page's input view last.
private static let pages = NSMapTable<NSWindow, NSArray>.weakToStrongObjects()
static func pageViews(of window: NSWindow) -> [NSView]? {
if let views = pages.object(forKey: window) as? [NSView] { return views }
guard let cv = window.contentView, let page = webContentsView(in: cv),
let compositor = find("ViewsCompositorSuperview", in: cv) else { return nil }
- let views = [compositor, page]
+ let views = [compositor, ChromeBarClicks(host: window, compositor: compositor), page]
pages.setObject(views as NSArray, forKey: window)
+ watch(page, compositor: compositor, host: window)
return views
}
+ /// Lays page views out in `bounds` of their superview: the compositor fills it, and the input
+ /// view keeps the place Chromium gave it there (below the debugger infobar, #241). Every frame
+ /// Cra gives a page view goes through here, so any other change of the input view's frame is
+ /// Chromium laying it out. Other views (none embedded) just fill `bounds`.
+ static func place(_ views: [NSView], in bounds: NSRect) {
+ placing += 1
+ defer { placing -= 1 }
+ for v in views {
+ let flipped = v.superview?.isFlipped ?? false
+ let frame = watcher(of: v).map { $0.insets.frame(in: bounds, flipped: flipped) } ?? bounds
+ if v.frame != frame { v.frame = frame }
+ }
+ }
+
+ /// Chromium's insets for a page's input view, for `cra://debug` and the log.
+ static func chromiumInsets(of view: NSView) -> PageViewInsets? { watcher(of: view)?.insets }
+
+ nonisolated(unsafe) private static var watcherKey: UInt8 = 0
+ private static var placing = 0
+
+ private static func watcher(of view: NSView) -> PageFrameWatcher? {
+ objc_getAssociatedObject(view, &watcherKey) as? PageFrameWatcher
+ }
+
+ /// The input view still has Chromium's frame here, in its Chrome window: start from that.
+ private static func watch(_ page: NSView, compositor: NSView, host: NSWindow) {
+ guard watcher(of: page) == nil else { return }
+ let watcher = PageFrameWatcher(host: host, compositor: compositor)
+ objc_setAssociatedObject(page, &watcherKey, watcher, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+ page.postsFrameChangedNotifications = true
+ NotificationCenter.default.addObserver(watcher, selector: #selector(PageFrameWatcher.frameChanged(_:)),
+ name: NSView.frameDidChangeNotification, object: page)
+ chromiumMoved(page, watcher)
+ }
+
+ /// Chromium set the input view's frame (`WebContentsNSViewBridge::SetBounds`, as its layout
+ /// shows or hides a bar above the page): keep its insets, and in a card put the view where
+ /// they say against the compositor, which may not be the Chrome window's size.
+ fileprivate static func chromiumMoved(_ page: NSView, _ watcher: PageFrameWatcher) {
+ guard placing == 0, let host = watcher.host else { return }
+ let client = host.contentRect(forFrameRect: host.frame).size
+ guard let insets = PageViewInsets(chromiumFrame: page.frame, superviewFlipped: page.superview?.isFlipped ?? false,
+ clientSize: client) else { return }
+ if insets != watcher.insets {
+ CraLog.note("page view: Chromium insets top=\(Int(insets.top)) left=\(Int(insets.left)) bottom=\(Int(insets.bottom)) right=\(Int(insets.right))")
+ watcher.insets = insets
+ }
+ if let compositor = watcher.compositor, let area = page.superview, compositor.superview === area, area !== host.contentView {
+ place([page], in: compositor.frame)
+ }
+ }
+
static func webContentsView(in root: NSView) -> NSView? { find("WebContentsViewCocoa", in: root) }
static func renderView(in root: NSView) -> NSView? { find("RenderWidgetHostViewCocoa", in: root) }
@@ -84,3 +138,63 @@ enum EmbeddedPages {
}
}
}
+
+/// An embedded page's input view's watch on its own frame (EmbeddedPages.place). Owned by the
+/// view, so it and its observation end with the page.
+private final class PageFrameWatcher: NSObject {
+ weak var host: NSWindow?
+ weak var compositor: NSView?
+ var insets = PageViewInsets.zero
+
+ init(host: NSWindow, compositor: NSView) {
+ self.host = host
+ self.compositor = compositor
+ }
+
+ @objc func frameChanged(_ note: Notification) {
+ guard let page = note.object as? NSView else { return }
+ MainActor.assumeIsolated { EmbeddedPages.chromiumMoved(page, self) }
+ }
+}
+
+/// The clicks on a bar Chromium's views draw around the page, like the debugger infobar's Cancel
+/// and ✕ (#241). The bar's views stay in the Chrome window, which ignores the mouse, so this view
+/// fills the compositor's area under the page's input view and hands what reaches it (the bar's
+/// strip) to the Chrome window at the same place in its client area.
+final class ChromeBarClicks: NSView {
+ private weak var host: NSWindow?
+ private weak var compositor: NSView?
+
+ init(host: NSWindow, compositor: NSView) {
+ self.host = host
+ self.compositor = compositor
+ super.init(frame: .zero)
+ }
+
+ required init?(coder: NSCoder) { nil }
+
+ /// Back in its own window (DevTools docked) the Chrome window takes its clicks itself.
+ override func hitTest(_ point: NSPoint) -> NSView? {
+ guard let host, window !== host else { return nil }
+ return super.hitTest(point)
+ }
+
+ override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }
+ override func mouseDown(with event: NSEvent) { forward(event) }
+ override func mouseDragged(with event: NSEvent) { forward(event) }
+ override func mouseUp(with event: NSEvent) { forward(event) }
+ override func rightMouseDown(with event: NSEvent) { forward(event) }
+ override func rightMouseUp(with event: NSEvent) { forward(event) }
+
+ private func forward(_ event: NSEvent) {
+ guard let host, let compositor, let content = host.contentView else { return }
+ // The compositor draws the Chrome window's client area from its top left.
+ let p = compositor.convert(event.locationInWindow, from: nil)
+ let fromTop = compositor.isFlipped ? p.y : compositor.bounds.height - p.y
+ let inHost = content.convert(NSPoint(x: p.x, y: content.isFlipped ? fromTop : content.bounds.height - fromTop), to: nil)
+ guard let e = NSEvent.mouseEvent(with: event.type, location: inHost, modifierFlags: event.modifierFlags, timestamp: event.timestamp,
+ windowNumber: host.windowNumber, context: nil, eventNumber: event.eventNumber,
+ clickCount: event.clickCount, pressure: event.pressure) else { return }
+ host.sendEvent(e)
+ }
+}
diff --git a/Sources/Cra/UI/Windows/ExtensionSidePanel.swift b/Sources/Cra/UI/Windows/ExtensionSidePanel.swift
index 3979a75..ba61448 100644
--- a/Sources/Cra/UI/Windows/ExtensionSidePanel.swift
+++ b/Sources/Cra/UI/Windows/ExtensionSidePanel.swift
@@ -78,7 +78,7 @@ final class ExtensionSidePanelCard: NSView {
title.frame = NSRect(x: icon.frame.maxX + 8, y: (h - titleH) / 2, width: max(0, closeButton.frame.minX - icon.frame.maxX - 16), height: titleH)
hairline.frame = NSRect(x: 0, y: b.height - h - 1, width: b.width, height: 1)
pageArea.frame = NSRect(x: 0, y: 0, width: b.width, height: max(0, b.height - h - 1))
- for sub in pageArea.subviews where sub.frame != pageArea.bounds { sub.frame = pageArea.bounds }
+ EmbeddedPages.place(pageArea.subviews, in: pageArea.bounds)
}
// The same shadow as a page card (PaneCardView): a sibling behind it.
@@ -268,7 +268,7 @@ final class ExtensionSidePanelController: NSObject, @preconcurrency CraBrowserDe
EmbeddedPages.markHost(host)
let area = shell.sidePanel.pageArea
if views.contains(where: { $0.superview !== area }) { for v in views { area.addSubview(v) } }
- for v in views where v.frame != area.bounds { v.frame = area.bounds }
+ EmbeddedPages.place(views, in: area.bounds)
}
/// The panel page's views (embedded in the card), so the window keeps its focus there.
diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swift
index 28b13d4..bee4180 100644
--- a/Sources/Cra/UI/Windows/MainWindowController.swift
+++ b/Sources/Cra/UI/Windows/MainWindowController.swift
@@ -1024,10 +1024,33 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM
for v in views { target.addSubview(v) }
}
let bounds = shell.paneCards.first { $0.webArea === target }?.frozenWebBounds ?? target.bounds
- for v in views where v.frame != bounds { v.frame = bounds }
+ EmbeddedPages.place(views, in: bounds)
if embedFocusTab == id { focusEmbeddedPage(id) }
}
+ /// `cra://debug?pageInsets=1`: where the focused page's input view sits against the compositor
+ /// that draws the page, after its card lays out again, and the insets Chromium gave it. While
+ /// the debugger bar shows, both say the bar's height at the top (#241).
+ func pageInsetsReadout() -> String {
+ guard let host = browsers.visibleRuntime?.hostWindow, let views = EmbeddedPages.pageViews(of: host),
+ let compositor = views.first, let page = views.last, let area = page.superview else { return "page view insets: no page" }
+ pageInsetsReadouts += 1
+ if let card = shell.paneCards.first(where: { $0.webArea === area }) {
+ card.needsLayout = true
+ card.layoutSubtreeIfNeeded()
+ }
+ let c = compositor.frame, p = page.frame
+ let top = area.isFlipped ? p.minY - c.minY : c.maxY - p.maxY
+ let bottom = area.isFlipped ? c.maxY - p.maxY : p.minY - c.minY
+ let chromium = EmbeddedPages.chromiumInsets(of: page).map { "top=\(Int($0.top)) left=\(Int($0.left)) bottom=\(Int($0.bottom)) right=\(Int($0.right))" } ?? "none"
+ // The compositor's area from the window's top left, where clickAt points go.
+ let inWindow = area.convert(c, to: nil)
+ let origin = "\(Int(inWindow.minX)),\(Int((window?.frame.height ?? 0) - inWindow.maxY))"
+ return "page view insets \(pageInsetsReadouts): top=\(Int(top)) left=\(Int(p.minX - c.minX)) bottom=\(Int(bottom)) right=\(Int(c.maxX - p.maxX)); Chromium's \(chromium); page area at \(origin) \(Int(c.width))x\(Int(c.height))"
+ }
+
+ private var pageInsetsReadouts = 0
+
/// `cra://debug?embedDump=1`: where every page view is, for EmbeddedPages work.
func embeddedPagesDump() -> String {
func tree(_ v: NSView, _ depth: Int) -> String {
diff --git a/Tests/Fixtures/DebuggerExtension/manifest.json b/Tests/Fixtures/DebuggerExtension/manifest.json
new file mode 100644
index 0000000..745feba
--- /dev/null
+++ b/Tests/Fixtures/DebuggerExtension/manifest.json
@@ -0,0 +1,8 @@
+{
+ "manifest_version": 3,
+ "name": "Cra Debugger Fixture",
+ "version": "1.0",
+ "description": "Made up for scripts/scenario.sh: attaches chrome.debugger to a page, as the Playwright MCP bridge does, so Chrome shows its \"started debugging this browser\" bar (GitHub #241).",
+ "permissions": ["debugger", "tabs"],
+ "background": { "service_worker": "worker.js" }
+}
diff --git a/Tests/Fixtures/DebuggerExtension/worker.js b/Tests/Fixtures/DebuggerExtension/worker.js
new file mode 100644
index 0000000..254fd45
--- /dev/null
+++ b/Tests/Fixtures/DebuggerExtension/worker.js
@@ -0,0 +1,8 @@
+// A page whose address has n=debugger gets the debugger attached, which shows Chrome's
+// "Cra Debugger Fixture started debugging this browser" bar above every page; n=detach lets go,
+// and the bar goes away.
+chrome.tabs.onUpdated.addListener((tabId, info, tab) => {
+ if (info.status !== "complete" || !tab.url) return;
+ if (tab.url.includes("n=debugger")) chrome.debugger.attach({ tabId }, "1.3", () => void chrome.runtime.lastError);
+ if (tab.url.includes("n=detach")) chrome.debugger.detach({ tabId }, () => void chrome.runtime.lastError);
+});
diff --git a/Tests/Scenarios/debugger-infobar.scenario b/Tests/Scenarios/debugger-infobar.scenario
new file mode 100644
index 0000000..93876e8
--- /dev/null
+++ b/Tests/Scenarios/debugger-infobar.scenario
@@ -0,0 +1,31 @@
+# An extension attaches chrome.debugger, as the Playwright MCP bridge does, and Chrome shows its
+# "<extension> started debugging this browser" bar above the page. The compositor drew the page
+# below the bar, but the card laid the page's input view over the whole web area, so every click
+# landed one bar-height low, and the bar's Cancel and ✕ took no clicks at all (GitHub #241).
+# The input view keeps Chromium's place below the bar when the card lays out again, also after a
+# resize, and a click on the bar's ✕ reaches Chrome's views: the bar goes and the page fills
+# the card again.
+# promise: #241
+budget rss=700 stalls50=5
+cra://debug?installExtension=${FIXTURES}/DebuggerExtension
+relaunch
+cra://debug?windowSize=1200x800
+wait 1
+cra://open?url=${PAGE}?n=debugger
+expect-log page view: Chromium insets top=[1-9][0-9]* left=0 bottom=0 right=0
+wait 1
+cra://debug?pageInsets=1
+expect-log page view insets 1: top=[1-9][0-9]* left=0 bottom=0 right=0; Chromium's top=[1-9]
+cra://debug?windowSize=1000x700
+wait 1
+cra://debug?pageInsets=1
+expect-log page view insets 2: top=[1-9][0-9]* left=0 bottom=0 right=0; Chromium's top=[1-9]
+cra://debug?windowSize=1200x800
+wait 1
+# The bar's ✕, 20 pt in from the page's right edge (the page area spans x 328…1190 from y 10).
+cra://debug?clickAt=1170,38
+expect-log page view: Chromium insets top=0 left=0 bottom=0 right=0
+wait 1
+cra://debug?pageInsets=1
+expect-log page view insets 3: top=0 left=0 bottom=0 right=0; Chromium's top=0
+reject-log fault:
diff --git a/Tests/promises.lock b/Tests/promises.lock
index 29f3312..5bcb9e3 100644
--- a/Tests/promises.lock
+++ b/Tests/promises.lock
@@ -364,5 +364,8 @@
#233 Packages/CraCore/Tests/CraCoreTests/MouseButtonSpaceSwitchTests.swift::backGoesToThePreviousSpaceAndForwardToTheNext 10b4dc8a4a65
#233 Packages/CraCore/Tests/CraCoreTests/MouseButtonSpaceSwitchTests.swift::otherButtonsDoNotSwitch 07b725a8e6f5
#233 Tests/Scenarios/mouse-buttons-switch-spaces.scenario 79148e8b3ebb
+#241 Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift::placesTheViewBelowTheBarInTheCard 7ba2374d493e
+#241 Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift::readsTheBarAboveThePageInEitherSuperview 548a9473598d
+#241 Tests/Scenarios/debugger-infobar.scenario 189c93dc5b96
#243 Packages/CraCore/Tests/CraCoreTests/TabRowTrailingTests.swift::hoveredNameRunsToTheCloseButton 0a8658ede567
#243 Packages/CraCore/Tests/CraCoreTests/TabRowTrailingTests.swift::restingTailIsUnchanged f479053f4258