Changed: CSS inherit value for some properties

This commit is contained in:
Nimetu 2016-06-12 12:46:42 +03:00
parent c8798be3cb
commit d05b77ff8e

View file

@ -5588,15 +5588,23 @@ namespace NLGUI
{ {
if (it->first == "font-size") if (it->first == "font-size")
{ {
float tmp; if (it->second == "inherit")
sint size = 0; style.FontSize = getFontSize();
getPercentage (size, tmp, it->second.c_str()); else
if (size > 0) {
style.FontSize = size; float tmp;
sint size = 0;
getPercentage (size, tmp, it->second.c_str());
if (size > 0)
style.FontSize = size;
}
} }
else else
if (it->first == "font-style") if (it->first == "font-style")
{ {
if (it->second == "inherit")
style.FontOblique = getFontOblique();
else
if (it->second == "italic" || it->second == "oblique") if (it->second == "italic" || it->second == "oblique")
style.FontOblique = true; style.FontOblique = true;
} }
@ -5605,6 +5613,9 @@ namespace NLGUI
{ {
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
uint weight = 400; uint weight = 400;
if (it->second == "inherit")
weight = getFontWeight();
else
if (it->second == "normal") if (it->second == "normal")
weight = 400; weight = 400;
else else
@ -5637,7 +5648,10 @@ namespace NLGUI
} }
else else
if (it->first == "color") if (it->first == "color")
scanHTMLColor(it->second.c_str(), style.TextColor); if (it->second == "inherit")
style.TextColor = getTextColor();
else
scanHTMLColor(it->second.c_str(), style.TextColor);
else else
if (it->first == "text-decoration" || it->first == "text-decoration-line") if (it->first == "text-decoration" || it->first == "text-decoration-line")
{ {