Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dw/ruler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Dillo Widget
*
* Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
* Copyright 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
Expand Down Expand Up @@ -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 ();
}
Expand Down
1 change: 1 addition & 0 deletions test/html/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 10 additions & 0 deletions test/html/render/hr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Test hr length</title>
</head>
<body>
<hr>
<hr style="border-width: 10px">
</body>
</html>
24 changes: 24 additions & 0 deletions test/html/render/hr.ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Test hr length</title>
</head>
<style>
div {
border: 1px inset;
margin-top: 5px;
margin-bottom: 5px;
}
</style>
<body>
<!--
Default canvas width is 780, with 5 pixels of margin for body on each
side, so we have 770 pixels of space available before the scrollbar is
shown. The ruler needs one pixel on each side by default, so 768 px is the
available width.
-->
<div style="width: 768px"></div>
<!-- Same but with 20 pixels for the ruler border -->
<div style="width: 750px; border-width: 10px"></div>
</body>
</html>
Loading