Commit 3094e403 authored by Jan Köster's avatar Jan Köster
Browse files

test

parent fff41318
Loading
Loading
Loading
Loading
+9 −4
Changes for editor/src/htmlimport.cpp: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -650,11 +650,16 @@ std::map<std::string,std::string> resolveCustomProperties(
    for (const auto &kv : cssProps) {
        if (kv.first.compare(0, 2, "--") == 0) env[kv.first] = kv.second;
    }
    for (auto &kv : cssProps) {
        kv.second = libhtmlpp::resolveCSSVariables(kv.second, env);
    }
    for (auto it = cssProps.begin(); it != cssProps.end(); ) {
        if (it->first.compare(0, 2, "--") == 0) it = cssProps.erase(it);
        bool unresolved = false;
        it->second = libhtmlpp::resolveCSSVariables(it->second, env, &unresolved);
        // An unresolvable var() (cyclic, or absent with no fallback)
        // invalidates the whole declaration per CSS semantics -- keeping it
        // would emit syntactically-broken text (e.g. a `calc(var(--fs-min)
        // * 1px)` whose `--fs-min` never made it into `env` collapsing to
        // `calc( * 1px)`) instead of just dropping the property so it falls
        // back to inherited/initial, same as a real browser would.
        if (unresolved || it->first.compare(0, 2, "--") == 0) it = cssProps.erase(it);
        else ++it;
    }
    return env;