Commit 1a5f6c5f authored by jan.koester's avatar jan.koester
Browse files

test

parent f27c9279
Loading
Loading
Loading
Loading
+15 −0
Changes for editor/src/htmlimport.cpp: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -275,6 +275,21 @@ bool stripImportant(std::string &value)
    return true;
}

// extractCustomCss's per-property loop drops "position: fixed"/"sticky"
// outright (see its own comment for why), but @media-scoped rules arrive
// there as one already-serialized libhtmlpp::getCSSRules text blob rather
// than a props map, so the same fixed/sticky declarations can still slip
// through inside it untouched. Neutralizing to "static" in place (instead of
// deleting the declaration) keeps the surrounding "selector { ... }" text
// syntactically intact and preserves a trailing "!important" 's priority --
// harmless once the value itself can no longer mean fixed/sticky.
std::string neutralizeFixedStickyPosition(const std::string &css)
{
    static const std::regex re(R"(position\s*:\s*(fixed|sticky)\b)",
                                std::regex::icase);
    return std::regex_replace(css, re, "position: static");
}

// Best-effort extraction of just the color component from a `background`
// shorthand value (e.g. "background: url(x.png) no-repeat center red;") --
// every widget's known-CSS mapping only ever looks for the longhand