~ubuntu-branches/ubuntu/lucid/kdelibs/lucid

162 by Jonathan Riddell
* Merge with Debian, remaining changes
1
--- a/khtml/rendering/table_layout.cpp
2
+++ b/khtml/rendering/table_layout.cpp
3
@@ -297,7 +297,8 @@ void FixedTableLayout::layout()
1.1.14 by Debian Qt/KDE Maintainers
+++ Changes by Ana Beatriz Guerrero Lopez:
4
 #endif
5
         for ( int i = 0; available > 0 && i < nEffCols; i++ ) {
6
             if ( width[i].isPercent() ) {
7
-                int w = base * width[i].value() / totalPercent;
8
+                // totalPercent may be 0 below if all %-width specifed are 0%. (#172557)
9
+                int w = totalPercent ? base * width[i].value() / totalPercent : 0;
10
                 available -= w;
11
                 calcWidth[i] = w;
12
             }
162 by Jonathan Riddell
* Merge with Debian, remaining changes
13
@@ -313,7 +314,8 @@ void FixedTableLayout::layout()
1.1.14 by Debian Qt/KDE Maintainers
+++ Changes by Ana Beatriz Guerrero Lopez:
14
 
15
         for ( int i = 0; available > 0 && i < nEffCols; i++ ) {
16
             if ( width[i].isVariable() ) {
17
-                int w = available / totalVariable;
18
+                // totalVariable may be 0 below if all the variable widths specified are 0.
19
+                int w = totalVariable ? available / totalVariable : 0;
20
                 available -= w;
21
                 calcWidth[i] = w;
22
 		totalVariable--;