]> git.saurik.com Git - wxWidgets.git/commitdiff
another bug fixed: wrong lookup of nearest cell before given point
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 2 Jun 2003 23:35:26 +0000 (23:35 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 2 Jun 2003 23:35:26 +0000 (23:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/htmlcell.cpp

index b1370118957b6a1f1a86a8365f22ed3e03dff031..1e86ed4112da287db7ac714a95471b7e86797457 100644 (file)
@@ -747,16 +747,18 @@ wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y,
     }
     else if ( flags & wxHTML_FIND_NEAREST_BEFORE )
     {
-        wxHtmlCell *c;
+        wxHtmlCell *c2, *c = NULL;
         for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() )
         {
             if (cell->GetPosY() > y || 
                     (cell->GetPosY() == y && cell->GetPosX() > x))
                 break;
-            c = cell->FindCellByPos(x - cell->GetPosX(), y - cell->GetPosY(),
-                                    flags);
-            if (c) return c;
+            c2 = cell->FindCellByPos(x - cell->GetPosX(), y - cell->GetPosY(),
+                                     flags);
+            if (c2)
+                c = c2;
         }
+        if (c) return c;
     }
 
     return NULL;