]> git.saurik.com Git - wxWidgets.git/commitdiff
simplified justification code; fixed incorrect positioning of first cell on line...
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 1 Jul 2004 07:59:19 +0000 (07:59 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 1 Jul 2004 07:59:19 +0000 (07:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/htmlcell.cpp

index 90dfc46e46bcab00cdb536dca420e4cad385e76c..a020833ea2318d2dadaadbdbc4b16e14e4834813 100644 (file)
@@ -781,41 +781,38 @@ void wxHtmlContainerCell::Layout(int w)
                     // first count the cells which will get extra space
                     int total = 0;
 
-                    const wxHtmlCell *c,
-                                     *prev = NULL,
-                                     *next wxDUMMY_INITIALIZE(NULL);
-                    for ( c = line; c != cell; prev = c, c = next )
+                    const wxHtmlCell *c;
+                    if ( line != cell )
                     {
-                        next = c->GetNext();
-                        if ( c->IsLinebreakAllowed() &&
-                                (next == cell || next->IsLinebreakAllowed()) &&
-                                    (!prev || prev->IsLinebreakAllowed()) )
+                        for ( c = line->GetNext(); c != cell; c = c->GetNext() )
                         {
-                            total++;
+                            if ( c->IsLinebreakAllowed() )
+                            {
+                                total++;
+                            }
                         }
                     }
 
                     // and now extra space to those cells which merit it
                     if ( total )
                     {
-                        prev =
-                        next = NULL;
-                        for ( int n = 0; line != cell; prev = line, line = line->GetNext() )
+                        // first cell on line is not moved:
+                        line->SetPos(line->GetPosX() + s_indent,
+                                     line->GetPosY() + ypos);
+                        
+                        line = line->GetNext();
+                        for ( int n = 0; line != cell; line = line->GetNext() )
                         {
-                            line->SetPos(line->GetPosX() + s_indent +
-                                           ((n * step) / total),
-                                           line->GetPosY() + ypos);
-
-                            next = line->GetNext();
-                            if ( line->IsLinebreakAllowed() &&
-                                    (next == cell ||
-                                        next->IsLinebreakAllowed()) &&
-                                        (!prev || prev->IsLinebreakAllowed()) )
+                            if ( line->IsLinebreakAllowed() )
                             {
                                 // offset the next cell relative to this one
                                 // thus increasing our size
                                 n++;
                             }
+                            
+                            line->SetPos(line->GetPosX() + s_indent +
+                                           ((n * step) / total),
+                                           line->GetPosY() + ypos);
                         }
                     }
                     else