Changed: Change long if blocks to early exits
--HG-- branch : develop
This commit is contained in:
parent
4fcd71d7ba
commit
ff3b4cfabd
1 changed files with 379 additions and 368 deletions
|
@ -5539,12 +5539,15 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupHTML::htmlIMG(const CHtmlElement &elm)
|
void CGroupHTML::htmlIMG(const CHtmlElement &elm)
|
||||||
{
|
{
|
||||||
// Get the string name
|
std::string src = trim(elm.getAttribute("src"));
|
||||||
if (elm.hasNonEmptyAttribute("src"))
|
if (src.empty())
|
||||||
{
|
{
|
||||||
|
// no 'src' attribute, or empty
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float tmpf;
|
float tmpf;
|
||||||
std::string id = elm.getAttribute("id");
|
std::string id = elm.getAttribute("id");
|
||||||
std::string src = elm.getAttribute("src");
|
|
||||||
|
|
||||||
if (elm.hasNonEmptyAttribute("width"))
|
if (elm.hasNonEmptyAttribute("width"))
|
||||||
getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str());
|
getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str());
|
||||||
|
@ -5599,7 +5602,6 @@ namespace NLGUI
|
||||||
addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current);
|
addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupHTML::htmlINPUT(const CHtmlElement &elm)
|
void CGroupHTML::htmlINPUT(const CHtmlElement &elm)
|
||||||
|
@ -5619,9 +5621,14 @@ namespace NLGUI
|
||||||
// Widget minimal width
|
// Widget minimal width
|
||||||
string minWidth = elm.getAttribute("z_input_width");
|
string minWidth = elm.getAttribute("z_input_width");
|
||||||
|
|
||||||
// Get the type
|
// <input type="...">
|
||||||
if (elm.hasNonEmptyAttribute("type"))
|
std::string type = trim(elm.getAttribute("type"));
|
||||||
|
if (type.empty())
|
||||||
{
|
{
|
||||||
|
// no 'type' attribute, or empty
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Global color flag
|
// Global color flag
|
||||||
if (elm.hasAttribute("global_color"))
|
if (elm.hasAttribute("global_color"))
|
||||||
_Style.Current.GlobalColor = true;
|
_Style.Current.GlobalColor = true;
|
||||||
|
@ -5633,7 +5640,6 @@ namespace NLGUI
|
||||||
if (!strtooltip.empty())
|
if (!strtooltip.empty())
|
||||||
tooltip = strtooltip.c_str();
|
tooltip = strtooltip.c_str();
|
||||||
|
|
||||||
string type = toLower(elm.getAttribute("type"));
|
|
||||||
if (type == "image")
|
if (type == "image")
|
||||||
{
|
{
|
||||||
// The submit button
|
// The submit button
|
||||||
|
@ -5835,7 +5841,6 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupHTML::htmlLI(const CHtmlElement &elm)
|
void CGroupHTML::htmlLI(const CHtmlElement &elm)
|
||||||
|
@ -5908,8 +5913,11 @@ namespace NLGUI
|
||||||
|
|
||||||
std::string httpEquiv = elm.getAttribute("http-equiv");
|
std::string httpEquiv = elm.getAttribute("http-equiv");
|
||||||
std::string httpContent = elm.getAttribute("content");
|
std::string httpContent = elm.getAttribute("content");
|
||||||
if (!httpEquiv.empty() && !httpContent.empty())
|
if (httpEquiv.empty() || httpContent.empty())
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// only first http-equiv="refresh" should be handled
|
// only first http-equiv="refresh" should be handled
|
||||||
if (_RefreshUrl.empty() && httpEquiv == "refresh")
|
if (_RefreshUrl.empty() && httpEquiv == "refresh")
|
||||||
{
|
{
|
||||||
|
@ -5934,7 +5942,6 @@ namespace NLGUI
|
||||||
_NextRefreshTime += timeSec;
|
_NextRefreshTime += timeSec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupHTML::htmlOBJECT(const CHtmlElement &elm)
|
void CGroupHTML::htmlOBJECT(const CHtmlElement &elm)
|
||||||
|
@ -6298,8 +6305,18 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
CGroupTable *table = getTable();
|
CGroupTable *table = getTable();
|
||||||
if (table)
|
if (!table)
|
||||||
{
|
{
|
||||||
|
// <td> appears to be outside <table>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_Cells.empty())
|
||||||
|
{
|
||||||
|
// <table> not started
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_Style.hasStyle("padding"))
|
if (_Style.hasStyle("padding"))
|
||||||
{
|
{
|
||||||
uint32 a;
|
uint32 a;
|
||||||
|
@ -6308,8 +6325,6 @@ namespace NLGUI
|
||||||
table->CellPadding = a;
|
table->CellPadding = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_Cells.empty())
|
|
||||||
{
|
|
||||||
_Cells.back() = new CGroupCell(CViewBase::TCtorParam());
|
_Cells.back() = new CGroupCell(CViewBase::TCtorParam());
|
||||||
|
|
||||||
if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
|
if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
|
||||||
|
@ -6376,8 +6391,6 @@ namespace NLGUI
|
||||||
|
|
||||||
renderPseudoElement(":before", elm);
|
renderPseudoElement(":before", elm);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGroupHTML::htmlTDend(const CHtmlElement &elm)
|
void CGroupHTML::htmlTDend(const CHtmlElement &elm)
|
||||||
{
|
{
|
||||||
|
@ -6391,11 +6404,9 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm)
|
void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm)
|
||||||
{
|
{
|
||||||
_PRE.push_back(true);
|
if (_Forms.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
// Got one form ?
|
|
||||||
if (!(_Forms.empty()))
|
|
||||||
{
|
|
||||||
// read general property
|
// read general property
|
||||||
string templateName;
|
string templateName;
|
||||||
|
|
||||||
|
@ -6420,14 +6431,11 @@ namespace NLGUI
|
||||||
|
|
||||||
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
|
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
|
||||||
_TextArea = true;
|
_TextArea = true;
|
||||||
}
|
_PRE.push_back(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm)
|
void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm)
|
||||||
{
|
{
|
||||||
_TextArea = false;
|
|
||||||
popIfNotEmpty (_PRE);
|
|
||||||
|
|
||||||
if (_Forms.empty())
|
if (_Forms.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -6440,6 +6448,9 @@ namespace NLGUI
|
||||||
entry.TextArea = textArea;
|
entry.TextArea = textArea;
|
||||||
_Forms.back().Entries.push_back (entry);
|
_Forms.back().Entries.push_back (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_TextArea = false;
|
||||||
|
popIfNotEmpty (_PRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue