X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18764039ab9c63717297b3132fac826e4c17f063..c1bae26d32d42d8826e89be6e7b944f108e81f91:/src/html/m_tables.cpp diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index 825329b2ca..1b96963be3 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -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.empty() && 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