Add a wxHtmlTag helper parsing both absolute values and percents.
This allows to avoid some code duplication in different handlers. Closes #14868. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -676,16 +676,16 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
||||
|
||||
if (tag.HasParam(wxT("WIDTH")))
|
||||
{
|
||||
wxString param = tag.GetParam(wxT("WIDTH"));
|
||||
wxSscanf(param.c_str(), wxT("%i"), &w);
|
||||
if (param.EndsWith(wxT("%"))) {
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
else if (w > 100)
|
||||
w = 100;
|
||||
wpercent = true;
|
||||
if (tag.GetParamAsIntOrPercent(wxT("WIDTH"), &w, wpercent))
|
||||
{
|
||||
if (wpercent)
|
||||
{
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
else if (w > 100)
|
||||
w = 100;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (tag.HasParam(wxT("HEIGHT")))
|
||||
|
||||
Reference in New Issue
Block a user