From 0de15805200bf4ec0c9815f2c4415331e7853906 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 24 Sep 2021 08:32:04 +0300 Subject: [PATCH 1/5] Fix background overflow on items limited with maxw/maxh --- nel/src/gui/css_background_renderer.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/nel/src/gui/css_background_renderer.cpp b/nel/src/gui/css_background_renderer.cpp index 4d7df021e..230807068 100644 --- a/nel/src/gui/css_background_renderer.cpp +++ b/nel/src/gui/css_background_renderer.cpp @@ -140,13 +140,6 @@ namespace NLGUI // flush draw cache to ensure correct draw order rVR.flush(); - sint32 clipX, clipY, clipW, clipH; - if (m_Viewport) - { - rVR.getClipWindow(clipX, clipY, clipW, clipH); - rVR.setClipWindow(m_Viewport->getXReal(), m_Viewport->getYReal(), m_Viewport->getWReal(), m_Viewport->getHReal()); - } - // TODO: no need for widget manager, if global color is set from parent CRGBA globalColor; if (m_ModulateGlobalColor) @@ -166,9 +159,6 @@ namespace NLGUI // flush draw cache to ensure correct draw order rVR.flush(); - - if (m_Viewport) - rVR.setClipWindow(clipX, clipY, clipW, clipH); } // ---------------------------------------------------------------------------- From 591ea6869e6d0b375365bd0a7c90257cf5fac0cf Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 25 Sep 2021 12:33:24 +0300 Subject: [PATCH 2/5] Remove shortcut to moveToAction(). sendExecuteToServer() will be called before clientExecute() and that will cause "stuck stanza" client side when server rejects the action. Reproducible with forage stanza with material specialization. --- ryzom/client/src/user_entity.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index 2ed7355b0..6c0e68973 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -1402,18 +1402,6 @@ void CUserEntity::moveToCheckStartDist(CLFECOMMON::TCLEntityId slot, double dist // disable afk mode setAFK(false); - - // if sufficiently near, launch the action - CEntityCL *target = EntitiesMngr.entity(slot); - if(target) - { - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if((dir2targ==CVectorD::Null) || (dir2targ.norm() < dist)) - { - moveToAction(target); - } - } } }// moveToCheckStartDist // From df4833bf0fa3c803b70997c6b035f7e5cc881bc6 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 24 Sep 2021 08:30:40 +0300 Subject: [PATCH 3/5] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4b691209f..c90a717ef 100644 --- a/.gitignore +++ b/.gitignore @@ -163,6 +163,7 @@ build-2010/* build/* install/* build_* +install_* nel/tools/build_gamedata/configuration/buildsite.py # Linux nel compile From 0b503e352b97b782dd03c2b4b6858b9992d4f3a0 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 26 Sep 2021 21:59:53 +0300 Subject: [PATCH 4/5] Fix htmlEscape function from deadlocking --- nel/include/nel/gui/html_element.h | 2 +- nel/src/gui/html_element.cpp | 39 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h index cc59d2126..9a26938af 100644 --- a/nel/include/nel/gui/html_element.h +++ b/nel/include/nel/gui/html_element.h @@ -76,7 +76,7 @@ namespace NLGUI void reindexChilds(); // escape text tag or attribute value - std::string htmlEscape(std::string val, bool isAttribute = false) const; + std::string htmlEscape(const std::string &val) const; // serialize element attributes as string std::string serializeAttributes() const; diff --git a/nel/src/gui/html_element.cpp b/nel/src/gui/html_element.cpp index 8eb706cc9..a8038be7d 100644 --- a/nel/src/gui/html_element.cpp +++ b/nel/src/gui/html_element.cpp @@ -142,26 +142,29 @@ namespace NLGUI } // *************************************************************************** - std::string CHtmlElement::htmlEscape(std::string val, bool isAttribute) const + std::string CHtmlElement::htmlEscape(const std::string &val) const { - static const std::string searchReplace[] = { - "&", "&", - "<", "<", - ">", ">", - "\xA0", " ", - }; - - for(uint i = 0; i < (sizeof(searchReplace) / sizeof(searchReplace[0])); i+=2) - val = strFindReplaceAll(val, searchReplace[i], searchReplace[i+1]); - - if (isAttribute) + if (val.find_first_of("\"'&<>\xA0") == std::string::npos) + return val; + + std::string ret; + // resize is quaranteed, make room for some free replacements + ret.reserve(val.size() + 24); + for(size_t pos = 0; pos != val.size(); pos++) { - static const std::string q = "\""; - static const std::string quot = """; - val = strFindReplaceAll(val, q, quot); + switch(val[pos]) + { + case '"': ret.append("""); break; + case '\'': ret.append("'"); break; + case '&': ret.append("&"); break; + case '<': ret.append("<"); break; + case '>': ret.append(">"); break; + case '\xA0': ret.append(" "); break; + default : ret.append(&val[pos],1); break; + } } - return val; + return ret; } // *************************************************************************** @@ -179,13 +182,13 @@ namespace NLGUI { result += " "; } - result += htmlEscape(*it2, true); + result += htmlEscape(*it2); } result += "\""; } else { - result += " " + it->first + "=\"" + htmlEscape(it->second, true) + "\""; + result += " " + it->first + "=\"" + htmlEscape(it->second) + "\""; } } return result; From ea6e4d91c3e9f645e0ee2dbe69024e251140e25b Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 26 Sep 2021 23:24:16 +0300 Subject: [PATCH 5/5] Html special chars for title/textarea tags should remain decoded --- nel/include/nel/gui/html_element.h | 6 +++--- nel/src/gui/group_html.cpp | 4 ++-- nel/src/gui/html_element.cpp | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h index 9a26938af..034bbccbf 100644 --- a/nel/include/nel/gui/html_element.h +++ b/nel/include/nel/gui/html_element.h @@ -79,13 +79,13 @@ namespace NLGUI std::string htmlEscape(const std::string &val) const; // serialize element attributes as string - std::string serializeAttributes() const; + std::string serializeAttributes(bool escape = true) const; // serialize child elements as html string - std::string serializeChilds() const; + std::string serializeChilds(bool escape = true) const; // serialize itself and children as html string - std::string serialize() const; + std::string serialize(bool escape = true) const; // debug std::string toString(bool tree = false, uint depth = 0) const; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 10472851c..c6a06b2aa 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -6777,7 +6777,7 @@ namespace NLGUI _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; - std::string content = strFindReplaceAll(elm.serializeChilds(), std::string("\r"), std::string("")); + std::string content = strFindReplaceAll(elm.serializeChilds(false), std::string("\r"), std::string("")); CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, content, _TextAreaMaxLength); if (textArea) @@ -6810,7 +6810,7 @@ namespace NLGUI // if (!_ReadingHeadTag) return; // consume all child elements - _TitleString = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" ")); + _TitleString = strFindReplaceAll(elm.serializeChilds(false), std::string("\t"), std::string(" ")); _TitleString = strFindReplaceAll(_TitleString, std::string("\n"), std::string(" ")); setTitle(_TitleString); } diff --git a/nel/src/gui/html_element.cpp b/nel/src/gui/html_element.cpp index a8038be7d..f4e770a4a 100644 --- a/nel/src/gui/html_element.cpp +++ b/nel/src/gui/html_element.cpp @@ -155,7 +155,7 @@ namespace NLGUI switch(val[pos]) { case '"': ret.append("""); break; - case '\'': ret.append("'"); break; + case '\'': ret.append("'"); break; case '&': ret.append("&"); break; case '<': ret.append("<"); break; case '>': ret.append(">"); break; @@ -168,7 +168,7 @@ namespace NLGUI } // *************************************************************************** - std::string CHtmlElement::serializeAttributes() const + std::string CHtmlElement::serializeAttributes(bool escape) const { std::string result; for(std::map::const_iterator it = Attributes.begin(); it != Attributes.end(); ++it) @@ -182,30 +182,30 @@ namespace NLGUI { result += " "; } - result += htmlEscape(*it2); + result += (escape ? htmlEscape(*it2) : *it2); } result += "\""; } else { - result += " " + it->first + "=\"" + htmlEscape(it->second) + "\""; + result += " " + it->first + "=\"" + (escape ? htmlEscape(it->second) : it->second) + "\""; } } return result; } // *************************************************************************** - std::string CHtmlElement::serializeChilds() const + std::string CHtmlElement::serializeChilds(bool escape) const { std::string result; for(std::list::const_iterator it = Children.begin(); it != Children.end(); ++it) - result += it->serialize(); + result += it->serialize(escape); return result; } // *************************************************************************** - std::string CHtmlElement::serialize() const + std::string CHtmlElement::serialize(bool escape) const { if (Type == TEXT_NODE) { @@ -214,12 +214,14 @@ namespace NLGUI parent->ID == HTML_NOSCRIPT)) { return Value; - } else { + } else if (escape) { return htmlEscape(Value); + } else { + return Value; } } - std::string result = "<" + Value + serializeAttributes() + ">"; + std::string result = "<" + Value + serializeAttributes(escape) + ">"; if (ID == HTML_AREA || ID == HTML_BASE || ID == HTML_BR || ID == HTML_COL || ID == HTML_EMBED || ID == HTML_HR || @@ -234,7 +236,7 @@ namespace NLGUI result += "\n"; if (!Children.empty()) - result += serializeChilds(); + result += serializeChilds(escape); result += "";