Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: brave.com is now scrollable #24066

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion Userland/Libraries/LibWeb/Layout/Box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ bool Box::is_scroll_container() const

bool Box::is_user_scrollable() const
{
// FIXME: Support horizontal scroll as well (overflow-x)
// FIXME: Support horizontal scroll as well (overflow-x).
if (computed_values().overflow_y() == CSS::Overflow::Hidden || computed_values().overflow_x() == CSS::Overflow::Hidden)
return false;
Comment on lines +60 to +61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring scrolling if either of directions has "overflow: hidden" is wrong: vertical scrolling should not be ignored, if only horizontal direction has hidden overflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming you trying to fix:

<!doctype html><style>
* { font-size: 200px; }
main { overflow-x: hidden; }
</style>
<main>
1<br>
2<br>
3<br>
4<br>
5<br>
6<br>
7<br>
8<br>
9<br>

let's have a look at paintable tree dump:

ViewportPaintable (Viewport<#document>) [0,0 1279x780] overflow: [0,0 1279x2086]
  PaintableWithLines (BlockContainer<HTML>) [0,0 1279x2086]
    PaintableWithLines (BlockContainer<BODY>) [8,8 1263x2070]
      PaintableWithLines (BlockContainer<MAIN>) [8,8 1263x2070]
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)
        TextPaintable (TextNode<#text>)

the only paintable with scrollable overflow (named overflow in the dump) is viewport. <main> does not have any. so <main> is scrollable based on css overflow properties, because overflow_y is auto.
BUT it does not have any scrollable overflow. let's make is_user_scrollable() to also look at rect returned by PaintableBox::scrollable_overflow_rect()?


return computed_values().overflow_y() == CSS::Overflow::Scroll || computed_values().overflow_y() == CSS::Overflow::Auto;
}

Expand Down