mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-17 16:28:06 +03:00
5285e22f2a
The main intention of this change is to have a consistent look and behavior across all scrollbars, including elements with `overflow: scroll` and `overflow: auto`, iframes, and a page. Before: - Page's scrollbar is painted by Browser (Qt/AppKit) using the corresponding UI framework style, - Both WebContent and Browser know the scroll position offset. - WebContent uses did_request_scroll_to() IPC call to send updates. - Browser uses set_viewport_rect() to send updates. After: - Page's scrollbar is painted on WebContent side using the same style as currently used for elements with `overflow: scroll` and `overflow: auto`. A nice side effects: scrollbars are now painted for iframes, and page's scrollbar respects scrollbar-width CSS property. - Only WebContent knows scroll position offset. - did_request_scroll_to() is no longer used. - set_viewport_rect() is changed to set_viewport_size().
27 lines
786 B
HTML
27 lines
786 B
HTML
<!DOCTYPE html>
|
|
<link rel="match" href="reference/scroll-iframe-ref.html" />
|
|
<style>
|
|
iframe {
|
|
width: 200px;
|
|
height: 200px;
|
|
border: 1px solid black;
|
|
}
|
|
</style>
|
|
<body></body>
|
|
<script>
|
|
const iframe = document.createElement("iframe");
|
|
iframe.srcdoc = `
|
|
<style>
|
|
body { margin: 0 }
|
|
html { scrollbar-width: none; }
|
|
</style>
|
|
<div style="width: 200px; height: 200px; background-color: darkblue"></div>
|
|
<div style="width: 200px; height: 200px; background-color: blue"></div>
|
|
<div style="width: 200px; height: 200px; background-color: magenta"></div>
|
|
`;
|
|
iframe.onload = function () {
|
|
iframe.contentWindow.scroll(0, 200);
|
|
};
|
|
document.body.appendChild(iframe);
|
|
</script>
|