#include <libcroco/cr-parser.h>
#include "xml/node-event-vector.h"
#include "document.h"
#include "sp-style-elem.h"
#include "attributes.h"
#include "style.h"
media_set_all(this->media);
this->is_css = false;
}
SPStyleElem::~SPStyleElem() {
}
switch (key) {
case SP_ATTR_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. */
}
break;
}
#if 0 /* unfinished */
case SP_ATTR_MEDIA: {
break;
}
#endif
/* title is ignored. */
default: {
break;
}
}
}
static void
void *const data)
{
obj->read_content();
}
static void
void *const data)
{
obj->read_content();
}
static void
void *const data)
{
obj->read_content();
}
Inkscape::XML::Node* SPStyleElem::write(Inkscape::XML::Document* xml_doc, Inkscape::XML::Node* repr, guint flags) {
}
if (flags & SP_OBJECT_WRITE_BUILD) {
g_warning("nyi: Forming <style> content for SP_OBJECT_WRITE_BUILD.");
/* fixme: Consider having the CRStyleSheet be a member of SPStyleElem, and then
pretty-print to a string s, then repr->addChild(xml_doc->createTextNode(s), NULL). */
}
if (is_css) {
}
/* todo: media */
return repr;
}
/** Returns the concatenation of the content of the text children of the specified object. */
static GString *
{
// effic: 0 is just to catch bugs. Increase to something reasonable.
}
}
return ret;
}
/* Callbacks for SAC-style libcroco parser. */
struct ParseTmp
{
unsigned magic;
{ }
bool hasMagic() const {
return magic == ParseTmp_magic;
}
~ParseTmp()
{
magic = 0;
}
};
static void
{
g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of ruleset, but found currStmt=%p, stmtType=%u",
// fixme: Check whether we need to unref currStmt if non-NULL.
}
}
static void
{
&& ruleset
{
ruleset);
} else {
}
}
static void
{
g_warning("Expecting currStmt==NULL and stmtType==0 (NO_STMT) at start of @font-face, but found currStmt=%p, stmtType=%u",
// fixme: Check whether we need to unref currStmt if non-NULL.
}
}
static void
{
g_warning("Expecting currStmt==NULL and stmtType==1 (FONT_FACE_STMT) at end of @font-face, but found currStmt=%p, stmtType=%u",
// fixme: Check whether we need to unref currStmt if non-NULL.
}
}
static void
{
}
/* We currently ignore @font-face descriptors. */
return;
}
}
/* fixme: If there's more than one <style> element in a document, then the document stylesheet
* will be set to a random one of them, even switching between them.
*
* However, I don't see in the spec what's supposed to happen when there are multiple <style>
* elements. The wording suggests that <style>'s content should be a full stylesheet.
* http://www.w3.org/TR/REC-CSS2/cascade.html#cascade says that "The author specifies style
* sheets for a source document according to the conventions of the document language. For
* instance, in HTML, style sheets may be included in the document or linked externally."
* (Note the plural in both sentences.) Whereas libcroco's CRCascade allows only one author
* stuff.
*
* Dodji replies "right, that's *bug*"; just an unexpected oversight.
*/
//XML Tree being used directly here while it shouldn't be.
/* I see a cr_statement_parse_from_buf for returning a CRStatement*, but no corresponding
cr_stylesheet_parse_from_buf. And cr_statement_parse_from_buf takes a char*, not a
CRInputBuf, and doesn't provide a way for calling it in a loop over the one buffer.
(I.e. it doesn't tell us where it got up to in the buffer.)
There's also the generic cr_parser_parse_stylesheet (or just cr_parser_parse), but that
just calls user-supplied callbacks rather than constructing a CRStylesheet.
*/
// impl: ref_count inited to 0, so cr_parser_destroy suffices to delete sac_handler.
/* todo: start_media, end_media. */
/* todo: Test error condition. */
if (parse_status == CR_OK) {
} else {
if (parse_status != CR_PARSING_ERROR) {
/* Better than nothing. TODO: Improve libcroco's error handling. At a minimum, add a
strerror-like function so that we can give a string rather than an integer. */
/* TODO: Improve error diagnosis stuff in inkscape. We'd like a panel showing the
errors/warnings/unsupported features of the current document. */
}
}
//requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
// Style references via class= do not, and actually cannot, use autoupdating URIReferences.
// Therefore, if an object refers to a stylesheet which has not yet loaded when the object is
// being loaded (e.g. if the stylesheet is below or inside the object in XML), its class= has
// no effect (bug 1491639). Below is a partial hack that fixes this for a single case: when
// the <style> is a child of the object that uses a style from it. It just forces the parent of
// <style> to reread its style as soon as the stylesheet is fully loaded. Naturally, this won't
// work if the user of the stylesheet is its grandparent or precedent.
if ( parent ) {
}
}
/**
* Does addListener(fns, data) on \a repr and all of its descendents.
*/
static void
{
}
}
read_content();
readAttr( "type" );
readAttr( "media" );
child_add_rm_cb, // child_added
child_add_rm_cb, // child_removed
NULL, // attr_changed
content_changed_cb, // content_changed
child_order_changed_cb, // order_changed
};
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :