// SPDX-License-Identifier: GPL-2.0-or-later /** @file * TODO: insert short description here *//* * Authors: see git history * * Copyright (C) 2018 Authors * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ #include <3rdparty/libcroco/cr-parser.h> #include "xml/node-event-vector.h" #include "xml/repr.h" #include "document.h" #include "sp-style-elem.h" #include "sp-root.h" #include "attributes.h" #include "style.h" // For external style sheets #include "io/resource.h" #include #include // For font-rule #include "libnrtype/FontFactory.h" SPStyleElem::SPStyleElem() : SPObject() { media_set_all(this->media); this->is_css = false; this->style_sheet = nullptr; } SPStyleElem::~SPStyleElem() = default; void SPStyleElem::set(SPAttr key, const gchar* value) { switch (key) { case SPAttr::TYPE: { if (!value) { /* TODO: `type' attribute is required. Give error message as per http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing. */ is_css = false; } else { /* fixme: determine what whitespace is allowed. Will probably need to ask on SVG list; though the relevant RFC may give info on its lexer. */ is_css = ( g_ascii_strncasecmp(value, "text/css", 8) == 0 && ( value[8] == '\0' || value[8] == ';' ) ); } break; } #if 0 /* unfinished */ case SPAttr::MEDIA: { parse_media(style_elem, value); break; } #endif /* title is ignored. */ default: { SPObject::set(key, value); break; } } } /** * Callback for changing the content of a