Merge with html-improvements

--HG--
branch : yubo
hg/yubo
Nimetu 5 years ago
commit 2e3fa918d4

@ -31,7 +31,7 @@ namespace NLGUI
class CCssParser {
public:
// parse style declaration, eg "color: red; font-size: 10px;"
static TStyle parseDecls(const std::string &styleString);
static TStyleVec parseDecls(const std::string &styleString);
// parse css stylesheet
void parseStylesheet(const std::string &cssString, std::vector<CCssStyle::SStyleRule> &rules);

@ -27,6 +27,8 @@ namespace NLGUI
class CHtmlElement;
typedef std::map<std::string, std::string> TStyle;
typedef std::pair<std::string, std::string> TStylePair;
typedef std::vector<TStylePair> TStyleVec;
/**
* \brief CSS style rules
@ -118,7 +120,7 @@ namespace NLGUI
struct SStyleRule {
std::vector<CCssSelector> Selector;
TStyle Properties;
TStyleVec Properties;
// pseudo element like ':before'
std::string PseudoElement;
@ -142,6 +144,9 @@ namespace NLGUI
// test if str is one of "thin/medium/thick" and return its pixel value
bool scanCssLength(const std::string& str, uint32 &px) const;
// split css properties string, ie '1px solid rgb(100, 100, 100)' split by ' ' returns 3 parts.
void splitParams(const std::string &str, char sep, std::vector<std::string> &result) const;
// read style attribute
void getStyleParams(const std::string &styleString, CStyleParams &style, const CStyleParams &current) const;
void getStyleParams(const TStyle &styleRules, CStyleParams &style, const CStyleParams &current) const;
@ -153,7 +158,7 @@ namespace NLGUI
void apply(CStyleParams &style, const CStyleParams &current) const;
// merge src into dest by overwriting key in dest
void merge(TStyle &dst, const TStyle &src) const;
void merge(TStyle &dst, const TStyleVec &src) const;
// match selector to dom path
bool match(const std::vector<CCssSelector> &selector, const CHtmlElement &elm) const;
@ -162,16 +167,20 @@ namespace NLGUI
bool getShorthandIndices(const uint32 size, uint8 &t, uint8 &r, uint8 &b, uint8 &l) const;
// break 'border' into 'border-top-color', 'border-top-style', etc rules
bool tryBorderWidthShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const;
bool tryBorderStyleShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const;
bool tryBorderColorShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const;
void parseBorderShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const;
bool tryBorderWidthShorthand(const std::string &prop, const std::string &value, TStyle &style) const;
bool tryBorderStyleShorthand(const std::string &prop, const std::string &value, TStyle &style) const;
bool tryBorderColorShorthand(const std::string &prop, const std::string &value, TStyle &style) const;
void expandBorderShorthand(const std::string &prop, const std::string &value, TStyle &style) const;
// parse 'background' into 'background-color', 'background-image', etc
void parseBackgroundShorthand(const std::string &value, CStyleParams &style) const;
void expandBackgroundShorthand(const std::string &value, TStyle &style) const;
// parse 'padding' into 'padding-top', 'padding-left', etc
void parsePaddingShorthand(const std::string &value, CStyleParams &style) const;
void expandPaddingShorthand(const std::string &value, TStyle &style) const;
// expand shorthand rule, ie "border", into longhand names, ie "border-top-width"
// if shorthand is present in style, then its removed
void expandShorthand(const std::string &prop, const std::string &value, TStyle &style) const;
// parse string value into corresponding value
void applyBorderWidth(const std::string &value, uint32 *dest, const uint32 currentWidth, const uint32 fontSize) const;

@ -41,6 +41,7 @@ namespace NLGUI
DECLARE_UI_CLASS( CGroupCell )
CGroupCell(const TCtorParam &param);
~CGroupCell();
enum TAlign
{

@ -35,9 +35,9 @@ namespace NLGUI
//
// key is converted to lowercase
// value is left as is
TStyle CCssParser::parseDecls(const std::string &styleString)
TStyleVec CCssParser::parseDecls(const std::string &styleString)
{
TStyle styles;
TStyleVec styles;
std::vector<std::string> elements;
NLMISC::splitString(styleString, ";", elements);
@ -49,7 +49,7 @@ namespace NLGUI
{
std::string key = trim(toLower(elements[i].substr(0, pos)));
std::string value = trim(elements[i].substr(pos+1));
styles[key] = value;
styles.push_back(TStylePair(key, value));
}
}
@ -94,7 +94,7 @@ namespace NLGUI
std::vector<ucstring> selectors;
NLMISC::explode(selectorString, ucstring(","), selectors);
TStyle props;
TStyleVec props;
props = parseDecls(styleString.toUtf8());
// duplicate props to each selector in selector list,

@ -102,7 +102,9 @@ namespace NLGUI
}
else
{
elm.setPseudo(i->PseudoElement, i->Properties);
TStyle props;
merge(props, i->Properties);
elm.setPseudo(i->PseudoElement, props);
}
}
}
@ -110,17 +112,18 @@ namespace NLGUI
// style from "style" attribute overrides <style>
if (elm.hasNonEmptyAttribute("style"))
{
TStyle styles = CCssParser::parseDecls(elm.getAttribute("style"));
TStyleVec styles = CCssParser::parseDecls(elm.getAttribute("style"));
merge(elm.Style, styles);
}
}
void CCssStyle::merge(TStyle &dst, const TStyle &src) const
void CCssStyle::merge(TStyle &dst, const TStyleVec &src) const
{
// TODO: does not use '!important' flag
for(TStyle::const_iterator it = src.begin(); it != src.end(); ++it)
for(TStyleVec::const_iterator it = src.begin(); it != src.end(); ++it)
{
dst[it->first] = it->second;
expandShorthand(it->first, it->second, dst);
}
}
@ -304,6 +307,48 @@ namespace NLGUI
return false;
}
// ***************************************************************************
void CCssStyle::splitParams(const std::string &str, char sep, std::vector<std::string> &result) const
{
// TODO: does not handle utf8
uint32 pos = 0;
for(uint i = 0; i< str.size(); i++)
{
// split by separator first, then check if string or function
if (str[i] == sep)
{
std::string sub = trim(str.substr(pos, i - pos));
if (!sub.empty())
result.push_back(str.substr(pos, i - pos));
// skip sep
pos = i + 1;
}
else if (str[i] == '"' || str[i] == '(')
{
// string "this is string", or function rgb(1, 2, 3)
char endChar;
if (str[i] == '"')
endChar = '"';
else if (str[i] == '\'')
endChar = '\'';
else
endChar = ')';
// skip start
i++;
while(i < str.size() && str[i] != endChar)
{
if (str[i] == '\\')
i++;
i++;
}
}
}
if (pos < str.size())
result.push_back(str.substr(pos).c_str());
}
// ***************************************************************************
// CStyleParams style;
// style.FontSize; // font-size: 10px;
@ -312,7 +357,10 @@ namespace NLGUI
// style.StrikeThrough; // text-decoration: line-through; text-decoration-line: line-through;
void CCssStyle::getStyleParams(const std::string &styleString, CStyleParams &style, const CStyleParams &current) const
{
TStyle styles = CCssParser::parseDecls(styleString);
TStyleVec stylevec = CCssParser::parseDecls(styleString);
TStyle styles;
merge(styles, stylevec);
getStyleParams(styles, style, current);
}
@ -338,13 +386,9 @@ namespace NLGUI
// - normalize values
void CCssStyle::normalize(const TStyle &styleRules, CStyleParams &style, const CStyleParams &current) const
{
bool keep = true;
TStyle::const_iterator it;
for (it=styleRules.begin(); it != styleRules.end(); ++it)
{
// shorthands will be replaced with proper statements and shorthand rule is removed
keep = true;
// update local copy of applied style
style.StyleRules[it->first] = it->second;
@ -432,11 +476,6 @@ namespace NLGUI
}
}
else
if (it->first == "background")
{
parseBackgroundShorthand(it->second, style);
}
else
if (it->first == "background-repeat")
{
// old ryzom specific value
@ -444,48 +483,6 @@ namespace NLGUI
style.StyleRules[it->first] = "repeat";
}
else
if (it->first == "background-scale")
{
// replace old ryzom specific rule with background-size
if (it->second != "1")
{
style.StyleRules["background-size"] = "auto";
}
else
{
style.StyleRules["background-size"] = "100%";
}
keep = false;
}
else
if (it->first == "border"
|| it->first == "border-top" || it->first == "border-right"
|| it->first == "border-bottom" || it->first == "border-left")
{
// TODO: use enum or bitmap constant instead of passing a string name (it->first)
parseBorderShorthand(it->second, style, it->first);
keep = false;
}
else
if (it->first == "border-width")
{
tryBorderWidthShorthand(it->second, style, it->first);
keep = false;
}
else
if (it->first == "border-style")
{
tryBorderStyleShorthand(it->second, style, it->first);
keep = false;
}
else
if (it->first == "border-color")
{
tryBorderColorShorthand(it->second, style, it->first);
keep = false;
}
else
if (it->first == "display")
{
if (it->second == "inherit")
@ -493,19 +490,6 @@ namespace NLGUI
else
style.DisplayBlock = (it->second == "block" || it->second == "table");
}
else
if (it->first == "padding")
{
parsePaddingShorthand(it->second, style);
keep = false;
}
if (!keep)
{
TStyle::iterator pos = style.StyleRules.find(it->first);
if (pos != style.StyleRules.end())
style.StyleRules.erase(pos);
}
}
}
@ -704,7 +688,7 @@ namespace NLGUI
uint px = 0;
CRGBA color;
std::vector<std::string> parts;
NLMISC::splitString(it->second, " ", parts);
splitParams(it->second, ' ', parts);
if (parts.size() == 1)
{
success = scanCssLength(parts[0], px);
@ -753,7 +737,7 @@ namespace NLGUI
prop = prop.substr(0, pos);
std::vector<std::string> parts;
NLMISC::splitString(prop, " ", parts);
splitParams(prop, ' ', parts);
switch(parts.size())
{
case 1:
@ -952,7 +936,7 @@ namespace NLGUI
// normalize
std::string val = toLower(trim(it->second));
std::vector<std::string> parts;
NLMISC::splitString(val, " ", parts);
splitParams(val, ' ', parts);
// check for "repeat repeat"
if (parts.size() == 2 && parts[0] == parts[1])
val = parts[0];
@ -965,7 +949,7 @@ namespace NLGUI
// normalize
std::string val = toLower(trim(it->second));
std::vector<std::string> parts;
NLMISC::splitString(val, " ", parts);
splitParams(val, ' ', parts);
if (parts.size() == 2 && parts[0] == parts[1])
val = parts[0];
@ -983,7 +967,7 @@ namespace NLGUI
}
// ***************************************************************************
void CCssStyle::parseBackgroundShorthand(const std::string &value, CStyleParams &style) const
void CCssStyle::expandBackgroundShorthand(const std::string &value, TStyle &style) const
{
// background: url(image.jpg) top center / 200px 200px no-repeat fixed padding-box content-box red;
// background-image : url(image.jpg)
@ -1008,9 +992,7 @@ namespace NLGUI
uint partIndex = 0;
std::vector<std::string> parts;
std::vector<std::string>::iterator it;
// FIXME: this will fail if url() contains ' ' chars
// FIXME: this will also fail on 'background: rgb(255, 0, 0)'
NLMISC::splitString(value, " ", parts);
splitParams(value, ' ', parts);
bool failed = false;
bool allowSize = false;
@ -1261,16 +1243,16 @@ namespace NLGUI
{
if (props[i] == "background-position")
{
style.StyleRules["background-position-x"] = bgPositionX;
style.StyleRules["background-position-y"] = bgPositionY;
style["background-position-x"] = bgPositionX;
style["background-position-y"] = bgPositionY;
}
else if (props[i] == "background-clip")
{
style.StyleRules["background-clip"] = bgClipValue;
style["background-clip"] = bgClipValue;
}
else
{
style.StyleRules[props[i]] = values[i];
style[props[i]] = values[i];
}
}
else
@ -1278,40 +1260,40 @@ namespace NLGUI
// fill in default if one is set
if (props[i] == "background-image")
{
style.StyleRules[props[i]] = "none";
style[props[i]] = "none";
}
else if (props[i] == "background-position")
{
style.StyleRules[props[i]] = "0% 0%";
style.StyleRules["background-position-x"] = "left 0%";
style.StyleRules["background-position-y"] = "top 0%";
style[props[i]] = "0% 0%";
style["background-position-x"] = "left 0%";
style["background-position-y"] = "top 0%";
}
else if (props[i] == "background-size")
{
style.StyleRules[props[i]] = "auto auto";
style[props[i]] = "auto auto";
}
else if (props[i] == "background-repeat")
{
style.StyleRules[props[i]] = "repeat";
style[props[i]] = "repeat";
}
else if(props[i] == "background-attachment")
{
style.StyleRules[props[i]] = "scroll";
style[props[i]] = "scroll";
}
else if(props[i] == "background-origin")
{
style.StyleRules[props[i]] = "padding-box";
style[props[i]] = "padding-box";
}
else if (props[i] == "background-clip")
{
if (bgClipFound)
style.StyleRules[props[i]] = bgClipValue;
style[props[i]] = bgClipValue;
else
style.StyleRules[props[i]] = "border-box";
style[props[i]] = "border-box";
}
else if (props[i] == "background-color")
{
style.StyleRules[props[i]] = "transparent";
style[props[i]] = "transparent";
}
}
}
@ -1349,10 +1331,10 @@ namespace NLGUI
}
// ***************************************************************************
bool CCssStyle::tryBorderWidthShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const
bool CCssStyle::tryBorderWidthShorthand(const std::string &prop, const std::string &value, TStyle &style) const
{
std::vector<std::string> parts;
NLMISC::splitString(toLower(value), " ", parts);
splitParams(toLower(value), ' ', parts);
float tmpf;
std::string unit;
@ -1378,18 +1360,18 @@ namespace NLGUI
uint8 t, r, b, l;
if (!getShorthandIndices(parts.size(), t, r, b, l)) return false;
if (hasTop) style.StyleRules["border-top-width"] = parts[t];
if (hasRight) style.StyleRules["border-right-width"] = parts[r];
if (hasBottom) style.StyleRules["border-bottom-width"] = parts[b];
if (hasLeft) style.StyleRules["border-left-width"] = parts[l];
if (hasTop) style["border-top-width"] = parts[t];
if (hasRight) style["border-right-width"] = parts[r];
if (hasBottom) style["border-bottom-width"] = parts[b];
if (hasLeft) style["border-left-width"] = parts[l];
return true;
}
// ***************************************************************************
bool CCssStyle::tryBorderStyleShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const
bool CCssStyle::tryBorderStyleShorthand(const std::string &prop, const std::string &value, TStyle &style) const
{
std::vector<std::string> parts;
NLMISC::splitString(toLower(value), " ", parts);
splitParams(toLower(value), ' ', parts);
// verify that parts are valid
uint8 maxSize = (prop == "border" || prop == "border-style") ? 4 : 1;
@ -1427,18 +1409,18 @@ namespace NLGUI
uint8 t, r, b, l;
if (!getShorthandIndices(parts.size(), t, r, b, l)) return false;
if (hasTop) style.StyleRules["border-top-style"] = parts[t];
if (hasRight) style.StyleRules["border-right-style"] = parts[r];
if (hasBottom) style.StyleRules["border-bottom-style"] = parts[b];
if (hasLeft) style.StyleRules["border-left-style"] = parts[l];
if (hasTop) style["border-top-style"] = parts[t];
if (hasRight) style["border-right-style"] = parts[r];
if (hasBottom) style["border-bottom-style"] = parts[b];
if (hasLeft) style["border-left-style"] = parts[l];
return true;
}
// ***************************************************************************
bool CCssStyle::tryBorderColorShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const
bool CCssStyle::tryBorderColorShorthand(const std::string &prop, const std::string &value, TStyle &style) const
{
std::vector<std::string> parts;
NLMISC::splitString(toLower(value), " ", parts);
splitParams(toLower(value), ' ', parts);
CRGBA color;
// verify that parts are valid
@ -1460,16 +1442,16 @@ namespace NLGUI
uint8 t, r, b, l;
if (!getShorthandIndices(parts.size(), t, r, b, l)) return false;
if (hasTop) style.StyleRules["border-top-color"] = parts[t];
if (hasRight) style.StyleRules["border-right-color"] = parts[r];
if (hasBottom) style.StyleRules["border-bottom-color"] = parts[b];
if (hasLeft) style.StyleRules["border-left-color"] = parts[l];
if (hasTop) style["border-top-color"] = parts[t];
if (hasRight) style["border-right-color"] = parts[r];
if (hasBottom) style["border-bottom-color"] = parts[b];
if (hasLeft) style["border-left-color"] = parts[l];
return true;
}
// ***************************************************************************
void CCssStyle::parseBorderShorthand(const std::string &value, CStyleParams &style, const std::string &prop) const
void CCssStyle::expandBorderShorthand(const std::string &prop, const std::string &value, TStyle &style) const
{
// border: 1px solid #000;
bool hasTop = (prop == "border" || prop == "border-top");
@ -1481,26 +1463,26 @@ namespace NLGUI
bool foundStyle = false;
bool foundColor = false;
CStyleParams borderStyle;
TStyle borderStyle;
std::vector<std::string> parts;
NLMISC::splitString(toLower(value), " ", parts);
splitParams(toLower(value), ' ', parts);
for(uint index = 0; index < parts.size(); ++index)
{
bool matched = false;
if (!foundWidth)
{
matched = foundWidth = tryBorderWidthShorthand(parts[index], borderStyle, prop);
matched = foundWidth = tryBorderWidthShorthand(prop, parts[index], borderStyle);
}
if (!matched && !foundStyle)
{
matched = foundStyle = tryBorderStyleShorthand(parts[index], borderStyle, prop);
matched = foundStyle = tryBorderStyleShorthand(prop, parts[index], borderStyle);
}
if (!matched && !foundColor)
{
matched = foundColor = tryBorderColorShorthand(parts[index], borderStyle, prop);
matched = foundColor = tryBorderColorShorthand(prop, parts[index], borderStyle);
}
// invalid rule if nothing gets matched
@ -1511,53 +1493,111 @@ namespace NLGUI
}
// apply rules that are present
TStyle::const_iterator it = borderStyle.StyleRules.begin();
while(it != borderStyle.StyleRules.end())
TStyle::const_iterator it = borderStyle.begin();
while(it != borderStyle.end())
{
style.StyleRules[it->first] = it->second;
style[it->first] = it->second;
++it;
}
// reset those not present
if (!foundWidth)
{
if (hasTop) style.StyleRules["border-top-width"] = "medium";
if (hasRight) style.StyleRules["border-right-width"] = "medium";
if (hasBottom) style.StyleRules["border-bottom-width"] = "medium";
if (hasLeft) style.StyleRules["border-left-width"] = "medium";
if (hasTop) style["border-top-width"] = "medium";
if (hasRight) style["border-right-width"] = "medium";
if (hasBottom) style["border-bottom-width"] = "medium";
if (hasLeft) style["border-left-width"] = "medium";
}
//
if (!foundStyle)
{
if (hasTop) style.StyleRules["border-top-style"] = "none";
if (hasRight) style.StyleRules["border-right-style"] = "none";
if (hasBottom) style.StyleRules["border-bottom-style"] = "none";
if (hasLeft) style.StyleRules["border-left-style"] = "none";
if (hasTop) style["border-top-style"] = "none";
if (hasRight) style["border-right-style"] = "none";
if (hasBottom) style["border-bottom-style"] = "none";
if (hasLeft) style["border-left-style"] = "none";
}
//
if (!foundColor)
{
if (hasTop) style.StyleRules["border-top-color"] = "currentcolor";
if (hasRight) style.StyleRules["border-right-color"] = "currentcolor";
if (hasBottom) style.StyleRules["border-bottom-color"] = "currentcolor";
if (hasLeft) style.StyleRules["border-left-color"] = "currentcolor";
if (hasTop) style["border-top-color"] = "currentcolor";
if (hasRight) style["border-right-color"] = "currentcolor";
if (hasBottom) style["border-bottom-color"] = "currentcolor";
if (hasLeft) style["border-left-color"] = "currentcolor";
}
}
// ***************************************************************************
void CCssStyle::parsePaddingShorthand(const std::string &value, CStyleParams &style) const
void CCssStyle::expandPaddingShorthand(const std::string &value, TStyle &style) const
{
std::vector<std::string> parts;
NLMISC::splitString(toLower(value), " ", parts);
splitParams(toLower(value), ' ', parts);
uint8 t, r, b, l;
if (!getShorthandIndices(parts.size(), t, r, b, l))
return;
style.StyleRules["padding-top"] = parts[t];
style.StyleRules["padding-right"] = parts[r];
style.StyleRules["padding-bottom"] = parts[b];
style.StyleRules["padding-left"] = parts[l];
style["padding-top"] = parts[t];
style["padding-right"] = parts[r];
style["padding-bottom"] = parts[b];
style["padding-left"] = parts[l];
}
// ***************************************************************************
void CCssStyle::expandShorthand(const std::string &prop, const std::string &value, TStyle &style) const
{
// if shorthand matches, then remove it after expansion
bool keep = false;
if (prop == "background")
{
expandBackgroundShorthand(value, style);
}
else if (prop == "background-scale")
{
// replace old ryzom specific rule with background-size
if (value != "1")
{
style["background-size"] = "auto";
}
else
{
style["background-size"] = "100%";
}
}
else if (prop == "border"
|| prop == "border-top" || prop == "border-right"
|| prop == "border-bottom" || prop == "border-left")
{
// TODO: use enum or bitmap constant instead of passing a string name (prop)
expandBorderShorthand(prop, value, style);
}
else if (prop == "border-width")
{
tryBorderWidthShorthand(prop, value, style);
}
else if (prop == "border-style")
{
tryBorderStyleShorthand(prop, value, style);
}
else if (prop == "border-color")
{
tryBorderColorShorthand(prop, value, style);
}
else if (prop == "padding")
{
expandPaddingShorthand(value, style);
}
else
{
keep = true;
}
if (!keep)
{
TStyle::iterator pos = style.find(prop);
if (pos != style.end())
style.erase(pos);
}
}
// ***************************************************************************

@ -6643,8 +6643,6 @@ namespace NLGUI
uint32 borderWidth = 0;
CRGBA borderColor = CRGBA::Transparent;
// TODO: _Style->hasBorder() ??
table->Border = new CSSBorderRenderer();
if (elm.hasAttribute("border"))
{
std::string s = elm.getAttribute("border");

@ -73,6 +73,16 @@ namespace NLGUI
addGroup (Group);
}
// ----------------------------------------------------------------------------
CGroupCell::~CGroupCell()
{
if (Border)
{
delete Border;
Border = NULL;
}
}
// ----------------------------------------------------------------------------
void CGroupCell::setEnclosedGroupDefaultParams()
{
@ -1124,7 +1134,9 @@ namespace NLGUI
if (cell->NewLine)
{
column = 0;
currentX = Border->LeftWidth + CellSpacing;
currentX = CellSpacing;
if (Border)
currentX += Border->getLeftWidth();
_Rows.push_back(CRow());
}
@ -1402,7 +1414,9 @@ namespace NLGUI
maxWidth += columns[i];
// TODO: CellPadding is probably already in columns width
maxWidth += Border->LeftWidth + Border->RightWidth + ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
maxWidth += ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
if (Border)
maxWidth += Border->getLeftRightWidth();
return maxWidth;
}
@ -1448,7 +1462,9 @@ namespace NLGUI
maxWidth += columns[i];
// TODO: CellPadding is probably already in columns width
maxWidth += Border->LeftWidth + Border->RightWidth + ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
maxWidth += ((sint32)columns.size()+1) * CellSpacing + ((sint32)columns.size()*2) * CellPadding;
if (Border)
maxWidth += Border->getLeftRightWidth();
return maxWidth;
}
@ -1546,12 +1562,16 @@ namespace NLGUI
{
if( name == "border" )
{
if (Border)
return toString( Border->TopWidth );
return "0";
}
else
if( name == "bordercolor" )
{
if (Border)
return toString( Border->TopColor );
return toString(CRGBA::Transparent);
}
else
if( name == "cellpadding" )
@ -1587,6 +1607,8 @@ namespace NLGUI
sint32 i;
if( fromString( value, i ) )
{
if (!Border)
Border = new CSSBorderRenderer();
Border->TopWidth = i;
Border->RightWidth = i;
Border->BottomWidth = i;
@ -1600,6 +1622,8 @@ namespace NLGUI
CRGBA c;
if( fromString( value, c ) )
{
if (!Border)
Border = new CSSBorderRenderer();
Border->TopColor = c;
Border->RightColor = c;
Border->BottomColor = c;
@ -1649,8 +1673,11 @@ namespace NLGUI
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "table" );
if (Border)
{
xmlSetProp( node, BAD_CAST "border", BAD_CAST toString( Border->TopWidth ).c_str() );
xmlSetProp( node, BAD_CAST "bordercolor", BAD_CAST toString( Border->TopColor ).c_str() );
}
xmlSetProp( node, BAD_CAST "cellpadding", BAD_CAST toString( CellPadding ).c_str() );
xmlSetProp( node, BAD_CAST "cellspacing", BAD_CAST toString( CellSpacing ).c_str() );
xmlSetProp( node, BAD_CAST "bgcolor", BAD_CAST toString( BgColor ).c_str() );

Loading…
Cancel
Save