diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 0de5e7a2d..b37d80272 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -36,6 +36,7 @@ typedef void CURLM; namespace NLGUI { + class CViewLink; class CCtrlButton; class CCtrlTextButton; class CCtrlScroll; @@ -142,37 +143,15 @@ namespace NLGUI float getTimeout() const {return (float)_TimeoutValue;} // Some constants - NLMISC::CRGBA BgColor; NLMISC::CRGBA ErrorColor; NLMISC::CRGBA LinkColor; - NLMISC::CRGBA TextColor; - NLMISC::CRGBA H1Color; - NLMISC::CRGBA H2Color; - NLMISC::CRGBA H3Color; - NLMISC::CRGBA H4Color; - NLMISC::CRGBA H5Color; - NLMISC::CRGBA H6Color; bool ErrorColorGlobalColor; bool LinkColorGlobalColor; bool TextColorGlobalColor; - bool H1ColorGlobalColor; - bool H2ColorGlobalColor; - bool H3ColorGlobalColor; - bool H4ColorGlobalColor; - bool H5ColorGlobalColor; - bool H6ColorGlobalColor; - uint TextFontSize; - uint H1FontSize; - uint H2FontSize; - uint H3FontSize; - uint H4FontSize; - uint H5FontSize; - uint H6FontSize; uint TDBeginSpace; uint PBeginSpace; uint LIBeginSpace; uint ULBeginSpace; - uint LIIndent; uint ULIndent; float LineSpaceFontFactor; std::string DefaultButtonGroup; @@ -187,7 +166,6 @@ namespace NLGUI std::string DefaultRadioButtonBitmapPushed; std::string DefaultRadioButtonBitmapOver; std::string DefaultBackgroundBitmapView; - std::string CurrentLinkTitle; struct TFormField { public: @@ -327,6 +305,12 @@ namespace NLGUI // Translate a char bool translateChar(u32char &output, u32char input, u32char lastChar) const; + // return true if text has same style + bool isSameStyle(CViewLink *text, const CStyleParams &style) const; + // add text link using template + void newTextButton(const std::string &text, const std::string &tpl); + void newTextLink(const std::string &text); + // Add a string in the current paragraph void addString(const std::string &str); @@ -752,9 +736,7 @@ namespace NLGUI bool _Localize; // Current node is a text area - bool _TextArea; std::string _TextAreaTemplate; - std::string _TextAreaContent; std::string _TextAreaName; uint _TextAreaRow; uint _TextAreaCols; @@ -1005,11 +987,9 @@ namespace NLGUI void htmlTD(const CHtmlElement &elm); void htmlTDend(const CHtmlElement &elm); void htmlTEXTAREA(const CHtmlElement &elm); - void htmlTEXTAREAend(const CHtmlElement &elm); void htmlTH(const CHtmlElement &elm); void htmlTHend(const CHtmlElement &elm); void htmlTITLE(const CHtmlElement &elm); - void htmlTITLEend(const CHtmlElement &elm); void htmlTR(const CHtmlElement &elm); void htmlTRend(const CHtmlElement &elm); //void htmlU(const CHtmlElement &elm); diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h index 22f037cd4..d96b00508 100644 --- a/nel/include/nel/gui/html_element.h +++ b/nel/include/nel/gui/html_element.h @@ -75,6 +75,18 @@ namespace NLGUI // update Children index/parent/next/prevSibling pointers void reindexChilds(); + // escape text tag or attribute value + std::string htmlEscape(std::string val, bool isAttribute = false) const; + + // serialize element attributes as string + std::string serializeAttributes() const; + + // serialize child elements as html string + std::string serializeChilds() const; + + // serialize itself and children as html string + std::string serialize() const; + // debug std::string toString(bool tree = false, uint depth = 0) const; diff --git a/nel/include/nel/misc/streamed_package.h b/nel/include/nel/misc/streamed_package.h index 82a138482..093f87a30 100644 --- a/nel/include/nel/misc/streamed_package.h +++ b/nel/include/nel/misc/streamed_package.h @@ -32,7 +32,7 @@ public: uint32 Size; uint32 LastModified; - void serial(NLMISC::IStream &f) throw(NLMISC::EStream); + void serial(NLMISC::IStream &f); }; @@ -40,7 +40,7 @@ public: CStreamedPackage(); ~CStreamedPackage(); - void serial(NLMISC::IStream &f) throw(NLMISC::EStream); + void serial(NLMISC::IStream &f); /// result: [out] ex. /00/00/000000000.. /// hash: [in] diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 44fc88663..3e3748a55 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -1231,10 +1231,10 @@ namespace NLGUI case HTML_TABLE: htmlTABLEend(elm); break; case HTML_TD: htmlTDend(elm); break; case HTML_TBODY: renderPseudoElement(":after", elm); break; - case HTML_TEXTAREA: htmlTEXTAREAend(elm); break; + case HTML_TEXTAREA: break; case HTML_TFOOT: renderPseudoElement(":after", elm); break; case HTML_TH: htmlTHend(elm); break; - case HTML_TITLE: htmlTITLEend(elm); break; + case HTML_TITLE: break; case HTML_TR: htmlTRend(elm); break; case HTML_U: renderPseudoElement(":after", elm); break; case HTML_UL: htmlULend(elm); break; @@ -1396,9 +1396,9 @@ namespace NLGUI { beginElement(elm); - std::list::iterator it = elm.Children.begin(); if (!_IgnoreChildElements) { + std::list::iterator it = elm.Children.begin(); while(it != elm.Children.end()) { renderDOM(*it); @@ -1460,37 +1460,15 @@ namespace NLGUI CWidgetManager::getInstance()->registerClockMsgTarget(this); // HTML parameters - BgColor = CRGBA::Black; ErrorColor = CRGBA(255, 0, 0); LinkColor = CRGBA(0, 0, 255); - TextColor = CRGBA(255, 255, 255); - H1Color = CRGBA(255, 255, 255); - H2Color = CRGBA(255, 255, 255); - H3Color = CRGBA(255, 255, 255); - H4Color = CRGBA(255, 255, 255); - H5Color = CRGBA(255, 255, 255); - H6Color = CRGBA(255, 255, 255); ErrorColorGlobalColor = false; LinkColorGlobalColor = false; TextColorGlobalColor = false; - H1ColorGlobalColor = false; - H2ColorGlobalColor = false; - H3ColorGlobalColor = false; - H4ColorGlobalColor = false; - H5ColorGlobalColor = false; - H6ColorGlobalColor = false; - TextFontSize = 9; - H1FontSize = 18; - H2FontSize = 15; - H3FontSize = 12; - H4FontSize = 9; - H5FontSize = 9; - H6FontSize = 9; LIBeginSpace = 4; ULBeginSpace = 12; PBeginSpace = 12; TDBeginSpace = 0; - LIIndent = -10; ULIndent = 30; LineSpaceFontFactor = 0.5f; DefaultButtonGroup = "html_text_button"; @@ -1562,11 +1540,6 @@ namespace NLGUI return _TitlePrefix; } else - if( name == "background_color" ) - { - return toString( BgColor ); - } - else if( name == "error_color" ) { return toString( ErrorColor ); @@ -1577,36 +1550,6 @@ namespace NLGUI return toString( LinkColor ); } else - if( name == "h1_color" ) - { - return toString( H1Color ); - } - else - if( name == "h2_color" ) - { - return toString( H2Color ); - } - else - if( name == "h3_color" ) - { - return toString( H3Color ); - } - else - if( name == "h4_color" ) - { - return toString( H4Color ); - } - else - if( name == "h5_color" ) - { - return toString( H5Color ); - } - else - if( name == "h6_color" ) - { - return toString( H6Color ); - } - else if( name == "error_color_global_color" ) { return toString( ErrorColorGlobalColor ); @@ -1622,71 +1565,6 @@ namespace NLGUI return toString( TextColorGlobalColor ); } else - if( name == "h1_color_global_color" ) - { - return toString( H1ColorGlobalColor ); - } - else - if( name == "h2_color_global_color" ) - { - return toString( H2ColorGlobalColor ); - } - else - if( name == "h3_color_global_color" ) - { - return toString( H3ColorGlobalColor ); - } - else - if( name == "h4_color_global_color" ) - { - return toString( H4ColorGlobalColor ); - } - else - if( name == "h5_color_global_color" ) - { - return toString( H5ColorGlobalColor ); - } - else - if( name == "h6_color_global_color" ) - { - return toString( H6ColorGlobalColor ); - } - else - if( name == "text_font_size" ) - { - return toString( TextFontSize ); - } - else - if( name == "h1_font_size" ) - { - return toString( H1FontSize ); - } - else - if( name == "h2_font_size" ) - { - return toString( H2FontSize ); - } - else - if( name == "h3_font_size" ) - { - return toString( H3FontSize ); - } - else - if( name == "h4_font_size" ) - { - return toString( H4FontSize ); - } - else - if( name == "h5_font_size" ) - { - return toString( H5FontSize ); - } - else - if( name == "h6_font_size" ) - { - return toString( H6FontSize ); - } - else if( name == "td_begin_space" ) { return toString( TDBeginSpace ); @@ -1707,11 +1585,6 @@ namespace NLGUI return toString( ULBeginSpace ); } else - if( name == "li_indent" ) - { - return toString( LIIndent ); - } - else if( name == "ul_indent" ) { return toString( ULIndent ); @@ -1824,14 +1697,6 @@ namespace NLGUI return; } else - if( name == "background_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - BgColor = c; - return; - } - else if( name == "error_color" ) { CRGBA c; @@ -1848,54 +1713,6 @@ namespace NLGUI return; } else - if( name == "h1_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H1Color = c; - return; - } - else - if( name == "h2_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H2Color = c; - return; - } - else - if( name == "h3_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H3Color = c; - return; - } - else - if( name == "h4_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H4Color = c; - return; - } - else - if( name == "h5_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H5Color = c; - return; - } - else - if( name == "h6_color" ) - { - CRGBA c; - if( fromString( value, c ) ) - H6Color = c; - return; - } - else if( name == "error_color_global_color" ) { bool b; @@ -1920,110 +1737,6 @@ namespace NLGUI return; } else - if( name == "h1_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H1ColorGlobalColor = b; - return; - } - else - if( name == "h2_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H2ColorGlobalColor = b; - return; - } - else - if( name == "h3_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H3ColorGlobalColor = b; - return; - } - else - if( name == "h4_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H4ColorGlobalColor = b; - return; - } - else - if( name == "h5_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H5ColorGlobalColor = b; - return; - } - else - if( name == "h6_color_global_color" ) - { - bool b; - if( fromString( value, b ) ) - H6ColorGlobalColor = b; - return; - } - else - if( name == "text_font_size" ) - { - uint i; - if( fromString( value, i ) ) - TextFontSize = i; - return; - } - else - if( name == "h1_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H1FontSize = i; - return; - } - else - if( name == "h2_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H2FontSize = i; - return; - } - else - if( name == "h3_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H3FontSize = i; - return; - } - else - if( name == "h4_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H4FontSize = i; - return; - } - else - if( name == "h5_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H5FontSize = i; - return; - } - else - if( name == "h6_font_size" ) - { - uint i; - if( fromString( value, i ) ) - H6FontSize = i; - return; - } - else if( name == "td_begin_space" ) { uint i; @@ -2056,14 +1769,6 @@ namespace NLGUI return; } else - if( name == "li_indent" ) - { - uint i; - if( fromString( value, i ) ) - LIIndent = i; - return; - } - else if( name == "ul_indent" ) { uint i; @@ -2222,16 +1927,8 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "type", BAD_CAST "html" ); xmlSetProp( node, BAD_CAST "url", BAD_CAST _URL.c_str() ); xmlSetProp( node, BAD_CAST "title_prefix", BAD_CAST _TitlePrefix.c_str() ); - xmlSetProp( node, BAD_CAST "background_color", BAD_CAST toString( BgColor ).c_str() ); xmlSetProp( node, BAD_CAST "error_color", BAD_CAST toString( ErrorColor ).c_str() ); xmlSetProp( node, BAD_CAST "link_color", BAD_CAST toString( LinkColor ).c_str() ); - xmlSetProp( node, BAD_CAST "background_color", BAD_CAST toString( BgColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_color", BAD_CAST toString( H1Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_color", BAD_CAST toString( H2Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_color", BAD_CAST toString( H3Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_color", BAD_CAST toString( H4Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_color", BAD_CAST toString( H5Color ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_color", BAD_CAST toString( H6Color ).c_str() ); xmlSetProp( node, BAD_CAST "error_color_global_color", BAD_CAST toString( ErrorColorGlobalColor ).c_str() ); @@ -2239,31 +1936,11 @@ namespace NLGUI BAD_CAST toString( LinkColorGlobalColor ).c_str() ); xmlSetProp( node, BAD_CAST "text_color_global_color", BAD_CAST toString( TextColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_color_global_color", - BAD_CAST toString( H1ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_color_global_color", - BAD_CAST toString( H2ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_color_global_color", - BAD_CAST toString( H3ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_color_global_color", - BAD_CAST toString( H4ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_color_global_color", - BAD_CAST toString( H5ColorGlobalColor ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_color_global_color", - BAD_CAST toString( H6ColorGlobalColor ).c_str() ); - - xmlSetProp( node, BAD_CAST "text_font_size", BAD_CAST toString( TextFontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h1_font_size", BAD_CAST toString( H1FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h2_font_size", BAD_CAST toString( H2FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h3_font_size", BAD_CAST toString( H3FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h4_font_size", BAD_CAST toString( H4FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h5_font_size", BAD_CAST toString( H5FontSize ).c_str() ); - xmlSetProp( node, BAD_CAST "h6_font_size", BAD_CAST toString( H6FontSize ).c_str() ); + xmlSetProp( node, BAD_CAST "td_begin_space", BAD_CAST toString( TDBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "paragraph_begin_space", BAD_CAST toString( PBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "li_begin_space", BAD_CAST toString( LIBeginSpace ).c_str() ); xmlSetProp( node, BAD_CAST "ul_begin_space", BAD_CAST toString( ULBeginSpace ).c_str() ); - xmlSetProp( node, BAD_CAST "li_indent", BAD_CAST toString( LIIndent ).c_str() ); xmlSetProp( node, BAD_CAST "ul_indent", BAD_CAST toString( ULIndent ).c_str() ); xmlSetProp( node, BAD_CAST "multi_line_space_factor", BAD_CAST toString( LineSpaceFontFactor ).c_str() ); xmlSetProp( node, BAD_CAST "form_text_area_group", BAD_CAST DefaultFormTextGroup.c_str() ); @@ -2315,36 +1992,12 @@ namespace NLGUI _TitlePrefix = CI18N::get((const char*)ptr); // Parameters - ptr = xmlGetProp (cur, (xmlChar*)"background_color"); - if (ptr) - BgColor = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"error_color"); if (ptr) ErrorColor = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"link_color"); if (ptr) LinkColor = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"text_color"); - if (ptr) - TextColor = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h1_color"); - if (ptr) - H1Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h2_color"); - if (ptr) - H2Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h3_color"); - if (ptr) - H3Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h4_color"); - if (ptr) - H4Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h5_color"); - if (ptr) - H5Color = convertColor(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h6_color"); - if (ptr) - H6Color = convertColor(ptr); ptr = xmlGetProp (cur, (xmlChar*)"error_color_global_color"); if (ptr) ErrorColorGlobalColor = convertBool(ptr); @@ -2354,45 +2007,6 @@ namespace NLGUI ptr = xmlGetProp (cur, (xmlChar*)"text_color_global_color"); if (ptr) TextColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h1_color_global_color"); - if (ptr) - H1ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h2_color_global_color"); - if (ptr) - H2ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h3_color_global_color"); - if (ptr) - H3ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h4_color_global_color"); - if (ptr) - H4ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h5_color_global_color"); - if (ptr) - H5ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"h6_color_global_color"); - if (ptr) - H6ColorGlobalColor = convertBool(ptr); - ptr = xmlGetProp (cur, (xmlChar*)"text_font_size"); - if (ptr) - fromString((const char*)ptr, TextFontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h1_font_size"); - if (ptr) - fromString((const char*)ptr, H1FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h2_font_size"); - if (ptr) - fromString((const char*)ptr, H2FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h3_font_size"); - if (ptr) - fromString((const char*)ptr, H3FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h4_font_size"); - if (ptr) - fromString((const char*)ptr, H4FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h5_font_size"); - if (ptr) - fromString((const char*)ptr, H5FontSize); - ptr = xmlGetProp (cur, (xmlChar*)"h6_font_size"); - if (ptr) - fromString((const char*)ptr, H6FontSize); ptr = xmlGetProp (cur, (xmlChar*)"td_begin_space"); if (ptr) fromString((const char*)ptr, TDBeginSpace); @@ -2405,9 +2019,6 @@ namespace NLGUI ptr = xmlGetProp (cur, (xmlChar*)"ul_begin_space"); if (ptr) fromString((const char*)ptr, ULBeginSpace); - ptr = xmlGetProp (cur, (xmlChar*)"li_indent"); - if (ptr) - fromString((const char*)ptr, LIIndent); ptr = xmlGetProp (cur, (xmlChar*)"ul_indent"); if (ptr) fromString((const char*)ptr, ULIndent); @@ -2770,6 +2381,113 @@ namespace NLGUI } } + // *************************************************************************** + bool CGroupHTML::isSameStyle(CViewLink *text, const CStyleParams &style) const + { + if (!text) return false; + + bool embolden = style.FontWeight >= FONT_WEIGHT_BOLD; + bool sameShadow = style.TextShadow.Enabled && text->getShadow(); + if (sameShadow && style.TextShadow.Enabled) + { + sint sx, sy; + text->getShadowOffset(sx, sy); + sameShadow = (style.TextShadow.Color == text->getShadowColor()); + sameShadow = sameShadow && (style.TextShadow.Outline == text->getShadowOutline()); + sameShadow = sameShadow && (style.TextShadow.X == sx) && (style.TextShadow.Y == sy); + } + // Compatible with current parameters ? + return sameShadow && + (style.TextColor == text->getColor()) && + (style.FontFamily == text->getFontName()) && + (style.FontSize == (uint)text->getFontSize()) && + (style.Underlined == text->getUnderlined()) && + (style.StrikeThrough == text->getStrikeThrough()) && + (embolden == text->getEmbolden()) && + (style.FontOblique == text->getOblique()) && + (getLink() == text->Link) && + (style.GlobalColor == text->getModulateGlobalColor()); + } + + // *************************************************************************** + void CGroupHTML::newTextButton(const std::string &text, const std::string &tpl) + { + _CurrentViewLink = NULL; + _CurrentViewImage = NULL; + + // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" + string param = "name=" + this->_Id + "|url=" + getLink(); + string name; + if (!_AnchorName.empty()) + name = _AnchorName.back(); + + typedef pair TTmplParam; + vector tmplParams; + tmplParams.push_back(TTmplParam("id", "")); + tmplParams.push_back(TTmplParam("onclick", "browse")); + tmplParams.push_back(TTmplParam("onclick_param", param)); + tmplParams.push_back(TTmplParam("active", "true")); + CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(tpl, getId()+":"+name, tmplParams); + if (!buttonGroup) + { + nlinfo("Text button template '%s' not found", tpl.c_str()); + return; + } + buttonGroup->setId(getId()+":"+name); + + // Add the ctrl button + CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); + if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); + if (!ctrlButton) + { + nlinfo("Text button template '%s' is missing :button or :b text element", tpl.c_str()); + return; + } + ctrlButton->setModulateGlobalColorAll(false); + + // Translate the tooltip + ctrlButton->setText(text); + ctrlButton->setDefaultContextHelp(std::string(getLinkTitle())); + // empty url / button disabled + ctrlButton->setFrozen(*getLink() == '\0'); + + setTextButtonStyle(ctrlButton, _Style.Current); + + _Paragraph->addChild(buttonGroup); + } + + // *************************************************************************** + void CGroupHTML::newTextLink(const std::string &text) + { + CViewLink *newLink = new CViewLink(CViewBase::TCtorParam()); + if (getA()) + { + newLink->Link = getLink(); + newLink->LinkTitle = getLinkTitle(); + if (!newLink->Link.empty()) + { + newLink->setHTMLView (this); + newLink->setActionOnLeftClick("browse"); + newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); + } + } + newLink->setText(text); + newLink->setMultiLineSpace((uint)((float)(_Style.Current.FontSize)*LineSpaceFontFactor)); + newLink->setMultiLine(true); + newLink->setModulateGlobalColor(_Style.Current.GlobalColor); + setTextStyle(newLink, _Style.Current); + + registerAnchor(newLink); + + if (getA() && !newLink->Link.empty()) + getParagraph()->addChildLink(newLink); + else + getParagraph()->addChild(newLink); + + _CurrentViewLink = newLink; + _CurrentViewImage = NULL; + } + // *************************************************************************** void CGroupHTML::addString(const std::string &str) @@ -2809,15 +2527,7 @@ namespace NLGUI } // In title ? - if (_Title) - { - _TitleString += tmpStr; - } - else if (_TextArea) - { - _TextAreaContent += tmpStr; - } - else if (_Object) + if (_Object) { _ObjectScript += tmpStr; } @@ -2844,32 +2554,11 @@ namespace NLGUI // Text added ? bool added = false; - bool embolden = style.FontWeight >= FONT_WEIGHT_BOLD; - // Number of child in this paragraph if (_CurrentViewLink) { bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == '\n'; - bool sameShadow = style.TextShadow.Enabled && _CurrentViewLink->getShadow(); - if (sameShadow && style.TextShadow.Enabled) - { - sint sx, sy; - _CurrentViewLink->getShadowOffset(sx, sy); - sameShadow = (style.TextShadow.Color == _CurrentViewLink->getShadowColor()); - sameShadow = sameShadow && (style.TextShadow.Outline == _CurrentViewLink->getShadowOutline()); - sameShadow = sameShadow && (style.TextShadow.X == sx) && (style.TextShadow.Y == sy); - } - // Compatible with current parameters ? - if (!skipLine && sameShadow && - (style.TextColor == _CurrentViewLink->getColor()) && - (style.FontFamily == _CurrentViewLink->getFontName()) && - (style.FontSize == (uint)_CurrentViewLink->getFontSize()) && - (style.Underlined == _CurrentViewLink->getUnderlined()) && - (style.StrikeThrough == _CurrentViewLink->getStrikeThrough()) && - (embolden == _CurrentViewLink->getEmbolden()) && - (style.FontOblique == _CurrentViewLink->getOblique()) && - (getLink() == _CurrentViewLink->Link) && - (style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) + if (!skipLine && isSameStyle(_CurrentViewLink, style)) { // Concat the text _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr); @@ -2882,78 +2571,9 @@ namespace NLGUI if (!added) { if (getA() && string(getLinkClass()) == "ryzom-ui-button") - { - string buttonTemplate = DefaultButtonGroup; - // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + this->_Id + "|url=" + getLink(); - string name; - if (!_AnchorName.empty()) - name = _AnchorName.back(); - typedef pair TTmplParam; - vector tmplParams; - tmplParams.push_back(TTmplParam("id", "")); - tmplParams.push_back(TTmplParam("onclick", "browse")); - tmplParams.push_back(TTmplParam("onclick_param", param)); - tmplParams.push_back(TTmplParam("active", "true")); - CInterfaceGroup *buttonGroup = CWidgetManager::getInstance()->getParser()->createGroupInstance(buttonTemplate, getId()+":"+name, tmplParams); - if (buttonGroup) - { - buttonGroup->setId(getId()+":"+name); - // Add the ctrl button - CCtrlTextButton *ctrlButton = dynamic_cast(buttonGroup->getCtrl("button")); - if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); - if (ctrlButton) - { - ctrlButton->setModulateGlobalColorAll (false); - - // Translate the tooltip - ctrlButton->setDefaultContextHelp(getLinkTitle()); - ctrlButton->setText(tmpStr); - // empty url / button disabled - bool disabled = string(getLink()).empty(); - ctrlButton->setFrozen(disabled); - - setTextButtonStyle(ctrlButton, style); - } - getParagraph()->addChild (buttonGroup); - paragraphChange (); - } - - } + newTextButton(tmpStr, DefaultButtonGroup); else - { - CViewLink *newLink = new CViewLink(CViewBase::TCtorParam()); - if (getA()) - { - newLink->Link = getLink(); - newLink->LinkTitle = getLinkTitle(); - if (!newLink->Link.empty()) - { - newLink->setHTMLView (this); - - newLink->setActionOnLeftClick("browse"); - newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); - } - } - newLink->setText(tmpStr); - newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor)); - newLink->setMultiLine(true); - newLink->setModulateGlobalColor(style.GlobalColor); - setTextStyle(newLink, style); - // newLink->setLineAtBottom (true); - - registerAnchor(newLink); - - if (getA() && !newLink->Link.empty()) - { - getParagraph()->addChildLink(newLink); - } - else - { - getParagraph()->addChild(newLink); - } - paragraphChange (); - } + newTextLink(tmpStr); } } } @@ -3302,8 +2922,6 @@ namespace NLGUI _Anchors.clear(); _AnchorName.clear(); _CellParams.clear(); - _Title = false; - _TextArea = false; _Object = false; _Localize = false; _ReadingHeadTag = false; @@ -3439,12 +3057,10 @@ namespace NLGUI void CGroupHTML::setTitle(const std::string &title) { - _TitleString.clear(); - if(!_TitlePrefix.empty()) - { - _TitleString = _TitlePrefix + " - "; - } - _TitleString += title; + if(_TitlePrefix.empty()) + _TitleString = title; + else + _TitleString = _TitlePrefix + " - " + title; setContainerTitle(_TitleString); } @@ -4428,7 +4044,7 @@ namespace NLGUI clearContext(); // Reset default background color - setBackgroundColor (BgColor); + setBackgroundColor (_BrowserStyle.Current.BackgroundColor); setBackground ("blank.tga", true, false); paragraphChange (); @@ -6845,12 +6461,11 @@ namespace NLGUI string image = _Style.getStyle("background-image"); addImageDownload(image, table, CStyleParams(), NormalImage, ""); } - - // setting ModulateGlobalColor must be after addImageDownload - if (_Style.checkStyle("-ryzom-modulate-bgcolor", "true")) - table->setModulateGlobalColor(true); - else if (_Style.checkStyle("-ryzom-modulate-bgcolor", "false")) - table->setModulateGlobalColor(false); + else + { + // will be set in addImageDownload if background-image exists + table->setModulateGlobalColor(_Style.Current.GlobalColor); + } table->setMarginLeft(getIndent()); addHtmlGroup (table, 0); @@ -6935,6 +6550,11 @@ namespace NLGUI string image = _Style.getStyle("background-image"); addImageDownload(image, _Cells.back(), CStyleParams(), NormalImage, ""); } + else + { + // will be set in addImageDownload if background-image is set + _Cells.back()->setModulateGlobalColor(_Style.Current.GlobalColor); + } if (elm.hasNonEmptyAttribute("colspan")) fromString(elm.getAttribute("colspan"), _Cells.back()->ColSpan); @@ -6971,10 +6591,6 @@ namespace NLGUI _Cells.back()->NewLine = getTR(); - // setting ModulateGlobalColor must be after addImageDownload - if (_Style.checkStyle("-ryzom-modulate-bgcolor", "true")) - _Cells.back()->setModulateGlobalColor(true); - // border from if (table->CellBorder) { @@ -7039,6 +6655,9 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm) { + _IgnoreChildElements = true; + + // TODO: allow textarea without form if (_Forms.empty()) return; @@ -7053,7 +6672,6 @@ namespace NLGUI _TextAreaName.clear(); _TextAreaRow = 1; _TextAreaCols = 10; - _TextAreaContent.clear(); _TextAreaMaxLength = 1024; if (elm.hasNonEmptyAttribute("name")) _TextAreaName = elm.getAttribute("name"); @@ -7065,16 +6683,11 @@ namespace NLGUI fromString(elm.getAttribute("maxlength"), _TextAreaMaxLength); _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; - _TextArea = true; - _PRE.push_back(true); - } - void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm) - { - if (_Forms.empty()) - return; + std::string content = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" ")); + content = strFindReplaceAll(content, std::string("\n"), std::string(" ")); - CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength); + CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, content, _TextAreaMaxLength); if (textArea) { // Add the text area to the form @@ -7083,9 +6696,6 @@ namespace NLGUI entry.TextArea = textArea; _Forms.back().Entries.push_back (entry); } - - _TextArea = false; - popIfNotEmpty (_PRE); } // *************************************************************************** @@ -7102,18 +6712,14 @@ namespace NLGUI // *************************************************************************** void CGroupHTML::htmlTITLE(const CHtmlElement &elm) { + _IgnoreChildElements = true; + // TODO: only from // if (!_ReadingHeadTag) return; - if(!_TitlePrefix.empty()) - _TitleString = _TitlePrefix + " - "; - else - _TitleString.clear(); - _Title = true; - } - void CGroupHTML::htmlTITLEend(const CHtmlElement &elm) - { - _Title = false; + // consume all child elements + _TitleString = strFindReplaceAll(elm.serializeChilds(), 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 8735cc56e..454833a5a 100644 --- a/nel/src/gui/html_element.cpp +++ b/nel/src/gui/html_element.cpp @@ -18,6 +18,7 @@ #include "stdpch.h" #include "nel/gui/html_element.h" +#include "nel/gui/libwww.h" using namespace std; using namespace NLMISC; @@ -137,6 +138,103 @@ namespace NLGUI return ""; } + // *************************************************************************** + std::string CHtmlElement::htmlEscape(std::string val, bool isAttribute) const + { + static const std::vector searchReplace = { + "&", "&", + "<", "<", + ">", ">", + "\xA0", " ", + }; + + for(uint i = 0; i < searchReplace.size(); i+=2) + val = strFindReplaceAll(val, searchReplace[i], searchReplace[i+1]); + + if (isAttribute) + { + static const std::string q = "\""; + static const std::string quot = """; + val = strFindReplaceAll(val, q, quot); + } + + return val; + } + + // *************************************************************************** + std::string CHtmlElement::serializeAttributes() const + { + std::string result; + for(std::map::const_iterator it = Attributes.begin(); it != Attributes.end(); ++it) + { + if (it->first == "class") + { + result += " class=\""; + for(std::set::const_iterator it2 = ClassNames.begin(); it2 != ClassNames.end(); ++it2) + { + if (it2 != ClassNames.begin()) + { + result += " "; + } + result += htmlEscape(*it2, true); + } + result += "\""; + } + else + { + result += " " + it->first + "=\"" + htmlEscape(it->second, true) + "\""; + } + } + return result; + } + + // *************************************************************************** + std::string CHtmlElement::serializeChilds() const + { + std::string result; + for(std::list::const_iterator it = Children.begin(); it != Children.end(); ++it) + result += it->serialize(); + + return result; + } + + // *************************************************************************** + std::string CHtmlElement::serialize() const + { + if (Type == TEXT_NODE) + { + if (parent && (parent->ID == HTML_SCRIPT || parent->ID == HTML_STYLE || + parent->ID == HTML_IFRAME || parent->ID == HTML_NOEMBED || + parent->ID == HTML_NOSCRIPT)) + { + return Value; + } else { + return htmlEscape(Value); + } + } + + std::string result = "<" + Value + serializeAttributes() + ">"; + + if (ID == HTML_AREA || ID == HTML_BASE || ID == HTML_BR || + ID == HTML_COL || ID == HTML_EMBED || ID == HTML_HR || + ID == HTML_IMG || ID == HTML_INPUT || ID == HTML_LINK || + ID == HTML_META || ID == HTML_PARAM || ID == HTML_WBR) + { + return result; + } + + // first linebreak that will be ignored on parse time + if (ID == HTML_PRE || ID == HTML_TEXTAREA) + result += "\n"; + + if (!Children.empty()) + result += serializeChilds(); + + result += ""; + + return result; + } + // *************************************************************************** std::string CHtmlElement::toString(bool tree, uint depth) const { diff --git a/nel/src/misc/streamed_package.cpp b/nel/src/misc/streamed_package.cpp index 28e2db956..ad013cccf 100644 --- a/nel/src/misc/streamed_package.cpp +++ b/nel/src/misc/streamed_package.cpp @@ -32,7 +32,7 @@ CStreamedPackage::~CStreamedPackage() // release } -void CStreamedPackage::serial(NLMISC::IStream &f) throw(NLMISC::EStream) +void CStreamedPackage::serial(NLMISC::IStream &f) { f.serialCheck(NELID("SNPK")); @@ -42,7 +42,7 @@ void CStreamedPackage::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serialCont(Entries); } -void CStreamedPackage::CEntry::serial(NLMISC::IStream &f) throw(NLMISC::EStream) +void CStreamedPackage::CEntry::serial(NLMISC::IStream &f) { uint version = 1; f.serialVersion(version); diff --git a/nel/tools/CMakeLists.txt b/nel/tools/CMakeLists.txt index 5297f34a4..079ded560 100644 --- a/nel/tools/CMakeLists.txt +++ b/nel/tools/CMakeLists.txt @@ -37,3 +37,8 @@ ENDIF() IF(WITH_NEL_TESTS) ADD_SUBDIRECTORY(nel_unit_test) ENDIF() + +IF(WITH_HTMLCSS_TEST) + ADD_SUBDIRECTORY(htmlcss_test) +ENDIF() + diff --git a/nel/tools/htmlcss_test/CMakeLists.txt b/nel/tools/htmlcss_test/CMakeLists.txt new file mode 100644 index 000000000..d37498f60 --- /dev/null +++ b/nel/tools/htmlcss_test/CMakeLists.txt @@ -0,0 +1,15 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.1) +CMAKE_POLICY(SET CMP0015 NEW) + +LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_LIBRARY_DIR}) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +FILE(GLOB SRC htmlcss_test.cpp) +ADD_EXECUTABLE(htmlcss_test ${SRC}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${LUA_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ) +TARGET_LINK_LIBRARIES(htmlcss_test nelmisc nelgui ${LUA_LIBRARIES} ${LIBXML2_LIBRARIES}) +NL_DEFAULT_PROPS(htmlcss_test "Ryzom, Tests: html/css parser tests") +NL_ADD_RUNTIME_FLAGS(htmlcss_test) + +INSTALL(TARGETS htmlcss_test RUNTIME DESTINATION bin COMPONENT tools) +# TODO: test fixtures diff --git a/nel/tools/htmlcss_test/htmlcss_test.cpp b/nel/tools/htmlcss_test/htmlcss_test.cpp new file mode 100644 index 000000000..4e5b79843 --- /dev/null +++ b/nel/tools/htmlcss_test/htmlcss_test.cpp @@ -0,0 +1,183 @@ +/* + * File: main.cpp + * Author: Karu + * + * Created on 2015-04-11 + */ + +typedef struct _xmlNode xmlNode; + +#include +#include + +#include "nel/misc/types_nl.h" +#include "nel/misc/file.h" +#include "nel/misc/path.h" + +#include "nel/gui/html_parser.h" +#include "nel/gui/css_parser.h" +#include "nel/gui/html_element.h" +#include "nel/gui/css_style.h" + +#include "nel/gui/libwww.h" + +using namespace std; +using namespace NLMISC; +using namespace NLGUI; + +sint indent { 0 }; + +// *************************************************************************** +void checkRuleset(CHtmlElement &elm, CCssStyle &style, TStyleVec testset, bool exists) +{ + bool verbose = false; + std::string existsMessage = exists ? "exist" : "unset"; + for (auto it : testset) + { + bool failed = (exists != style.hasStyle(it.first)); + if (failed) + { + bool failed2 = true; + if (it.first == "font-size") + { + printf("[%s]: font-size: %d; expected '%s'\n", existsMessage.c_str(), style.Current.FontSize, it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + failed2 = false; + } + else if (it.first == "background-color") + { + printf("[%s]: background-color: '%s'; expected '%s'\n", existsMessage.c_str(), style.Current.BackgroundColor.toString().c_str(), it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + failed2 = false; + } + + if (failed2) + { + printf("[%s] FAIL: '%s': '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str()); + printf(" (%s)\n", elm.toString().c_str()); + for (auto it2 : style.Current.StyleRules) + printf("'%s': '%s'\n", it2.first.c_str(), it2.second.c_str()); + } + } + else if (exists && !style.checkStyle(it.first, it.second)) + { + printf("[%s] FAIL: expecting '%s': '%s', got '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str(), style.getStyle(it.first).c_str()); + printf(" (%s)\n", elm.toString().c_str()); + } + else if (!failed) + { + if (verbose) + printf("[%s] PASS: '%s': '%s'\n", existsMessage.c_str(), it.first.c_str(), it.second.c_str()); + } + } +} + +// *************************************************************************** +void recursiveHtmlRender(CHtmlElement &elm, CCssStyle &style) +{ + bool verbose = false; + if (elm.Type == CHtmlElement::TEXT_NODE) + { + std::string val = trim(elm.Value); + if (verbose) + if (!val.empty()) + printf("[%d] '%s'\n", indent, val.c_str()); + } + else if (elm.Type == CHtmlElement::ELEMENT_NODE) + { + style.pushStyle(); + + if (verbose) + printf("========= '%s'\n", elm.toString().c_str()); + + style.getStyleFor(elm); + style.applyStyle(elm.Style); + if (elm.hasAttribute("data-ruleset")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleset")); + checkRuleset(elm, style, testset, true); + } + + if (elm.hasAttribute("data-ruleunset")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleunset")); + checkRuleset(elm, style, testset, false); + } + + if (elm.hasAttribute("data-ruleset-before")) + { + TStyleVec testset = CCssParser::parseDecls(elm.getAttribute("data-ruleset-before")); + + } + + for (auto it = elm.Children.begin(); it != elm.Children.end(); ++it) + { + recursiveHtmlRender(*it, style); + } + + style.popStyle(); + } +} + +// *************************************************************************** +void runTestOnFile(const std::string &filename) +{ + CHtmlElement dom; + + CHtmlParser htmlParser; + + std::vector links; + std::vector styles; + //, elm, styles, links + + ifstream f(filename); + if (!f.is_open()) + { + printf("!! failed to open file '%s'\n", filename.c_str()); + return; + } + + printf(": %s\n", filename.c_str()); + std::string htmlString; + std::string line; + while (getline(f, line)) + htmlString += line; + + htmlParser.getDOM(htmlString, dom, styles, links); + + CCssStyle style; + for (std::string s : styles) + { + if (!s.empty()) + style.parseStylesheet(s); + } + + for (auto it = dom.Children.begin(); it != dom.Children.end(); ++it) + recursiveHtmlRender(*it, style); +} + +// *************************************************************************** +int main(int argc, const char *argv[]) +{ + CApplicationContext *appContext = new CApplicationContext; + + // htmlcss_test file.html + if (argc == 2) + { + runTestOnFile(argv[1]); + } + else + { + std::vector result; + CPath::getPathContent("tests/", true /*recursive*/, false /*wantDir*/, true /*wantFile*/, result, NULL /*callback*/, true /*showEverything*/); + printf(":: got %ld files\n", result.size()); + for (const auto &fname : result) + { + if (endsWith(fname, ".html") && fname != "tests/XX-template.html") + runTestOnFile(fname); + } + } + + printf(">>> all done\n"); + return EXIT_SUCCESS; +} diff --git a/nel/tools/htmlcss_test/tests/01-syntax-tests.html b/nel/tools/htmlcss_test/tests/01-syntax-tests.html new file mode 100644 index 000000000..f9b2c9356 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/01-syntax-tests.html @@ -0,0 +1,28 @@ + + + + +
+ + link + link + + + diff --git a/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html b/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html new file mode 100644 index 000000000..72e49b854 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/css-tricks/01-var-toggle.html @@ -0,0 +1,24 @@ + + + + +

+

+

+

+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html b/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html new file mode 100644 index 000000000..c5085b8ef --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e01.basic.html @@ -0,0 +1,18 @@ + + + + +
+

Header

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html b/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html new file mode 100644 index 000000000..1d9dc7b88 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e02.case-sensitive-name.html @@ -0,0 +1,23 @@ + + + + +
+

Header1

+

Header2

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html b/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html new file mode 100644 index 000000000..28f0a9c69 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e03.value-syntax.html @@ -0,0 +1,17 @@ + + + + +
+

Header

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html b/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html new file mode 100644 index 000000000..bafbbf37f --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e05.inherited.html @@ -0,0 +1,17 @@ + + + + +

I inherited blue from the root element!

+
I got green set directly on me!
+
+ While I got red set directly on me! +

I’m red too, because of inheritance!

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html b/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html new file mode 100644 index 000000000..861e60412 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e06.i18n.html @@ -0,0 +1,15 @@ + + + + + + link + + link + + + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html new file mode 100644 index 000000000..39ed3a299 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e07-safe-use-not-cyclic.html @@ -0,0 +1,15 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html new file mode 100644 index 000000000..4d1f5fdd8 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e08-cyclic.html @@ -0,0 +1,14 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html b/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html new file mode 100644 index 000000000..f3e1788ee --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e09-not-cyclic.html @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html b/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html new file mode 100644 index 000000000..5d785bffa --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e10.fallback.html @@ -0,0 +1,24 @@ + + + + +
+

header

+

text

+
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html b/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html new file mode 100644 index 000000000..488e733a9 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e11.1.invalid-property-name.html @@ -0,0 +1,12 @@ + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html b/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html new file mode 100644 index 000000000..a67b4ba1d --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e11.2.whitespace-after-var.html @@ -0,0 +1,13 @@ + + + + + +
+ + diff --git a/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html b/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html new file mode 100644 index 000000000..f60877d82 --- /dev/null +++ b/nel/tools/htmlcss_test/tests/custom-properties/e13.invalid-variables.html @@ -0,0 +1,13 @@ + + + + + + +
+ + diff --git a/ryzom/client/src/interface_v3/group_quick_help.cpp b/ryzom/client/src/interface_v3/group_quick_help.cpp index 0b1bf0b65..81ceb4aa1 100644 --- a/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -170,8 +170,8 @@ void CGroupQuickHelp::setGroupTextSize (CInterfaceGroup *group, bool selected) { bool globalColor = selected ? TextColorGlobalColor : _NonSelectedGlobalColor; bool linkGlobalColor = selected ? LinkColorGlobalColor : _NonSelectedGlobalColor; - uint fontSize = selected ? TextFontSize : _NonSelectedSize; - NLMISC::CRGBA color = selected ? TextColor : _NonSelectedColor; + uint fontSize = selected ? _BrowserStyle.Current.FontSize : _NonSelectedSize; + NLMISC::CRGBA color = selected ? _BrowserStyle.Current.TextColor : _NonSelectedColor; NLMISC::CRGBA linkColor = selected ? LinkColor : _NonSelectedLinkColor; // Look for text in this group