]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_tables.cpp
Add wxGCC_WARNING_{SUPPRESS,RESTORE} macros and use them for -Wfloat-equal.
[wxWidgets.git] / src / html / m_tables.cpp
index 5b5b22fca17b38c03dcae992f5b2b821e981660e..1b96963be3640d3cc834ac67a11e819b9a571705 100644 (file)
@@ -43,7 +43,7 @@ struct colStruct
             // ('width' is the number, 'units' determines its meaning)
     int minWidth, maxWidth;
             // minimal/maximal column width. This is needed by HTML 4.0
-            // layouting algorithm and can be determined by trying to
+            // layout algorithm and can be determined by trying to
             // layout table cells with width=1 and width=infinity
     int leftpos, pixwidth, maxrealwidth;
             // temporary (depends on actual width of table)
@@ -135,7 +135,7 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t
     if (tag.HasParam(wxT("BGCOLOR")))
     {
         tag.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg);
-        if (m_tBkg.Ok())
+        if (m_tBkg.IsOk())
             SetBackgroundColour(m_tBkg);
     }
     if (tag.HasParam(wxT("VALIGN")))
@@ -288,7 +288,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
         {
             wxString wd = tag.GetParam(wxT("WIDTH"));
 
-            if (wd[wd.length()-1] == wxT('%'))
+            if (!wd.empty() && wd[wd.length()-1] == wxT('%'))
             {
                 if ( wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width) == 1 )
                 {
@@ -344,7 +344,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
         wxColour bk = m_rBkg;
         if (tag.HasParam(wxT("BGCOLOR")))
             tag.GetParamAsColour(wxT("BGCOLOR"), &bk);
-        if (bk.Ok())
+        if (bk.IsOk())
             cell->SetBackgroundColour(bk);
     }
     if (m_Border > 0)
@@ -460,7 +460,7 @@ void wxHtmlTableCell::Layout(int w)
 
     /*
 
-    LAYOUTING :
+    LAYOUT :
 
     */
 
@@ -702,19 +702,18 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
             {
                 if (tag.HasParam(wxT("WIDTH")))
                 {
-                    wxString wd = tag.GetParam(wxT("WIDTH"));
-
-                    if (wd[wd.length()-1] == wxT('%'))
-                    {
-                        int width = 0;
-                        wxSscanf(wd.c_str(), wxT("%i%%"), &width);
-                        m_Table->SetWidthFloat(width, wxHTML_UNITS_PERCENT);
-                    }
-                    else
+                    int width = 0;
+                    bool wpercent = false;
+                    if (tag.GetParamAsIntOrPercent(wxT("WIDTH"), &width, wpercent))
                     {
-                        int width = 0;
-                        wxSscanf(wd.c_str(), wxT("%i"), &width);
-                        m_Table->SetWidthFloat((int)(m_WParser->GetPixelScale() * width), wxHTML_UNITS_PIXELS);
+                        if (wpercent)
+                        {
+                            m_Table->SetWidthFloat(width, wxHTML_UNITS_PERCENT);
+                        }
+                        else
+                        {
+                            m_Table->SetWidthFloat((int)(m_WParser->GetPixelScale() * width), wxHTML_UNITS_PIXELS);
+                        }
                     }
                 }
                 else