Re: image overlaps text
Jorge Arellano Cid <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Sebastian,
On Sun, May 22, 2016 at 11:29:34AM -0400, Jorge Arellano Cid wrote:
> [...]
> Short story: I have a working patch.
>
> It solves the overlap (not 1.- 2.- and 3.-). It seems there're
> a few different bugs here.
>
> It's not as clean as I'd like, but it already is a proof of concept.
> I'll try to understand the issues better and clean it up.
>
> AFAIS it can have an effect on general rendering of floats. Currently,
> I dont know if it's related to n33180d.html.
>
> I'll try to share my findings this monday (unless you'd like to
> look at it "as is" now).
OK, here is what I've found so far. Two patches attached plus some
testcases.
The first patch is the fix for o4.html. The second one also tackles
o5.html and o6.html (progressive patches).
AFAIU the gist of the problem is in getGeneratorX() not returning
the correct value on some cases. It is called in four places inside
ooffloatsmgr.cc so other functions are sometimes making calculations
with a wrong x value.
The second problem is getFloatsSize() returning the widest among
a list of floats instead of a cumulative sum of widths inside a
cretain range (the second patch just adds to ilustrate the point).
Some tests:
o4.html o5.html o6.html some-sites [1] [2]
First patch: OK Wrong Wrong OK (1) (2)
Second patch: OK OK OK +/- (3) (4)
(1), (2): No images over text. As it was before.
(3) : Some images overlap text.
(4) : Different background color! some rendering diffs.
[1] http://www.pravdareport.com/}
[2] http://tinyurl.com/j2uzps9
It looks like fixing getGeneratorX() paves the way for fixing hidden
bugs. Also fixing getFloatsSize() can shed light for a patch for
n33180d.html.
Please get back to me when you've processed this so we can coordinate.
HTH
--
Cheers
Jorge.-
_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev
o4.html
(text/html, 891 B)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>overlap</title>
<style type="text/css">
body {text-align:center;}
.center1 {align: left;background-color: olive;}
.center {margin:0 auto;width:810px;background-color: teal;}
.images2 {float:right; width:250px; height:375px;}
</style>
</head>
<body>
<div class="center1">
Watch-what-happens when-this-sentence-is-split
<div class="center">
<img src="logo.png" alt="[image here]" class="images2">
The bugtracker mercurial-extension helps you manage bugs
and issues with your project, and keeps track of all bug
addition/modification just as if the bugs where regular files.
When you modify a bug, or add a new one, a new commit is
done automatically to the repository.
The extension provides you with two commands:
"hg bugs" and "hg bug".
</div>
</div>
</body>
</html>
o5.html
(text/html, 973 B)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>overlap</title>
<style type="text/css">
body {text-align:center;}
.center1 {align: left;background-color: olive;}
.center {margin:0 auto;width:810px;background-color: teal;}
.images1 {float:left;}
.images2 {float:right; width:250px; height:375px;}
</style>
</head>
<body>
<div class="center1">
Watch-what-happens when-this-sentence-is-split
<div class="center">
<img src="mono.gif" alt="[image here]" class="images1">
<img src="logo.png" alt="[image here]" class="images2">
The bugtracker mercurial-extension helps you manage bugs
and issues with your project, and keeps track of all bug
addition/modification just as if the bugs where regular files.
When you modify a bug, or add a new one, a new commit is
done automatically to the repository.
The extension provides you with two commands:
"hg bugs" and "hg bug".
</div>
</div>
</body>
</html>
o6.html
(text/html, 1 KB)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>overlap</title>
<style type="text/css">
body {text-align:center;}
.center1 {align: left;background-color: olive;}
.center {margin:0 auto;width:810px;background-color: teal;}
.images1 {float:left;}
.images2 {float:right; width:250px; height:375px;}
</style>
</head>
<body>
<div class="center1">
Watch-what-happens when-this-sentence-is-split
<div class="center">
<img src="mono.gif" alt="[image here]" class="images1">
<img src="mono.gif" alt="[image here]" class="images2">
<img src="logo.png" alt="[image here]" class="images2">
The bugtracker mercurial-extension helps you manage bugs
and issues with your project, and keeps track of all bug
addition/modification just as if the bugs where regular files.
When you modify a bug, or add a new one, a new commit is
done automatically to the repository.
The extension provides you with two commands:
"hg bugs" and "hg bug".
</div>
</div>
</body>
</html>
mono.gif
(image/gif, 9.2 KB) - not displayed
logo.png
(image/png, 2.2 KB) - not displayed
floats1.diff
(text/x-diff, 1.3 KB)
--- ooffloatsmgr.cc.orig 2016-05-23 09:20:59.000000000 -0400
+++ ooffloatsmgr.cc.tmp1 2016-05-23 17:03:40.000000000 -0400
@@ -476,7 +476,7 @@ int OOFFloatsMgr::calcFloatX (Float *vlo
min (vloat->generator->getGeneratorWidth () + vloat->size.width,
vloat->generator->getMaxGeneratorWidth ());
- x = max (generator->getGeneratorX (oofmIndex) + effGeneratorWidth
+ x = max (generator->getAllocation()->x + effGeneratorWidth
- vloat->size.width - generator->getStyle()->boxRestWidth(),
// Do not exceed container allocation:
0);
diff -r 0c5bd3a2f066 dw/widget.cc
--- a/dw/widget.cc Thu May 19 14:21:08 2016 -0400
+++ b/dw/widget.cc Mon May 23 18:08:23 2016 -0400
@@ -1134,10 +1134,9 @@ void Widget::sizeAllocate (Allocation *a
sizeAllocateImpl (allocation);
- //DEBUG_MSG (DEBUG_ALLOC, "... to %d, %d, %d x %d x %d\n",
- // widget->allocation.x, widget->allocation.y,
- // widget->allocation.width, widget->allocation.ascent,
- // widget->allocation.descent);
+ MSG ("alloc %p to %d, %d, %d x %d x %d\n",
+ this, allocation->x, allocation->y,
+ allocation->width, allocation->ascent, allocation->descent);
this->allocation = *allocation;
unsetFlags (NEEDS_ALLOCATE);
floats2.diff
(text/x-diff, 1.3 KB)
--- ooffloatsmgr.cc.tmp1 2016-05-23 17:03:40.000000000 -0400
+++ ooffloatsmgr.cc 2016-05-23 16:51:36.000000000 -0400
@@ -438,7 +438,7 @@ int OOFFloatsMgr::calcFloatX (Float *vlo
case FLOAT_LEFT:
// Left floats are always aligned on the left side of the generator
// (content, not allocation) ...
- x = generator->getGeneratorX (oofmIndex)
+ x = generator->getAllocation()->x
+ generator->getStyle()->boxOffsetX();
// ... but when the float exceeds the line break width of the container,
@@ -951,14 +951,20 @@ void OOFFloatsMgr::getFloatsSize (Requis
DBG_OBJ_MSGF ("resize.oofm", 1,
"float %p has generator %p (container is %p)",
vloat->getWidget (), vloat->generator, container);
-
+
ensureFloatSize (vloat);
-
- *width = max (*width, calcFloatX (vloat) + vloat->size.width);
+
+ // This finds the widest among the float list
+ //*width = max (*width, calcFloatX (vloat) + vloat->size.width);
+
+ // This blindly computes cum width among the float list
+ if (*width == 0)
+ *width += calcFloatX (vloat);
+ *width += vloat->size.width;
*height = max (*height,
vloat->yReal + vloat->size.ascent + vloat->size.descent);
}
-
+
DBG_OBJ_LEAVE ();
}