diff --git a/dw/ruler.cc b/dw/ruler.cc index fc0bbce6..5e922723 100644 --- a/dw/ruler.cc +++ b/dw/ruler.cc @@ -2,6 +2,7 @@ * Dillo Widget * * Copyright 2005-2007 Sebastian Geerken + * Copyright 2025 Rodrigo Arias Mallo * * 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 @@ -41,7 +42,10 @@ Ruler::~Ruler () void Ruler::sizeRequestSimpl (core::Requisition *requisition) { - requisition->width = lout::misc::max (getAvailWidth (true), boxDiffWidth ()); + /* The ruler will be drawn by using a 1px border, so we substract the + * border from the available width when computing the content width. */ + int w = lout::misc::max(0, getAvailWidth(true) - boxDiffWidth()); + requisition->width = w; requisition->ascent = boxOffsetY (); requisition->descent = boxRestHeight (); } diff --git a/test/html/Makefile.am b/test/html/Makefile.am index fc959b1f..60455ac5 100644 --- a/test/html/Makefile.am +++ b/test/html/Makefile.am @@ -18,6 +18,7 @@ TESTS = \ render/form-display-none.html \ render/github-infinite-loop.html \ render/hackernews.html \ + render/hr.html \ render/img-aspect-ratio-absolute.html \ render/img-aspect-ratio-div.html \ render/img-aspect-ratio-mix-border.html \ diff --git a/test/html/render/hr.html b/test/html/render/hr.html new file mode 100644 index 00000000..e76dde7a --- /dev/null +++ b/test/html/render/hr.html @@ -0,0 +1,10 @@ + + + + Test hr length + + +
+
+ + diff --git a/test/html/render/hr.ref.html b/test/html/render/hr.ref.html new file mode 100644 index 00000000..21064d9f --- /dev/null +++ b/test/html/render/hr.ref.html @@ -0,0 +1,24 @@ + + + + Test hr length + + + + +
+ +
+ +