mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Apply enclosing scroll frame offset to iframe's position
Fixes iframe painting when it's nested into a scrollable box.
This commit is contained in:
parent
5865cf5864
commit
9def582fba
Notes:
github-actions[bot]
2024-08-07 18:16:53 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/9def582fba8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1003
3 changed files with 50 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/scrollable-contains-iframe-ref.html" />
|
||||
<style>
|
||||
* {
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
#scrollable {
|
||||
width: 80%;
|
||||
height: 300px;
|
||||
border: 1px solid #000;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
iframe {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
<div id="scrollable">
|
||||
<iframe srcdoc="iframe nested into scrollable"></iframe>
|
||||
</div>
|
27
Tests/LibWeb/Ref/scrollable-contains-iframe.html
Normal file
27
Tests/LibWeb/Ref/scrollable-contains-iframe.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/scrollable-contains-iframe-ref.html" />
|
||||
<style>
|
||||
* {
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
#scrollable {
|
||||
width: 80%;
|
||||
height: 300px;
|
||||
border: 1px solid #000;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
iframe {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
<div id="scrollable">
|
||||
<div style="height: 200px"></div>
|
||||
<iframe srcdoc="iframe nested into scrollable"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
const scrollContainer = document.getElementById("scrollable");
|
||||
scrollContainer.scrollTop = 200;
|
||||
</script>
|
|
@ -40,6 +40,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
|
|||
|
||||
if (phase == PaintPhase::Foreground) {
|
||||
auto absolute_rect = this->absolute_rect();
|
||||
absolute_rect.translate_by(enclosing_scroll_frame_offset());
|
||||
auto clip_rect = context.rounded_device_rect(absolute_rect);
|
||||
ScopedCornerRadiusClip corner_clip { context, clip_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
|
||||
|
||||
|
|
Loading…
Reference in a new issue