aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2025-02-28 00:07:25 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-02-28 00:11:27 +0100
commit432437a6840b8175ac1399c56448833aeb7333f0 (patch)
treeae0d71e0fccbd62d4884f238bc821c871e03b42a
parentfbd719f93ab659fec6c42952e76f5e5b971728be (diff)
Fix text under scrollbar on the left
When the page is first layouted, we can then determine if the vertical scrollbar needs to be present. When the vertical scrollbar is on the left side, the whole content needs to be shifted to the right, so we need to allocate the top level widget again. The current fix simply marks the top level widget for allocation. Fixes: https://github.com/dillo-browser/dillo/issues/359
-rw-r--r--dw/layout.cc7
-rw-r--r--test/html/manual/left-scrollbar.html15
2 files changed, 21 insertions, 1 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index 1784b139..f0a46fa8 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -2,7 +2,7 @@
* Dillo Widget
*
* Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
- * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ * Copyright 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -969,6 +969,11 @@ void Layout::resizeIdle ()
DBG_OBJ_SET_SYM ("canvasHeightGreater",
canvasHeightGreater ? "true" : "false");
containerSizeChanged ();
+
+ // We need to place the top level widget at an offset, so
+ // be sure that we allocate it with the new allocation.x
+ if (view->getScrollbarOnLeft())
+ topLevel->setFlags(Widget::NEEDS_ALLOCATE);
}
// Set viewport sizes.
diff --git a/test/html/manual/left-scrollbar.html b/test/html/manual/left-scrollbar.html
new file mode 100644
index 00000000..dfa0d2e5
--- /dev/null
+++ b/test/html/manual/left-scrollbar.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test text under left scrollbar</title>
+ <style>
+ body { width: 700px; height: 1000px; }
+ </style>
+ </head>
+ <body>
+ <p>
+ Can you read me?
+ <em>You must set the scrollbar_on_left=YES config option</em>
+ </p>
+ </body>
+</html>