Loading editor/src/htmlimport.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -1007,9 +1007,14 @@ void blogi::htmlimport::htmlElementToWidgetXml( w->SetAttribute("object_fit", cssProps["object-fit"].c_str()); if (cssProps.count("border-radius")) w->SetAttribute("border_radius", cssProps["border-radius"].c_str()); if (cssProps.count("border")) w->SetAttribute("border_style", cssProps["border"].c_str()); if (cssMeansHidden(cssProps)) w->SetAttribute("hidden", "true"); std::vector<std::string> knownCss = { "width","height","object-fit","border-radius","display"}; "width","height","object-fit","border-radius","border", "display","visibility"}; std::string custom = extractCustomCss(cssProps, knownCss, mediaRules, cssClass, elemId); if (!custom.empty()) { tinyxml2::XMLElement *ccEl = doc.NewElement("CustomCss"); Loading tests/htmlimport_smoke.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,26 @@ int main(){ "visibility:hidden on a Table maps to hidden=\"true\" (previously silently dropped)"); } // --- Image CSS properties reach the Image widget's own attributes --- std::cout << "=== Image CSS properties ===" << std::endl; { std::string html = "<img src=\"/a.jpg\" style=\"border: 1px solid #333; " "visibility:hidden\">"; std::string xml = importXml(html); check(xml.find("<Image") != std::string::npos, "an <img> still produces an Image widget"); check(xml.find("border_style=\"1px solid #333\"") != std::string::npos, "border reaches the Image's border_style attribute (previously fell through to CustomCss)"); check(xml.find("hidden=\"true\"") != std::string::npos, "visibility:hidden on an Image maps to hidden=\"true\" (previously silently dropped)"); } { std::string xml = importXml("<img src=\"/a.jpg\" style=\"display:none\">"); check(xml.find("hidden=\"true\"") != std::string::npos, "display:none on an Image maps to hidden=\"true\" (previously silently dropped)"); } // --- Summary --- std::cout << "\n=== " << passCount << "/" << testCount << " tests passed ===" << std::endl; Loading Loading
editor/src/htmlimport.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -1007,9 +1007,14 @@ void blogi::htmlimport::htmlElementToWidgetXml( w->SetAttribute("object_fit", cssProps["object-fit"].c_str()); if (cssProps.count("border-radius")) w->SetAttribute("border_radius", cssProps["border-radius"].c_str()); if (cssProps.count("border")) w->SetAttribute("border_style", cssProps["border"].c_str()); if (cssMeansHidden(cssProps)) w->SetAttribute("hidden", "true"); std::vector<std::string> knownCss = { "width","height","object-fit","border-radius","display"}; "width","height","object-fit","border-radius","border", "display","visibility"}; std::string custom = extractCustomCss(cssProps, knownCss, mediaRules, cssClass, elemId); if (!custom.empty()) { tinyxml2::XMLElement *ccEl = doc.NewElement("CustomCss"); Loading
tests/htmlimport_smoke.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,26 @@ int main(){ "visibility:hidden on a Table maps to hidden=\"true\" (previously silently dropped)"); } // --- Image CSS properties reach the Image widget's own attributes --- std::cout << "=== Image CSS properties ===" << std::endl; { std::string html = "<img src=\"/a.jpg\" style=\"border: 1px solid #333; " "visibility:hidden\">"; std::string xml = importXml(html); check(xml.find("<Image") != std::string::npos, "an <img> still produces an Image widget"); check(xml.find("border_style=\"1px solid #333\"") != std::string::npos, "border reaches the Image's border_style attribute (previously fell through to CustomCss)"); check(xml.find("hidden=\"true\"") != std::string::npos, "visibility:hidden on an Image maps to hidden=\"true\" (previously silently dropped)"); } { std::string xml = importXml("<img src=\"/a.jpg\" style=\"display:none\">"); check(xml.find("hidden=\"true\"") != std::string::npos, "display:none on an Image maps to hidden=\"true\" (previously silently dropped)"); } // --- Summary --- std::cout << "\n=== " << passCount << "/" << testCount << " tests passed ===" << std::endl; Loading