Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 6 years ago
commit bb6562f47b

@ -823,6 +823,9 @@ namespace NLGUI
// :before, :after rendering
void renderPseudoElement(const std::string &pseudo, const CHtmlElement &elm);
// apply background from current style (for html, body)
void applyBackground(const CHtmlElement &elm);
// HTML elements
void htmlA(const CHtmlElement &elm);
void htmlAend(const CHtmlElement &elm);

@ -3381,6 +3381,13 @@ namespace NLGUI
bitmap->setRenderLayer(-2);
bitmap->setScale(scale);
bitmap->setTile(tile);
// clear size ref for non-scaled image or it does not show up
if (scale || tile)
bitmap->setSizeRef("wh");
else
bitmap->setSizeRef("");
addImageDownload(bgtex, view);
}
}
@ -4195,6 +4202,7 @@ namespace NLGUI
// Reset default background color
setBackgroundColor (BgColor);
setBackground ("blank.tga", true, false);
paragraphChange ();
}
@ -5043,6 +5051,52 @@ namespace NLGUI
_CellParams.push_back (cellParams);
}
// ***************************************************************************
void CGroupHTML::applyBackground(const CHtmlElement &elm)
{
bool root = elm.Value == "html" || elm.Value == "body";
// non-empty image
if (_Style.hasStyle("background-image"))
{
// value '1' and 'background-scale' are ryzom only
bool repeat = _Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat");
bool scale = _Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "100% 100%");
std::string image = trim(_Style.getStyle("background-image"));
string::size_type texExt = toLower(image).find("url(");
if (texExt != string::npos)
{
image = image.substr(texExt+4, image.size()-texExt-5);
}
if (!image.empty())
{
if (root)
{
setBackground (image, scale, repeat);
}
// TODO: else
// default background color is transparent, so image does not show
if (!_Style.hasStyle("background-color"))
{
_Style.applyStyle("background-color: #fff;");
}
}
}
if (_Style.hasStyle("background-color"))
{
CRGBA bgColor = _Style.Current.BackgroundColor;
scanHTMLColor(elm.getAttribute("bgcolor").c_str(), bgColor);
if (root)
{
setBackgroundColor(bgColor);
}
// TODO: else
}
}
// ***************************************************************************
void CGroupHTML::htmlA(const CHtmlElement &elm)
{
@ -5112,39 +5166,7 @@ namespace NLGUI
_Style.applyStyle("background-color: " + elm.getAttribute("bgcolor"));
}
if (_Style.hasStyle("background-color"))
{
CRGBA bgColor = _Style.Current.BackgroundColor;
scanHTMLColor(elm.getAttribute("bgcolor").c_str(), bgColor);
setBackgroundColor(bgColor);
}
if (elm.hasNonEmptyAttribute("style"))
{
string style = elm.getAttribute("style");
TStyle styles = parseStyle(style);
TStyle::iterator it;
it = styles.find("background-repeat");
bool repeat = (it != styles.end() && it->second == "1");
// Webig only
it = styles.find("background-scale");
bool scale = (it != styles.end() && it->second == "1");
it = styles.find("background-image");
if (it != styles.end())
{
string image = it->second;
string::size_type texExt = toLower(image).find("url(");
// Url image
if (texExt != string::npos)
// Remove url()
image = image.substr(4, image.size()-5);
setBackground (image, scale, repeat);
}
}
applyBackground(elm);
renderPseudoElement(":before", elm);
}
@ -5496,7 +5518,7 @@ namespace NLGUI
_Style.applyRootStyle(elm.getAttribute("style"));
_Style.Current = _Style.Root;
}
setBackgroundColor(_Style.Current.BackgroundColor);
applyBackground(elm);
}
// ***************************************************************************
@ -6306,7 +6328,7 @@ namespace NLGUI
if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
_Cells.back()->setTextureTile(true);
if (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "cover"))
if (_Style.checkStyle("background-scale", "1") || _Style.checkStyle("background-size", "100% 100%"))
_Cells.back()->setTextureScale(true);
if (_Style.hasStyle("background-image"))

@ -357,6 +357,9 @@ void CGroupHTMLAuth::addHTTPGetParams (string &url, bool trustedDomain)
void CGroupHTMLAuth::addHTTPPostParams (SFormFields &formfields, bool trustedDomain)
{
// no extras parameters added to url if not in trusted domains list
if (!trustedDomain) return;
if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return;
uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot;

Loading…
Cancel
Save